1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
4 .. _VIDIOC_SUBSCRIBE_EVENT:
5 .. _VIDIOC_UNSUBSCRIBE_EVENT:
7 ******************************************************
8 ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
9 ******************************************************
14 VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event
19 .. c:macro:: VIDIOC_SUBSCRIBE_EVENT
21 ``int ioctl(int fd, VIDIOC_SUBSCRIBE_EVENT, struct v4l2_event_subscription *argp)``
23 .. c:macro:: VIDIOC_UNSUBSCRIBE_EVENT
25 ``int ioctl(int fd, VIDIOC_UNSUBSCRIBE_EVENT, struct v4l2_event_subscription *argp)``
31 File descriptor returned by :c:func:`open()`.
34 Pointer to struct :c:type:`v4l2_event_subscription`.
39 Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by
40 using the :ref:`VIDIOC_DQEVENT` ioctl.
42 .. tabularcolumns:: |p{4.6cm}|p{4.4cm}|p{8.7cm}|
44 .. c:type:: v4l2_event_subscription
46 .. flat-table:: struct v4l2_event_subscription
53 - Type of the event, see :ref:`event-type`.
57 ``V4L2_EVENT_ALL`` can be used with
58 :ref:`VIDIOC_UNSUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` for
59 unsubscribing all events at once.
62 - ID of the event source. If there is no ID associated with the
63 event source, then set this to 0. Whether or not an event needs an
64 ID depends on the event type.
67 - Event flags, see :ref:`event-flags`.
70 - Reserved for future extensions. Drivers and applications must set
74 .. tabularcolumns:: |p{6.8cm}|p{2.2cm}|p{8.5cm}|
78 .. flat-table:: Event Flags
83 * - ``V4L2_EVENT_SUB_FL_SEND_INITIAL``
85 - When this event is subscribed an initial event will be sent
86 containing the current status. This only makes sense for events
87 that are triggered by a status change such as ``V4L2_EVENT_CTRL``.
88 Other events will ignore this flag.
89 * - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK``
91 - If set, then events directly caused by an ioctl will also be sent
92 to the filehandle that called that ioctl. For example, changing a
93 control using :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` will cause
94 a V4L2_EVENT_CTRL to be sent back to that same filehandle.
95 Normally such events are suppressed to prevent feedback loops
96 where an application changes a control to a one value and then
97 another, and then receives an event telling it that that control
98 has changed to the first value.
100 Since it can't tell whether that event was caused by another
101 application or by the :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>`
102 call it is hard to decide whether to set the control to the value
103 in the event, or ignore it.
105 Think carefully when you set this flag so you won't get into
106 situations like that.
111 On success 0 is returned, on error -1 and the ``errno`` variable is set
112 appropriately. The generic error codes are described at the
113 :ref:`Generic Error Codes <gen-errors>` chapter.