vidioc-querycap.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: V4L
  3. .. _VIDIOC_QUERYCAP:
  4. *********************
  5. ioctl VIDIOC_QUERYCAP
  6. *********************
  7. Name
  8. ====
  9. VIDIOC_QUERYCAP - Query device capabilities
  10. Synopsis
  11. ========
  12. .. c:macro:: VIDIOC_QUERYCAP
  13. ``int ioctl(int fd, VIDIOC_QUERYCAP, struct v4l2_capability *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`v4l2_capability`.
  20. Description
  21. ===========
  22. All V4L2 devices support the ``VIDIOC_QUERYCAP`` ioctl. It is used to
  23. identify kernel devices compatible with this specification and to obtain
  24. information about driver and hardware capabilities. The ioctl takes a
  25. pointer to a struct :c:type:`v4l2_capability` which is
  26. filled by the driver. When the driver is not compatible with this
  27. specification the ioctl returns an ``EINVAL`` error code.
  28. .. c:type:: v4l2_capability
  29. .. tabularcolumns:: |p{1.4cm}|p{2.8cm}|p{13.1cm}|
  30. .. cssclass:: longtable
  31. .. flat-table:: struct v4l2_capability
  32. :header-rows: 0
  33. :stub-columns: 0
  34. :widths: 3 4 20
  35. * - __u8
  36. - ``driver``\ [16]
  37. - Name of the driver, a unique NUL-terminated ASCII string. For
  38. example: "bttv". Driver specific applications can use this
  39. information to verify the driver identity. It is also useful to
  40. work around known bugs, or to identify drivers in error reports.
  41. Storing strings in fixed sized arrays is bad practice but
  42. unavoidable here. Drivers and applications should take precautions
  43. to never read or write beyond the end of the array and to make
  44. sure the strings are properly NUL-terminated.
  45. * - __u8
  46. - ``card``\ [32]
  47. - Name of the device, a NUL-terminated UTF-8 string. For example:
  48. "Yoyodyne TV/FM". One driver may support different brands or
  49. models of video hardware. This information is intended for users,
  50. for example in a menu of available devices. Since multiple TV
  51. cards of the same brand may be installed which are supported by
  52. the same driver, this name should be combined with the character
  53. device file name (e. g. ``/dev/video2``) or the ``bus_info``
  54. string to avoid ambiguities.
  55. * - __u8
  56. - ``bus_info``\ [32]
  57. - Location of the device in the system, a NUL-terminated ASCII
  58. string. For example: "PCI:0000:05:06.0". This information is
  59. intended for users, to distinguish multiple identical devices. If
  60. no such information is available the field must simply count the
  61. devices controlled by the driver ("platform:vivid-000"). The
  62. bus_info must start with "PCI:" for PCI boards, "PCIe:" for PCI
  63. Express boards, "usb-" for USB devices, "I2C:" for i2c devices,
  64. "ISA:" for ISA devices, "parport" for parallel port devices and
  65. "platform:" for platform devices.
  66. * - __u32
  67. - ``version``
  68. - Version number of the driver.
  69. Starting with kernel 3.1, the version reported is provided by the
  70. V4L2 subsystem following the kernel numbering scheme. However, it
  71. may not always return the same version as the kernel if, for
  72. example, a stable or distribution-modified kernel uses the V4L2
  73. stack from a newer kernel.
  74. The version number is formatted using the ``KERNEL_VERSION()``
  75. macro. For example if the media stack corresponds to the V4L2
  76. version shipped with Kernel 4.14, it would be equivalent to:
  77. * - :cspan:`2`
  78. ``#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))``
  79. ``__u32 version = KERNEL_VERSION(4, 14, 0);``
  80. ``printf ("Version: %u.%u.%u\\n",``
  81. ``(version >> 16) & 0xFF, (version >> 8) & 0xFF, version & 0xFF);``
  82. * - __u32
  83. - ``capabilities``
  84. - Available capabilities of the physical device as a whole, see
  85. :ref:`device-capabilities`. The same physical device can export
  86. multiple devices in /dev (e.g. /dev/videoX, /dev/vbiY and
  87. /dev/radioZ). The ``capabilities`` field should contain a union of
  88. all capabilities available around the several V4L2 devices
  89. exported to userspace. For all those devices the ``capabilities``
  90. field returns the same set of capabilities. This allows
  91. applications to open just one of the devices (typically the video
  92. device) and discover whether video, vbi and/or radio are also
  93. supported.
  94. * - __u32
  95. - ``device_caps``
  96. - Device capabilities of the opened device, see
  97. :ref:`device-capabilities`. Should contain the available
  98. capabilities of that specific device node. So, for example,
  99. ``device_caps`` of a radio device will only contain radio related
  100. capabilities and no video or vbi capabilities. This field is only
  101. set if the ``capabilities`` field contains the
  102. ``V4L2_CAP_DEVICE_CAPS`` capability. Only the ``capabilities``
  103. field can have the ``V4L2_CAP_DEVICE_CAPS`` capability,
  104. ``device_caps`` will never set ``V4L2_CAP_DEVICE_CAPS``.
  105. * - __u32
  106. - ``reserved``\ [3]
  107. - Reserved for future extensions. Drivers must set this array to
  108. zero.
  109. .. tabularcolumns:: |p{7.0cm}|p{2.6cm}|p{7.7cm}|
  110. .. _device-capabilities:
  111. .. cssclass:: longtable
  112. .. flat-table:: Device Capabilities Flags
  113. :header-rows: 0
  114. :stub-columns: 0
  115. :widths: 3 1 4
  116. * - ``V4L2_CAP_VIDEO_CAPTURE``
  117. - 0x00000001
  118. - The device supports the single-planar API through the
  119. :ref:`Video Capture <capture>` interface.
  120. * - ``V4L2_CAP_VIDEO_CAPTURE_MPLANE``
  121. - 0x00001000
  122. - The device supports the :ref:`multi-planar API <planar-apis>`
  123. through the :ref:`Video Capture <capture>` interface.
  124. * - ``V4L2_CAP_VIDEO_OUTPUT``
  125. - 0x00000002
  126. - The device supports the single-planar API through the
  127. :ref:`Video Output <output>` interface.
  128. * - ``V4L2_CAP_VIDEO_OUTPUT_MPLANE``
  129. - 0x00002000
  130. - The device supports the :ref:`multi-planar API <planar-apis>`
  131. through the :ref:`Video Output <output>` interface.
  132. * - ``V4L2_CAP_VIDEO_M2M``
  133. - 0x00008000
  134. - The device supports the single-planar API through the Video
  135. Memory-To-Memory interface.
  136. * - ``V4L2_CAP_VIDEO_M2M_MPLANE``
  137. - 0x00004000
  138. - The device supports the :ref:`multi-planar API <planar-apis>`
  139. through the Video Memory-To-Memory interface.
  140. * - ``V4L2_CAP_VIDEO_OVERLAY``
  141. - 0x00000004
  142. - The device supports the :ref:`Video Overlay <overlay>`
  143. interface. A video overlay device typically stores captured images
  144. directly in the video memory of a graphics card, with hardware
  145. clipping and scaling.
  146. * - ``V4L2_CAP_VBI_CAPTURE``
  147. - 0x00000010
  148. - The device supports the :ref:`Raw VBI Capture <raw-vbi>`
  149. interface, providing Teletext and Closed Caption data.
  150. * - ``V4L2_CAP_VBI_OUTPUT``
  151. - 0x00000020
  152. - The device supports the :ref:`Raw VBI Output <raw-vbi>`
  153. interface.
  154. * - ``V4L2_CAP_SLICED_VBI_CAPTURE``
  155. - 0x00000040
  156. - The device supports the :ref:`Sliced VBI Capture <sliced>`
  157. interface.
  158. * - ``V4L2_CAP_SLICED_VBI_OUTPUT``
  159. - 0x00000080
  160. - The device supports the :ref:`Sliced VBI Output <sliced>`
  161. interface.
  162. * - ``V4L2_CAP_RDS_CAPTURE``
  163. - 0x00000100
  164. - The device supports the :ref:`RDS <rds>` capture interface.
  165. * - ``V4L2_CAP_VIDEO_OUTPUT_OVERLAY``
  166. - 0x00000200
  167. - The device supports the :ref:`Video Output Overlay <osd>` (OSD)
  168. interface. Unlike the *Video Overlay* interface, this is a
  169. secondary function of video output devices and overlays an image
  170. onto an outgoing video signal. When the driver sets this flag, it
  171. must clear the ``V4L2_CAP_VIDEO_OVERLAY`` flag and vice
  172. versa. [#f1]_
  173. * - ``V4L2_CAP_HW_FREQ_SEEK``
  174. - 0x00000400
  175. - The device supports the
  176. :ref:`VIDIOC_S_HW_FREQ_SEEK` ioctl
  177. for hardware frequency seeking.
  178. * - ``V4L2_CAP_RDS_OUTPUT``
  179. - 0x00000800
  180. - The device supports the :ref:`RDS <rds>` output interface.
  181. * - ``V4L2_CAP_TUNER``
  182. - 0x00010000
  183. - The device has some sort of tuner to receive RF-modulated video
  184. signals. For more information about tuner programming see
  185. :ref:`tuner`.
  186. * - ``V4L2_CAP_AUDIO``
  187. - 0x00020000
  188. - The device has audio inputs or outputs. It may or may not support
  189. audio recording or playback, in PCM or compressed formats. PCM
  190. audio support must be implemented as ALSA or OSS interface. For
  191. more information on audio inputs and outputs see :ref:`audio`.
  192. * - ``V4L2_CAP_RADIO``
  193. - 0x00040000
  194. - This is a radio receiver.
  195. * - ``V4L2_CAP_MODULATOR``
  196. - 0x00080000
  197. - The device has some sort of modulator to emit RF-modulated
  198. video/audio signals. For more information about modulator
  199. programming see :ref:`tuner`.
  200. * - ``V4L2_CAP_SDR_CAPTURE``
  201. - 0x00100000
  202. - The device supports the :ref:`SDR Capture <sdr>` interface.
  203. * - ``V4L2_CAP_EXT_PIX_FORMAT``
  204. - 0x00200000
  205. - The device supports the struct
  206. :c:type:`v4l2_pix_format` extended fields.
  207. * - ``V4L2_CAP_SDR_OUTPUT``
  208. - 0x00400000
  209. - The device supports the :ref:`SDR Output <sdr>` interface.
  210. * - ``V4L2_CAP_META_CAPTURE``
  211. - 0x00800000
  212. - The device supports the :ref:`metadata` capture interface.
  213. * - ``V4L2_CAP_READWRITE``
  214. - 0x01000000
  215. - The device supports the :c:func:`read()` and/or
  216. :c:func:`write()` I/O methods.
  217. * - ``V4L2_CAP_EDID``
  218. - 0x02000000
  219. - The device stores the EDID for a video input, or retrieves the EDID for a video
  220. output. It is a standalone EDID device, so no video streaming etc. will take place.
  221. For a video input this is typically an eeprom that supports the
  222. :ref:`VESA Enhanced Display Data Channel Standard <vesaeddc>`. It can be something
  223. else as well, for example a micro controller.
  224. For a video output this is typically read from an external device such as an
  225. HDMI splitter accessed by a serial port.
  226. * - ``V4L2_CAP_STREAMING``
  227. - 0x04000000
  228. - The device supports the :ref:`streaming <mmap>` I/O method.
  229. * - ``V4L2_CAP_META_OUTPUT``
  230. - 0x08000000
  231. - The device supports the :ref:`metadata` output interface.
  232. * - ``V4L2_CAP_TOUCH``
  233. - 0x10000000
  234. - This is a touch device.
  235. * - ``V4L2_CAP_IO_MC``
  236. - 0x20000000
  237. - There is only one input and/or output seen from userspace. The whole
  238. video topology configuration, including which I/O entity is routed to
  239. the input/output, is configured by userspace via the Media Controller.
  240. See :ref:`media_controller`.
  241. * - ``V4L2_CAP_DEVICE_CAPS``
  242. - 0x80000000
  243. - The driver fills the ``device_caps`` field. This capability can
  244. only appear in the ``capabilities`` field and never in the
  245. ``device_caps`` field.
  246. Return Value
  247. ============
  248. On success 0 is returned, on error -1 and the ``errno`` variable is set
  249. appropriately. The generic error codes are described at the
  250. :ref:`Generic Error Codes <gen-errors>` chapter.
  251. .. [#f1]
  252. The struct :c:type:`v4l2_framebuffer` lacks an
  253. enum :c:type:`v4l2_buf_type` field, therefore the
  254. type of overlay is implied by the driver capabilities.