18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci.. c:namespace:: MC
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci.. _media_ioc_device_info:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci***************************
78c2ecf20Sopenharmony_ciioctl MEDIA_IOC_DEVICE_INFO
88c2ecf20Sopenharmony_ci***************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ciName
118c2ecf20Sopenharmony_ci====
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ciMEDIA_IOC_DEVICE_INFO - Query device information
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ciSynopsis
168c2ecf20Sopenharmony_ci========
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci.. c:macro:: MEDIA_IOC_DEVICE_INFO
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci``int ioctl(int fd, MEDIA_IOC_DEVICE_INFO, struct media_device_info *argp)``
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciArguments
238c2ecf20Sopenharmony_ci=========
248c2ecf20Sopenharmony_ci
258c2ecf20Sopenharmony_ci``fd``
268c2ecf20Sopenharmony_ci    File descriptor returned by :c:func:`open()`.
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci``argp``
298c2ecf20Sopenharmony_ci    Pointer to struct :c:type:`media_device_info`.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciDescription
328c2ecf20Sopenharmony_ci===========
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ciAll media devices must support the ``MEDIA_IOC_DEVICE_INFO`` ioctl. To
358c2ecf20Sopenharmony_ciquery device information, applications call the ioctl with a pointer to
368c2ecf20Sopenharmony_cia struct :c:type:`media_device_info`. The driver
378c2ecf20Sopenharmony_cifills the structure and returns the information to the application. The
388c2ecf20Sopenharmony_ciioctl never fails.
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci.. c:type:: media_device_info
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci.. flat-table:: struct media_device_info
458c2ecf20Sopenharmony_ci    :header-rows:  0
468c2ecf20Sopenharmony_ci    :stub-columns: 0
478c2ecf20Sopenharmony_ci    :widths:       1 1 2
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci    *  -  char
508c2ecf20Sopenharmony_ci       -  ``driver``\ [16]
518c2ecf20Sopenharmony_ci       -  Name of the driver implementing the media API as a NUL-terminated
528c2ecf20Sopenharmony_ci	  ASCII string. The driver version is stored in the
538c2ecf20Sopenharmony_ci	  ``driver_version`` field.
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci	  Driver specific applications can use this information to verify
568c2ecf20Sopenharmony_ci	  the driver identity. It is also useful to work around known bugs,
578c2ecf20Sopenharmony_ci	  or to identify drivers in error reports.
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci    *  -  char
608c2ecf20Sopenharmony_ci       -  ``model``\ [32]
618c2ecf20Sopenharmony_ci       -  Device model name as a NUL-terminated UTF-8 string. The device
628c2ecf20Sopenharmony_ci	  version is stored in the ``device_version`` field and is not be
638c2ecf20Sopenharmony_ci	  appended to the model name.
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci    *  -  char
668c2ecf20Sopenharmony_ci       -  ``serial``\ [40]
678c2ecf20Sopenharmony_ci       -  Serial number as a NUL-terminated ASCII string.
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci    *  -  char
708c2ecf20Sopenharmony_ci       -  ``bus_info``\ [32]
718c2ecf20Sopenharmony_ci       -  Location of the device in the system as a NUL-terminated ASCII
728c2ecf20Sopenharmony_ci	  string. This includes the bus type name (PCI, USB, ...) and a
738c2ecf20Sopenharmony_ci	  bus-specific identifier.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ci    *  -  __u32
768c2ecf20Sopenharmony_ci       -  ``media_version``
778c2ecf20Sopenharmony_ci       -  Media API version, formatted with the ``KERNEL_VERSION()`` macro.
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci    *  -  __u32
808c2ecf20Sopenharmony_ci       -  ``hw_revision``
818c2ecf20Sopenharmony_ci       -  Hardware device revision in a driver-specific format.
828c2ecf20Sopenharmony_ci
838c2ecf20Sopenharmony_ci    *  -  __u32
848c2ecf20Sopenharmony_ci       -  ``driver_version``
858c2ecf20Sopenharmony_ci       -  Media device driver version, formatted with the
868c2ecf20Sopenharmony_ci	  ``KERNEL_VERSION()`` macro. Together with the ``driver`` field
878c2ecf20Sopenharmony_ci	  this identifies a particular driver.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci    *  -  __u32
908c2ecf20Sopenharmony_ci       -  ``reserved``\ [31]
918c2ecf20Sopenharmony_ci       -  Reserved for future extensions. Drivers and applications must set
928c2ecf20Sopenharmony_ci	  this array to zero.
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ciThe ``serial`` and ``bus_info`` fields can be used to distinguish
958c2ecf20Sopenharmony_cibetween multiple instances of otherwise identical hardware. The serial
968c2ecf20Sopenharmony_cinumber takes precedence when provided and can be assumed to be unique.
978c2ecf20Sopenharmony_ciIf the serial number is an empty string, the ``bus_info`` field can be
988c2ecf20Sopenharmony_ciused instead. The ``bus_info`` field is guaranteed to be unique, but can
998c2ecf20Sopenharmony_civary across reboots or device unplug/replug.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ciReturn Value
1028c2ecf20Sopenharmony_ci============
1038c2ecf20Sopenharmony_ci
1048c2ecf20Sopenharmony_ciOn success 0 is returned, on error -1 and the ``errno`` variable is set
1058c2ecf20Sopenharmony_ciappropriately. The generic error codes are described at the
1068c2ecf20Sopenharmony_ci:ref:`Generic Error Codes <gen-errors>` chapter.
107