1 <refentry id="vidioc-subscribe-event">
3 <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle>
8 <refname>VIDIOC_SUBSCRIBE_EVENT</refname>
9 <refname>VIDIOC_UNSUBSCRIBE_EVENT</refname>
10 <refpurpose>Subscribe or unsubscribe event</refpurpose>
16 <funcdef>int <function>ioctl</function></funcdef>
17 <paramdef>int <parameter>fd</parameter></paramdef>
18 <paramdef>int <parameter>request</parameter></paramdef>
19 <paramdef>struct v4l2_event_subscription
20 *<parameter>argp</parameter></paramdef>
26 <title>Arguments</title>
30 <term><parameter>fd</parameter></term>
36 <term><parameter>request</parameter></term>
38 <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para>
42 <term><parameter>argp</parameter></term>
51 <title>Description</title>
53 <para>Subscribe or unsubscribe V4L2 event. Subscribed events are
54 dequeued by using the &VIDIOC-DQEVENT; ioctl.</para>
56 <table frame="none" pgwide="1" id="v4l2-event-subscription">
57 <title>struct <structname>v4l2_event_subscription</structname></title>
63 <entry><structfield>type</structfield></entry>
64 <entry>Type of the event, see <xref linkend="event-type" />. Note that
65 <constant>V4L2_EVENT_ALL</constant> can be used with VIDIOC_UNSUBSCRIBE_EVENT
66 for unsubscribing all events at once.</entry>
70 <entry><structfield>id</structfield></entry>
71 <entry>ID of the event source. If there is no ID associated with
72 the event source, then set this to 0. Whether or not an event
73 needs an ID depends on the event type.</entry>
77 <entry><structfield>flags</structfield></entry>
78 <entry>Event flags, see <xref linkend="event-flags" />.</entry>
82 <entry><structfield>reserved</structfield>[5]</entry>
83 <entry>Reserved for future extensions. Drivers and applications
84 must set the array to zero.</entry>
90 <table pgwide="1" frame="none" id="event-flags">
91 <title>Event Flags</title>
96 <entry><constant>V4L2_EVENT_SUB_FL_SEND_INITIAL</constant></entry>
98 <entry>When this event is subscribed an initial event will be sent
99 containing the current status. This only makes sense for events
100 that are triggered by a status change such as <constant>V4L2_EVENT_CTRL</constant>.
101 Other events will ignore this flag.</entry>
104 <entry><constant>V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK</constant></entry>
105 <entry>0x0002</entry>
106 <entry><para>If set, then events directly caused by an ioctl will also be sent to
107 the filehandle that called that ioctl. For example, changing a control using
108 &VIDIOC-S-CTRL; will cause a V4L2_EVENT_CTRL to be sent back to that same
109 filehandle. Normally such events are suppressed to prevent feedback loops
110 where an application changes a control to a one value and then another, and
111 then receives an event telling it that that control has changed to the first
114 <para>Since it can't tell whether that event was caused by another application
115 or by the &VIDIOC-S-CTRL; call it is hard to decide whether to set the
116 control to the value in the event, or ignore it.</para>
118 <para>Think carefully when you set this flag so you won't get into situations