media-ioc-device-info.rst 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2. .. c:namespace:: MC
  3. .. _media_ioc_device_info:
  4. ***************************
  5. ioctl MEDIA_IOC_DEVICE_INFO
  6. ***************************
  7. Name
  8. ====
  9. MEDIA_IOC_DEVICE_INFO - Query device information
  10. Synopsis
  11. ========
  12. .. c:macro:: MEDIA_IOC_DEVICE_INFO
  13. ``int ioctl(int fd, MEDIA_IOC_DEVICE_INFO, struct media_device_info *argp)``
  14. Arguments
  15. =========
  16. ``fd``
  17. File descriptor returned by :c:func:`open()`.
  18. ``argp``
  19. Pointer to struct :c:type:`media_device_info`.
  20. Description
  21. ===========
  22. All media devices must support the ``MEDIA_IOC_DEVICE_INFO`` ioctl. To
  23. query device information, applications call the ioctl with a pointer to
  24. a struct :c:type:`media_device_info`. The driver
  25. fills the structure and returns the information to the application. The
  26. ioctl never fails.
  27. .. c:type:: media_device_info
  28. .. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.5cm}|
  29. .. flat-table:: struct media_device_info
  30. :header-rows: 0
  31. :stub-columns: 0
  32. :widths: 1 1 2
  33. * - char
  34. - ``driver``\ [16]
  35. - Name of the driver implementing the media API as a NUL-terminated
  36. ASCII string. The driver version is stored in the
  37. ``driver_version`` field.
  38. Driver specific applications can use this information to verify
  39. the driver identity. It is also useful to work around known bugs,
  40. or to identify drivers in error reports.
  41. * - char
  42. - ``model``\ [32]
  43. - Device model name as a NUL-terminated UTF-8 string. The device
  44. version is stored in the ``device_version`` field and is not be
  45. appended to the model name.
  46. * - char
  47. - ``serial``\ [40]
  48. - Serial number as a NUL-terminated ASCII string.
  49. * - char
  50. - ``bus_info``\ [32]
  51. - Location of the device in the system as a NUL-terminated ASCII
  52. string. This includes the bus type name (PCI, USB, ...) and a
  53. bus-specific identifier.
  54. * - __u32
  55. - ``media_version``
  56. - Media API version, formatted with the ``KERNEL_VERSION()`` macro.
  57. * - __u32
  58. - ``hw_revision``
  59. - Hardware device revision in a driver-specific format.
  60. * - __u32
  61. - ``driver_version``
  62. - Media device driver version, formatted with the
  63. ``KERNEL_VERSION()`` macro. Together with the ``driver`` field
  64. this identifies a particular driver.
  65. * - __u32
  66. - ``reserved``\ [31]
  67. - Reserved for future extensions. Drivers and applications must set
  68. this array to zero.
  69. The ``serial`` and ``bus_info`` fields can be used to distinguish
  70. between multiple instances of otherwise identical hardware. The serial
  71. number takes precedence when provided and can be assumed to be unique.
  72. If the serial number is an empty string, the ``bus_info`` field can be
  73. used instead. The ``bus_info`` field is guaranteed to be unique, but can
  74. vary across reboots or device unplug/replug.
  75. Return Value
  76. ============
  77. On success 0 is returned, on error -1 and the ``errno`` variable is set
  78. appropriately. The generic error codes are described at the
  79. :ref:`Generic Error Codes <gen-errors>` chapter.