1 <refentry id="vidioc-subscribe-event">
3 <refentrytitle>ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refentrytitle>
8 <refname>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</refname>
9 <refpurpose>Subscribe or unsubscribe 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 v4l2_event_subscription
19 *<parameter>argp</parameter></paramdef>
25 <title>Arguments</title>
29 <term><parameter>fd</parameter></term>
35 <term><parameter>request</parameter></term>
37 <para>VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT</para>
41 <term><parameter>argp</parameter></term>
50 <title>Description</title>
52 <para>Subscribe or unsubscribe V4L2 event. Subscribed events are
53 dequeued by using the &VIDIOC-DQEVENT; ioctl.</para>
55 <table frame="none" pgwide="1" id="v4l2-event-subscription">
56 <title>struct <structname>v4l2_event_subscription</structname></title>
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>
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>
76 <entry><structfield>flags</structfield></entry>
77 <entry>Event flags, see <xref linkend="event-flags" />.</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>
89 <table pgwide="1" frame="none" id="event-flags">
90 <title>Event Flags</title>
95 <entry><constant>V4L2_EVENT_SUB_FL_SEND_INITIAL</constant></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>
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
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>
117 <para>Think carefully when you set this flag so you won't get into situations