-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdynctrl.txt
More file actions
189 lines (140 loc) · 5.81 KB
/
dynctrl.txt
File metadata and controls
189 lines (140 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
Dynamic controls API
--------------------
This file documents the dynamic controls API and its associated ioctls. Please
keep in mind that this is a work in progress. The API can change at any time,
and the documentation is probably unaccurate. Questions and remarks can be
sent to the Linux UVC development mailing list at linux-uvc-devel@lists.berlios.de.
1. Introduction
The UVC specification allows for vendor-specific extensions through extension
units. With more and more products being UVC compliant, the number of controls
defined through extension units is expected to grow rapidly.
The Linux UVC driver supports extension unit controls (XU controls) through a
hardcode control list. This implementation requires vendors to submit a list
of their controls to the Linux UVC project, and wastes kernel memory to store
control information that are useful for a small number of cameras only. The
dynamic controls API aims at solving those issues.
The basic idea is to provide a userspace API through which applications can
add control definitions at runtime.
2. Security
The API doesn't currently provide any access control facility. Any application
allowed to access a UVC device will be able to add control definitions with no
limit. Suggestions are welcome.
3. IOCTLs
---- UVCIOC_CTRL_ADD - Define a vendor UVC control ----
Argument: struct uvc_xu_control_info
Description:
This ioctl allows userspace applications to add an Extension Unit UVC
control definition to the driver.
Return value:
On success 0 is returned. On error -1 is returned and errno is set
appropriately.
ENOMEM
Not enough memory to perform the operation.
EEXIST
Control is already defined.
Data types:
* struct uvc_xu_control_info
__u8 entity[16] Extension unit GUID
__u8 index Control index in the unit's bmControl bit field
__u8 selector Control selector
__u16 size Control size (in bytes)
__u32 flags See below
* struct uvc_xu_control_info flags field
UVC_CONTROL_SET_CUR Control is writable.
UVC_CONTROL_GET_CUR Control is readable.
UVC_CONTROL_GET_MIN Control supports GET MIN queries.
UVC_CONTROL_GET_MAX Control supports GET MAX queries.
UVC_CONTROL_GET_RES Control supports GET RES queries.
UVC_CONTROL_GET_DEF Control supports GET DEF queries.
UVC_CONTROL_RESTORE Control should be restored when resuming from
sleep.
---- UVCIOC_CTRL_MAP - Map a UVC control to a V4L2 control ----
Argument: struct uvc_xu_control_mapping
Description:
This ioctl creates a mapping between a UVC control or part of a UVC
control and a V4L2 control. Once mappings are defined, userspace
applications can access vendor-defined UVC control through the V4L2
control API.
To create a mapping, applications fill the uvc_xu_control_mapping
structure with information about an existing UVC control defined with
UVCIOC_CTRL_ADD and a new V4L2 control.
A UVC control can be mapped to several V4L2 controls. For instance,
a UVC pan/tilt control could be mapped to separate pan and tilt V4L2
controls. The UVC control is divided into non overlapping fields using
the 'size' and 'offset' fields and are then independantly mapped to
V4L2 control.
For signed integer V4L2 controls the data_type field should be set to
UVC_CTRL_DATA_TYPE_SIGNED. Other values are currently ignored.
Return value:
On success 0 is returned. On error -1 is returned and errno is set
appropriately.
ENOMEM
Not enough memory to perform the operation.
EINVAL
No such UVC control.
EOVERFLOW
The requested offset and size would overflow the UVC control.
EEXIST
Mapping already exists.
Data types:
* struct uvc_xu_control_mapping
__u32 id V4L2 control identifier
__u8 name[32] V4L2 control name
__u8 entity[16] UVC extension unit GUID
__u8 selector UVC control selector
__u8 size V4L2 control size (in bits)
__u8 offset V4L2 control offset (in bits)
enum v4l2_ctrl_type
v4l2_type V4L2 control type
enum uvc_control_data_type
data_type UVC control data type
* enum uvc_control_data_type
UVC_CTRL_DATA_TYPE_RAW Raw control (byte array)
UVC_CTRL_DATA_TYPE_SIGNED Signed integer
UVC_CTRL_DATA_TYPE_UNSIGNED Unsigned integer
UVC_CTRL_DATA_TYPE_BOOLEAN Boolean
UVC_CTRL_DATA_TYPE_ENUM Enumeration
UVC_CTRL_DATA_TYPE_BITMASK Bitmask
---- UVCIOC_CTRL_GET - Get the value of a UVC control ----
Argument: struct uvc_xu_control
Description:
This ioctl retrieves the current value of the UVC control identified
by its extension unit ID and control selector. Applications must set
the control size and provide a pointer to a writable buffer big enough
to fit the data.
Data are taken directly from the device without any driver-side
processing. Applications are responsible for data buffer formatting,
including little-endian/big-endian conversion.
Return value:
On success 0 is returned. On error -1 is returned and errno is set
appropriately.
EINVAL
No such UVC control, or control isn't readable.
EFAULT
data references an inaccessible memory area.
Data types:
* struct uvc_xu_control
__u8 unit Extension unit ID
__u8 selector Control selector
__u16 size Control data size (in bytes)
__u8 *data Control value
---- UVCIOC_CTRL_SET - Set the value of a UVC control ----
Argument: struct uvc_xu_control
Description:
This ioctl sets the value of the UVC control identified by its
extension unit ID and control selector. Applications must set the
control size and provide a pointer to a readable buffer containing the
data.
Data are passed directly to the device without any driver-side
processing. Applications are responsible for data buffer formatting,
including little-endian/big-endian conversion.
Return value:
On success 0 is returned. On error -1 is returned and errno is set
appropriately.
EINVAL
No such UVC control, or control isn't writable.
EFAULT
data references an inaccessible memory area.
Data types:
* struct uvc_xu_control
See UVCIOC_CTRL_GET