blob: d499da93a4506917619e57847ca9bdf82330198d [file] [log] [blame]
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -03001<refentry id="vidioc-querycap">
2 <refmeta>
3 <refentrytitle>ioctl VIDIOC_QUERYCAP</refentrytitle>
4 &manvol;
5 </refmeta>
6
7 <refnamediv>
8 <refname>VIDIOC_QUERYCAP</refname>
9 <refpurpose>Query device capabilities</refpurpose>
10 </refnamediv>
11
12 <refsynopsisdiv>
13 <funcsynopsis>
14 <funcprototype>
15 <funcdef>int <function>ioctl</function></funcdef>
16 <paramdef>int <parameter>fd</parameter></paramdef>
17 <paramdef>int <parameter>request</parameter></paramdef>
18 <paramdef>struct v4l2_capability *<parameter>argp</parameter></paramdef>
19 </funcprototype>
20 </funcsynopsis>
21 </refsynopsisdiv>
22
23 <refsect1>
24 <title>Arguments</title>
25
26 <variablelist>
27 <varlistentry>
28 <term><parameter>fd</parameter></term>
29 <listitem>
30 <para>&fd;</para>
31 </listitem>
32 </varlistentry>
33 <varlistentry>
34 <term><parameter>request</parameter></term>
35 <listitem>
36 <para>VIDIOC_QUERYCAP</para>
37 </listitem>
38 </varlistentry>
39 <varlistentry>
40 <term><parameter>argp</parameter></term>
41 <listitem>
42 <para></para>
43 </listitem>
44 </varlistentry>
45 </variablelist>
46 </refsect1>
47
48 <refsect1>
49 <title>Description</title>
50
51 <para>All V4L2 devices support the
52<constant>VIDIOC_QUERYCAP</constant> ioctl. It is used to identify
53kernel devices compatible with this specification and to obtain
54information about driver and hardware capabilities. The ioctl takes a
55pointer to a &v4l2-capability; which is filled by the driver. When the
56driver is not compatible with this specification the ioctl returns an
57&EINVAL;.</para>
58
59 <table pgwide="1" frame="none" id="v4l2-capability">
60 <title>struct <structname>v4l2_capability</structname></title>
61 <tgroup cols="3">
62 &cs-str;
63 <tbody valign="top">
64 <row>
65 <entry>__u8</entry>
66 <entry><structfield>driver</structfield>[16]</entry>
67 <entry><para>Name of the driver, a unique NUL-terminated
68ASCII string. For example: "bttv". Driver specific applications can
69use this information to verify the driver identity. It is also useful
70to work around known bugs, or to identify drivers in error reports.
71The driver version is stored in the <structfield>version</structfield>
72field.</para><para>Storing strings in fixed sized arrays is bad
73practice but unavoidable here. Drivers and applications should take
74precautions to never read or write beyond the end of the array and to
75make sure the strings are properly NUL-terminated.</para></entry>
76 </row>
77 <row>
78 <entry>__u8</entry>
79 <entry><structfield>card</structfield>[32]</entry>
80 <entry>Name of the device, a NUL-terminated ASCII string.
81For example: "Yoyodyne TV/FM". One driver may support different brands
82or models of video hardware. This information is intended for users,
83for example in a menu of available devices. Since multiple TV cards of
84the same brand may be installed which are supported by the same
85driver, this name should be combined with the character device file
86name (&eg; <filename>/dev/video2</filename>) or the
87<structfield>bus_info</structfield> string to avoid
88ambiguities.</entry>
89 </row>
90 <row>
91 <entry>__u8</entry>
92 <entry><structfield>bus_info</structfield>[32]</entry>
93 <entry>Location of the device in the system, a
94NUL-terminated ASCII string. For example: "PCI Slot 4". This
95information is intended for users, to distinguish multiple
96identical devices. If no such information is available the field may
97simply count the devices controlled by the driver, or contain the
98empty string (<structfield>bus_info</structfield>[0] = 0).<!-- XXX pci_dev->slot_name example --></entry>
99 </row>
100 <row>
101 <entry>__u32</entry>
102 <entry><structfield>version</structfield></entry>
103 <entry><para>Version number of the driver. Together with
104the <structfield>driver</structfield> field this identifies a
105particular driver. The version number is formatted using the
106<constant>KERNEL_VERSION()</constant> macro:</para></entry>
107 </row>
108 <row>
109 <entry spanname="hspan"><para>
110<programlisting>
111#define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c))
112
113__u32 version = KERNEL_VERSION(0, 8, 1);
114
115printf ("Version: %u.%u.%u\n",
116 (version &gt;&gt; 16) &amp; 0xFF,
117 (version &gt;&gt; 8) &amp; 0xFF,
118 version &amp; 0xFF);
119</programlisting></para></entry>
120 </row>
121 <row>
122 <entry>__u32</entry>
123 <entry><structfield>capabilities</structfield></entry>
124 <entry>Device capabilities, see <xref
125 linkend="device-capabilities" />.</entry>
126 </row>
127 <row>
128 <entry>__u32</entry>
129 <entry><structfield>reserved</structfield>[4]</entry>
130 <entry>Reserved for future extensions. Drivers must set
131this array to zero.</entry>
132 </row>
133 </tbody>
134 </tgroup>
135 </table>
136
137 <table pgwide="1" frame="none" id="device-capabilities">
138 <title>Device Capabilities Flags</title>
139 <tgroup cols="3">
140 &cs-def;
141 <tbody valign="top">
142 <row>
143 <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
144 <entry>0x00000001</entry>
145 <entry>The device supports the <link
146linkend="capture">Video Capture</link> interface.</entry>
147 </row>
148 <row>
149 <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry>
150 <entry>0x00000002</entry>
151 <entry>The device supports the <link
152linkend="output">Video Output</link> interface.</entry>
153 </row>
154 <row>
155 <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
156 <entry>0x00000004</entry>
157 <entry>The device supports the <link
158linkend="overlay">Video Overlay</link> interface. A video overlay device
159typically stores captured images directly in the video memory of a
160graphics card, with hardware clipping and scaling.</entry>
161 </row>
162 <row>
163 <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
164 <entry>0x00000010</entry>
165 <entry>The device supports the <link linkend="raw-vbi">Raw
166VBI Capture</link> interface, providing Teletext and Closed Caption
167data.</entry>
168 </row>
169 <row>
170 <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry>
171 <entry>0x00000020</entry>
172 <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry>
173 </row>
174 <row>
175 <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry>
176 <entry>0x00000040</entry>
177 <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry>
178 </row>
179 <row>
180 <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry>
181 <entry>0x00000080</entry>
182 <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry>
183 </row>
184 <row>
185 <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry>
186 <entry>0x00000100</entry>
Hans Verkuil0827d062010-09-11 08:39:47 -0300187 <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300188 </row>
189 <row>
190 <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry>
191 <entry>0x00000200</entry>
192 <entry>The device supports the <link linkend="osd">Video
193Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
194Overlay</wordasword> interface, this is a secondary function of video
195output devices and overlays an image onto an outgoing video signal.
196When the driver sets this flag, it must clear the
197<constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
198versa.<footnote><para>The &v4l2-framebuffer; lacks an
199&v4l2-buf-type; field, therefore the type of overlay is implied by the
200driver capabilities.</para></footnote></entry>
201 </row>
202 <row>
203 <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry>
204 <entry>0x00000400</entry>
205 <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for
206hardware frequency seeking.</entry>
207 </row>
208 <row>
Hans Verkuil0827d062010-09-11 08:39:47 -0300209 <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry>
210 <entry>0x00000800</entry>
211 <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry>
212 </row>
213 <row>
Mauro Carvalho Chehab8e080c22009-09-13 22:16:04 -0300214 <entry><constant>V4L2_CAP_TUNER</constant></entry>
215 <entry>0x00010000</entry>
216 <entry>The device has some sort of tuner to
217receive RF-modulated video signals. For more information about
218tuner programming see
219<xref linkend="tuner" />.</entry>
220 </row>
221 <row>
222 <entry><constant>V4L2_CAP_AUDIO</constant></entry>
223 <entry>0x00020000</entry>
224 <entry>The device has audio inputs or outputs. It may or
225may not support audio recording or playback, in PCM or compressed
226formats. PCM audio support must be implemented as ALSA or OSS
227interface. For more information on audio inputs and outputs see <xref
228 linkend="audio" />.</entry>
229 </row>
230 <row>
231 <entry><constant>V4L2_CAP_RADIO</constant></entry>
232 <entry>0x00040000</entry>
233 <entry>This is a radio receiver.</entry>
234 </row>
235 <row>
236 <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
237 <entry>0x00080000</entry>
238 <entry>The device has some sort of modulator to
239emit RF-modulated video/audio signals. For more information about
240modulator programming see
241<xref linkend="tuner" />.</entry>
242 </row>
243 <row>
244 <entry><constant>V4L2_CAP_READWRITE</constant></entry>
245 <entry>0x01000000</entry>
246 <entry>The device supports the <link
247linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
248I/O methods.</entry>
249 </row>
250 <row>
251 <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
252 <entry>0x02000000</entry>
253 <entry>The device supports the <link
254linkend="async">asynchronous</link> I/O methods.</entry>
255 </row>
256 <row>
257 <entry><constant>V4L2_CAP_STREAMING</constant></entry>
258 <entry>0x04000000</entry>
259 <entry>The device supports the <link
260linkend="mmap">streaming</link> I/O method.</entry>
261 </row>
262 </tbody>
263 </tgroup>
264 </table>
265 </refsect1>
266
267 <refsect1>
268 &return-value;
269
270 <variablelist>
271 <varlistentry>
272 <term><errorcode>EINVAL</errorcode></term>
273 <listitem>
274 <para>The device is not compatible with this
275specification.</para>
276 </listitem>
277 </varlistentry>
278 </variablelist>
279 </refsect1>
280</refentry>
281
282<!--
283Local Variables:
284mode: sgml
285sgml-parent-document: "v4l2.sgml"
286indent-tabs-mode: nil
287End:
288-->
289