This file is indexed.

/usr/share/doc/lirc/html/technical.html is in lirc 0.9.0~pre1-1.2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
  <HEAD>
    <TITLE>LIRC - Linux Infrared Remote Control</TITLE>
    <LINK REL=stylesheet TYPE="text/css" HREF="../lirc.css">
    <LINK REL="shortcut icon" HREF="../favicon.ico">
    <META NAME="description" CONTENT="LIRC - Linux Infra-red Remote Control">
    <META NAME="keywords" CONTENT="linux, kernel module, remote control, animax, multimedia">
  </HEAD>
  
  <BODY BACKGROUND="../images/marb18.jpg"
    BGCOLOR="#FFFFFF" TEXT="#000000" ALINK="#8080FF">
    <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
      <TR>
	<TD CLASS="menu" WIDTH="100%" HEIGHT="150">
	  <IMG SRC="../images/diode.gif" ALT=""
	    WIDTH="300" HEIGHT="150" BORDER="0" HSPACE="20"
	    VSPACE="0" ALIGN="LEFT"> 
	  <IMG SRC="../images/lirc.gif" ALT=""
	    WIDTH="300" HEIGHT="150" BORDER="0" HSPACE="20"
	    VSPACE="0" ALIGN="RIGHT">
	</TD>
      </TR>
      <TR>
	<TD WIDTH="100%">&#160;<BR>
	  <TABLE WIDTH="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
	    <TR>
	      <TD WIDTH="15%">&#160;<BR></TD>
	      <TD WIDTH="70%" ALIGN="LEFT" VALIGN="TOP">&#160;<BR>

<!-- Text ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

    <!-- Overview ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <A NAME="overview"></A><HR>
    <CENTER><H1>Driver Model</H1></CENTER>
    <HR WIDTH="70%">
    
    <PRE>
  |  +---------------------------------------------------------------+
S |  | 'gpm -t msc -m /var/run/lirc/lircm' or a well configured X    |
O |  | (see section 'Configuring lircmd') for details                |
F |  +--------------+------------------------------------------------+
T |                 |
W |   /var/run/lirc/lircm (named pipe (FIFO) ==&gt; one connection)
A |                 |
R |     +-----------+-----------+   +-------------------------------+
E |     | mouse daemon (lircmd) |   | tools (irexec, irxevent, ...) |
  |     | configured with       |   | configured with ~/.lircrc     |
  |     | lircmd.conf           |   |                               |
  |     +-----------+-----------+   +-----------+-------------------+
  |                 |                           |
  |                 +-------------+-------------+
  |                               |
  |              /var/run/lirc/lircd (socket ==&gt; multiple connections)
  |                               |
S |              +----------------+--------------------------+
O |              | decoder daemon (lircd), irrecord or mode2 |    TCP/IP
F |              | lircd is configured through lircd.conf    +---  port
T | User space   |                                           |     8765
W |              +------------------+------------------------+
A |                                 |            |
R |                                 |            |
E |                                 |            |
  |                                 |   /dev/uinput (Linux input layer)
  |                                 |
  |                                 |
  +---------------------------------+----------------------------------
  | Kernel space                    |              (character device
  |                                 |                  driver ==&gt;
  |                    +------------+----------+    one connection)
  |                    |                       |  
  |                /dev/lirc               /dev/ttySx
  |                    |                       |
  |       +------------+-------------+   +-----+---------------+
  |       |  LIRC device driver      |   | Linux serial driver |
  |       | (with ioctl-interface)   |   |                     |
  |       +------------+-------------+   +----------+----------+
  |                    |                            |
--+--------------------+----------------------------+------------------
  |                    |                            |
  |         +----------+------------+               |
  |         |                       |               |
  | +-------+----------------+ +----+-----+ +-------+-----------------+
H | | serial / parallel port | | TV cards | | Irman/RemoteMaster/etc. |
W | +------------------------+ +----------+ +-------------------------+
  |
