• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd">
2<HTML
3><HEAD
4><TITLE
5>ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL</TITLE
6><META
7NAME="GENERATOR"
8CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
9REL="HOME"
10TITLE="Video for Linux Two API Specification"
11HREF="book1.htm"><LINK
12REL="UP"
13TITLE="Function Reference"
14HREF="r7624.htm"><LINK
15REL="PREVIOUS"
16TITLE="ioctl VIDIOC_G_CROP, VIDIOC_S_CROP"
17HREF="r9994.htm"><LINK
18REL="NEXT"
19TITLE="ioctl VIDIOC_G_ENC_INDEX"
20HREF="r10211.htm"></HEAD
21><BODY
22CLASS="REFENTRY"
23BGCOLOR="#FFFFFF"
24TEXT="#000000"
25LINK="#0000FF"
26VLINK="#840084"
27ALINK="#0000FF"
28><DIV
29CLASS="NAVHEADER"
30><TABLE
31SUMMARY="Header navigation table"
32WIDTH="100%"
33BORDER="0"
34CELLPADDING="0"
35CELLSPACING="0"
36><TR
37><TH
38COLSPAN="3"
39ALIGN="center"
40>Video for Linux Two API Specification: Revision 0.24</TH
41></TR
42><TR
43><TD
44WIDTH="10%"
45ALIGN="left"
46VALIGN="bottom"
47><A
48HREF="r9994.htm"
49ACCESSKEY="P"
50>Prev</A
51></TD
52><TD
53WIDTH="80%"
54ALIGN="center"
55VALIGN="bottom"
56></TD
57><TD
58WIDTH="10%"
59ALIGN="right"
60VALIGN="bottom"
61><A
62HREF="r10211.htm"
63ACCESSKEY="N"
64>Next</A
65></TD
66></TR
67></TABLE
68><HR
69ALIGN="LEFT"
70WIDTH="100%"></DIV
71><H1
72><A
73NAME="VIDIOC-G-CTRL"
74></A
75>ioctl VIDIOC_G_CTRL, VIDIOC_S_CTRL</H1
76><DIV
77CLASS="REFNAMEDIV"
78><A
79NAME="AEN10108"
80></A
81><H2
82>Name</H2
83>VIDIOC_G_CTRL, VIDIOC_S_CTRL&nbsp;--&nbsp;Get or set the value of a control</DIV
84><DIV
85CLASS="REFSYNOPSISDIV"
86><A
87NAME="AEN10112"
88></A
89><H2
90>Synopsis</H2
91><DIV
92CLASS="FUNCSYNOPSIS"
93><P
94></P
95><A
96NAME="AEN10113"
97></A
98><P
99><CODE
100><CODE
101CLASS="FUNCDEF"
102>int ioctl</CODE
103>(int fd, int request, struct v4l2_control
104*argp);</CODE
105></P
106><P
107></P
108></DIV
109></DIV
110><DIV
111CLASS="REFSECT1"
112><A
113NAME="AEN10123"
114></A
115><H2
116>Arguments</H2
117><P
118></P
119><DIV
120CLASS="VARIABLELIST"
121><DL
122><DT
123><CODE
124CLASS="PARAMETER"
125>fd</CODE
126></DT
127><DD
128><P
129>File descriptor returned by <A
130HREF="r14090.htm"
131><CODE
132CLASS="FUNCTION"
133>open()</CODE
134></A
135>.</P
136></DD
137><DT
138><CODE
139CLASS="PARAMETER"
140>request</CODE
141></DT
142><DD
143><P
144>VIDIOC_G_CTRL, VIDIOC_S_CTRL</P
145></DD
146><DT
147><CODE
148CLASS="PARAMETER"
149>argp</CODE
150></DT
151><DD
152><P
153></P
154></DD
155></DL
156></DIV
157></DIV
158><DIV
159CLASS="REFSECT1"
160><A
161NAME="AEN10143"
162></A
163><H2
164>Description</H2
165><P
166>To get the current value of a control applications
167initialize the <CODE
168CLASS="STRUCTFIELD"
169>id</CODE
170> field of a struct
171<CODE
172CLASS="STRUCTNAME"
173>v4l2_control</CODE
174> and call the
175<CODE
176CLASS="CONSTANT"
177>VIDIOC_G_CTRL</CODE
178> ioctl with a pointer to this
179structure. To change the value of a control applications initialize
180the <CODE
181CLASS="STRUCTFIELD"
182>id</CODE
183> and <CODE
184CLASS="STRUCTFIELD"
185>value</CODE
186>
187fields of a struct <CODE
188CLASS="STRUCTNAME"
189>v4l2_control</CODE
190> and call the
191<CODE
192CLASS="CONSTANT"
193>VIDIOC_S_CTRL</CODE
194> ioctl.</P
195><P
196>When the <CODE
197CLASS="STRUCTFIELD"
198>id</CODE
199> is invalid drivers
200return an <SPAN
201CLASS="ERRORCODE"
202>EINVAL</SPAN
203> error code. When the <CODE
204CLASS="STRUCTFIELD"
205>value</CODE
206> is out
207of bounds drivers can choose to take the closest valid value or return
208an <SPAN
209CLASS="ERRORCODE"
210>ERANGE</SPAN
211> error code, whatever seems more appropriate. However,
212<CODE
213CLASS="CONSTANT"
214>VIDIOC_S_CTRL</CODE
215> is a write-only ioctl, it does not
216return the actual new value.</P
217><P
218>These ioctls work only with user controls. For other
219control classes the <A
220HREF="r10386.htm"
221><CODE
222CLASS="CONSTANT"
223>VIDIOC_G_EXT_CTRLS</CODE
224></A
225>, <A
226HREF="r10386.htm"
227><CODE
228CLASS="CONSTANT"
229>VIDIOC_S_EXT_CTRLS</CODE
230></A
231> or
232<A
233HREF="r10386.htm"
234><CODE
235CLASS="CONSTANT"
236>VIDIOC_TRY_EXT_CTRLS</CODE
237></A
238> must be used.</P
239><DIV
240CLASS="TABLE"
241><A
242NAME="V4L2-CONTROL"
243></A
244><P
245><B
246>Table 1. struct <CODE
247CLASS="STRUCTNAME"
248>v4l2_control</CODE
249></B
250></P
251><TABLE
252BORDER="0"
253FRAME="void"
254WIDTH="100%"
255CLASS="CALSTABLE"
256><COL
257WIDTH="25%"
258TITLE="C1"><COL
259WIDTH="25%"
260TITLE="C2"><COL
261WIDTH="50%"
262TITLE="C3"><TBODY
263VALIGN="TOP"
264><TR
265><TD
266>__u32</TD
267><TD
268><CODE
269CLASS="STRUCTFIELD"
270>id</CODE
271></TD
272><TD
273>Identifies the control, set by the
274application.</TD
275></TR
276><TR
277><TD
278>__s32</TD
279><TD
280><CODE
281CLASS="STRUCTFIELD"
282>value</CODE
283></TD
284><TD
285>New value or current value.</TD
286></TR
287></TBODY
288></TABLE
289></DIV
290></DIV
291><DIV
292CLASS="REFSECT1"
293><A
294NAME="AEN10185"
295></A
296><H2
297>Return Value</H2
298><P
299>On success <SPAN
300CLASS="RETURNVALUE"
301>0</SPAN
302> is returned, on error <SPAN
303CLASS="RETURNVALUE"
304>-1</SPAN
305> and the <CODE
306CLASS="VARNAME"
307>errno</CODE
308> variable is set appropriately:</P
309><P
310></P
311><DIV
312CLASS="VARIABLELIST"
313><DL
314><DT
315><SPAN
316CLASS="ERRORCODE"
317>EINVAL</SPAN
318></DT
319><DD
320><P
321>The struct&nbsp;<A
322HREF="r10104.htm#V4L2-CONTROL"
323>v4l2_control</A
324> <CODE
325CLASS="STRUCTFIELD"
326>id</CODE
327> is
328invalid.</P
329></DD
330><DT
331><SPAN
332CLASS="ERRORCODE"
333>ERANGE</SPAN
334></DT
335><DD
336><P
337>The struct&nbsp;<A
338HREF="r10104.htm#V4L2-CONTROL"
339>v4l2_control</A
340> <CODE
341CLASS="STRUCTFIELD"
342>value</CODE
343>
344is out of bounds.</P
345></DD
346><DT
347><SPAN
348CLASS="ERRORCODE"
349>EBUSY</SPAN
350></DT
351><DD
352><P
353>The control is temporarily not changeable, possibly
354because another applications took over control of the device function
355this control belongs to.</P
356></DD
357></DL
358></DIV
359></DIV
360><DIV
361CLASS="NAVFOOTER"
362><HR
363ALIGN="LEFT"
364WIDTH="100%"><TABLE
365SUMMARY="Footer navigation table"
366WIDTH="100%"
367BORDER="0"
368CELLPADDING="0"
369CELLSPACING="0"
370><TR
371><TD
372WIDTH="33%"
373ALIGN="left"
374VALIGN="top"
375><A
376HREF="r9994.htm"
377ACCESSKEY="P"
378>Prev</A
379></TD
380><TD
381WIDTH="34%"
382ALIGN="center"
383VALIGN="top"
384><A
385HREF="book1.htm"
386ACCESSKEY="H"
387>Home</A
388></TD
389><TD
390WIDTH="33%"
391ALIGN="right"
392VALIGN="top"
393><A
394HREF="r10211.htm"
395ACCESSKEY="N"
396>Next</A
397></TD
398></TR
399><TR
400><TD
401WIDTH="33%"
402ALIGN="left"
403VALIGN="top"
404>ioctl VIDIOC_G_CROP, VIDIOC_S_CROP</TD
405><TD
406WIDTH="34%"
407ALIGN="center"
408VALIGN="top"
409><A
410HREF="r7624.htm"
411ACCESSKEY="U"
412>Up</A
413></TD
414><TD
415WIDTH="33%"
416ALIGN="right"
417VALIGN="top"
418>ioctl VIDIOC_G_ENC_INDEX</TD
419></TR
420></TABLE
421></DIV
422></BODY
423></HTML
424>
425