Skip to contentSkip to conversation

gspca webcam: need to plug it 5 times before it works

DISCUSSION Pavel Machek 2 participants 5 messages Apr 4, 2020 – May 11, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi!

..but if I'm patient enough, it eventually starts working... somehow.

Incoming data seems to go in reliably. Outgoing commands (such as change gain) don't seem to be unreliable.

Any idea how to debug / what could be wrong?

Thanks,
Pavel

[36790.733135] usb 2-1.1: USB disconnect, device number 30
[39686.814093] usb 2-1.1: new high-speed USB device number 33 using ehci-pci
[39686.853138] usb 2-1.1: New USB device found, idVendor=2770, idProduct=930c, bcdDevice= 1.00
[39686.853162] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[39686.853178] usb 2-1.1: Product: USB 2.0 PC camera 
[39686.853193] usb 2-1.1: Manufacturer: SQ Tech CO., LTD.
[39686.859210] gspca_main: sq930x-2.14.0 probing 2770:930c
[39688.769984] gspca_sq930x: Unknown sensor
[39688.770037] sq930x: probe of 2-1.1:1.0 failed with error -22
[39748.021772] usb 2-1.1: USB disconnect, device number 33
[39754.901755] usb 2-1.1: new high-speed USB device number 34 using ehci-pci
[39754.940668] usb 2-1.1: New USB device found, idVendor=2770, idProduct=930c, bcdDevice= 1.00
[39754.940688] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[39754.940700] usb 2-1.1: Product: USB 2.0 PC camera 
[39754.940710] usb 2-1.1: Manufacturer: SQ Tech CO., LTD.
[39754.944401] gspca_main: sq930x-2.14.0 probing 2770:930c
[39756.845672] gspca_sq930x: Unknown sensor
[39756.845750] sq930x: probe of 2-1.1:1.0 failed with error -22
[39759.797800] usb 2-1.1: USB disconnect, device number 34
[39763.349750] usb 2-1.1: new high-speed USB device number 35 using ehci-pci
[39763.389838] usb 2-1.1: New USB device found, idVendor=2770, idProduct=930c, bcdDevice= 1.00
[39763.389859] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[39763.389871] usb 2-1.1: Product: USB 2.0 PC camera 
[39763.389882] usb 2-1.1: Manufacturer: SQ Tech CO., LTD.
[39763.391369] gspca_main: sq930x-2.14.0 probing 2770:930c
[39765.297703] gspca_sq930x: Unknown sensor
[39765.297787] sq930x: probe of 2-1.1:1.0 failed with error -22
[39775.669563] usb 2-1.1: USB disconnect, device number 35
[39779.477651] usb 2-1.1: new high-speed USB device number 36 using ehci-pci
[39779.517205] usb 2-1.1: New USB device found, idVendor=2770, idProduct=930c, bcdDevice= 1.00
[39779.517227] usb 2-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[39779.517239] usb 2-1.1: Product: USB 2.0 PC camera 
[39779.517250] usb 2-1.1: Manufacturer: SQ Tech CO., LTD.
[39779.519033] gspca_main: sq930x-2.14.0 probing 2770:930c
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#1 lore raw

Hi!

Quoted 6 lines

..but if I'm patient enough, it eventually starts working... somehow.

Incoming data seems to go in reliably. Outgoing commands (such as change gain) don't seem to be unreliable.

Any idea how to debug / what could be wrong?

And I can force it to probe like this: which... makes it work, but does not fix the outgoing commands.

Any ideas?

Best regards,
Pavel

drivers/media/usb/gspca/sq930x.c +13 -6
index c3610247a90e..c9756c0a78df 100644
@@ -7,6 +7,7 @@
  * Copyright (C) 2007 Sam Revitch <[email protected]>
  */
 
+#define DEBUG
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #define MODULE_NAME "sq930x"
@@ -446,7 +447,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
 			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			value, index, NULL, 0,
 			500);
-	msleep(30);
+	msleep(90);
 	if (ret < 0) {
 		pr_err("reg_w %04x %04x failed %d\n", value, index, ret);
 		gspca_dev->usb_err = ret;
@@ -635,19 +636,25 @@ static void cmos_probe(struct gspca_dev *gspca_dev)
 		SENSOR_MT9V111,
 	};
 
