ioctl VIDIOC_DBG_G_CHIP_IDENT

&manvol;

VIDIOC_DBG_G_CHIP_IDENT

Identify the chips on a TV card

    	int ioctl
    	int fd
    	int request
    	struct v4l2_dbg_chip_ident
    *argp

## Arguments

`fd`

- &fd;

`request`

- VIDIOC_DBG_G_CHIP_IDENT

`argp`

## Description

### Experimental

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 (&v4l-ml;) so it can be fixed.

To query the driver applications must initialize the match.type and match.addr or match.name fields of a &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;. The number zero always selects the host chip, ⪚ 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;.

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.

## struct v4l2_dbg_match

&cs-ustr;
__u32 | type | See ident-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.

## struct v4l2_dbg_chip_ident

&cs-str;
struct v4l2_dbg_match | match | How to match the chip, see ident-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 chip-ids.
__u32 | revision | A chip revision, chip and driver specific.

## Chip Match Types

&cs-def;
`V4L2_CHIP_MATCH_BRIDGE` | 0 | Match the nth chip on the card, zero for the bridge chip. Does not match sub-devices.
`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.
`V4L2_CHIP_MATCH_SUBDEV` | 4 | Match the nth sub-device. Can't be used with this ioctl.

## Chip Identifiers

&cs-def;
`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.

&return-value;

EINVAL

- The match_type is invalid.