</PRE>
    
    <A NAME="formats"></A><HR>
    <H1 ALIGN="CENTER">Formats</H1>
    <HR WIDTH="70%">
    
    <UL>
      <LI><B>/dev/lirc:</B><BR>
	<P>
	  highly depends on the mode selected with ioctls:
	</P>
	<DL>
	  <DT>LIRC_MODE_MODE2</DT>
	  <DD>
	    <P>
	      outputs packets containing an int value describing a IR
	      signal
	    </P>
	    <UL>
	      <LI>bits 0-23 contain the length of the pulse/space in
		microseconds</LI>
	      <LI>bits 31-24 can be:
		<UL>
		  <LI>0: space</LI>
		  <LI>1: pulse</LI>
		  <LI>2: timeout (has to be enabled using
		    LIRC_SET_REC_TIMEOUT ioctl and is not supported by
		    all receivers)</LI>
		</UL>
	      </LI> 
	      <LI>all other values are reserved</LI>
	    </UL>
	    <P>
	      Lengths greater than or equal to 16 seconds are clamped to
	      0xffffff.
	    </P>
	    <P>References:</P>
	    <UL>
	      <LI>drivers/lirc_serial/lirc_serial.c</LI>
	      <LI>drivers/lirc_parallel/lirc_parallel.c</LI>
	      <LI>tools/mode2.c (dumps the output from the driver to
		stdout)</LI>
	    </UL>
	    <BR>
	  </DD>
	  <DT>LIRC_MODE_LIRCCODE</DT>
	  <DD>
	    <P>
	      outputs codes of configurable length in big endian byte
	      order
	    </P>
	  </DD>
	</DL>
      </LI>
      <LI><B>/var/run/lirc/lircd:</B><BR>
	<P>
	  outputs strings containing all information about the remote and the
	  pressed button.
	</P>
	<P>References:</P>
	<UL>
	  <LI>daemons/lircd.c</LI>
	  <LI>tools/irw.c</LI>
	</UL>
	<BR>
      </LI>
      <LI><B>/var/run/lirc/lircm:</B><BR>
	<BR>
	<UL>
	  <LI>MouseSystems<BR>
	    5 byte packets:
	    <UL>
	      <LI>byte 1: button information</LI>
	      <LI>byte 2: change on X axis</LI>
	      <LI>byte 3: change on Y axis</LI>
	      <LI>byte 4,5: 0</LI>
	    </UL>
	  </LI>
	  <LI>IMPS/2<BR>
	    4 byte packets: check the source code for details
	  </LI>
	  <LI>IntelliMouse<BR>
	    4 byte packets: check the source code for details
	  </LI>
	</UL>
	
	<P>References:</P>
	<UL>
	  <LI>daemons/lircmd.c</LI>
	</UL>
      </LI>
    </UL>
    
    <A NAME="lirc_dev"></A><HR>
    <H1 ALIGN="CENTER">Writing TV card drivers using lirc_dev</H1>
    <HR WIDTH="70%">
    
    <P>
      The <em>lirc_dev</em> module is a helper and abstraction layer
      for other modules.  It registers <em>/dev/lirc</em> device in a
      system (including support for devfs) and waits for plugin
      registration.  After that it serves device requests (open, read,
      poll, ioctl, close) and if needed calls callback functions from
      plugin(s) to communicate with the physical device.
    </P>
    <P>
      Plugins can be registered and unregistered many times. The
      current implementation allows two concurrent plugins, but can be
      easily changed by increasing the MAX_IRCTL_DEVICES
      definition. It also allows receiving of scan codes, which have
      more than 8 bits. Current limit for a scan code is 16*8 bits and
      also can be changed by increasing the BUFLEN definition.
    </P>
    <P>
      For an API description see <em>lirc_dev.h</em>. The lirc_gpio
      module can be treated as examples of using this API.<br> This
      code contains many lines with debug messages (activated by
      <em>debug</em> option) and they will sustain until more tests
      will be performed.
    </P>
    <P>
      <B>Warning:</B> Due to the used kernel API it requires kernel
      2.2.4 or higher.<br> Any suggestions and questions are
      welcome. <A href="mailto:alipowski@interia.pl">Artur
	Lipowski</A>
    </P>
    
    <!-- Writing LIRC Applications +++++++++++++++++++++++++++++++++++++++ -->
    
    <A NAME="applications"></A><HR>
    <H1 ALIGN="CENTER">Writing Applications for LIRC</H1>
    <HR WIDTH="70%">
    
    <P>
      As LIRC is able to both receive and send IR commands there are
      two possible types of applications. Programs that send IR
      commands like <em>xrc</em> and <em>irsend</em> or programs that
      receive commands like <em>irexec</em>, <em>irxevent</em> and
      <em>irpty</em>.  Both types of applications will have to connect
      to the lircd daemon using the socket interface usually located
      in /var/run/lirc/lircd. Communication on the socket uses human
      readable format. The end of a line is indicated by a newline
      character.
    </P>
    <P>
      Whenever lircd receives a IR signal it will broadcast the
      following string to each client:</P>
    <PRE>
  &lt;code&gt; &lt;repeat count&gt; &lt;button name&gt; &lt;remote control name&gt;</PRE>
    <P>
      <em>code</em> is a 64-bit encoding (in hexadecimal
      representation) of the IR signal. It's usage in applications is
      deprecated and should be ignored. The <em>repeat count</em>
      shows how long the user has been holding down a button. The
      counter will start at 0 and increment each time a new IR signal
      has been received. The <em>button name</em> and <em>remote
      control name</em> are defined in the lircd config file. Their
      purpose should be quite self-explanatory. They must not contain
      any whitespace.<BR>
      
      The only other situation when lircd broadcasts to all clients is
      when it receives the SIGHUP signal and successfully re-reads its
      config file. Then it will send a SIGHUP packet to its clients
      indicating that its configuration might have changed. This
      feature is <NOBR>e.g.</NOBR> used in <em>xrc</em> to rebuild the
      list of supported remote controls each time lircd's
      configuration changes. The format of the packet will be
      explained later.
    </P>
    <P>
      Applications that want to send out IR commands can use the
      following commands:
      </P>
    <PRE>
  SEND_ONCE &lt;remote control name&gt; &lt;button name&gt; [&lt;repeat count&gt;]
  SEND_START &lt;remote control name&gt; &lt;button name&gt;
  SEND_STOP &lt;remote control name&gt; &lt;button name&gt;</PRE>
    <P>
      The SEND_ONCE directive tells lircd to send the IR signal
      associated with the given remote control and button name, and then
      repeat it <var>repeat count</var> times. <var>repeat count</var> is
      a decimal number between 0 and <var>repeat_max</var>. The latter
      can be given as a command line argument to lircd, and defaults
      to 600.  If <var>repeat count</var> is
      not specified or is less than the minimum number of repeats
      for the selected remote control, the minimum value will be
      used. SEND_START tells lircd to start repeating the 
      given button until it receives a SEND_STOP command. However, the
      number of repeats is limited to <var>repeat_max</var>. lircd
      won't accept any new send commands while it is repeating.
    </P>
    <P>
      lircd also understands the following commands:
    </P>
    <PRE>
  VERSION
  LIST [&lt;remote control name&gt;]</PRE>
    <P>
      The response to the VERSION command will be a packet containing
      lircd's version.<BR>
      
      The LIST command without further arguments can be used to get a
      list of all remote controls known to lircd. If a name of a
      supported remote control is given as argument all buttons of the
      given remote control are listed in the reply packet. Have a look
      at <em>xrc</em> for an example how this can be used.
    </P>
    <P>
      There still remains to explain the format of lircd's reply
      packets. Here is a formal description of the packets:
    </P>
    <PRE>
  BEGIN
  &lt;command&gt;
  [SUCCESS|ERROR]
  [DATA
  n
  n lines of data]
  END</PRE>
    <P>
      The protocol guarantees that broadcasted messages won't
      interfere with reply packets. But broadcasts may appear at any
      point between packets. <em>command</em> is the command lircd is
      currently processing. Its an exact copy of the command the
      client application has sent. The only exception are SIGHUP
      packages where <em>command</em> is substituted with SIGHUP. Note
      that SIGHUP packages may appear just after you have sent a
      command to lircd, so you have to make sure you don't confuse
      them with replies. SIGHUP packages come without any further data
      while each reply to a command contains either SUCCESS or ERROR
      indicating the result of processing the command. In case of an
      error the following data is a message explaining the
      problem. This message can be used to create an error message for
      the user.<BR>

      If the command was successful, data is only sent for the
      commands that return some information. Note that a packet
      containing 0 lines of data can be a valid reply.
    </P>
    
    <!-- Writing LIRC Applications +++++++++++++++++++++++++++++++++++++++ -->
    
    <A NAME="library"></A><HR>
    
    <H2 ALIGN="CENTER">The lirc_client library</H2>
    <HR WIDTH="70%">
    
    <P>
      If you only want to make your application receive IR commands
      and if you don't want to mess with all the protocol stuff you
      can use the <em>lirc_client</em> library that comes with LIRC
      since version 0.6.0. With the help of this library your program
      can look as simple as this:
    </P>
    <PRE>
