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