Merge remote-tracking branch 'upstream' into next
[cascardo/linux.git] / Documentation / DocBook / media / v4l / vidioc-querycap.xml
1 <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
53 kernel devices compatible with this specification and to obtain
54 information about driver and hardware capabilities. The ioctl takes a
55 pointer to a &v4l2-capability; which is filled by the driver. When the
56 driver 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
68 ASCII string. For example: "bttv". Driver specific applications can
69 use this information to verify the driver identity. It is also useful
70 to work around known bugs, or to identify drivers in error reports.</para>
71 <para>Storing strings in fixed sized arrays is bad
72 practice but unavoidable here. Drivers and applications should take
73 precautions to never read or write beyond the end of the array and to
74 make sure the strings are properly NUL-terminated.</para></entry>
75           </row>
76           <row>
77             <entry>__u8</entry>
78             <entry><structfield>card</structfield>[32]</entry>
79             <entry>Name of the device, a NUL-terminated ASCII string.
80 For example: "Yoyodyne TV/FM". One driver may support different brands
81 or models of video hardware. This information is intended for users,
82 for example in a menu of available devices. Since multiple TV cards of
83 the same brand may be installed which are supported by the same
84 driver, this name should be combined with the character device file
85 name (&eg; <filename>/dev/video2</filename>) or the
86 <structfield>bus_info</structfield> string to avoid
87 ambiguities.</entry>
88           </row>
89           <row>
90             <entry>__u8</entry>
91             <entry><structfield>bus_info</structfield>[32]</entry>
92             <entry>Location of the device in the system, a
93 NUL-terminated ASCII string. For example: "PCI Slot 4". This
94 information is intended for users, to distinguish multiple
95 identical devices. If no such information is available the field may
96 simply count the devices controlled by the driver, or contain the
97 empty string (<structfield>bus_info</structfield>[0] = 0).<!-- XXX pci_dev->slot_name example --></entry>
98           </row>
99           <row>
100             <entry>__u32</entry>
101             <entry><structfield>version</structfield></entry>
102             <entry><para>Version number of the driver.</para>
103 <para>Starting on kernel 3.1, the version reported is provided per
104 V4L2 subsystem, following the same Kernel numberation scheme. However, it
105 should not always return the same version as the kernel, if, for example,
106 an stable or distribution-modified kernel uses the V4L2 stack from a
107 newer kernel.</para>
108 <para>The version number is formatted using the
109 <constant>KERNEL_VERSION()</constant> macro:</para></entry>
110           </row>
111           <row>
112             <entry spanname="hspan"><para>
113 <programlisting>
114 #define KERNEL_VERSION(a,b,c) (((a) &lt;&lt; 16) + ((b) &lt;&lt; 8) + (c))
115
116 __u32 version = KERNEL_VERSION(0, 8, 1);
117
118 printf ("Version: %u.%u.%u\n",
119         (version &gt;&gt; 16) &amp; 0xFF,
120         (version &gt;&gt; 8) &amp; 0xFF,
121          version &amp; 0xFF);
122 </programlisting></para></entry>
123           </row>
124           <row>
125             <entry>__u32</entry>
126             <entry><structfield>capabilities</structfield></entry>
127             <entry>Available capabilities of the physical device as a whole, see <xref
128                 linkend="device-capabilities" />. The same physical device can export
129                 multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and /dev/radioZ).
130                 The <structfield>capabilities</structfield> field should contain a union
131                 of all capabilities available around the several V4L2 devices exported
132                 to userspace.
133                 For all those devices the <structfield>capabilities</structfield> field
134                 returns the same set of capabilities. This allows applications to open
135                 just one of the devices (typically the video device) and discover whether
136                 video, vbi and/or radio are also supported.
137             </entry>
138           </row>
139           <row>
140             <entry>__u32</entry>
141             <entry><structfield>device_caps</structfield></entry>
142             <entry>Device capabilities of the opened device, see <xref
143                 linkend="device-capabilities" />. Should contain the available capabilities
144                 of that specific device node. So, for example, <structfield>device_caps</structfield>
145                 of a radio device will only contain radio related capabilities and
146                 no video or vbi capabilities. This field is only set if the <structfield>capabilities</structfield>
147                 field contains the <constant>V4L2_CAP_DEVICE_CAPS</constant> capability.
148                 Only the <structfield>capabilities</structfield> field can have the
149                 <constant>V4L2_CAP_DEVICE_CAPS</constant> capability, <structfield>device_caps</structfield>
150                 will never set <constant>V4L2_CAP_DEVICE_CAPS</constant>.
151             </entry>
152           </row>
153           <row>
154             <entry>__u32</entry>
155             <entry><structfield>reserved</structfield>[3]</entry>
156             <entry>Reserved for future extensions. Drivers must set
157 this array to zero.</entry>
158           </row>
159         </tbody>
160       </tgroup>
161     </table>
162
163     <table pgwide="1" frame="none" id="device-capabilities">
164       <title>Device Capabilities Flags</title>
165       <tgroup cols="3">
166         &cs-def;
167         <tbody valign="top">
168           <row>
169             <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry>
170             <entry>0x00000001</entry>
171             <entry>The device supports the single-planar API through the <link
172 linkend="capture">Video Capture</link> interface.</entry>
173           </row>
174           <row>
175             <entry><constant>V4L2_CAP_VIDEO_CAPTURE_MPLANE</constant></entry>
176             <entry>0x00001000</entry>
177             <entry>The device supports the
178             <link linkend="planar-apis">multi-planar API</link> through the
179             <link linkend="capture">Video Capture</link> interface.</entry>
180           </row>
181           <row>
182             <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry>
183             <entry>0x00000002</entry>
184             <entry>The device supports the single-planar API through the <link
185 linkend="output">Video Output</link> interface.</entry>
186           </row>
187           <row>
188             <entry><constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant></entry>
189             <entry>0x00002000</entry>
190             <entry>The device supports the
191             <link linkend="planar-apis">multi-planar API</link> through the
192             <link linkend="output">Video Output</link> interface.</entry>
193           </row>
194           <row>
195             <entry><constant>V4L2_CAP_VIDEO_M2M</constant></entry>
196             <entry>0x00004000</entry>
197             <entry>The device supports the single-planar API through the
198             Video Memory-To-Memory interface.</entry>
199           </row>
200           <row>
201             <entry><constant>V4L2_CAP_VIDEO_M2M_MPLANE</constant></entry>
202             <entry>0x00008000</entry>
203             <entry>The device supports the
204             <link linkend="planar-apis">multi-planar API</link> through the
205             Video Memory-To-Memory  interface.</entry>
206           </row>
207           <row>
208             <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry>
209             <entry>0x00000004</entry>
210             <entry>The device supports the <link
211 linkend="overlay">Video Overlay</link> interface. A video overlay device
212 typically stores captured images directly in the video memory of a
213 graphics card, with hardware clipping and scaling.</entry>
214           </row>
215           <row>
216             <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
217             <entry>0x00000010</entry>
218             <entry>The device supports the <link linkend="raw-vbi">Raw
219 VBI Capture</link> interface, providing Teletext and Closed Caption
220 data.</entry>
221           </row>
222           <row>
223             <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry>
224             <entry>0x00000020</entry>
225             <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry>
226           </row>
227           <row>
228             <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry>
229             <entry>0x00000040</entry>
230             <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry>
231           </row>
232           <row>
233             <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry>
234             <entry>0x00000080</entry>
235             <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry>
236           </row>
237           <row>
238             <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry>
239             <entry>0x00000100</entry>
240             <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry>
241           </row>
242           <row>
243             <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry>
244             <entry>0x00000200</entry>
245             <entry>The device supports the <link linkend="osd">Video
246 Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
247 Overlay</wordasword> interface, this is a secondary function of video
248 output devices and overlays an image onto an outgoing video signal.
249 When the driver sets this flag, it must clear the
250 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
251 versa.<footnote><para>The &v4l2-framebuffer; lacks an
252 &v4l2-buf-type; field, therefore the type of overlay is implied by the
253 driver capabilities.</para></footnote></entry>
254           </row>
255           <row>
256             <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry>
257             <entry>0x00000400</entry>
258             <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for
259 hardware frequency seeking.</entry>
260           </row>
261           <row>
262             <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry>
263             <entry>0x00000800</entry>
264             <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry>
265           </row>
266           <row>
267             <entry><constant>V4L2_CAP_TUNER</constant></entry>
268             <entry>0x00010000</entry>
269             <entry>The device has some sort of tuner to
270 receive RF-modulated video signals. For more information about
271 tuner programming see
272 <xref linkend="tuner" />.</entry>
273           </row>
274           <row>
275             <entry><constant>V4L2_CAP_AUDIO</constant></entry>
276             <entry>0x00020000</entry>
277             <entry>The device has audio inputs or outputs. It may or
278 may not support audio recording or playback, in PCM or compressed
279 formats. PCM audio support must be implemented as ALSA or OSS
280 interface. For more information on audio inputs and outputs see <xref
281                 linkend="audio" />.</entry>
282           </row>
283           <row>
284             <entry><constant>V4L2_CAP_RADIO</constant></entry>
285             <entry>0x00040000</entry>
286             <entry>This is a radio receiver.</entry>
287           </row>
288           <row>
289             <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
290             <entry>0x00080000</entry>
291             <entry>The device has some sort of modulator to
292 emit RF-modulated video/audio signals. For more information about
293 modulator programming see
294 <xref linkend="tuner" />.</entry>
295           </row>
296           <row>
297             <entry><constant>V4L2_CAP_READWRITE</constant></entry>
298             <entry>0x01000000</entry>
299             <entry>The device supports the <link
300 linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
301 I/O methods.</entry>
302           </row>
303           <row>
304             <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
305             <entry>0x02000000</entry>
306             <entry>The device supports the <link
307 linkend="async">asynchronous</link> I/O methods.</entry>
308           </row>
309           <row>
310             <entry><constant>V4L2_CAP_STREAMING</constant></entry>
311             <entry>0x04000000</entry>
312             <entry>The device supports the <link
313 linkend="mmap">streaming</link> I/O method.</entry>
314           </row>
315           <row>
316             <entry><constant>V4L2_CAP_DEVICE_CAPS</constant></entry>
317             <entry>0x80000000</entry>
318             <entry>The driver fills the <structfield>device_caps</structfield>
319             field. This capability can only appear in the <structfield>capabilities</structfield>
320             field and never in the <structfield>device_caps</structfield> field.</entry>
321           </row>
322         </tbody>
323       </tgroup>
324     </table>
325   </refsect1>
326
327   <refsect1>
328     &return-value;
329   </refsect1>
330 </refentry>