/*      $Id: technical.html,v 1.34 2010/01/30 15:01:29 lirc Exp $      */

/****************************************************************************
 ** irexec.c ****************************************************************
 ****************************************************************************
 *
 * irexec  - execute programs according to the pressed remote control buttons
 *
 * Copyright (C) 1998 Trent Piepho &lt;xyzzy@u.washington.edu&gt;
 * Copyright (C) 1998 Christoph Bartelmus &lt;lirc@bartelmus.de&gt;
 *
 */

#ifdef HAVE_CONFIG_H
# include &lt;config.h&gt;
#endif

#include &lt;errno.h&gt;
#include &lt;unistd.h&gt;
#include &lt;stdarg.h&gt;
#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include "lirc_client.h"

char *progname;

int main(int argc, char *argv[])
{
	struct lirc_config *config;

	progname=argv[0];
	if(argc&gt;2)
	{
		fprintf(stderr,"Usage: %s &lt;config file&gt;\n",progname);
		exit(EXIT_FAILURE);
	}
	if(lirc_init("irexec",1)==-1) exit(EXIT_FAILURE);

	if(lirc_readconfig(argc==2 ? argv[1]:NULL,&amp;config,NULL)==0)
	{
		char *code;
		char *c;
		int ret;

		while(lirc_nextcode(&amp;code)==0)
		{
			if(code==NULL) continue;
			while((ret=lirc_code2char(config,code,&amp;c))==0 &amp;&amp;
			      c!=NULL)
			{
#ifdef DEBUG
				printf("Execing command \"%s\"\n",c);
#endif
				system(c);
			}
			free(code);
			if(ret==-1) break;
		}
		lirc_freeconfig(config);
	}

	lirc_deinit();
	exit(EXIT_SUCCESS);
}</PRE>
    
    <P>
      Before anything else you have to include the header file for the
      lirc_client library. This is done with
    </P>
    <PRE>
