Website Update
[pierogi] / www / index.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4 <title>
5 Pierogi Universal Infrared Remote Control
6 </title>
7 </head>
8 <body>
9
10 <h1 align="center">
11 <img src="PierogiIcon.png">
12 Pierogi
13 <img src="PierogiIcon.png">
14 </h1>
15
16 <h2 align="center">A Universal Infrared Remote Control App for the Nokia N900</h2>
17
18 <p>Welcome to the Pierogi website!  This web page and the app itself are
19 still under active construction.  Until I have time to construct a proper
20 home page, I'll just place a copy of the app's internal documentation below.
21 If you have any questions or comments, please post a note on the 
22 <a href="https://garage.maemo.org/forum/?group_id=2286">Pierogi forum boards</a>
23 or send a message to
24 <a href="mailto:jpietrzak8@gmail.com">jpietrzak8@gmail.com</a>.  Also, a thread
25 has been set up on
26 <a href="http://talk.maemo.org/showthread.php?t=82243">talk.maemo.org</a>,
27 containing a great deal of information.
28 </p>
29
30 <h3>A note on licensing and such</h3>
31 <p>
32 I have placed Pierogi under the GNU General Public License, version 2.0 or
33 later.  (Here is a
34 <a href="http://www.gnu.org/licenses/gpl-2.0.html">link</a> to the terms of
35 that license.)  In short, this places certain restrictions on how you can use
36 the source code for this program (which you can find
37 <a href="https://garage.maemo.org/plugins/ggit/browse.php/?p=pierogi">here</a>;
38 if that link is not working for you, please send me a note).  The program
39 itself is free for use, in whatever manner you wish to use it.
40 </p>
41
42 <p>
43 However, some kind folks have asked about donations, and I've decided I will
44 go ahead and set up a Paypal donation site.  Any funds received will be put
45 towards the purchase of a second N900 I can devote fully towards development
46 work.  Thank you for your support!
47 </p>
48
49 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
50 <input type="hidden" name="cmd" value="_s-xclick">
51 <input type="hidden" name="hosted_button_id" value="K697WUWYDLNJA">
52 <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
53 <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
54 </form>
55
56 <h1>Pierogi Documentation</h1>
57
58 <p>
59 The Pierogi universal infrared remote controller is a single self-contained
60 app capable of sending IR commands to a wide variety of devices.
61 At the moment, it is oriented towards television, VCR, DVD, and Blu-ray
62 devices, but a few other types of device have had their command sets entered.
63 </p>
64
65 <p>
66 In this app, each family of related infrared commands is collected into a
67 "keyset".  As manufacturers commonly reuse a given set of commands rather
68 than re-invent the wheel each time they come out with a new product, many
69 devices can share the same keyset.
70 </p>
71
72 <p>
73 Pierogi also follows the classic concept of a universal remote, by having
74 a common set of buttons that are reused for each device.  So, for example,
75 the "power" button has the same name and is located in the same position,
76 no matter what keyset is currently in use -- even if that keyset has a
77 different name for "power", or has no "power" command at all.  (Check out
78 the <a href="http://en.wikipedia.org/wiki/Universal_remote">Universal
79 Remote wiki</a> for a description of universal remote controls, which
80 includes a special mention of the N900!)
81 </p>
82
83 <p>
84 So in short, to use Pierogi, you first select an appropriate keyset, then
85 press the appropriate buttons to control the target device.  More detail on
86 the features of Pierogi is provided below.
87 </p>
88
89 <h2>Using Pierogi</h2>
90
91 <p>
92 The current Pierogi design is built around a tabbed window, each tab containing
93 a group of related buttons.  Depending on the keyset that has been selected,
94 some of these buttons will be active, others inactive.  Active buttons are ones
95 which have been associated with a command in the current keyset.  Pressing an
96 active button will begin repeating the associated command; letting up on the
97 button will stop the command.
98 </p>
99
100 <p>
101 Keysets can be chosen using the "Select Keyset" option in the drop-down menu.
102 If you have a particular keyset you use often, it can be stored in the
103 "favorites" tab for quick access.
104 </p>
105
106 <h3>Main Window</h3>
107
108 <h4>Main Tab</h4>
109
110 <img src="MainTab.png">
111
112 <p>The Main tab contains just the power, volume, mute, and channel buttons.
113 It is intended to be a quick way to get to the most important, commonly used
114 controls.  The name of the current keyset is also provided in this tab.</p>
115
116 <h4>Utility Tab</h4>
117
118 <img src="UtilityTab.png">
119
120 <p>The Utility tab contains a selection of commonly useful controls, such as
121 "Sleep", "Input", "Closed Captions / Subtitles", and the color buttons.
122 This tab is intended to be a quick way to reach the most frequently used
123 buttons; as such, the selection may be updated in future versions of Pierogi.
124 </p>
125
126 <h4>Keypad Tab</h4>
127
128 <img src="KeypadTab.png">
129
130 <p>This tab provides a numeric keypad and a handful of associated commands,
131 intended mainly for use with televisions.  The "Prev Channel" button should
132 take you to the previously selected channel, if any.  The "Dash" button
133 should allow you to specify a digital subchannel, as in "16-4".  The "+100"
134 button is used for television sets which normally expect only two digits
135 per channel; using this button allows you to enter a third digit.  The "-/--
136 Double Digit" button is used on very old televisions that normally expect
137 channels to be represented by just a single digit; pressing this should
138 allow you to enter a second digit.</p>
139
140 <h4>Menu Tab</h4>
141
142 <img src="MenuTab.png">
143
144 <p>This tab contains buttons used to enter and exit a menu, navigate within
145 a menu, and select menu entries.  The "Menu" button is meant to enter the
146 main system menu of a given device; "Guide" is a content-related menu available
147 on many modern devices; and "Disc Menu" is used to access the menu interface
148 provided with DVD and Blu-Ray media.</p>
149
150 <h4>Media Tab</h4>
151
152 <img src="MediaTab.png">
153
154 <p>Many of the most important playback commands are represented on this tab.
155 "Play", "Pause", and "Stop" are the most common ones, along with "Reverse"
156 (often called rewind) and "Fast Forward".  A variety of other less common
157 navigation controls are included, along with the "Eject" command.</p>
158
159 <h4>Favorite Tab</h4>
160
161 <img src="FavoriteTab.png">
162
163 <p>As there are numerous keysets available in Pierogi, a "Favorite" tab has
164 been implemented.  To add a favorite keyset to the tab, first select that
165 keyset from the "Select Keyset" window.  Then, navigate to the Favorite tab
166 and press "Add Current Keyset".</p>
167
168 <p>Once you have added some keysets to the favorites list, you can tell
169 Pierogi to use one by simply selecting that keyset from the list.</p>
170
171 <p>A keyset can be removed from the list by selecting it and pressing
172 "Remove Selected Keyset".</p>
173
174 <h3>Select Keyset Window</h3>
175
176 <img src="SelectKeysetWindow.png">
177
178 <p>The Select Keyset window presents a list of all the keysets currently
179 available in Pierogi.  As this list is fairly long, buttons have been added
180 at the top of the window to choose the make and/or type of device for
181 the product you are trying to control; all keysets not associated with
182 the chosen values will be hidden.  To use a keyset,
183 simply select it from the list, and close the window (by pressing the
184 return arrow at the top right of the screen).</p>
185
186 <h3>Secondary Buttons Window</h3>
187
188 <h4>TV Tab</h4>
189
190 <img src="TVTab.png">
191
192 <p>This page contains several more TV-oriented buttons, including controls for
193 picture-in-picture, teletext, and some graphics and audio controls.  The
194 content of this page is subject to change.</p>
195
196 <h4>Media2 Tab</h4>
197
198 <img src="Media2Tab.png">
199
200 <p>This is another page of media buttons, containing a mix of commands useful
201 for DVD players, VCRs, audio devices, and possibly other devices.  The content
202 of this page may change in the future.</p>
203
204 <h4>Input Tab</h4>
205
206 <img src="InputTab.png">
207
208 <p>
209 Many devices have multiple sources for their data, whether it be television
210 signals piped in over the air or through a cable, or audio from a variety of
211 stereo components.  It is unlikely that Pierogi will ever be able to list all
212 of the various possible input buttons, but this tab contains a few of them.
213 </p>
214
215 <h4>Adjust Tab</h4>
216
217 <img src="AdjustTab.png">
218
219 <p>
220 A handful of the various audio and video adjustment buttons are placed on
221 this tab.  Actual volume controls will likely remain on the main window,
222 however.
223 </p>
224
225 <h2>Design Rationale</h2>
226
227 <p>Here I collect my thoughts on the how and why of creating Pierogi.</p>
228
229 <h3>Hasn't this been done before?</h3>
230
231 <p>Yes, remote control software has already been written for the N900.  In
232 particular, the
233 <a href="http://irreco.garage.maemo.org/">Irreco / QtIrreco</a> project
234 creates beautiful virtual remote controls.  I've also used the
235 <a href="http://thp.io/2010/raemote/">Raemote</a> widget to control my Apple
236 computers.  But these programs have their shortcomings; in particular, they
237 are not universal.  Each simulated remote control in QtIrreco is a completely
238 separate animal.  I would like to have a standard set of buttons that I can
239 use on all sorts of different hardware.</p>
240
241 <h3>What's up with LIRC?</h3>
242
243 <p>Just as QtIrreco and Raemote do, I want to leverage the work of the 
244 <a href="http://www.lirc.org/">Linux Infrared Remote Control</a> project.
245 The LIRC project is by far the most influential open-source effort working
246 with consumer IR.  And the N900 comes with a device driver made
247 specifically for their server!  But, you see, I have a problem.  I
248 don't want to do things the way LIRC wants to do things.</p>
249
250 <p>The N900 is different from other Linux systems using IR -- rather than
251 being the machine at which you point a remote control, this machine <i>is</i>
252 the remote control.  This is not what LIRC was designed for; the heart of the
253 LIRC project is a server that will sit and wait for messages to arrive from
254 the IR system.  Although it can also broadcast IR data back out (when using
255 hardware that supports 2-way IR communication), that is not its primary
256 purpose.</p>
257
258 <p>I believe there are three disadvantages to using the LIRC server as it
259 currently exists.  First, there isn't much point to running a daemon on
260 the N900 to manage the IR device; no messages are ever going to come in from
261 the output-only hardware on the N900, so why sit and listen for them?</p>
262
263 <p>The second problem is somewhat larger.  LIRC uses configuration files to
264 describe the command set for each remote control.  And there are a lot of them.
265 A whole lot.  We're talking thousands of files here, and each file can describe
266 many remote controls.  This is not a problem for Raemote or Irreco, as they
267 only need to deal with one config file at a time.  But if you're aiming to
268 manage the whole lot of them, you need to find a way to deal with the
269 multitudes.</p>
270
271 <p>The third problem is more subtle, but really tough to crack.  You see, the
272 whole point of LIRC is to take the commands it receives from the IR port and
273 translate them into something recognizable.  As such, each config file provides
274 a mapping from numeric commands to human-readable strings.  This is a
275 serious problem, if your interest is in finding similar commands in
276 different config files!  Take, for example, the "power"
277 button found on most remote controls.  In some config files, the string for
278 this is "power".  Others have "Power", or "POWER".  You can also find "pwr",
279 "PWR", "ON/OFF", "ON-OFF", "ONOFF", "POWER_ON_OFF", "KEY_POWER", "Operate",
280 "Standby", and who knows what else.  And, you've gotta be careful not to get
281 confused by strings like "SUBTITLE_ON/OFF" or "TV_ON_TIMER".  How is an app to
282 know which key to map all these strings to?</p>
283
284 <h3>So how is Pierogi different?</h3>
285
286 <p>
287 Pierogi attempts to answer these problems.  First, it talks directly to the
288 /dev/lirc0 device, no server middleman needed.  Yes, you can use Pierogi
289 without the LIRC daemon running; in fact, there's no need to ever install it.
290 Second, Pierogi is built
291 around the concept of the "keyset"; all IR codes that can share the same
292 protocol without interfering with one another are combined into a single
293 family of related commands.  In short, this reduces the quantity of data
294 available from LIRC config files to something much more manageable.</p>
295  
296 <p>The third problem mentioned above is a bit harder to solve; I'm currently
297 mapping each LIRC string to a corresponding Pierogi key by hand.  Naturally,
298 this process will be fraught with errors; I intend to keep updating Pierogi
299 as these errors are found and fixed.
300 </p>
301
302 <h2>Internal Design Notes</h2>
303
304 <p>If you're interested in the ugly details of the code, read on!</p>
305
306 <h3>What's up with the name of this app?</h3>
307
308 <p>Lately I've been naming my projects after tasty foods.  In particular,
309 I've been working my way through the pasta-oriented dishes.  (My previous
310 project, "Linguine", has gotten bogged down, so I moved on to this one...)</p>
311
312 <h3>Why use Qt?</h3>
313
314 <p>I'm a C++ kind of guy, it just makes sense to me to use a C++ kind of
315 interface.  The Qt classes have everything you need to set up a decent UI,
316 and Qt Creator makes coding up a project for the N900 relatively
317 painless.  Check it out for yourself at
318 <a href="http://qt.nokia.com/">the Qt webpage</a>.
319 </p>
320
321 <h3>The simplest device ever!</h3>
322
323 <p>If you ever wanted to learn how to work with device drivers on Linux, the
324 N900's infrared port is the device you want to start with.  It's not 
325 much more than a flashlight: You turn it on.  You turn it off.  You turn it on
326 again.  You turn it off again.  You really can't get much simpler than that.
327 Interaction with the "/dev/lirc0" device involves no more than handing
328 it an array of integers: the first integer being an amount of time to keep the
329 light lit (in microseconds), the second being an amount of time to leave it
330 switched off, the third on, the fourth off, and so on.</p>
331
332 <p>Well, ok, so it involves just a little bit more than that.  You don't want
333 to leave the light stuck in the "on" state when you are finished, so the driver
334 demands that the last item in every array be an "on" amount -- after finishing
335 that timer, the IR will stay off until the next command arrives.
336 </p>
337
338 <p>
339 Also, in an attempt to weed out any confusing signals from natural IR sources
340 in the environment, consumer IR devices are "pulsed" at a particular
341 frequency.  So you're really turning a strobelight on and off, not just a
342 flashlight.  When the receiver sees that the light is coming from a strobelight
343 pulsing at the desired frequency, it can be assured that that signal came from
344 an actual remote control.  The N900's device driver allows you to set the
345 frequency anywhere between 20000 Hz and 500000 Hz.  38000 Hz seems to the most
346 popular frequency used by modern remote controls, at least from what you find
347 in LIRC config files.  Also, you can set how long each pulse needs to be held,
348 in terms of a percentage: 25% means turning the light on for just one quarter
349 of the pulse, 33% means leaving it on for one third, etc.  This is called the
350 "duty cycle", and can be anywhere between 0 and 100 percent.  LIRC's default
351 duty cycle is 50 percent.
352 </p>
353
354 <p>And that's about it.  I've been using a 
355 <a href="http://svn.jacekowski.org/host_mode/trunk/drivers/input/lirc/lirc_rx51.c">web page</a>
356 that lists the source code for the IR device driver.  I'm not sure if there's
357 a better location out there for N900 source code, but this seems accurate
358 so far.</p>
359
360 <h3>You did <i>what</i> to the LIRC daemon?</h3>
361
362 <p>
363 Well, ok, yeah, I've cannibalized the transmission code out of the LIRC
364 server and dumped it into my app.  Sort of.  I can't really keep my hands off
365 of code once I've seen it, so I've rewritten it in C++, reorganizing it in
366 an object-oriented manner along the way.</p>
367
368 <p>
369 As I have progressed in adding support for additional IR protocols, I'm
370 beginning to see why the authors of the LIRC made the attempt to compress
371 every possible IR protocol into a straightforward count of individual IR
372 pulses.  The total number of IR protocols in use is amazing, and many of them
373 (through oversight or due to the longevity of their use) are mind-numbingly
374 complicated to deal with.  Still, I believe that separating the major protocols
375 into their own code paths results in code that is easier to understand and
376 maintain; I'm slowly moving away from the LIRC's system to my own as time
377 goes on.
378 </p>
379
380 <p>
381 In any case, I owe the LIRC authors a deep debt of gratitude for their
382 efforts.  If you are one such author, thank you.  As Pierogi is more-or-less
383 derived directly from their work, it is also licensed under the same terms,
384 the GNU General Public License (GPL) version 2 or later.
385 </p>
386
387 <h2>Attribution</h2>
388
389 <p>I've fallen in love with the Gentleface Mono Icon Set.  Of the creative
390 commons icon sets available, theirs stands head and shoulders above the rest.
391 Find their work at <a href="http://www.gentleface.com">www.gentleface.com</a>.
392
393 <h2>References</h2>
394
395 <p>A set of links to some resources I've used while writing the code.</p>
396
397 <ul>
398 <li>The center of the Linux infrared world, the
399 <a href="http://www.lirc.org/">Linux Infrared Remote Control</a> project.
400
401 <li>A <a href="http://en.wikipedia.org/wiki/Consumer_IR">Wiki page</a> with
402 general info on consumer IR
403
404 <li>A <a href="http://www.sbprojects.com/knowledge/ir/index.php">good introduction</a>
405 to the theory and practice behind consumer IR devices
406
407 <li>A <a href="http://en.wikipedia.org/wiki/RC-5">Wiki for the RC-5 protocol</a>
408
409 <li>Some <a href="http://www.sbprojects.com/knowledge/ir/nec.php">Info on the NEC protocol</a>
410
411 <li>Some <a href="http://www2.renesas.com/faq/en/mi_com/f_com_remo.html">More info on the NEC protocol</a>
412
413 <li>An introduction to the <a href="http://www.sbprojects.com/knowledge/ir/sirc.php">Sony SIRC protocol</a>
414
415 <li>An excellent collection of <a href="http://www.hifi-remote.com/sony/">Sony command codes</a>
416
417 <li>Link to (what appears to be) source code for the N900's
418 <a href="http://svn.jacekowski.org/host_mode/trunk/drivers/input/lirc/lirc_rx51.c">/dev/lirc0 device driver</a>.
419
420 <ul>
421
422 </body>
423 </html>