| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 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 | 
| Mauro Carvalho Chehab | c20eb18 | 2011-06-25 14:11:52 -0300 | [diff] [blame] | 70 | to work around known bugs, or to identify drivers in error reports.</para> | 
|  | 71 | <para>Storing strings in fixed sized arrays is bad | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 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 (⪚ <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> | 
| Mauro Carvalho Chehab | c20eb18 | 2011-06-25 14:11:52 -0300 | [diff] [blame] | 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 | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 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) << 16) + ((b) << 8) + (c)) | 
|  | 115 |  | 
|  | 116 | __u32 version = KERNEL_VERSION(0, 8, 1); | 
|  | 117 |  | 
|  | 118 | printf ("Version: %u.%u.%u\n", | 
|  | 119 | (version >> 16) & 0xFF, | 
|  | 120 | (version >> 8) & 0xFF, | 
|  | 121 | version & 0xFF); | 
|  | 122 | </programlisting></para></entry> | 
|  | 123 | </row> | 
|  | 124 | <row> | 
|  | 125 | <entry>__u32</entry> | 
|  | 126 | <entry><structfield>capabilities</structfield></entry> | 
|  | 127 | <entry>Device capabilities, see <xref | 
|  | 128 | linkend="device-capabilities" />.</entry> | 
|  | 129 | </row> | 
|  | 130 | <row> | 
|  | 131 | <entry>__u32</entry> | 
|  | 132 | <entry><structfield>reserved</structfield>[4]</entry> | 
|  | 133 | <entry>Reserved for future extensions. Drivers must set | 
|  | 134 | this array to zero.</entry> | 
|  | 135 | </row> | 
|  | 136 | </tbody> | 
|  | 137 | </tgroup> | 
|  | 138 | </table> | 
|  | 139 |  | 
|  | 140 | <table pgwide="1" frame="none" id="device-capabilities"> | 
|  | 141 | <title>Device Capabilities Flags</title> | 
|  | 142 | <tgroup cols="3"> | 
|  | 143 | &cs-def; | 
|  | 144 | <tbody valign="top"> | 
|  | 145 | <row> | 
|  | 146 | <entry><constant>V4L2_CAP_VIDEO_CAPTURE</constant></entry> | 
|  | 147 | <entry>0x00000001</entry> | 
| Pawel Osciak | d39155d | 2011-01-16 13:53:31 -0300 | [diff] [blame] | 148 | <entry>The device supports the single-planar API through the <link | 
|  | 149 | linkend="capture">Video Capture</link> interface.</entry> | 
| Pawel Osciak | 53b5d57 | 2011-01-07 01:41:33 -0300 | [diff] [blame] | 150 | </row> | 
|  | 151 | <row> | 
|  | 152 | <entry><constant>V4L2_CAP_VIDEO_CAPTURE_MPLANE</constant></entry> | 
|  | 153 | <entry>0x00001000</entry> | 
| Pawel Osciak | d39155d | 2011-01-16 13:53:31 -0300 | [diff] [blame] | 154 | <entry>The device supports the | 
|  | 155 | <link linkend="planar-apis">multi-planar API</link> through the | 
|  | 156 | <link linkend="capture">Video Capture</link> interface.</entry> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 157 | </row> | 
|  | 158 | <row> | 
|  | 159 | <entry><constant>V4L2_CAP_VIDEO_OUTPUT</constant></entry> | 
|  | 160 | <entry>0x00000002</entry> | 
| Pawel Osciak | d39155d | 2011-01-16 13:53:31 -0300 | [diff] [blame] | 161 | <entry>The device supports the single-planar API through the <link | 
|  | 162 | linkend="output">Video Output</link> interface.</entry> | 
| Pawel Osciak | 53b5d57 | 2011-01-07 01:41:33 -0300 | [diff] [blame] | 163 | </row> | 
|  | 164 | <row> | 
|  | 165 | <entry><constant>V4L2_CAP_VIDEO_OUTPUT_MPLANE</constant></entry> | 
|  | 166 | <entry>0x00002000</entry> | 
| Pawel Osciak | d39155d | 2011-01-16 13:53:31 -0300 | [diff] [blame] | 167 | <entry>The device supports the | 
|  | 168 | <link linkend="planar-apis">multi-planar API</link> through the | 
|  | 169 | <link linkend="output">Video Output</link> interface.</entry> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 170 | </row> | 
|  | 171 | <row> | 
|  | 172 | <entry><constant>V4L2_CAP_VIDEO_OVERLAY</constant></entry> | 
|  | 173 | <entry>0x00000004</entry> | 
|  | 174 | <entry>The device supports the <link | 
|  | 175 | linkend="overlay">Video Overlay</link> interface. A video overlay device | 
|  | 176 | typically stores captured images directly in the video memory of a | 
|  | 177 | graphics card, with hardware clipping and scaling.</entry> | 
|  | 178 | </row> | 
|  | 179 | <row> | 
|  | 180 | <entry><constant>V4L2_CAP_VBI_CAPTURE</constant></entry> | 
|  | 181 | <entry>0x00000010</entry> | 
|  | 182 | <entry>The device supports the <link linkend="raw-vbi">Raw | 
|  | 183 | VBI Capture</link> interface, providing Teletext and Closed Caption | 
|  | 184 | data.</entry> | 
|  | 185 | </row> | 
|  | 186 | <row> | 
|  | 187 | <entry><constant>V4L2_CAP_VBI_OUTPUT</constant></entry> | 
|  | 188 | <entry>0x00000020</entry> | 
|  | 189 | <entry>The device supports the <link linkend="raw-vbi">Raw VBI Output</link> interface.</entry> | 
|  | 190 | </row> | 
|  | 191 | <row> | 
|  | 192 | <entry><constant>V4L2_CAP_SLICED_VBI_CAPTURE</constant></entry> | 
|  | 193 | <entry>0x00000040</entry> | 
|  | 194 | <entry>The device supports the <link linkend="sliced">Sliced VBI Capture</link> interface.</entry> | 
|  | 195 | </row> | 
|  | 196 | <row> | 
|  | 197 | <entry><constant>V4L2_CAP_SLICED_VBI_OUTPUT</constant></entry> | 
|  | 198 | <entry>0x00000080</entry> | 
|  | 199 | <entry>The device supports the <link linkend="sliced">Sliced VBI Output</link> interface.</entry> | 
|  | 200 | </row> | 
|  | 201 | <row> | 
|  | 202 | <entry><constant>V4L2_CAP_RDS_CAPTURE</constant></entry> | 
|  | 203 | <entry>0x00000100</entry> | 
| Hans Verkuil | 0827d06 | 2010-09-11 08:39:47 -0300 | [diff] [blame] | 204 | <entry>The device supports the <link linkend="rds">RDS</link> capture interface.</entry> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 205 | </row> | 
|  | 206 | <row> | 
|  | 207 | <entry><constant>V4L2_CAP_VIDEO_OUTPUT_OVERLAY</constant></entry> | 
|  | 208 | <entry>0x00000200</entry> | 
|  | 209 | <entry>The device supports the <link linkend="osd">Video | 
|  | 210 | Output Overlay</link> (OSD) interface. Unlike the <wordasword>Video | 
|  | 211 | Overlay</wordasword> interface, this is a secondary function of video | 
|  | 212 | output devices and overlays an image onto an outgoing video signal. | 
|  | 213 | When the driver sets this flag, it must clear the | 
|  | 214 | <constant>V4L2_CAP_VIDEO_OVERLAY</constant> flag and vice | 
|  | 215 | versa.<footnote><para>The &v4l2-framebuffer; lacks an | 
|  | 216 | &v4l2-buf-type; field, therefore the type of overlay is implied by the | 
|  | 217 | driver capabilities.</para></footnote></entry> | 
|  | 218 | </row> | 
|  | 219 | <row> | 
|  | 220 | <entry><constant>V4L2_CAP_HW_FREQ_SEEK</constant></entry> | 
|  | 221 | <entry>0x00000400</entry> | 
|  | 222 | <entry>The device supports the &VIDIOC-S-HW-FREQ-SEEK; ioctl for | 
|  | 223 | hardware frequency seeking.</entry> | 
|  | 224 | </row> | 
|  | 225 | <row> | 
| Hans Verkuil | 0827d06 | 2010-09-11 08:39:47 -0300 | [diff] [blame] | 226 | <entry><constant>V4L2_CAP_RDS_OUTPUT</constant></entry> | 
|  | 227 | <entry>0x00000800</entry> | 
|  | 228 | <entry>The device supports the <link linkend="rds">RDS</link> output interface.</entry> | 
|  | 229 | </row> | 
|  | 230 | <row> | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 231 | <entry><constant>V4L2_CAP_TUNER</constant></entry> | 
|  | 232 | <entry>0x00010000</entry> | 
|  | 233 | <entry>The device has some sort of tuner to | 
|  | 234 | receive RF-modulated video signals. For more information about | 
|  | 235 | tuner programming see | 
|  | 236 | <xref linkend="tuner" />.</entry> | 
|  | 237 | </row> | 
|  | 238 | <row> | 
|  | 239 | <entry><constant>V4L2_CAP_AUDIO</constant></entry> | 
|  | 240 | <entry>0x00020000</entry> | 
|  | 241 | <entry>The device has audio inputs or outputs. It may or | 
|  | 242 | may not support audio recording or playback, in PCM or compressed | 
|  | 243 | formats. PCM audio support must be implemented as ALSA or OSS | 
|  | 244 | interface. For more information on audio inputs and outputs see <xref | 
|  | 245 | linkend="audio" />.</entry> | 
|  | 246 | </row> | 
|  | 247 | <row> | 
|  | 248 | <entry><constant>V4L2_CAP_RADIO</constant></entry> | 
|  | 249 | <entry>0x00040000</entry> | 
|  | 250 | <entry>This is a radio receiver.</entry> | 
|  | 251 | </row> | 
|  | 252 | <row> | 
|  | 253 | <entry><constant>V4L2_CAP_MODULATOR</constant></entry> | 
|  | 254 | <entry>0x00080000</entry> | 
|  | 255 | <entry>The device has some sort of modulator to | 
|  | 256 | emit RF-modulated video/audio signals. For more information about | 
|  | 257 | modulator programming see | 
|  | 258 | <xref linkend="tuner" />.</entry> | 
|  | 259 | </row> | 
|  | 260 | <row> | 
|  | 261 | <entry><constant>V4L2_CAP_READWRITE</constant></entry> | 
|  | 262 | <entry>0x01000000</entry> | 
|  | 263 | <entry>The device supports the <link | 
|  | 264 | linkend="rw">read()</link> and/or <link linkend="rw">write()</link> | 
|  | 265 | I/O methods.</entry> | 
|  | 266 | </row> | 
|  | 267 | <row> | 
|  | 268 | <entry><constant>V4L2_CAP_ASYNCIO</constant></entry> | 
|  | 269 | <entry>0x02000000</entry> | 
|  | 270 | <entry>The device supports the <link | 
|  | 271 | linkend="async">asynchronous</link> I/O methods.</entry> | 
|  | 272 | </row> | 
|  | 273 | <row> | 
|  | 274 | <entry><constant>V4L2_CAP_STREAMING</constant></entry> | 
|  | 275 | <entry>0x04000000</entry> | 
|  | 276 | <entry>The device supports the <link | 
|  | 277 | linkend="mmap">streaming</link> I/O method.</entry> | 
|  | 278 | </row> | 
|  | 279 | </tbody> | 
|  | 280 | </tgroup> | 
|  | 281 | </table> | 
|  | 282 | </refsect1> | 
|  | 283 |  | 
|  | 284 | <refsect1> | 
|  | 285 | &return-value; | 
| Mauro Carvalho Chehab | 8e080c2 | 2009-09-13 22:16:04 -0300 | [diff] [blame] | 286 | </refsect1> | 
|  | 287 | </refentry> |