doc-rst: customize RTD theme, captions & inline literal
[deliverable/linux.git] / Documentation / linux_tv / media / v4l / vidioc-subscribe-event.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_SUBSCRIBE_EVENT:
5377d91f
MH
4
5******************************************************
6ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
7******************************************************
8
586027ce
MCC
9NAME
10====
5377d91f 11
586027ce 12VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event
5377d91f 13
586027ce 14SYNOPSIS
5377d91f
MH
15========
16
b7e67f6c 17.. cpp:function:: int ioctl( int fd, int request, struct v4l2_event_subscription *argp )
5377d91f 18
586027ce
MCC
19
20ARGUMENTS
5377d91f
MH
21=========
22
23``fd``
24 File descriptor returned by :ref:`open() <func-open>`.
25
26``request``
27 VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
28
29``argp``
30
31
586027ce 32DESCRIPTION
5377d91f
MH
33===========
34
35Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by
7347081e 36using the :ref:`VIDIOC_DQEVENT` ioctl.
5377d91f
MH
37
38
39.. _v4l2-event-subscription:
40
41.. flat-table:: struct v4l2_event_subscription
42 :header-rows: 0
43 :stub-columns: 0
44 :widths: 1 1 2
45
46
47 - .. row 1
48
49 - __u32
50
51 - ``type``
52
53 - Type of the event, see :ref:`event-type`. Note that
0579e6e3
MCC
54 ``V4L2_EVENT_ALL`` can be used with VIDIOC_UNSUBSCRIBE_EVENT for
55 unsubscribing all events at once.
5377d91f
MH
56
57 - .. row 2
58
59 - __u32
60
61 - ``id``
62
63 - ID of the event source. If there is no ID associated with the
0579e6e3
MCC
64 event source, then set this to 0. Whether or not an event needs an
65 ID depends on the event type.
5377d91f
MH
66
67 - .. row 3
68
69 - __u32
70
71 - ``flags``
72
73 - Event flags, see :ref:`event-flags`.
74
75 - .. row 4
76
77 - __u32
78
79 - ``reserved``\ [5]
80
81 - Reserved for future extensions. Drivers and applications must set
0579e6e3 82 the array to zero.
5377d91f
MH
83
84
85
86.. _event-flags:
87
88.. flat-table:: Event Flags
89 :header-rows: 0
90 :stub-columns: 0
91 :widths: 3 1 4
92
93
94 - .. row 1
95
96 - ``V4L2_EVENT_SUB_FL_SEND_INITIAL``
97
98 - 0x0001
99
100 - When this event is subscribed an initial event will be sent
0579e6e3
MCC
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.
5377d91f
MH
104
105 - .. row 2
106
107 - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK``
108
109 - 0x0002
110
111 - If set, then events directly caused by an ioctl will also be sent
0579e6e3
MCC
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.
119
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.
124
125 Think carefully when you set this flag so you won't get into
126 situations like that.
5377d91f
MH
127
128
586027ce 129RETURN VALUE
5377d91f
MH
130============
131
132On success 0 is returned, on error -1 and the ``errno`` variable is set
133appropriately. The generic error codes are described at the
134:ref:`Generic Error Codes <gen-errors>` chapter.
This page took 0.047085 seconds and 5 git commands to generate.