2016-06-30 21:18:56 +08:00
|
|
|
.. -*- coding: utf-8; mode: rst -*-
|
|
|
|
|
2016-07-09 19:54:35 +08:00
|
|
|
.. _media_ioc_device_info:
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
***************************
|
|
|
|
ioctl MEDIA_IOC_DEVICE_INFO
|
|
|
|
***************************
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Name
|
2016-07-05 18:58:48 +08:00
|
|
|
====
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 18:58:48 +08:00
|
|
|
MEDIA_IOC_DEVICE_INFO - Query device information
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
|
|
|
|
Synopsis
|
2016-06-30 21:18:56 +08:00
|
|
|
========
|
|
|
|
|
2016-08-20 03:59:55 +08:00
|
|
|
.. c:function:: int ioctl( int fd, MEDIA_IOC_DEVICE_INFO, struct media_device_info *argp )
|
|
|
|
:name: MEDIA_IOC_DEVICE_INFO
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 18:58:48 +08:00
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Arguments
|
2016-06-30 21:18:56 +08:00
|
|
|
=========
|
|
|
|
|
|
|
|
``fd``
|
|
|
|
File descriptor returned by :ref:`open() <media-func-open>`.
|
|
|
|
|
|
|
|
``argp``
|
|
|
|
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Description
|
2016-06-30 21:18:56 +08:00
|
|
|
===========
|
|
|
|
|
|
|
|
All media devices must support the ``MEDIA_IOC_DEVICE_INFO`` ioctl. To
|
|
|
|
query device information, applications call the ioctl with a pointer to
|
2016-08-30 04:37:59 +08:00
|
|
|
a struct :c:type:`media_device_info`. The driver
|
2016-06-30 21:18:56 +08:00
|
|
|
fills the structure and returns the information to the application. The
|
|
|
|
ioctl never fails.
|
|
|
|
|
|
|
|
|
2016-08-30 04:37:59 +08:00
|
|
|
.. c:type:: media_device_info
|
2016-06-30 21:18:56 +08:00
|
|
|
|
[media] docs-rst: add tabularcolumns to all tables
LaTeX doesn't handle too well auto-width on tables, and ReST
markup requires an special tag to give it the needed hints.
As we're using A4 paper, we have 17cm of useful spaces. As
most media tables have widths, let's use it to generate the
needed via the following perl script:
my ($line_size, $table_header, $has_cols) = (17.5, 0, 0);
my $out;
my $header = "";
my @widths = ();
sub round { $_[0] > 0 ? int($_[0] + .5) : -int(-$_[0] + .5) }
while (<>) {
if (!$table_header) {
$has_cols = 1 if (m/..\s+tabularcolumns::/);
if (m/..\s+flat-table::/) {
$table_header = 1;
$header = $_;
next;
}
$out .= $_;
next;
}
$header .= $_;
@widths = split(/ /, $1) if (m/:widths:\s+(.*)/);
if (m/^\n$/) {
if (!$has_cols && @widths) {
my ($tot, $t, $i) = (0, 0, 0);
foreach my $v(@widths) { $tot += $v; };
$out .= ".. tabularcolumns:: |";
for ($i = 0; $i < scalar @widths - 1; $i++) {
my $v = $widths[$i];
my $w = round(10 * ($v * $line_size) / $tot) / 10;
$out .= sprintf "p{%.1fcm}|", $w;
$t += $w;
}
my $w = $line_size - $t;
$out .= sprintf "p{%.1fcm}|\n\n", $w;
}
$out .= $header;
$table_header = 0;
$has_cols = 0;
$header = "";
@widths = ();
}
}
print $out;
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-08-17 19:14:19 +08:00
|
|
|
.. tabularcolumns:: |p{4.4cm}|p{4.4cm}|p{8.7cm}|
|
|
|
|
|
2016-06-30 21:18:56 +08:00
|
|
|
.. flat-table:: struct media_device_info
|
|
|
|
:header-rows: 0
|
|
|
|
:stub-columns: 0
|
|
|
|
:widths: 1 1 2
|
|
|
|
|
|
|
|
|
|
|
|
- .. row 1
|
|
|
|
|
|
|
|
- char
|
|
|
|
|
2016-07-13 19:43:30 +08:00
|
|
|
- ``driver``\ [16]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Name of the driver implementing the media API as a NUL-terminated
|
2016-07-05 03:25:48 +08:00
|
|
|
ASCII string. The driver version is stored in the
|
|
|
|
``driver_version`` field.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
2016-07-05 03:25:48 +08:00
|
|
|
Driver specific applications can use this information to verify
|
|
|
|
the driver identity. It is also useful to work around known bugs,
|
|
|
|
or to identify drivers in error reports.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 2
|
|
|
|
|
|
|
|
- char
|
|
|
|
|
2016-07-13 19:43:30 +08:00
|
|
|
- ``model``\ [32]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Device model name as a NUL-terminated UTF-8 string. The device
|
2016-07-05 03:25:48 +08:00
|
|
|
version is stored in the ``device_version`` field and is not be
|
|
|
|
appended to the model name.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 3
|
|
|
|
|
|
|
|
- char
|
|
|
|
|
2016-07-13 19:43:30 +08:00
|
|
|
- ``serial``\ [40]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Serial number as a NUL-terminated ASCII string.
|
|
|
|
|
|
|
|
- .. row 4
|
|
|
|
|
|
|
|
- char
|
|
|
|
|
2016-07-13 19:43:30 +08:00
|
|
|
- ``bus_info``\ [32]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Location of the device in the system as a NUL-terminated ASCII
|
2016-07-05 03:25:48 +08:00
|
|
|
string. This includes the bus type name (PCI, USB, ...) and a
|
|
|
|
bus-specific identifier.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 5
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``media_version``
|
|
|
|
|
|
|
|
- Media API version, formatted with the ``KERNEL_VERSION()`` macro.
|
|
|
|
|
|
|
|
- .. row 6
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``hw_revision``
|
|
|
|
|
|
|
|
- Hardware device revision in a driver-specific format.
|
|
|
|
|
|
|
|
- .. row 7
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
|
|
|
- ``driver_version``
|
|
|
|
|
|
|
|
- Media device driver version, formatted with the
|
2016-07-05 03:25:48 +08:00
|
|
|
``KERNEL_VERSION()`` macro. Together with the ``driver`` field
|
|
|
|
this identifies a particular driver.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- .. row 8
|
|
|
|
|
|
|
|
- __u32
|
|
|
|
|
2016-07-13 19:43:30 +08:00
|
|
|
- ``reserved``\ [31]
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
- Reserved for future extensions. Drivers and applications must set
|
2016-07-05 03:25:48 +08:00
|
|
|
this array to zero.
|
2016-06-30 21:18:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
The ``serial`` and ``bus_info`` fields can be used to distinguish
|
|
|
|
between multiple instances of otherwise identical hardware. The serial
|
|
|
|
number takes precedence when provided and can be assumed to be unique.
|
|
|
|
If the serial number is an empty string, the ``bus_info`` field can be
|
|
|
|
used instead. The ``bus_info`` field is guaranteed to be unique, but can
|
|
|
|
vary across reboots or device unplug/replug.
|
|
|
|
|
|
|
|
|
2016-07-06 02:14:35 +08:00
|
|
|
Return Value
|
2016-06-30 21:18:56 +08:00
|
|
|
============
|
|
|
|
|
|
|
|
On success 0 is returned, on error -1 and the ``errno`` variable is set
|
|
|
|
appropriately. The generic error codes are described at the
|
|
|
|
:ref:`Generic Error Codes <gen-errors>` chapter.
|