VIDIOC_DBG_G_CHIP_IDENT — Identify the chips on a TV card
int fsfuncioctl( | int fd, |
int request, | |
struct v4l2_dbg_chip_ident
*argp) ; |
This is an experimental interface and may change in the future.
For driver debugging purposes this ioctl allows test applications to query the driver about the chips present on the TV card. Regular applications must not use it. When you found a chip specific bug, please contact the linux-media mailing list (http://www.linuxtv.org/lists.php) so it can be fixed.
To query the driver applications must initialize the
match.type
and
match.addr
or match.name
fields of a struct v4l2_dbg_chip_ident
and call VIDIOC_DBG_G_CHIP_IDENT
with a pointer to
this structure. On success the driver stores information about the
selected chip in the ident
and
revision
fields. On failure the structure
remains unchanged.
When match.type
is
V4L2_CHIP_MATCH_HOST
,
match.addr
selects the nth non-I2C chip
on the TV card. You can enumerate all chips by starting at zero and
incrementing match.addr
by one until
VIDIOC_DBG_G_CHIP_IDENT
fails with an EINVAL error code.
The number zero always selects the host chip, e. g. the chip connected
to the PCI or USB bus.
When match.type
is
V4L2_CHIP_MATCH_I2C_DRIVER
,
match.name
contains the I2C driver name.
For instance
"saa7127"
will match any chip
supported by the saa7127 driver, regardless of its I2C bus address.
When multiple chips supported by the same driver are present, the
ioctl will return V4L2_IDENT_AMBIGUOUS
in the
ident
field.
When match.type
is
V4L2_CHIP_MATCH_I2C_ADDR
,
match.addr
selects a chip by its 7 bit
I2C bus address.
When match.type
is
V4L2_CHIP_MATCH_AC97
,
match.addr
selects the nth AC97 chip
on the TV card. You can enumerate all chips by starting at zero and
incrementing match.addr
by one until
VIDIOC_DBG_G_CHIP_IDENT
fails with an EINVAL error code.
On success, the ident
field will
contain a chip ID from the Linux
media/v4l2-chip-ident.h
header file, and the
revision
field will contain a driver
specific value, or zero if no particular revision is associated with
this chip.
When the driver could not identify the selected chip,
ident
will contain
V4L2_IDENT_UNKNOWN
. When no chip matched
the ioctl will succeed but the
ident
field will contain
V4L2_IDENT_NONE
. If multiple chips matched,
ident
will contain
V4L2_IDENT_AMBIGUOUS
. In all these cases the
revision
field remains unchanged.
This ioctl is optional, not all drivers may support it. It was introduced in Linux 2.6.21, but the API was changed to the one described here in 2.6.29.
We recommended the v4l2-dbg utility over calling this ioctl directly. It is available from the LinuxTV v4l-dvb repository; see http://linuxtv.org/repo/ for access instructions.
Table A.4. struct v4l2_dbg_match
__u32 | type | See Table A.6, “Chip Match Types” for a list of possible types. | |
union | (anonymous) | ||
__u32 | addr | Match a chip by this number, interpreted according
to the type field. | |
char | name[32] | Match a chip by this name, interpreted according
to the type field. |
Table A.5. struct v4l2_dbg_chip_ident
struct v4l2_dbg_match | match | How to match the chip, see Table A.4, “struct v4l2_dbg_match”. |
__u32 | ident | A chip identifier as defined in the Linux
media/v4l2-chip-ident.h header file, or one of
the values from Table A.7, “Chip Identifiers”. |
__u32 | revision | A chip revision, chip and driver specific. |
Table A.6. Chip Match Types
V4L2_CHIP_MATCH_HOST | 0 | Match the nth chip on the card, zero for the host chip. Does not match I2C chips. |
V4L2_CHIP_MATCH_I2C_DRIVER | 1 | Match an I2C chip by its driver name. |
V4L2_CHIP_MATCH_I2C_ADDR | 2 | Match a chip by its 7 bit I2C bus address. |
V4L2_CHIP_MATCH_AC97 | 3 | Match the nth anciliary AC97 chip. |
Table A.7. Chip Identifiers
V4L2_IDENT_NONE | 0 | No chip matched. |
V4L2_IDENT_AMBIGUOUS | 1 | Multiple chips matched. |
V4L2_IDENT_UNKNOWN | 2 | A chip is present at this address, but the driver could not identify it. |
On success 0 is returned, on error -1 and the errno
variable is set appropriately. The generic error codes are described at the Generic Error Codes chapter.
The match_type
is invalid.