+	printk("CMOS Probing...\n");
 	for (i = 0; i < ARRAY_SIZE(probe_order); i++) {
+	  printk("Probing type %d...\n", i);
+	  
 		sensor = &sensor_tb[probe_order[i]];
 		ucbus_write(&sd->gspca_dev, sensor->cmd, sensor->cmd_len, 8);
 		gpio_init(sd, sensor->gpio);
-		msleep(100);
+		msleep(200);
 		reg_r(gspca_dev, (sensor->i2c_addr << 8) | 0x001c, 1);
-		msleep(100);
-		if (gspca_dev->usb_buf[0] != 0)
+		msleep(200);
+		if (gspca_dev->usb_buf[0] != 0) {
+		  printk("#### LUCKY! Have type %d\n", i);
 			break;
+		}
 	}
 	if (i >= ARRAY_SIZE(probe_order)) {
-		pr_err("Unknown sensor\n");
-		gspca_dev->usb_err = -EINVAL;
+		printk("Unknown sensor ... hmm?\n");
+		sd->sensor = probe_order[i-1];
+		//gspca_dev->usb_err = -EINVAL;
 		return;
 	}
 	sd->sensor = probe_order[i];
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#2 lore raw

Hi!

Quoted 11 lines
Quoted 6 lines

..but if I'm patient enough, it eventually starts working... somehow.

Incoming data seems to go in reliably. Outgoing commands (such as change gain) don't seem to be unreliable.

Any idea how to debug / what could be wrong?

And I can force it to probe like this: which... makes it work, but does not fix the outgoing commands.

Any ideas?

(Adding people from module_authors to the list.)

Pavel

Quoted 57 lines
drivers/media/usb/gspca/sq930x.c +13 -6
index c3610247a90e..c9756c0a78df 100644
@@ -7,6 +7,7 @@
  * Copyright (C) 2007 Sam Revitch <[email protected]>
  */
 
+#define DEBUG
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #define MODULE_NAME "sq930x"
@@ -446,7 +447,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
 			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			value, index, NULL, 0,
 			500);
-	msleep(30);
+	msleep(90);
 	if (ret < 0) {
 		pr_err("reg_w %04x %04x failed %d\n", value, index, ret);
 		gspca_dev->usb_err = ret;
@@ -635,19 +636,25 @@ static void cmos_probe(struct gspca_dev *gspca_dev)
 		SENSOR_MT9V111,
 	};
 
+	printk("CMOS Probing...\n");
 	for (i = 0; i < ARRAY_SIZE(probe_order); i++) {
+	  printk("Probing type %d...\n", i);
+	  
 		sensor = &sensor_tb[probe_order[i]];
 		ucbus_write(&sd->gspca_dev, sensor->cmd, sensor->cmd_len, 8);
 		gpio_init(sd, sensor->gpio);
-		msleep(100);
+		msleep(200);
 		reg_r(gspca_dev, (sensor->i2c_addr << 8) | 0x001c, 1);
-		msleep(100);
-		if (gspca_dev->usb_buf[0] != 0)
+		msleep(200);
+		if (gspca_dev->usb_buf[0] != 0) {
+		  printk("#### LUCKY! Have type %d\n", i);
 			break;
+		}
 	}
 	if (i >= ARRAY_SIZE(probe_order)) {
-		pr_err("Unknown sensor\n");
-		gspca_dev->usb_err = -EINVAL;
+		printk("Unknown sensor ... hmm?\n");
+		sd->sensor = probe_order[i-1];
+		//gspca_dev->usb_err = -EINVAL;
 		return;
 	}
 	sd->sensor = probe_order[i];
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#3 lore raw

Hi Pavel,

Quoted 13 lines · Pavel Machek

Hi!

Quoted 11 lines
Quoted 6 lines

..but if I'm patient enough, it eventually starts working... somehow.

Incoming data seems to go in reliably. Outgoing commands (such as change gain) don't seem to be unreliable.

Any idea how to debug / what could be wrong?

And I can force it to probe like this: which... makes it work, but does not fix the outgoing commands.

Any ideas?

You're on your own, I'm afraid.

I think I have one or two of these webcams, but they are in the Netherlands while I am in Norway, and I have no idea when I will be back.

Frankly, I would recommend buying a uvc webcam rather than spending any time on these old crappy webcams.

Regards,

Hans

Quoted 65 lines

(Adding people from module_authors to the list.)

Pavel

Quoted 57 lines
drivers/media/usb/gspca/sq930x.c +13 -6
index c3610247a90e..c9756c0a78df 100644
@@ -7,6 +7,7 @@
  * Copyright (C) 2007 Sam Revitch <[email protected]>
  */
 
+#define DEBUG
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #define MODULE_NAME "sq930x"
@@ -446,7 +447,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
 			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			value, index, NULL, 0,
 			500);
