Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] Re: Nova-USB-t v2.1 version



> > Now: the problem. The ALPS TDLB7 and ALPS TDMB7 both do i2c transfers of
> > 0 bytes to detect if the devices are present, so the above cannot catch
> > the error. The solution would appear to be to fix those tuners so they do
> > a transfer of 1 byte (e.g. read a register) from the frontend device so
> > the USB i2c error detection code can work. This is whats I'm looking into
> > now... if anyone has any suggestions, please let me know.
>
> yes - replacing the ping by the register read transfer and checking the
> error code should work.

Cool! Please find the patch attached. I didn't want to check it in until 
someone had tested the ALPS TDLB7 and ALPS TDMB7 are still detected OK (I 
don't have one of those cards here right now).

Let me know what you think....
Index: linux/drivers/media/dvb/frontends/alps_tdlb7.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/alps_tdlb7.c,v
retrieving revision 1.15
diff -a -u -b -r1.15 alps_tdlb7.c
--- linux/drivers/media/dvb/frontends/alps_tdlb7.c	8 Oct 2003 23:12:46 -0000	1.15
+++ linux/drivers/media/dvb/frontends/alps_tdlb7.c	27 Jan 2004 14:34:08 -0000
@@ -663,11 +663,14 @@
 
 static int tdlb7_attach (struct dvb_i2c_bus *i2c, void **data)
 {
-	struct i2c_msg msg = { addr: 0x71, flags: 0, buf: NULL, len: 0 };
+        u8 b0 [] = { 0x02 , 0x00 };
+        u8 b1 [] = { 0, 0 };
+        struct i2c_msg msg [] = { { addr: 0x71, flags: 0, buf: b0, len: 2 },
+                                  { addr: 0x71, flags: I2C_M_RD, buf: b1, len: 2 } };
 
 	dprintk ("%s\n", __FUNCTION__);
 
-	if (i2c->xfer (i2c, &msg, 1) != 1)
+        if (i2c->xfer (i2c, msg, 2) != 2)
                 return -ENODEV;
 
 	sp8870_firmware_upload(i2c);
Index: linux/drivers/media/dvb/frontends/alps_tdmb7.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/frontends/alps_tdmb7.c,v
retrieving revision 1.22
diff -a -u -b -r1.22 alps_tdmb7.c
--- linux/drivers/media/dvb/frontends/alps_tdmb7.c	23 Jan 2004 08:37:00 -0000	1.22
+++ linux/drivers/media/dvb/frontends/alps_tdmb7.c	27 Jan 2004 14:34:08 -0000
@@ -404,11 +404,14 @@
 
 static int tdmb7_attach (struct dvb_i2c_bus *i2c, void **data)
 {
-	struct i2c_msg msg = { .addr = 0x43, .flags = 0, .buf = NULL,. len = 0 };
+        u8 b0 [] = { 0x7 };
+        u8 b1 [] = { 0 };
+        struct i2c_msg msg [] = { { .addr = 0x43, .flags = 0, .buf = b0, .len = 1 },
+                                  { .addr = 0x43, .flags = I2C_M_RD, .buf = b1, .len = 1 } };
 
 	dprintk ("%s\n", __FUNCTION__);
 
-	if (i2c->xfer (i2c, &msg, 1) != 1)
+        if (i2c->xfer (i2c, msg, 2) != 2)
                 return -ENODEV;
 
 	return dvb_register_frontend (tdmb7_ioctl, i2c, NULL, &tdmb7_info);
Index: linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
===================================================================
RCS file: /cvs/linuxtv/dvb-kernel/linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c,v
retrieving revision 1.21
diff -a -u -b -r1.21 dvb-ttusb-budget.c
--- linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	18 Jan 2004 00:28:35 -0000	1.21
+++ linux/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c	27 Jan 2004 14:34:09 -0000
@@ -224,6 +224,9 @@
 
 	err = ttusb_result(ttusb, b, 0x20);
 
+        /* check if the i2c transaction was successful */
+        if ((snd_len != b[5]) || (rcv_len != b[6])) return -EREMOTEIO;
+
 	if (rcv_len > 0) {
 
 		if (err || b[0] != 0x55 || b[1] != id) {
@@ -274,7 +277,7 @@
 				    snd_buf, snd_len, rcv_buf, rcv_len);
 
 		if (err < rcv_len) {
-			printk("%s: i == %i\n", __FUNCTION__, i);
+			dprintk("%s: i == %i\n", __FUNCTION__, i);
 			break;
 		}
 

Home | Main Index | Thread Index