blob: 4394184a1a6db2fb0653dd3974d9a6adf835c13f [file] [log] [blame]
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -03001<refentry id="func-ioctl">
2 <refmeta>
3 <refentrytitle>V4L2 ioctl()</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>v4l2-ioctl</refname>
9 <refpurpose>Program a V4L2 device</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcsynopsisinfo>#include &lt;sys/ioctl.h&gt;</funcsynopsisinfo>
15 <funcprototype>
16 <funcdef>int <function>ioctl</function></funcdef>
17 <paramdef>int <parameter>fd</parameter></paramdef>
18 <paramdef>int <parameter>request</parameter></paramdef>
19 <paramdef>void *<parameter>argp</parameter></paramdef>
20 </funcprototype>
21 </funcsynopsis>
22 </refsynopsisdiv>
23
24 <refsect1>
25 <title>Arguments</title>
26
27 <variablelist>
28 <varlistentry>
29 <term><parameter>fd</parameter></term>
30 <listitem>
31 <para>&fd;</para>
32 </listitem>
33 </varlistentry>
34 <varlistentry>
35 <term><parameter>request</parameter></term>
36 <listitem>
Mauro Carvalho Chehab1fb03672010-12-27 08:24:58 -030037 <para>V4L2 ioctl request code as defined in the <filename>videodev2.h</filename> header file, for example
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030038VIDIOC_QUERYCAP.</para>
39 </listitem>
40 </varlistentry>
41 <varlistentry>
42 <term><parameter>argp</parameter></term>
43 <listitem>
44 <para>Pointer to a function parameter, usually a structure.</para>
45 </listitem>
46 </varlistentry>
47 </variablelist>
48 </refsect1>
49
50 <refsect1>
51 <title>Description</title>
52
53 <para>The <function>ioctl()</function> function is used to program
54V4L2 devices. The argument <parameter>fd</parameter> must be an open
55file descriptor. An ioctl <parameter>request</parameter> has encoded
56in it whether the argument is an input, output or read/write
57parameter, and the size of the argument <parameter>argp</parameter> in
58bytes. Macros and defines specifying V4L2 ioctl requests are located
Mauro Carvalho Chehab1fb03672010-12-27 08:24:58 -030059in the <filename>videodev2.h</filename> header file.
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030060Applications should use their own copy, not include the version in the
61kernel sources on the system they compile on. All V4L2 ioctl requests,
62their respective function and parameters are specified in <xref
63 linkend="user-func" />.</para>
64 </refsect1>
65
66 <refsect1>
Mauro Carvalho Chehab4c14e4a2011-07-05 11:57:05 -030067 &return-value;
68 <para>When an ioctl that takes an output or read/write parameter fails,
69 the parameter remains unmodified.</para>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -030070 </refsect1>
71</refentry>