1 <refentry id="cec-ioc-g-event">
3 <refentrytitle>ioctl CEC_DQEVENT</refentrytitle>
8 <refname>CEC_DQEVENT</refname>
9 <refpurpose>Dequeue a CEC event</refpurpose>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct cec_event *<parameter>argp</parameter></paramdef>
24 <title>Arguments</title>
28 <term><parameter>fd</parameter></term>
30 <para>File descriptor returned by
31 <link linkend='cec-func-open'><function>open()</function></link>.</para>
35 <term><parameter>request</parameter></term>
37 <para>CEC_DQEVENT</para>
41 <term><parameter>argp</parameter></term>
50 <title>Description</title>
53 Note: this documents the proposed CEC API. This API is not yet finalized and
54 is currently only available as a staging kernel module.
57 <para>CEC devices can send asynchronous events. These can be retrieved by calling
58 the <constant>CEC_DQEVENT</constant> ioctl. If the file descriptor is in non-blocking
59 mode and no event is pending, then it will return -1 and set errno to the &EAGAIN;.</para>
61 <para>The internal event queues are per-filehandle and per-event type. If there is
62 no more room in a queue then the last event is overwritten with the new one. This
63 means that intermediate results can be thrown away but that the latest event is always
64 available. This also means that is it possible to read two successive events that have
65 the same value (e.g. two CEC_EVENT_STATE_CHANGE events with the same state). In that
66 case the intermediate state changes were lost but it is guaranteed that the state
67 did change in between the two events.</para>
69 <table pgwide="1" frame="none" id="cec-event-state-change">
70 <title>struct <structname>cec_event_state_change</structname></title>
76 <entry><structfield>phys_addr</structfield></entry>
77 <entry>The current physical address.</entry>
81 <entry><structfield>log_addr_mask</structfield></entry>
82 <entry>The current set of claimed logical addresses.</entry>
88 <table pgwide="1" frame="none" id="cec-event-lost-msgs">
89 <title>struct <structname>cec_event_lost_msgs</structname></title>
95 <entry><structfield>lost_msgs</structfield></entry>
96 <entry>Set to the number of lost messages since the filehandle
97 was opened or since the last time this event was dequeued for
98 this filehandle. The messages lost are the oldest messages. So
99 when a new message arrives and there is no more room, then the
100 oldest message is discarded to make room for the new one. The
101 internal size of the message queue guarantees that all messages
102 received in the last two seconds will be stored. Since messages
103 should be replied to within a second according to the CEC
104 specification, this is more than enough.
111 <table pgwide="1" frame="none" id="cec-event">
112 <title>struct <structname>cec_event</structname></title>
118 <entry><structfield>ts</structfield></entry>
119 <entry>Timestamp of the event in ns.</entry>
124 <entry><structfield>event</structfield></entry>
125 <entry>The CEC event type, see <xref linkend="cec-events" />.</entry>
130 <entry><structfield>flags</structfield></entry>
131 <entry>Event flags, see <xref linkend="cec-event-flags" />.</entry>
136 <entry>(anonymous)</entry>
142 <entry>struct cec_event_state_change</entry>
143 <entry><structfield>state_change</structfield></entry>
144 <entry>The new adapter state as sent by the <constant>CEC_EVENT_STATE_CHANGE</constant>
149 <entry>struct cec_event_lost_msgs</entry>
150 <entry><structfield>lost_msgs</structfield></entry>
151 <entry>The number of lost messages as sent by the <constant>CEC_EVENT_LOST_MSGS</constant>
158 <table pgwide="1" frame="none" id="cec-events">
159 <title>CEC Events Types</title>
164 <entry><constant>CEC_EVENT_STATE_CHANGE</constant></entry>
166 <entry>Generated when the CEC Adapter's state changes. When open() is
167 called an initial event will be generated for that filehandle with the
168 CEC Adapter's state at that time.
172 <entry><constant>CEC_EVENT_LOST_MSGS</constant></entry>
174 <entry>Generated if one or more CEC messages were lost because the
175 application didn't dequeue CEC messages fast enough.</entry>
181 <table pgwide="1" frame="none" id="cec-event-flags">
182 <title>CEC Event Flags</title>
187 <entry><constant>CEC_EVENT_FL_INITIAL_VALUE</constant></entry>
189 <entry>Set for the initial events that are generated when the device is
190 opened. See the table above for which events do this. This allows
191 applications to learn the initial state of the CEC adapter at open()