#include &lt;lirc/lirc_client.h&gt;</PRE>
    <P>
      Note that our example differs in this point because it was taken
      directly from the lirc-0.6.0 source that comes with its own
      <em>lirc_client.h</em> but we have to use the one that is
      already installed on the system.
    </P>
    <P>
      The next step is to initialize the library code with
      <em>lirc_init()</em>. This function connects to lircd and does
      some internal init stuff.
    </P>
    <PRE>
int lirc_init(char *prog,int verbose);</PRE>
    <P>
      The first argument to this function is the string users will
      have to provide as <em>prog</em> token in their .lircrc config
      files. If the second argument is non-zero error messages will be
      printed to <em>stderr</em>. Otherwise no error messages will
      ever be displayed.  This function returns the file descriptor of
      the socket that is connected to lircd or -1 if an error
      occurred.
    </P>
    <P>
      The example continues by reading a config file. This is done by
      the <em>lirc_readconfig()</em> function:
    </P>
    <PRE>
int lirc_readconfig(char *file,struct lirc_config **config,
		    int (check)(char *s));</PRE>
    <P>
      If you want to load the default config file you should pass NULL
      as first argument. If you want to load some other config file
      the <em>file</em> argument should contain the complete path to
      the file. Your program should give the user the possibility to
      use an other than the default config file. You should also be
      able to load multiple config files by calling this function
      several times.<BR>

      The <em>config</em> argument is used to pass the pointer to the
      config file data structures back to your application. You will
      need it for calls to the <em>lirc_code2char()</em> function. The
      last argument is a call-back function that can be used to do
      syntax checks with the config strings. The library code will
      call the call-back function for all config strings where the
      <em>prog</em> token in the config file matches the prog string
      you provided with the <em>lirc_init()</em> function. If there is
      an error in the config string the call-back function should
      return -1, otherwise 0. If you don't need to do any syntax
      checks you can pass NULL here. The function returns -1 if an
      error occurred, 0 otherwise.
    </P>
    <P>
      The <em>lirc_nextcode()</em> function blocks until there is
      something available on the lircd socket. This way it can be used
      in the main loop of your program like in our example.
    </P>
    <PRE>
