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