1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>struct lirc_driver</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch06s03.html" title="Remote Controller devices"><link rel="prev" href="API-struct-rc-dev.html" title="struct rc_dev"><link rel="next" href="ch06s04.html" title="Media Controller devices"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">struct lirc_driver</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-struct-rc-dev.html">Prev</a> </td><th width="60%" align="center">Remote Controller devices</th><td width="20%" align="right"> <a accesskey="n" href="ch06s04.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-struct-lirc-driver"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>struct lirc_driver — 
2  Defines the parameters on a LIRC driver
3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="programlisting">
4struct lirc_driver {
5  char name[40];
6  int minor;
7  __u32 code_length;
8  unsigned int buffer_size;
9  int sample_rate;
10  __u32 features;
11  unsigned int chunk_size;
12  void * data;
13  int min_timeout;
14  int max_timeout;
15  int (* add_to_buf) (void *data, struct lirc_buffer *buf);
16  struct lirc_buffer * rbuf;
17  int (* set_use_inc) (void *data);
18  void (* set_use_dec) (void *data);
19  struct rc_dev * rdev;
20  const struct file_operations * fops;
21  struct device * dev;
22  struct module * owner;
23};  </pre></div><div class="refsect1"><a name="id-1.8.4.5.5"></a><h2>Members</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term">name[40]</span></dt><dd><p>
24this string will be used for logs
25      </p></dd><dt><span class="term">minor</span></dt><dd><p>
26indicates minor device (/dev/lirc) number for
27registered driver if caller fills it with negative
28value, then the first free minor number will be used
29(if available).
30      </p></dd><dt><span class="term">code_length</span></dt><dd><p>
31length of the remote control key code expressed in bits.
32      </p></dd><dt><span class="term">buffer_size</span></dt><dd><p>
33Number of FIFO buffers with <em class="parameter"><code>chunk_size</code></em> size. If zero,
34creates a buffer with BUFLEN size (16 bytes).
35      </p></dd><dt><span class="term">sample_rate</span></dt><dd><p>
36if zero, the device will wait for an event with a new
37code to be parsed. Otherwise, specifies the sample
38rate for polling. Value should be between 0
39and HZ. If equal to HZ, it would mean one polling per
40second.
41      </p></dd><dt><span class="term">features</span></dt><dd><p>
42lirc compatible hardware features, like LIRC_MODE_RAW,
43LIRC_CAN_*, as defined at include/media/lirc.h.
44      </p></dd><dt><span class="term">chunk_size</span></dt><dd><p>
45Size of each FIFO buffer.
46      </p></dd><dt><span class="term">data</span></dt><dd><p>
47it may point to any driver data and this pointer will
48be passed to all callback functions.
49      </p></dd><dt><span class="term">min_timeout</span></dt><dd><p>
50Minimum timeout for record. Valid only if
51LIRC_CAN_SET_REC_TIMEOUT is defined.
52      </p></dd><dt><span class="term">max_timeout</span></dt><dd><p>
53Maximum timeout for record. Valid only if
54LIRC_CAN_SET_REC_TIMEOUT is defined.
55      </p></dd><dt><span class="term">add_to_buf</span></dt><dd><p>
56add_to_buf will be called after specified period of the
57time or triggered by the external event, this behavior
58depends on value of the sample_rate this function will
59be called in user context. This routine should return
600 if data was added to the buffer and -ENODATA if none
61was available. This should add some number of bits
62evenly divisible by code_length to the buffer.
63      </p></dd><dt><span class="term">rbuf</span></dt><dd><p>
64if not NULL, it will be used as a read buffer, you will
65have to write to the buffer by other means, like irq's
66(see also lirc_serial.c).
67      </p></dd><dt><span class="term">set_use_inc</span></dt><dd><p>
68set_use_inc will be called after device is opened
69      </p></dd><dt><span class="term">set_use_dec</span></dt><dd><p>
70set_use_dec will be called after device is closed
71      </p></dd><dt><span class="term">rdev</span></dt><dd><p>
72Pointed to struct rc_dev associated with the LIRC
73device.
74      </p></dd><dt><span class="term">fops</span></dt><dd><p>
75file_operations for drivers which don't fit the current
76driver model.
77Some ioctl's can be directly handled by lirc_dev if the
78driver's ioctl function is NULL or if it returns
79-ENOIOCTLCMD (see also lirc_serial.c).
80      </p></dd><dt><span class="term">dev</span></dt><dd><p>
81pointer to the struct device associated with the LIRC
82device.
83      </p></dd><dt><span class="term">owner</span></dt><dd><p>
84the module owning this struct
85      </p></dd></dl></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-struct-rc-dev.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06s03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch06s04.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">struct rc_dev</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Media Controller devices</td></tr></table></div></body></html>
86