diff options
author | István Váradi <ivaradi@varadiistvan.hu> | 2024-02-13 21:20:32 +0100 |
---|---|---|
committer | Hans Verkuil <hverkuil-cisco@xs4all.nl> | 2024-04-08 13:48:18 +0200 |
commit | 3c2ea5ec1d86d07329e9a117186a0c8cd30d1c40 (patch) | |
tree | fcb19f8e86e136cf0475878868d6d44de0ee3b87 /drivers/media | |
parent | b82779648dfd3814df4e381f086326ec70fd791f (diff) | |
download | linux-stable-3c2ea5ec1d86d07329e9a117186a0c8cd30d1c40.tar.gz linux-stable-3c2ea5ec1d86d07329e9a117186a0c8cd30d1c40.tar.bz2 linux-stable-3c2ea5ec1d86d07329e9a117186a0c8cd30d1c40.zip |
media: anysee: accept read buffers of length 1 in anysee_master_xfer
anysee_master_xfer currently accepts read messages of length 2 only.
However, several frontends, e.g. tda10023 send buffers of length 1,
containing an 8-bit register number (see tda10023_readreg).
These buffers are rejected currently, making many Anysee variants
to not work. In these cases the "Unsupported Anysee version"
message is logged.
This patch alters the function to accept buffers of a length of 1 too.
Signed-off-by: István Váradi <ivaradi@varadiistvan.hu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil: add spaces around '<', fix typo in 'sevaral']
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/anysee.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c index a1235d0cce92..8699846eb416 100644 --- a/drivers/media/usb/dvb-usb-v2/anysee.c +++ b/drivers/media/usb/dvb-usb-v2/anysee.c @@ -202,14 +202,14 @@ static int anysee_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msg, while (i < num) { if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) { - if (msg[i].len != 2 || msg[i + 1].len > 60) { + if (msg[i].len < 1 || msg[i].len > 2 || msg[i + 1].len > 60) { ret = -EOPNOTSUPP; break; } buf[0] = CMD_I2C_READ; buf[1] = (msg[i].addr << 1) | 0x01; buf[2] = msg[i].buf[0]; - buf[3] = msg[i].buf[1]; + buf[3] = (msg[i].len < 2) ? 0 : msg[i].buf[1]; buf[4] = msg[i].len-1; buf[5] = msg[i+1].len; ret = anysee_ctrl_msg(d, buf, 6, msg[i+1].buf, |