1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_SUBSCRIBE_EVENT:
5 ******************************************************
6 ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
7 ******************************************************
9 *man VIDIOC_SUBSCRIBE_EVENT(2)*
11 VIDIOC_UNSUBSCRIBE_EVENT
12 Subscribe or unsubscribe event
18 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp )
24 File descriptor returned by :ref:`open() <func-open>`.
27 VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
35 Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by
36 using the :ref:`VIDIOC_DQEVENT` ioctl.
39 .. _v4l2-event-subscription:
41 .. flat-table:: struct v4l2_event_subscription
53 - Type of the event, see :ref:`event-type`. Note that
54 ``V4L2_EVENT_ALL`` can be used with VIDIOC_UNSUBSCRIBE_EVENT for
55 unsubscribing all events at once.
63 - ID of the event source. If there is no ID associated with the
64 event source, then set this to 0. Whether or not an event needs an
65 ID depends on the event type.
73 - Event flags, see :ref:`event-flags`.
81 - Reserved for future extensions. Drivers and applications must set
88 .. flat-table:: Event Flags
96 - ``V4L2_EVENT_SUB_FL_SEND_INITIAL``
100 - When this event is subscribed an initial event will be sent
101 containing the current status. This only makes sense for events
102 that are triggered by a status change such as ``V4L2_EVENT_CTRL``.
103 Other events will ignore this flag.
107 - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK``
111 - If set, then events directly caused by an ioctl will also be sent
112 to the filehandle that called that ioctl. For example, changing a
113 control using :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` will cause
114 a V4L2_EVENT_CTRL to be sent back to that same filehandle.
115 Normally such events are suppressed to prevent feedback loops
116 where an application changes a control to a one value and then
117 another, and then receives an event telling it that that control
118 has changed to the first value.
120 Since it can't tell whether that event was caused by another
121 application or by the :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>`
122 call it is hard to decide whether to set the control to the value
123 in the event, or ignore it.
125 Think carefully when you set this flag so you won't get into
126 situations like that.
133 On success 0 is returned, on error -1 and the ``errno`` variable is set
134 appropriately. The generic error codes are described at the
135 :ref:`Generic Error Codes <gen-errors>` chapter.
138 .. ------------------------------------------------------------------------------
139 .. This file was automatically converted from DocBook-XML with the dbxml
140 .. library (https://github.com/return42/sphkerneldoc). The origin XML comes
141 .. from the linux kernel, refer to:
143 .. * https://github.com/torvalds/linux/tree/master/Documentation/DocBook
144 .. ------------------------------------------------------------------------------