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

Commit 38ffcd10 authored by Patrick Boettcher's avatar Patrick Boettcher Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB (13581): DiBUSB: fix I2c access when there is a read-access w/o write sequence



This patch fixes the behaviour of the dibusb-i2c-access which was previously changed to avoid accidental EEprom writes:

Now it allow i2c-reads without prepended i2c-writes, but it is still not doing anything in case the EEprom is addressed.

Thanks to Mario Bachmann for testing.

Tested-by: default avatarMario Bachmann <grafgrimm77@gmx.de>
Cc: Mario Bachmann <grafgrimm77@gmx.de>
Signed-off-by: default avatarPatrick Boettcher <pboettcher@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent d995a187
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -142,9 +142,14 @@ static int dibusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num
		} else if ((msg[i].flags & I2C_M_RD) == 0) {
			if (dibusb_i2c_msg(d, msg[i].addr, msg[i].buf,msg[i].len,NULL,0) < 0)
				break;
		} else
		} else if (msg[i].addr != 0x50) {
			/* 0x50 is the address of the eeprom - we need to protect it
			 * from dibusb's bad i2c implementation: reads without
			 * writing the offset before are forbidden */
			if (dibusb_i2c_msg(d, msg[i].addr, NULL, 0, msg[i].buf, msg[i].len) < 0)
				break;
		}
	}

	mutex_unlock(&d->i2c_mutex);
	return i;