aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/DocBook
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2010-07-03 00:10:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 14:18:36 -0400
commitf0cae143e113d28ab89a930934c36f619c4367f0 (patch)
treeb5017abd03f01ebd1817a9e7ea749b748d2e3e4e /Documentation/DocBook
parent15f135d0cfc1ce762889bb804549da4081087597 (diff)
V4L/DVB: IR/lirc: add docbook info covering lirc device interface
First ever crack at creating docbook documentation... Contains a bevy of information on the various lirc device interface ioctls, as well as a bit about the read and write interfaces. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'Documentation/DocBook')
-rw-r--r--Documentation/DocBook/v4l/lirc_device_interface.xml235
1 files changed, 235 insertions, 0 deletions
diff --git a/Documentation/DocBook/v4l/lirc_device_interface.xml b/Documentation/DocBook/v4l/lirc_device_interface.xml
new file mode 100644
index 000000000000..d9ae6803c2fc
--- /dev/null
+++ b/Documentation/DocBook/v4l/lirc_device_interface.xml
@@ -0,0 +1,235 @@
1<title>LIRC Device Interface</title>
2
3
4<section id="lirc_dev_intro">
5<title>Introduction</title>
6
7<para>The LIRC device interface is a bi-directional interface for
8transporting raw IR data between userspace and kernelspace. Fundamentally,
9it is just a chardev (/dev/lircX, for X = 0, 1, 2, ...), with a number
10of standard struct file_operations defined on it. With respect to
11transporting raw IR data to and fro, the essential fops are read, write
12and ioctl.</para>
13
14<para>Example dmesg output upon a driver registering w/LIRC:</para>
15 <blockquote>
16 <para>$ dmesg |grep lirc_dev</para>
17 <para>lirc_dev: IR Remote Control driver registered, major 248</para>
18 <para>rc rc0: lirc_dev: driver ir-lirc-codec (mceusb) registered at minor = 0</para>
19 </blockquote>
20<para>
21
22<para>What you should see for a chardev:</para>
23 <blockquote>
24 <para>$ ls -l /dev/lirc*</para>
25 <para>crw-rw---- 1 root root 248, 0 Jul 2 22:20 /dev/lirc0</para>
26 </blockquote>
27</para>
28
29
30<section id="lirc_read">
31<title>LIRC read fop</title>
32
33<para>The lircd userspace daemon reads raw IR data from the LIRC chardev. The
34exact format of the data depends on what modes a driver supports, and what
35mode has been selected. lircd obtains supported modes and sets the active mode
36via the ioctl interface, detailed at <xref linkend="lirc_ioctl">. The generally
37preferred mode is LIRC_MODE_MODE2, in which packets containing an int value
38describing an IR signal are read from the chardev.</para>
39
40<para>See also <ulink url="http://www.lirc.org/html/technical.html">http://www.lirc.org/html/technical.html</> for more info.</para>
41
42
43<section id="lirc_write">
44<title>LIRC write fop</title>
45
46<para>The data written to the chardev is a pulse/space sequence of integer
47values. Pulses and spaces are only marked implicitly by their position. The
48data must start and end with a pulse, therefore, the data must always include
49an unevent number of samples. The write function must block until the data has
50been transmitted by the hardware.</para>
51
52
53<section id="lirc_ioctl">
54<title> LIRC ioctl fop</title>
55
56<para>The LIRC device's ioctl definition is bound by the ioctl function
57definition of struct file_operations, leaving us with an unsigned int
58for the ioctl command and an unsigned long for the arg. For the purposes
59of ioctl portability across 32-bit and 64-bit, these values are capped
60to their 32-bit sizes.</para>
61
62<para>The following ioctls can be used to change specific hardware settings.
63In general each driver should have a default set of settings. The driver
64implementation is expected to re-apply the default settings when the device
65is closed by user-space, so that every application opening the device can rely
66on working with the default settings initially.</para>
67
68<variablelist>
69 <varlistentry>
70 <term>LIRC_GET_FEATURES</term>
71 <listitem>
72 <to>Obviously, get the underlying hardware device's features. If a driver
73 does not announce support of certain features, calling of the corresponding
74 ioctls is undefined.</to>
75 </listitem>
76 </varlistentry>
77 <varlistentry>
78 <term>LIRC_GET_SEND_MODE</term>
79 <listitem>
80 <to>Get supported transmit mode. Only LIRC_MODE_PULSE is supported by lircd.</to>
81 </listitem>
82 </varlistentry>
83 <varlistentry>
84 <term>LIRC_GET_REC_MODE</term>
85 <listitem>
86 <to>Get supported receive modes. Only LIRC_MODE_MODE2 and LIRC_MODE_LIRCCODE
87 are supported by lircd.</to>
88 </listitem>
89 </varlistentry>
90 <varlistentry>
91 <term>LIRC_GET_SEND_CARRIER</term>
92 <listitem>
93 <to>Get carrier frequency (in Hz) currently used for transmit.</to>
94 </listitem>
95 </varlistentry>
96 <varlistentry>
97 <term>LIRC_GET_REC_CARRIER</term>
98 <listitem>
99 <to>Get carrier frequency (in Hz) currently used for IR reception.</to>
100 </listitem>
101 </varlistentry>
102 <varlistentry>
103 <term>LIRC_{G,S}ET_{SEND,REC}_DUTY_CYCLE</term>
104 <listitem>
105 <to>Get/set the duty cycle (from 0 to 100) of the carrier signal. Currently,
106 no special meaning is defined for 0 or 100, but this could be used to switch
107 off carrier generation in the future, so these values should be reserved.</to>
108 </listitem>
109 </varlistentry>
110 <varlistentry>
111 <term>LIRC_GET_REC_RESOLUTION</term>
112 <listitem>
113 <to>Some receiver have maximum resolution which is defined by internal
114 sample rate or data format limitations. E.g. it's common that signals can
115 only be reported in 50 microsecond steps. This integer value is used by
116 lircd to automatically adjust the aeps tolerance value in the lircd
117 config file.</to>
118 </listitem>
119 </varlistentry>
120 <varlistentry>
121 <term>LIRC_GET_M{IN,AX}_TIMEOUT</term>
122 <listitem>
123 <to>Some devices have internal timers that can be used to detect when
124 there's no IR activity for a long time. This can help lircd in detecting
125 that a IR signal is finished and can speed up the decoding process.
126 Returns an integer value with the minimum/maximum timeout that can be
127 set. Some devices have a fixed timeout, in that case both ioctls will
128 return the same value even though the timeout cannot be changed.</to>
129 </listitem>
130 </varlistentry>
131 <varlistentry>
132 <term>LIRC_GET_M{IN,AX}_FILTER_{PULSE,SPACE}</term>
133 <listitem>
134 <to>Some devices are able to filter out spikes in the incoming signal
135 using given filter rules. These ioctls return the hardware capabilities
136 that describe the bounds of the possible filters. Filter settings depend
137 on the IR protocols that are expected. lircd derives the settings from
138 all protocols definitions found in its config file.</to>
139 </listitem>
140 </varlistentry>
141 <varlistentry>
142 <term>LIRC_GET_LENGTH</term>
143 <listitem>
144 <to>Retrieves the code length in bits (only for LIRC_MODE_LIRCCODE).
145 Reads on the device must be done in blocks matching the bit count.
146 The bit could should be rounded up so that it matches full bytes.</to>
147 </listitem>
148 </varlistentry>
149 <varlistentry>
150 <term>LIRC_SET_{SEND,REC}_MODE</term>
151 <listitem>
152 <to>Set send/receive mode. Largely obsolete for send, as only
153 LIRC_MODE_PULSE is supported.</to>
154 </listitem>
155 </varlistentry>
156 <varlistentry>
157 <term>LIRC_SET_{SEND,REC}_CARRIER</term>
158 <listitem>
159 <to>Set send/receive carrier (in Hz).</to>
160 </listitem>
161 </varlistentry>
162 <varlistentry>
163 <term>LIRC_SET_TRANSMITTER_MASK</term>
164 <listitem>
165 <to>This enables the given set of transmitters. The first transmitter
166 is encoded by the least significant bit, etc. When an invalid bit mask
167 is given, i.e. a bit is set, even though the device does not have so many
168 transitters, then this ioctl returns the number of available transitters
169 and does nothing otherwise.</to>
170 </listitem>
171 </varlistentry>
172 <varlistentry>
173 <term>LIRC_SET_REC_TIMEOUT</term>
174 <listitem>
175 <to>Sets the integer value for IR inactivity timeout (cf.
176 LIRC_GET_MIN_TIMEOUT and LIRC_GET_MAX_TIMEOUT). A value of 0 (if
177 supported by the hardware) disables all hardware timeouts and data should
178 be reported as soon as possible. If the exact value cannot be set, then
179 the next possible value _greater_ than the given value should be set.</to>
180 </listitem>
181 </varlistentry>
182 <varlistentry>
183 <term>LIRC_SET_REC_TIMEOUT_REPORTS</term>
184 <listitem>
185 <to>Enable (1) or disable (0) timeout reports in LIRC_MODE_MODE2. By
186 default, timeout reports should be turned off.</to>
187 </listitem>
188 </varlistentry>
189 <varlistentry>
190 <term>LIRC_SET_REC_FILTER_{,PULSE,SPACE}</term>
191 <listitem>
192 <to>Pulses/spaces shorter than this are filtered out by hardware. If
193 filters cannot be set independently for pulse/space, the corresponding
194 ioctls must return an error and LIRC_SET_REC_FILTER shall be used instead.</to>
195 </listitem>
196 </varlistentry>
197 <varlistentry>
198 <term>LIRC_SET_MEASURE_CARRIER_MODE</term>
199 <listitem>
200 <to>Enable (1)/disable (0) measure mode. If enabled, from the next key
201 press on, the driver will send LIRC_MODE2_FREQUENCY packets. By default
202 this should be turned off.</to>
203 </listitem>
204 </varlistentry>
205 <varlistentry>
206 <term>LIRC_SET_REC_{DUTY_CYCLE,CARRIER}_RANGE</term>
207 <listitem>
208 <to>To set a range use LIRC_SET_REC_DUTY_CYCLE_RANGE/LIRC_SET_REC_CARRIER_RANGE
209 with the lower bound first and later LIRC_SET_REC_DUTY_CYCLE/LIRC_SET_REC_CARRIER
210 with the upper bound.</to>
211 </listitem>
212 </varlistentry>
213 <varlistentry>
214 <term>LIRC_NOTIFY_DECODE</term>
215 <listitem>
216 <to>This ioctl is called by lircd whenever a successful decoding of an
217 incoming IR signal could be done. This can be used by supporting hardware
218 to give visual feedback to the user e.g. by flashing a LED.</to>
219 </listitem>
220 </varlistentry>
221 <varlistentry>
222 <term>LIRC_SETUP_{START,END}</term>
223 <listitem>
224 <to>Setting of several driver parameters can be optimized by encapsulating
225 the according ioctl calls with LIRC_SETUP_START/LIRC_SETUP_END. When a
226 driver receives a LIRC_SETUP_START ioctl it can choose to not commit
227 further setting changes to the hardware until a LIRC_SETUP_END is received.
228 But this is open to the driver implementation and every driver must also
229 handle parameter changes which are not encapsulated by LIRC_SETUP_START
230 and LIRC_SETUP_END. Drivers can also choose to ignore these ioctls.</to>
231 </listitem>
232 </varlistentry>
233</variablelist>
234
235</section>