Merge branch 'xen/xenbus' into upstream/xen
[pandora-kernel.git] / Documentation / DocBook / 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.
71 The driver version is stored in the <structfield>version</structfield>
72 field.</para><para>Storing strings in fixed sized arrays is bad
73 practice but unavoidable here. Drivers and applications should take
74 precautions to never read or write beyond the end of the array and to
75 make 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.
81 For example: "Yoyodyne TV/FM". One driver may support different brands
82 or models of video hardware. This information is intended for users,
83 for example in a menu of available devices. Since multiple TV cards of
84 the same brand may be installed which are supported by the same
85 driver, this name should be combined with the character device file
86 name (&eg; <filename>/dev/video2</filename>) or the
87 <structfield>bus_info</structfield> string to avoid
88 ambiguities.</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
94 NUL-terminated ASCII string. For example: "PCI Slot 4". This
95 information is intended for users, to distinguish multiple
96 identical devices. If no such information is available the field may
97 simply count the devices controlled by the driver, or contain the
98 empty 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
104 the <structfield>driver</structfield> field this identifies a
105 particular 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
115 printf ("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
131 this 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
146 linkend="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
152 linkend="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
158 linkend="overlay">Video Overlay</link> interface. A video overlay device
159 typically stores captured images directly in the video memory of a
160 graphics 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
166 VBI Capture</link> interface, providing Teletext and Closed Caption
167 data.</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>
187             <entry>The device supports the <link linkend="rds">RDS</link> interface.</entry>
188           </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
193 Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video
194 Overlay</wordasword> interface, this is a secondary function of video
195 output devices and overlays an image onto an outgoing video signal.
196 When the driver sets this flag, it must clear the
197 <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice
198 versa.<footnote><para>The &v4l2-framebuffer; lacks an
199 &v4l2-buf-type; field, therefore the type of overlay is implied by the
200 driver 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
206 hardware frequency seeking.</entry>
207           </row>
208           <row>
209             <entry><constant>V4L2_CAP_TUNER</constant></entry>
210             <entry>0x00010000</entry>
211             <entry>The device has some sort of tuner to
212 receive RF-modulated video signals. For more information about
213 tuner programming see
214 <xref linkend="tuner" />.</entry>
215           </row>
216           <row>
217             <entry><constant>V4L2_CAP_AUDIO</constant></entry>
218             <entry>0x00020000</entry>
219             <entry>The device has audio inputs or outputs. It may or
220 may not support audio recording or playback, in PCM or compressed
221 formats. PCM audio support must be implemented as ALSA or OSS
222 interface. For more information on audio inputs and outputs see <xref
223                 linkend="audio" />.</entry>
224           </row>
225           <row>
226             <entry><constant>V4L2_CAP_RADIO</constant></entry>
227             <entry>0x00040000</entry>
228             <entry>This is a radio receiver.</entry>
229           </row>
230           <row>
231             <entry><constant>V4L2_CAP_MODULATOR</constant></entry>
232             <entry>0x00080000</entry>
233             <entry>The device has some sort of modulator to
234 emit RF-modulated video/audio signals. For more information about
235 modulator programming see
236 <xref linkend="tuner" />.</entry>
237           </row>
238           <row>
239             <entry><constant>V4L2_CAP_READWRITE</constant></entry>
240             <entry>0x01000000</entry>
241             <entry>The device supports the <link
242 linkend="rw">read()</link> and/or <link linkend="rw">write()</link>
243 I/O methods.</entry>
244           </row>
245           <row>
246             <entry><constant>V4L2_CAP_ASYNCIO</constant></entry>
247             <entry>0x02000000</entry>
248             <entry>The device supports the <link
249 linkend="async">asynchronous</link> I/O methods.</entry>
250           </row>
251           <row>
252             <entry><constant>V4L2_CAP_STREAMING</constant></entry>
253             <entry>0x04000000</entry>
254             <entry>The device supports the <link
255 linkend="mmap">streaming</link> I/O method.</entry>
256           </row>
257         </tbody>
258       </tgroup>
259     </table>
260   </refsect1>
261
262   <refsect1>
263     &return-value;
264
265     <variablelist>
266       <varlistentry>
267         <term><errorcode>EINVAL</errorcode></term>
268         <listitem>
269           <para>The device is not compatible with this
270 specification.</para>
271         </listitem>
272       </varlistentry>
273     </variablelist>
274   </refsect1>
275 </refentry>
276
277 <!--
278 Local Variables:
279 mode: sgml
280 sgml-parent-document: "v4l2.sgml"
281 indent-tabs-mode: nil
282 End:
283 -->
284