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