-	msleep(30);
+	msleep(90);
 	if (ret < 0) {
 		pr_err("reg_w %04x %04x failed %d\n", value, index, ret);
 		gspca_dev->usb_err = ret;
@@ -635,19 +636,25 @@ static void cmos_probe(struct gspca_dev *gspca_dev)
 		SENSOR_MT9V111,
 	};
 
+	printk("CMOS Probing...\n");
 	for (i = 0; i < ARRAY_SIZE(probe_order); i++) {
+	  printk("Probing type %d...\n", i);
+	  
 		sensor = &sensor_tb[probe_order[i]];
 		ucbus_write(&sd->gspca_dev, sensor->cmd, sensor->cmd_len, 8);
 		gpio_init(sd, sensor->gpio);
-		msleep(100);
+		msleep(200);
 		reg_r(gspca_dev, (sensor->i2c_addr << 8) | 0x001c, 1);
-		msleep(100);
-		if (gspca_dev->usb_buf[0] != 0)
+		msleep(200);
+		if (gspca_dev->usb_buf[0] != 0) {
+		  printk("#### LUCKY! Have type %d\n", i);
 			break;
+		}
 	}
 	if (i >= ARRAY_SIZE(probe_order)) {
-		pr_err("Unknown sensor\n");
-		gspca_dev->usb_err = -EINVAL;
+		printk("Unknown sensor ... hmm?\n");
+		sd->sensor = probe_order[i-1];
+		//gspca_dev->usb_err = -EINVAL;
 		return;
 	}
 	sd->sensor = probe_order[i];
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
#4 lore raw
In reply to Pavel Machek

Hi Pavel,

I tested with my sq930x (Creative WebCam Notebook Ultra) and I couldn't reproduce this. Changing gain/exposure while streaming worked fine too.

It could be flaky usb hardware on your side, it's hard to tell.

Regards,

Hans

Quoted 78 lines · Pavel Machek

Hi!

Quoted 11 lines
Quoted 6 lines

..but if I'm patient enough, it eventually starts working... somehow.

Incoming data seems to go in reliably. Outgoing commands (such as change gain) don't seem to be unreliable.

Any idea how to debug / what could be wrong?

And I can force it to probe like this: which... makes it work, but does not fix the outgoing commands.

Any ideas?

(Adding people from module_authors to the list.)

Pavel

Quoted 57 lines
drivers/media/usb/gspca/sq930x.c +13 -6
index c3610247a90e..c9756c0a78df 100644
@@ -7,6 +7,7 @@
  * Copyright (C) 2007 Sam Revitch <[email protected]>
  */
 
+#define DEBUG
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
 #define MODULE_NAME "sq930x"
@@ -446,7 +447,7 @@ static void reg_w(struct gspca_dev *gspca_dev, u16 value, u16 index)
 			USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
 			value, index, NULL, 0,
 			500);
-	msleep(30);
+	msleep(90);
 	if (ret < 0) {
 		pr_err("reg_w %04x %04x failed %d\n", value, index, ret);
 		gspca_dev->usb_err = ret;
@@ -635,19 +636,25 @@ static void cmos_probe(struct gspca_dev *gspca_dev)
 		SENSOR_MT9V111,
 	};
 
+	printk("CMOS Probing...\n");
 	for (i = 0; i < ARRAY_SIZE(probe_order); i++) {
+	  printk("Probing type %d...\n", i);
+	  
 		sensor = &sensor_tb[probe_order[i]];
 		ucbus_write(&sd->gspca_dev, sensor->cmd, sensor->cmd_len, 8);
 		gpio_init(sd, sensor->gpio);
-		msleep(100);
+		msleep(200);
 		reg_r(gspca_dev, (sensor->i2c_addr << 8) | 0x001c, 1);
-		msleep(100);
-		if (gspca_dev->usb_buf[0] != 0)
+		msleep(200);
+		if (gspca_dev->usb_buf[0] != 0) {
+		  printk("#### LUCKY! Have type %d\n", i);
 			break;
+		}
 	}
 	if (i >= ARRAY_SIZE(probe_order)) {
-		pr_err("Unknown sensor\n");
-		gspca_dev->usb_err = -EINVAL;
+		printk("Unknown sensor ... hmm?\n");
+		sd->sensor = probe_order[i-1];
+		//gspca_dev->usb_err = -EINVAL;
 		return;
 	}
 	sd->sensor = probe_order[i];
Signature · 3 lines
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html