1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>ioctl VIDIOC_QUERYCAP</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="LINUX MEDIA INFRASTRUCTURE API"><link rel="up" href="user-func.html" title="Appendix A. Function Reference"><link rel="prev" href="vidioc-querybuf.html" title="ioctl VIDIOC_QUERYBUF"><link rel="next" href="vidioc-queryctrl.html" title="ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">ioctl VIDIOC_QUERYCAP</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="vidioc-querybuf.html">Prev</a> </td><th width="60%" align="center">Appendix A. Function Reference</th><td width="20%" align="right"> <a accesskey="n" href="vidioc-queryctrl.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="vidioc-querycap"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>VIDIOC_QUERYCAP — Query device capabilities</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">ioctl</b>(</code></td><td>int <var class="pdparam">fd</var>, </td></tr><tr><td> </td><td>int <var class="pdparam">request</var>, </td></tr><tr><td> </td><td>struct v4l2_capability *<var class="pdparam">argp</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1115720812"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>fd</code></em></span></dt><dd><p>File descriptor returned by <a class="link" href="func-open.html" title="V4L2 open()"><code class="function">open()</code></a>.</p></dd><dt><span class="term"><em class="parameter"><code>request</code></em></span></dt><dd><p>VIDIOC_QUERYCAP</p></dd><dt><span class="term"><em class="parameter"><code>argp</code></em></span></dt><dd><p></p></dd></dl></div></div><div class="refsect1"><a name="idp1115783468"></a><h2>Description</h2><p>All V4L2 devices support the 2<code class="constant">VIDIOC_QUERYCAP</code> ioctl. It is used to identify 3kernel devices compatible with this specification and to obtain 4information about driver and hardware capabilities. The ioctl takes a 5pointer to a struct <a class="link" href="vidioc-querycap.html#v4l2-capability" title="Table A.93. struct v4l2_capability">v4l2_capability</a> which is filled by the driver. When the 6driver is not compatible with this specification the ioctl returns an 7<span class="errorcode">EINVAL</span> error code.</p><div class="table"><a name="v4l2-capability"></a><p class="title"><b>Table A.93. struct <span class="structname">v4l2_capability</span></b></p><div class="table-contents"><table summary="struct v4l2_capability" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>driver</code></em>[16]</td><td valign="top"><p>Name of the driver, a unique NUL-terminated 8ASCII string. For example: "bttv". Driver specific applications can 9use this information to verify the driver identity. It is also useful 10to work around known bugs, or to identify drivers in error reports.</p> 11<p>Storing strings in fixed sized arrays is bad 12practice but unavoidable here. Drivers and applications should take 13precautions to never read or write beyond the end of the array and to 14make sure the strings are properly NUL-terminated.</p></td></tr><tr><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>card</code></em>[32]</td><td valign="top">Name of the device, a NUL-terminated UTF-8 string. 15For example: "Yoyodyne TV/FM". One driver may support different brands 16or models of video hardware. This information is intended for users, 17for example in a menu of available devices. Since multiple TV cards of 18the same brand may be installed which are supported by the same 19driver, this name should be combined with the character device file 20name (e. g. <code class="filename">/dev/video2</code>) or the 21<em class="structfield"><code>bus_info</code></em> string to avoid 22ambiguities.</td></tr><tr><td valign="top">__u8</td><td valign="top"><em class="structfield"><code>bus_info</code></em>[32]</td><td valign="top">Location of the device in the system, a 23NUL-terminated ASCII string. For example: "PCI:0000:05:06.0". This 24information is intended for users, to distinguish multiple 25identical devices. If no such information is available the field must 26simply count the devices controlled by the driver ("platform:vivi-000"). 27The bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI Express boards, 28"usb-" for USB devices, "I2C:" for i2c devices, "ISA:" for ISA devices, 29"parport" for parallel port devices and "platform:" for platform devices.</td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>version</code></em></td><td valign="top"><p>Version number of the driver.</p> 30<p>Starting with kernel 3.1, the version reported is provided by the 31V4L2 subsystem following the kernel numbering scheme. However, it 32may not always return the same version as the kernel if, for example, 33a stable or distribution-modified kernel uses the V4L2 stack from a 34newer kernel.</p> 35<p>The version number is formatted using the 36<code class="constant">KERNEL_VERSION()</code> macro:</p></td></tr><tr><td colspan="3" valign="top"><p> 37</p><pre class="programlisting"> 38#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) 39 40__u32 version = KERNEL_VERSION(0, 8, 1); 41 42printf ("Version: %u.%u.%u\n", 43 (version >> 16) & 0xFF, 44 (version >> 8) & 0xFF, 45 version & 0xFF); 46</pre></td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>capabilities</code></em></td><td valign="top">Available capabilities of the physical device as a whole, see <a class="xref" href="vidioc-querycap.html#device-capabilities" title="Table A.94. Device Capabilities Flags">Table A.94, “Device Capabilities Flags”</a>. The same physical device can export 47 multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and /dev/radioZ). 48 The <em class="structfield"><code>capabilities</code></em> field should contain a union 49 of all capabilities available around the several V4L2 devices exported 50 to userspace. 51 For all those devices the <em class="structfield"><code>capabilities</code></em> field 52 returns the same set of capabilities. This allows applications to open 53 just one of the devices (typically the video device) and discover whether 54 video, vbi and/or radio are also supported. 55 </td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>device_caps</code></em></td><td valign="top">Device capabilities of the opened device, see <a class="xref" href="vidioc-querycap.html#device-capabilities" title="Table A.94. Device Capabilities Flags">Table A.94, “Device Capabilities Flags”</a>. Should contain the available capabilities 56 of that specific device node. So, for example, <em class="structfield"><code>device_caps</code></em> 57 of a radio device will only contain radio related capabilities and 58 no video or vbi capabilities. This field is only set if the <em class="structfield"><code>capabilities</code></em> 59 field contains the <code class="constant">V4L2_CAP_DEVICE_CAPS</code> capability. 60 Only the <em class="structfield"><code>capabilities</code></em> field can have the 61 <code class="constant">V4L2_CAP_DEVICE_CAPS</code> capability, <em class="structfield"><code>device_caps</code></em> 62 will never set <code class="constant">V4L2_CAP_DEVICE_CAPS</code>. 63 </td></tr><tr><td valign="top">__u32</td><td valign="top"><em class="structfield"><code>reserved</code></em>[3]</td><td valign="top">Reserved for future extensions. Drivers must set 64this array to zero.</td></tr></tbody></table></div></div><br class="table-break"><div class="table"><a name="device-capabilities"></a><p class="title"><b>Table A.94. Device Capabilities Flags</b></p><div class="table-contents"><table summary="Device Capabilities Flags" width="100%" border="0"><colgroup><col class="c1"><col class="c2"><col class="c3"></colgroup><tbody valign="top"><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_CAPTURE</code></td><td valign="top">0x00000001</td><td valign="top">The device supports the single-planar API through the <a class="link" href="devices.html#capture" title="Video Capture Interface">Video Capture</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_CAPTURE_MPLANE</code></td><td valign="top">0x00001000</td><td valign="top">The device supports the 65 <a class="link" href="planar-apis.html" title="Single- and multi-planar APIs">multi-planar API</a> through the 66 <a class="link" href="devices.html#capture" title="Video Capture Interface">Video Capture</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_OUTPUT</code></td><td valign="top">0x00000002</td><td valign="top">The device supports the single-planar API through the <a class="link" href="output.html" title="Video Output Interface">Video Output</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_OUTPUT_MPLANE</code></td><td valign="top">0x00002000</td><td valign="top">The device supports the 67 <a class="link" href="planar-apis.html" title="Single- and multi-planar APIs">multi-planar API</a> through the 68 <a class="link" href="output.html" title="Video Output Interface">Video Output</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_M2M</code></td><td valign="top">0x00004000</td><td valign="top">The device supports the single-planar API through the 69 Video Memory-To-Memory interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_M2M_MPLANE</code></td><td valign="top">0x00008000</td><td valign="top">The device supports the 70 <a class="link" href="planar-apis.html" title="Single- and multi-planar APIs">multi-planar API</a> through the 71 Video Memory-To-Memory interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_OVERLAY</code></td><td valign="top">0x00000004</td><td valign="top">The device supports the <a class="link" href="overlay.html" title="Video Overlay Interface">Video Overlay</a> interface. A video overlay device 72typically stores captured images directly in the video memory of a 73graphics card, with hardware clipping and scaling.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VBI_CAPTURE</code></td><td valign="top">0x00000010</td><td valign="top">The device supports the <a class="link" href="raw-vbi.html" title="Raw VBI Data Interface">Raw 74VBI Capture</a> interface, providing Teletext and Closed Caption 75data.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VBI_OUTPUT</code></td><td valign="top">0x00000020</td><td valign="top">The device supports the <a class="link" href="raw-vbi.html" title="Raw VBI Data Interface">Raw VBI Output</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_SLICED_VBI_CAPTURE</code></td><td valign="top">0x00000040</td><td valign="top">The device supports the <a class="link" href="sliced.html" title="Sliced VBI Data Interface">Sliced VBI Capture</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_SLICED_VBI_OUTPUT</code></td><td valign="top">0x00000080</td><td valign="top">The device supports the <a class="link" href="sliced.html" title="Sliced VBI Data Interface">Sliced VBI Output</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_RDS_CAPTURE</code></td><td valign="top">0x00000100</td><td valign="top">The device supports the <a class="link" href="rds.html" title="RDS Interface">RDS</a> capture interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_VIDEO_OUTPUT_OVERLAY</code></td><td valign="top">0x00000200</td><td valign="top">The device supports the <a class="link" href="osd.html" title="Video Output Overlay Interface">Video 76Output Overlay</a> (OSD) interface. Unlike the <em class="wordasword">Video 77Overlay</em> interface, this is a secondary function of video 78output devices and overlays an image onto an outgoing video signal. 79When the driver sets this flag, it must clear the 80<code class="constant">V4L2_CAP_VIDEO_OVERLAY</code> flag and vice 81versa.<a href="#ftn.idp1115824908" class="footnote" name="idp1115824908"><sup class="footnote">[a]</sup></a></td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_HW_FREQ_SEEK</code></td><td valign="top">0x00000400</td><td valign="top">The device supports the <a class="link" href="vidioc-s-hw-freq-seek.html" title="ioctl VIDIOC_S_HW_FREQ_SEEK"><code class="constant">VIDIOC_S_HW_FREQ_SEEK</code></a> ioctl for 82hardware frequency seeking.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_RDS_OUTPUT</code></td><td valign="top">0x00000800</td><td valign="top">The device supports the <a class="link" href="rds.html" title="RDS Interface">RDS</a> output interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_TUNER</code></td><td valign="top">0x00010000</td><td valign="top">The device has some sort of tuner to 83receive RF-modulated video signals. For more information about 84tuner programming see 85<a class="xref" href="tuner.html" title="Tuners and Modulators">the section called “Tuners and Modulators”</a>.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_AUDIO</code></td><td valign="top">0x00020000</td><td valign="top">The device has audio inputs or outputs. It may or 86may not support audio recording or playback, in PCM or compressed 87formats. PCM audio support must be implemented as ALSA or OSS 88interface. For more information on audio inputs and outputs see <a class="xref" href="audio.html" title="Audio Inputs and Outputs">the section called “Audio Inputs and Outputs”</a>.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_RADIO</code></td><td valign="top">0x00040000</td><td valign="top">This is a radio receiver.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_MODULATOR</code></td><td valign="top">0x00080000</td><td valign="top">The device has some sort of modulator to 89emit RF-modulated video/audio signals. For more information about 90modulator programming see 91<a class="xref" href="tuner.html" title="Tuners and Modulators">the section called “Tuners and Modulators”</a>.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_SDR_CAPTURE</code></td><td valign="top">0x00100000</td><td valign="top">The device supports the 92<a class="link" href="sdr.html" title="Software Defined Radio Interface (SDR)">SDR Capture</a> interface.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_EXT_PIX_FORMAT</code></td><td valign="top">0x00200000</td><td valign="top">The device supports the struct <a class="link" href="pixfmt.html#v4l2-pix-format" title="Table 2.1. struct v4l2_pix_format">v4l2_pix_format</a> extended 93fields.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_READWRITE</code></td><td valign="top">0x01000000</td><td valign="top">The device supports the <a class="link" href="io.html#rw" title="Read/Write">read()</a> and/or <a class="link" href="io.html#rw" title="Read/Write">write()</a> 94I/O methods.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_ASYNCIO</code></td><td valign="top">0x02000000</td><td valign="top">The device supports the <a class="link" href="async.html" title="Asynchronous I/O">asynchronous</a> I/O methods.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_STREAMING</code></td><td valign="top">0x04000000</td><td valign="top">The device supports the <a class="link" href="mmap.html" title="Streaming I/O (Memory Mapping)">streaming</a> I/O method.</td></tr><tr><td valign="top"><code class="constant">V4L2_CAP_DEVICE_CAPS</code></td><td valign="top">0x80000000</td><td valign="top">The driver fills the <em class="structfield"><code>device_caps</code></em> 95 field. This capability can only appear in the <em class="structfield"><code>capabilities</code></em> 96 field and never in the <em class="structfield"><code>device_caps</code></em> field.</td></tr></tbody><tbody class="footnotes"><tr><td colspan="3"><div id="ftn.idp1115824908" class="footnote"><p><a href="#idp1115824908" class="para"><sup class="para">[a] </sup></a>The struct <a class="link" href="vidioc-g-fbuf.html#v4l2-framebuffer" title="Table A.69. struct v4l2_framebuffer">v4l2_framebuffer</a> lacks an 97enum <a class="link" href="buffer.html#v4l2-buf-type" title="Table 3.3. enum v4l2_buf_type">v4l2_buf_type</a> field, therefore the type of overlay is implied by the 98driver capabilities.</p></div></td></tr></tbody></table></div></div><br class="table-break"></div><div class="refsect1"><a name="idp1115842740"></a><h2>Return Value</h2><p>On success <span class="returnvalue">0</span> is returned, on error <span class="returnvalue">-1</span> and the <code class="varname">errno</code> variable is set appropriately. The generic error codes are described at the <a class="link" href="gen_errors.html#gen-errors" title="Table 19.1. Generic error codes">Generic Error Codes</a> chapter.</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="vidioc-querybuf.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="user-func.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="vidioc-queryctrl.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ioctl VIDIOC_QUERYBUF </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> ioctl VIDIOC_QUERYCTRL, VIDIOC_QUERY_EXT_CTRL, VIDIOC_QUERYMENU</td></tr></table></div></body></html> 99