int lirc_nextcode(char **code);</PRE>
    <P>
      If an error occurs (usually this means that the socket has been
      closed by the daemon) this function returns -1. Otherwise it
      returns 0 and <em>code</em> points to the next string available
      in the data stream. This string has to be freed by your
      application using the <em>free(3)</em> function. If no complete
      string is available <em>code</em> will be NULL.<BR>

      If you use some GUI-toolkit for your program then you probably
      won't be able to use this function in your program's main loop
      because this is already handled by the GUI-toolkit. In this
      situation you should use the call-back abilities of the toolkit
      that will notify you whenever there is some input available from
      a file descriptor (you get the file descriptor from the
      <em>lirc_init()</em> function). E.g. you can use the
      <em>gdk_input_add()</em>/<em>gdk_input_remove</em>() functions
      with gtk or the <em>QSocketNotifier</em> class with Qt. If you
      don't have such functionality in your toolkit or can't use it
      for some reason you can still use SIGIO signals for this
      purpose. Check the documentation for your GUI-toolkit and
      signal(2) for further information.<BR>

      Please note that using call-backs you still have to use some
      kind of while loop to read strings from the socket because
      several strings may be available in the data stream and you will
      only get a notification for the first one. This poses a problem
      for us because <em>lirc_nextcode()</em> blocks until there is
      something available from the socket which is not what we need
      here. You can solve this problem by setting the
      <b>O_NONBLOCK</b> flag for the socket using the
      <em>fcntl(2)</em> function. Have a look at the current xirw code
      that is available from the LIRC homepage for an implementation
      example.
    </P>
    <P>
      To get the config string that the user has provided in the
      config file in response to a button press you use the following
      function:
    </P>
    <PRE>
int lirc_code2char(struct lirc_config *config,char *code,char **string);</PRE>
    <P>
      <em>config</em> is a pointer to the config file data structure
      that you can get with <em>lirc_readconfig()</em> and
      <em>code</em> is the code transmitted to your application on the
      lircd socket. If an action should be taken <em>string</em> will
      point to the config string the user has provided in the config
      file. The user might want to take several actions on a button
      press so you have to execute this function until <em>string</em>
      is NULL, which means that no more actions shall be taken, or an
      error occurs. The function returns -1 if an error occurred, 0
      otherwise.
    </P>
    <P>
      In our example there are only two clean-up functions to be
      explained.
    </P>
    <PRE>
void lirc_freeconfig(struct lirc_config *config);</PRE>
    <P>
      This functions frees the data structures associated with
      <em>config</em>.
    </P>
    <PRE>
