1059b1c5bSMauro Carvalho Chehab.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 2407e84cdSMauro Carvalho Chehab.. c:namespace:: V4L 354f38fcaSMauro Carvalho Chehab 454f38fcaSMauro Carvalho Chehab.. _VIDIOC_SUBSCRIBE_EVENT: 554f38fcaSMauro Carvalho Chehab.. _VIDIOC_UNSUBSCRIBE_EVENT: 654f38fcaSMauro Carvalho Chehab 754f38fcaSMauro Carvalho Chehab****************************************************** 854f38fcaSMauro Carvalho Chehabioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT 954f38fcaSMauro Carvalho Chehab****************************************************** 1054f38fcaSMauro Carvalho Chehab 1154f38fcaSMauro Carvalho ChehabName 1254f38fcaSMauro Carvalho Chehab==== 1354f38fcaSMauro Carvalho Chehab 1454f38fcaSMauro Carvalho ChehabVIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event 1554f38fcaSMauro Carvalho Chehab 1654f38fcaSMauro Carvalho ChehabSynopsis 1754f38fcaSMauro Carvalho Chehab======== 1854f38fcaSMauro Carvalho Chehab 19407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_SUBSCRIBE_EVENT 2054f38fcaSMauro Carvalho Chehab 21407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_SUBSCRIBE_EVENT, struct v4l2_event_subscription *argp)`` 2254f38fcaSMauro Carvalho Chehab 23407e84cdSMauro Carvalho Chehab.. c:macro:: VIDIOC_UNSUBSCRIBE_EVENT 24407e84cdSMauro Carvalho Chehab 25407e84cdSMauro Carvalho Chehab``int ioctl(int fd, VIDIOC_UNSUBSCRIBE_EVENT, struct v4l2_event_subscription *argp)`` 2654f38fcaSMauro Carvalho Chehab 2754f38fcaSMauro Carvalho ChehabArguments 2854f38fcaSMauro Carvalho Chehab========= 2954f38fcaSMauro Carvalho Chehab 3054f38fcaSMauro Carvalho Chehab``fd`` 31407e84cdSMauro Carvalho Chehab File descriptor returned by :c:func:`open()`. 3254f38fcaSMauro Carvalho Chehab 3354f38fcaSMauro Carvalho Chehab``argp`` 3454f38fcaSMauro Carvalho Chehab Pointer to struct :c:type:`v4l2_event_subscription`. 3554f38fcaSMauro Carvalho Chehab 3654f38fcaSMauro Carvalho ChehabDescription 3754f38fcaSMauro Carvalho Chehab=========== 3854f38fcaSMauro Carvalho Chehab 3954f38fcaSMauro Carvalho ChehabSubscribe or unsubscribe V4L2 event. Subscribed events are dequeued by 4054f38fcaSMauro Carvalho Chehabusing the :ref:`VIDIOC_DQEVENT` ioctl. 4154f38fcaSMauro Carvalho Chehab 42*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{2.6cm}|p{4.4cm}|p{10.3cm}| 4354f38fcaSMauro Carvalho Chehab 4454f38fcaSMauro Carvalho Chehab.. c:type:: v4l2_event_subscription 4554f38fcaSMauro Carvalho Chehab 4654f38fcaSMauro Carvalho Chehab.. flat-table:: struct v4l2_event_subscription 4754f38fcaSMauro Carvalho Chehab :header-rows: 0 4854f38fcaSMauro Carvalho Chehab :stub-columns: 0 4954f38fcaSMauro Carvalho Chehab :widths: 1 1 2 5054f38fcaSMauro Carvalho Chehab 5154f38fcaSMauro Carvalho Chehab * - __u32 5254f38fcaSMauro Carvalho Chehab - ``type`` 5354f38fcaSMauro Carvalho Chehab - Type of the event, see :ref:`event-type`. 5454f38fcaSMauro Carvalho Chehab 5554f38fcaSMauro Carvalho Chehab .. note:: 5654f38fcaSMauro Carvalho Chehab 5754f38fcaSMauro Carvalho Chehab ``V4L2_EVENT_ALL`` can be used with 5854f38fcaSMauro Carvalho Chehab :ref:`VIDIOC_UNSUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` for 5954f38fcaSMauro Carvalho Chehab unsubscribing all events at once. 6054f38fcaSMauro Carvalho Chehab * - __u32 6154f38fcaSMauro Carvalho Chehab - ``id`` 6254f38fcaSMauro Carvalho Chehab - ID of the event source. If there is no ID associated with the 6354f38fcaSMauro Carvalho Chehab event source, then set this to 0. Whether or not an event needs an 6454f38fcaSMauro Carvalho Chehab ID depends on the event type. 6554f38fcaSMauro Carvalho Chehab * - __u32 6654f38fcaSMauro Carvalho Chehab - ``flags`` 6754f38fcaSMauro Carvalho Chehab - Event flags, see :ref:`event-flags`. 6854f38fcaSMauro Carvalho Chehab * - __u32 6954f38fcaSMauro Carvalho Chehab - ``reserved``\ [5] 7054f38fcaSMauro Carvalho Chehab - Reserved for future extensions. Drivers and applications must set 7154f38fcaSMauro Carvalho Chehab the array to zero. 7254f38fcaSMauro Carvalho Chehab 7354f38fcaSMauro Carvalho Chehab 74*fea13a69SMauro Carvalho Chehab.. tabularcolumns:: |p{7.5cm}|p{2.0cm}|p{7.8cm}| 7554f38fcaSMauro Carvalho Chehab 7654f38fcaSMauro Carvalho Chehab.. _event-flags: 7754f38fcaSMauro Carvalho Chehab 7854f38fcaSMauro Carvalho Chehab.. flat-table:: Event Flags 7954f38fcaSMauro Carvalho Chehab :header-rows: 0 8054f38fcaSMauro Carvalho Chehab :stub-columns: 0 8154f38fcaSMauro Carvalho Chehab :widths: 3 1 4 8254f38fcaSMauro Carvalho Chehab 8354f38fcaSMauro Carvalho Chehab * - ``V4L2_EVENT_SUB_FL_SEND_INITIAL`` 8454f38fcaSMauro Carvalho Chehab - 0x0001 8554f38fcaSMauro Carvalho Chehab - When this event is subscribed an initial event will be sent 8654f38fcaSMauro Carvalho Chehab containing the current status. This only makes sense for events 8754f38fcaSMauro Carvalho Chehab that are triggered by a status change such as ``V4L2_EVENT_CTRL``. 8854f38fcaSMauro Carvalho Chehab Other events will ignore this flag. 8954f38fcaSMauro Carvalho Chehab * - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK`` 9054f38fcaSMauro Carvalho Chehab - 0x0002 9154f38fcaSMauro Carvalho Chehab - If set, then events directly caused by an ioctl will also be sent 9254f38fcaSMauro Carvalho Chehab to the filehandle that called that ioctl. For example, changing a 9354f38fcaSMauro Carvalho Chehab control using :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` will cause 9454f38fcaSMauro Carvalho Chehab a V4L2_EVENT_CTRL to be sent back to that same filehandle. 9554f38fcaSMauro Carvalho Chehab Normally such events are suppressed to prevent feedback loops 9654f38fcaSMauro Carvalho Chehab where an application changes a control to a one value and then 9754f38fcaSMauro Carvalho Chehab another, and then receives an event telling it that that control 9854f38fcaSMauro Carvalho Chehab has changed to the first value. 9954f38fcaSMauro Carvalho Chehab 10054f38fcaSMauro Carvalho Chehab Since it can't tell whether that event was caused by another 10154f38fcaSMauro Carvalho Chehab application or by the :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` 10254f38fcaSMauro Carvalho Chehab call it is hard to decide whether to set the control to the value 10354f38fcaSMauro Carvalho Chehab in the event, or ignore it. 10454f38fcaSMauro Carvalho Chehab 10554f38fcaSMauro Carvalho Chehab Think carefully when you set this flag so you won't get into 10654f38fcaSMauro Carvalho Chehab situations like that. 10754f38fcaSMauro Carvalho Chehab 10854f38fcaSMauro Carvalho ChehabReturn Value 10954f38fcaSMauro Carvalho Chehab============ 11054f38fcaSMauro Carvalho Chehab 11154f38fcaSMauro Carvalho ChehabOn success 0 is returned, on error -1 and the ``errno`` variable is set 11254f38fcaSMauro Carvalho Chehabappropriately. The generic error codes are described at the 11354f38fcaSMauro Carvalho Chehab:ref:`Generic Error Codes <gen-errors>` chapter. 114