Add the rt linux 4.1.3-rt3 as base
[kvmfornfv.git] / kernel / Documentation / DocBook / media / v4l / vidioc-subscribe-event.xml
1 <refentry id="vidioc-subscribe-event">
2   <refmeta>
3     <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle>
4     &manvol;
5   </refmeta>
6
7   <refnamediv>
8     <refname>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refname>
9     <refpurpose>Subscribe or unsubscribe event</refpurpose>
10   </refnamediv>
11
12   <refsynopsisdiv>
13     <funcsynopsis>
14       <funcprototype>
15         <funcdef>int <function>ioctl</function></funcdef>
16         <paramdef>int <parameter>fd</parameter></paramdef>
17         <paramdef>int <parameter>request</parameter></paramdef>
18         <paramdef>struct v4l2_event_subscription
19 *<parameter>argp</parameter></paramdef>
20       </funcprototype>
21     </funcsynopsis>
22   </refsynopsisdiv>
23
24   <refsect1>
25     <title>Arguments</title>
26
27     <variablelist>
28       <varlistentry>
29         <term><parameter>fd</parameter></term>
30         <listitem>
31           <para>&fd;</para>
32         </listitem>
33       </varlistentry>
34       <varlistentry>
35         <term><parameter>request</parameter></term>
36         <listitem>
37           <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para>
38         </listitem>
39       </varlistentry>
40       <varlistentry>
41         <term><parameter>argp</parameter></term>
42         <listitem>
43           <para></para>
44         </listitem>
45       </varlistentry>
46     </variablelist>
47   </refsect1>
48
49   <refsect1>
50     <title>Description</title>
51
52     <para>Subscribe or unsubscribe V4L2 event. Subscribed events are
53     dequeued by using the &VIDIOC-DQEVENT; ioctl.</para>
54
55     <table frame="none" pgwide="1" id="v4l2-event-subscription">
56       <title>struct <structname>v4l2_event_subscription</structname></title>
57       <tgroup cols="3">
58         &cs-str;
59         <tbody valign="top">
60           <row>
61             <entry>__u32</entry>
62             <entry><structfield>type</structfield></entry>
63             <entry>Type of the event, see <xref linkend="event-type" />. Note that
64 <constant>V4L2_EVENT_ALL</constant> can be used with VIDIOC_UNSUBSCRIBE_EVENT
65 for unsubscribing all events at once.</entry>
66           </row>
67           <row>
68             <entry>__u32</entry>
69             <entry><structfield>id</structfield></entry>
70             <entry>ID of the event source. If there is no ID associated with
71                 the event source, then set this to 0. Whether or not an event
72                 needs an ID depends on the event type.</entry>
73           </row>
74           <row>
75             <entry>__u32</entry>
76             <entry><structfield>flags</structfield></entry>
77             <entry>Event flags, see <xref linkend="event-flags" />.</entry>
78           </row>
79           <row>
80             <entry>__u32</entry>
81             <entry><structfield>reserved</structfield>[5]</entry>
82             <entry>Reserved for future extensions. Drivers and applications
83             must set the array to zero.</entry>
84           </row>
85         </tbody>
86       </tgroup>
87     </table>
88
89     <table pgwide="1" frame="none" id="event-flags">
90       <title>Event Flags</title>
91       <tgroup cols="3">
92         &cs-def;
93         <tbody valign="top">
94           <row>
95             <entry><constant>V4L2_EVENT_SUB_FL_SEND_INITIAL</constant></entry>
96             <entry>0x0001</entry>
97             <entry>When this event is subscribed an initial event will be sent
98                 containing the current status. This only makes sense for events
99                 that are triggered by a status change such as <constant>V4L2_EVENT_CTRL</constant>.
100                 Other events will ignore this flag.</entry>
101           </row>
102           <row>
103             <entry><constant>V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK</constant></entry>
104             <entry>0x0002</entry>
105             <entry><para>If set, then events directly caused by an ioctl will also be sent to
106                 the filehandle that called that ioctl. For example, changing a control using
107                 &VIDIOC-S-CTRL; will cause a V4L2_EVENT_CTRL to be sent back to that same
108                 filehandle. Normally such events are suppressed to prevent feedback loops
109                 where an application changes a control to a one value and then another, and
110                 then receives an event telling it that that control has changed to the first
111                 value.</para>
112
113                 <para>Since it can't tell whether that event was caused by another application
114                 or by the &VIDIOC-S-CTRL; call it is hard to decide whether to set the
115                 control to the value in the event, or ignore it.</para>
116
117                 <para>Think carefully when you set this flag so you won't get into situations
118                 like that.</para>
119             </entry>
120           </row>
121         </tbody>
122       </tgroup>
123     </table>
124
125   </refsect1>
126   <refsect1>
127     &return-value;
128   </refsect1>
129 </refentry>