Merge branch 'next' of git://git.monstr.eu/linux-2.6-microblaze
[sfrench/cifs-2.6.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_OVERLAY</constant></entry>
196             <entry>0x00000004</entry>
197             <entry>The device supports the <link
198 linkend="overlay">Video Overlay</link> interface. A video overlay device
199 typically stores captured images directly in the video memory of a
200 graphics card, with hardware clipping and scaling.</entry>
201           </row>
202           <row>
203             <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry>
204             <entry>0x00000010</entry>
205             <entry>The device supports the <link linkend="raw-vbi">Raw
206 VBI Capture</link> interface, providing Teletext and Closed Caption
207 data.</entry>
208           </row>
209           <row>
210             <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry>
211             <entry>0x00000020</entry>
212             <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry>
213           </row>
214           <row>
215             <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry>
216             <entry>0x00000040</entry>
217             <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry>
218           </row>
219           <row>
220             <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry>
221             <entry>0x00000080</entry>
222             <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry>
223           </row>
224           <row>
225             <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry>
226             <entry>0x00000100</entry>
227             <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry>
228           </row>
229           <row>
230             <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry>
231             <entry>0x00000200</entry>
232             <entry>The device supports the <link linkend="osd">Video
233 Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
234 Overlay</wordasword> interface, this is a secondary function of video
235 output devices and overlays an image onto an outgoing video signal.
236 When the driver sets this flag, it must clear the
237 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
238 versa.<footnote><para>The &v4l2-framebuffer; lacks an
239 &v4l2-buf-type; field, therefore the type of overlay is implied by the
240 driver capabilities.</para></footnote></entry>
241           </row>
242           <row>
243             <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry>
244             <entry>0x00000400</entry>
245             <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for
246 hardware frequency seeking.</entry>
247           </row>
248           <row>
249             <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry>
250             <entry>0x00000800</entry>
251             <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry>
252           </row>
253           <row>
254             <entry><constant>V4L2_CAP_TUNER</constant></entry>
255             <entry>0x00010000</entry>
256             <entry>The device has some sort of tuner to
257 receive RF-modulated video signals. For more information about
258 tuner programming see
259 <xref linkend="tuner" />.</entry>
260           </row>
261           <row>
262             <entry><constant>V4L2_CAP_AUDIO</constant></entry>
263             <entry>0x00020000</entry>
264             <entry>The device has audio inputs or outputs. It may or
265 may not support audio recording or playback, in PCM or compressed
266 formats. PCM audio support must be implemented as ALSA or OSS
267 interface. For more information on audio inputs and outputs see <xref
268                 linkend="audio" />.</entry>
269           </row>
270           <row>
271             <entry><constant>V4L2_CAP_RADIO</constant></entry>
272             <entry>0x00040000</entry>
273             <entry>This is a radio receiver.</entry>
274           </row>
275           <row>
276             <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
277             <entry>0x00080000</entry>
278             <entry>The device has some sort of modulator to
279 emit RF-modulated video/audio signals. For more information about
280 modulator programming see
281 <xref linkend="tuner" />.</entry>
282           </row>
283           <row>
284             <entry><constant>V4L2_CAP_READWRITE</constant></entry>
285             <entry>0x01000000</entry>
286             <entry>The device supports the <link
287 linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
288 I/O methods.</entry>
289           </row>
290           <row>
291             <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
292             <entry>0x02000000</entry>
293             <entry>The device supports the <link
294 linkend="async">asynchronous</link> I/O methods.</entry>
295           </row>
296           <row>
297             <entry><constant>V4L2_CAP_STREAMING</constant></entry>
298             <entry>0x04000000</entry>
299             <entry>The device supports the <link
300 linkend="mmap">streaming</link> I/O method.</entry>
301           </row>
302           <row>
303             <entry><constant>V4L2_CAP_DEVICE_CAPS</constant></entry>
304             <entry>0x80000000</entry>
305             <entry>The driver fills the <structfield>device_caps</structfield>
306             field. This capability can only appear in the <structfield>capabilities</structfield>
307             field and never in the <structfield>device_caps</structfield> field.</entry>
308           </row>
309         </tbody>
310       </tgroup>
311     </table>
312   </refsect1>
313
314   <refsect1>
315     &return-value;
316   </refsect1>
317 </refentry>