1 .. -*- coding: utf-8; mode: rst -*-
3 .. _VIDIOC_SUBSCRIBE_EVENT:
4 .. _VIDIOC_UNSUBSCRIBE_EVENT:
6 ******************************************************
7 ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
8 ******************************************************
13 VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event
19 .. cpp:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp )
26 File descriptor returned by :ref:`open() <func-open>`.
29 VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
37 Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by
38 using the :ref:`VIDIOC_DQEVENT` ioctl.
41 .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
43 .. _v4l2-event-subscription:
45 .. flat-table:: struct v4l2_event_subscription
57 - Type of the event, see :ref:`event-type`.
61 ``V4L2_EVENT_ALL`` can be used with
62 :ref:`VIDIOC_UNSUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` for
63 unsubscribing all events at once.
71 - ID of the event source. If there is no ID associated with the
72 event source, then set this to 0. Whether or not an event needs an
73 ID depends on the event type.
81 - Event flags, see :ref:`event-flags`.
89 - Reserved for future extensions. Drivers and applications must set
94 .. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
98 .. flat-table:: Event Flags
106 - ``V4L2_EVENT_SUB_FL_SEND_INITIAL``
110 - When this event is subscribed an initial event will be sent
111 containing the current status. This only makes sense for events
112 that are triggered by a status change such as ``V4L2_EVENT_CTRL``.
113 Other events will ignore this flag.
117 - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK``
121 - If set, then events directly caused by an ioctl will also be sent
122 to the filehandle that called that ioctl. For example, changing a
123 control using :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` will cause
124 a V4L2_EVENT_CTRL to be sent back to that same filehandle.
125 Normally such events are suppressed to prevent feedback loops
126 where an application changes a control to a one value and then
127 another, and then receives an event telling it that that control
128 has changed to the first value.
130 Since it can't tell whether that event was caused by another
131 application or by the :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>`
132 call it is hard to decide whether to set the control to the value
133 in the event, or ignore it.
135 Think carefully when you set this flag so you won't get into
136 situations like that.
142 On success 0 is returned, on error -1 and the ``errno`` variable is set
143 appropriately. The generic error codes are described at the
144 :ref:`Generic Error Codes <gen-errors>` chapter.