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