Merge remote-tracking branch 'battery/for-next'
[deliverable/linux.git] / Documentation / media / uapi / v4l / vidioc-subscribe-event.rst
CommitLineData
5377d91f
MH
1.. -*- coding: utf-8; mode: rst -*-
2
af4a4d0d 3.. _VIDIOC_SUBSCRIBE_EVENT:
6710ea47 4.. _VIDIOC_UNSUBSCRIBE_EVENT:
5377d91f
MH
5
6******************************************************
7ioctl VIDIOC_SUBSCRIBE_EVENT, VIDIOC_UNSUBSCRIBE_EVENT
8******************************************************
9
15e7d615 10Name
586027ce 11====
5377d91f 12
586027ce 13VIDIOC_SUBSCRIBE_EVENT - VIDIOC_UNSUBSCRIBE_EVENT - Subscribe or unsubscribe event
5377d91f 14
15e7d615
MCC
15
16Synopsis
5377d91f
MH
17========
18
41d80465
MCC
19.. c:function:: int ioctl( int fd, VIDIOC_SUBSCRIBE_EVENT, struct v4l2_event_subscription *argp )
20 :name: VIDIOC_SUBSCRIBE_EVENT
21
22.. c:function:: int ioctl( int fd, VIDIOC_UNSUBSCRIBE_EVENT, struct v4l2_event_subscription *argp )
23 :name: VIDIOC_UNSUBSCRIBE_EVENT
5377d91f 24
586027ce 25
15e7d615 26Arguments
5377d91f
MH
27=========
28
29``fd``
30 File descriptor returned by :ref:`open() <func-open>`.
31
5377d91f
MH
32``argp``
33
34
15e7d615 35Description
5377d91f
MH
36===========
37
38Subscribe or unsubscribe V4L2 event. Subscribed events are dequeued by
7347081e 39using the :ref:`VIDIOC_DQEVENT` ioctl.
5377d91f
MH
40
41
5bd4bb78
MCC
42.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
43
e8be7e97 44.. c:type:: v4l2_event_subscription
fa92b04d 45
5377d91f
MH
46.. flat-table:: struct v4l2_event_subscription
47 :header-rows: 0
48 :stub-columns: 0
49 :widths: 1 1 2
50
51
52 - .. row 1
53
54 - __u32
55
56 - ``type``
57
706f8a99
MCC
58 - Type of the event, see :ref:`event-type`.
59
b6b6e678
MCC
60 .. note::
61
62 ``V4L2_EVENT_ALL`` can be used with
6710ea47
MCC
63 :ref:`VIDIOC_UNSUBSCRIBE_EVENT <VIDIOC_SUBSCRIBE_EVENT>` for
64 unsubscribing all events at once.
5377d91f
MH
65
66 - .. row 2
67
68 - __u32
69
70 - ``id``
71
72 - ID of the event source. If there is no ID associated with the
0579e6e3
MCC
73 event source, then set this to 0. Whether or not an event needs an
74 ID depends on the event type.
5377d91f
MH
75
76 - .. row 3
77
78 - __u32
79
80 - ``flags``
81
82 - Event flags, see :ref:`event-flags`.
83
84 - .. row 4
85
86 - __u32
87
8968da9b 88 - ``reserved``\ [5]
5377d91f
MH
89
90 - Reserved for future extensions. Drivers and applications must set
0579e6e3 91 the array to zero.
5377d91f
MH
92
93
94
5bd4bb78
MCC
95.. tabularcolumns:: |p{6.6cm}|p{2.2cm}|p{8.7cm}|
96
fa92b04d
MCC
97.. _event-flags:
98
5377d91f
MH
99.. flat-table:: Event Flags
100 :header-rows: 0
101 :stub-columns: 0
102 :widths: 3 1 4
103
104
105 - .. row 1
106
107 - ``V4L2_EVENT_SUB_FL_SEND_INITIAL``
108
109 - 0x0001
110
111 - When this event is subscribed an initial event will be sent
0579e6e3
MCC
112 containing the current status. This only makes sense for events
113 that are triggered by a status change such as ``V4L2_EVENT_CTRL``.
114 Other events will ignore this flag.
5377d91f
MH
115
116 - .. row 2
117
118 - ``V4L2_EVENT_SUB_FL_ALLOW_FEEDBACK``
119
120 - 0x0002
121
122 - If set, then events directly caused by an ioctl will also be sent
0579e6e3
MCC
123 to the filehandle that called that ioctl. For example, changing a
124 control using :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>` will cause
125 a V4L2_EVENT_CTRL to be sent back to that same filehandle.
126 Normally such events are suppressed to prevent feedback loops
127 where an application changes a control to a one value and then
128 another, and then receives an event telling it that that control
129 has changed to the first value.
130
131 Since it can't tell whether that event was caused by another
132 application or by the :ref:`VIDIOC_S_CTRL <VIDIOC_G_CTRL>`
133 call it is hard to decide whether to set the control to the value
134 in the event, or ignore it.
135
136 Think carefully when you set this flag so you won't get into
137 situations like that.
5377d91f
MH
138
139
15e7d615 140Return Value
5377d91f
MH
141============
142
143On success 0 is returned, on error -1 and the ``errno`` variable is set
144appropriately. The generic error codes are described at the
145:ref:`Generic Error Codes <gen-errors>` chapter.
This page took 0.064152 seconds and 5 git commands to generate.