int lirc_deinit();</PRE>
    <P>
      <em>lirc_deinit()</em> closes the connection to lircd and does
      some internal clean-up stuff.
    </P>
    <P>
      I encourage you to use autoconf and automake for your
      projects. To check for the lirc_client library all you have to
      insert into your <em>configure.ac</em> (or <em>configure.in</em>) 
      file is the following:
    </P>
    <PRE>
dnl Check for LIRC client support
dnl This really is not worth making a separate file for it.

have_lirc=yes
AC_REQUIRE_CPP
AC_CHECK_LIB(lirc_client,lirc_init,
  AC_CHECK_HEADER(lirc/lirc_client.h,true,have_lirc=no),have_lirc=no)

if test "$have_lirc" = "yes"; then
dnl  AC_DEFINE(HAVE_LIRC);
  true;
else
  AC_MSG_ERROR([*** LIRC client support not available ***]);
fi</PRE>
    <P>
      There is also a more complex m4 macro in the contrib directory
      of the current LIRC distribution if you plan to add LIRC support
      to your application without using the lirc_client library.
    </P>
    <P>
      While developing LIRC applications you might find a <A
	HREF="http://www.fi.muni.cz/~xkutale1/en/lircemu/">emulator</A>
      for lircd useful. With this emulator you don't need a remote
      control to generate LIRC events. That way you can develop LIRC
      applications even if you don't have a LIRC compatible device
      yourself.
    </P>

    <A NAME="lircrcd"></A><HR>
    <H1 ALIGN="CENTER">lircrcd protocol</H1>
    <HR WIDTH="70%">

    <P>
      lircrcd syntactically uses the same protocol as lircd described
      in the last section. It supports the following commands:
    </P>
    <DL>
      <DT>IDENT <em>ident</em></DT>
      <DD>
	<P>
	  Each program connecting to lircrcd identifies itself using
	  this program. <em>ident</em> is the string that is used in
	  the prog token inside the .lircrc file.
        </P>
      </DD>
      <DT>CODE <em>code</em></DT>
      <DD>
	<P>
	  When the client receives the <em>code</em> string from lircd
	  it will send it to lircrcd and will receive back the
	  applicable config string from the .lircrc config file. It
	  should resend the CODE command until nothing is returned
	  back which means that nothing (more) should happen in
	  response to <em>code</em>. This command is used each time
	  the lirc_code2char() function is called by a client.
        </P>
      </DD>
      <DT>GETMODE</DT>
      <DD>
	<P>
	  lircrcd will return the current mode string.
        </P>
      </DD>
    </DL>

    <A NAME="packagers"></A><HR>
    <H1 ALIGN="CENTER">Note for packagers</H1>
    <HR WIDTH="70%">
    
    <P>
      If you want to make a binary package for lirc (.deb, .rpm, ...),
      there are a couple of goodies you can take advantage of:
      <dl>
      <dt>--with-driver=all
      <dd>
	Builds support for as many devices as possible into a single
	lircd binary.
      </dd>
      <dt>--with-driver=userspace
      <dd>
        The same as the all driver, but no kernel modules will be
        built.
      </dd>
      <dt>--enable-sandboxed
      <dd>
	Prevents any changes out of the installation directory on "make
	install":
          <ul>
          <li>will not create device nodes on /dev/</li>
	  <li>will not run depmod</li>
	  </ul>
      </dd>
      <dt>DESTDIR
      <dd>
	You should use <em>DESTDIR</em> and not <em>prefix</em> to install
	into the sandbox, modules will be installed to <em>/lib/</em>
	otherwise.
      </dd>
	<br>Finally, you should consider installing the doc/lirc.hwdb file.
	This one is a parseable list of LIRC supported devices, which
	is useful for LIRC configuration applications.<br>
	You should also have a look at the below HAL integration description.<br>
	For more information, refer to the next section.
      </dl>
    </P>

    <A NAME="hal"></A><HR>
    <H1 ALIGN="CENTER">Hardware Abstraction Layer (HAL) integration</H1>
    <HR WIDTH="70%">
    
    <P>
      If your system support the <a href="http://www.freedesktop.org/wiki/Software/hal">FreeDesktop Hardware Abstraction Layer (HAL)</a>,
      you will want to install the file <em>contrib/hal/20-ircontrol-lirc.fdi</em> in
      <em>${datarootdir}/hal/fdi/information/20thirdparty</em>
    </P>
    <P>
      This file can be generated at will using contrib/hal/gen-hal-fdi.pl.<br>
      Installing 20-ircontrol-lirc.fdi allow applications developers to detect
      USB remotes easily by searching for HAL devices with <em>info.capabilities=input.remote_control</em>
    </P>
    <P>
      This is a work in progress. We will also provide more information in the
      future, such as the driver/manufacturer/device name(s), and possibly
      event reporting.
    </P>

    <A NAME="config"></A><HR>
    <H1 ALIGN="CENTER">Note for configuration application developers</H1>
    <HR WIDTH="70%">
    
    <P>
      If you want to make a configuration application, lirc provides
			a parseable list of LIRC supported devices.<br>
			<br>
			This file is generated at compilation time, along with its <a href="table.html">HTML
			equivalent</a> and is available as doc/lirc.hwdb in the source tree.
			It should also be installed by the binary packages of your prefered
			distribution (bug report otherwise!).
			<br><br>
			The format is:
			<br>
			[remote controls type]<br>
			description;driver;lirc driver;HW_DEFAULT;lircd_conf;<br>
    </P>

    <A NAME="bugs"></A><HR>
    <H1 ALIGN="CENTER">Known bugs</H1>
    <HR WIDTH="70%">
    
    <UL>
      <LI>
	<P>
	  If you use the <em>lirc_serial</em> or
	  <em>lirc_parallel</em> driver regularly to transmit
	  infra-red signals you might notice that your system clock
	  will slow down. During transmit the driver turns off
	  interrupts and hence some clock interrupts might get lost
	  causing system clock inaccuracy. Unfortunately in order to
	  ensure a good signal timing interrupts have to be
	  disabled. Currently no work-around is known for this problem
	  except using a program like <em>netdate</em> to synchronize
	  your system clock regularly.
	</P>
      </LI>
      <LI>
	<P>
	  The <em>lirc_serial</em> and <em>lirc_parallel</em> drivers
	  measure the time between interrupts on the serial resp.
	  parallel port to get a pulse and space representation of the
	  incoming infra-red signal. If interrupts are disabled by the
	  CPU for a rather long time (&gt;100 &micro;s, which happens
	  often e.g. during heavy IDE disk activity) some interrupts
	  might get lost and the incoming data stream becomes
	  disturbed. In this case decoding of the infra-red signal
	  will fail. This is the downside of the really simple
	  receiver circuits and can't be addressed in software except
	  keeping the time where interrupts are disabled to a minimum.
	</P>
	<P>
	  If you are using an IDE system you might want to try calling
	  <em>hdparm -u1 -d1</em> for all of your drives. This enables
	  DMA for the drive and allows the driver to unmask other
	  interrupts during handling of a disk interrupt. But be aware
	  that this can be dangerous for some (buggy) IDE
	  chipsets. Consult the hdparm man page for further
	  information.
	</P>
      </LI>
    </UL>
    

<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

		<BR><BR>
		<CENTER>[<A HREF="http://www.lirc.org/">LIRC homepage</A>]<BR>
		  <I>The LIRC Manual, last update: 24-May-2009</I></CENTER>
		<BR><BR>
	      </TD>
	      <TD WIDTH="15%">&#160;<BR></TD>
	    </TR>
	  </TABLE>
	</TD>
      </TR>
      <TR>
	<TD CLASS="menu" WIDTH="100%">&#160;<BR>
	</TD>
      </TR>
    </TABLE>
  </BODY>
</HTML>