Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e78567d2 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

[media] gspca/sn9c20x: Test if sensor is a OV sensor



Instead of just assuming a ov9650 sensor based on USB ID,
double-check it, by reading the sensor ID.

Acked-by: default avatarJean-Francois Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent dd89aec4
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1224,8 +1224,17 @@ static int i2c_r2(struct gspca_dev *gspca_dev, u8 reg, u16 *val)
static int ov9650_init_sensor(struct gspca_dev *gspca_dev)
{
	int i;
	u16 id;
	struct sd *sd = (struct sd *) gspca_dev;

	if (i2c_r2(gspca_dev, 0x1c, &id) < 0)
		return -EINVAL;

	if (id != 0x7fa2) {
		err("sensor id for ov9650 doesn't match (0x%04x)", id);
		return -ENODEV;
	}

	for (i = 0; i < ARRAY_SIZE(ov9650_init); i++) {
		if (i2c_w1(gspca_dev, ov9650_init[i].reg,
				ov9650_init[i].val) < 0) {