linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* gspca webcam: need to plug it 5 times before it works
@ 2020-04-04 18:47 Pavel Machek
  2020-04-04 19:15 ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2020-04-04 18:47 UTC (permalink / raw)
  To: kernel list, hverkuil, linux-media; +Cc: linux, kilgota, moinejf

[-- Attachment #1: Type: text/plain, Size: 2707 bytes --]

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

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gspca webcam: need to plug it 5 times before it works
  2020-04-04 18:47 gspca webcam: need to plug it 5 times before it works Pavel Machek
@ 2020-04-04 19:15 ` Pavel Machek
  2020-04-04 19:18   ` Pavel Machek
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Machek @ 2020-04-04 19:15 UTC (permalink / raw)
  To: kernel list, hverkuil, linux-media; +Cc: linux, kilgota, moinejf

[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]

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?

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

diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
index c3610247a90e..c9756c0a78df 100644
--- a/drivers/media/usb/gspca/sq930x.c
+++ b/drivers/media/usb/gspca/sq930x.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2007 Sam Revitch <samr7@cs.washington.edu>
  */
 
+#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];


-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: gspca webcam: need to plug it 5 times before it works
  2020-04-04 19:15 ` Pavel Machek
@ 2020-04-04 19:18   ` Pavel Machek
  2020-04-14  8:59     ` Hans Verkuil
  2020-05-11 10:08     ` Hans Verkuil
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Machek @ 2020-04-04 19:18 UTC (permalink / raw)
  To: kernel list, hverkuil, linux-media, samr7, gerard; +Cc: linux, kilgota, moinejf

[-- Attachment #1: Type: text/plain, Size: 2489 bytes --]

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?
> 
> 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
 
> diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
> index c3610247a90e..c9756c0a78df 100644
> --- a/drivers/media/usb/gspca/sq930x.c
> +++ b/drivers/media/usb/gspca/sq930x.c
> @@ -7,6 +7,7 @@
>   * Copyright (C) 2007 Sam Revitch <samr7@cs.washington.edu>
>   */
>  
> +#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];
> 
> 
> -- 
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html



-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gspca webcam: need to plug it 5 times before it works
  2020-04-04 19:18   ` Pavel Machek
@ 2020-04-14  8:59     ` Hans Verkuil
  2020-05-11 10:08     ` Hans Verkuil
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2020-04-14  8:59 UTC (permalink / raw)
  To: Pavel Machek, kernel list, linux-media, samr7, gerard
  Cc: linux, kilgota, moinejf

Hi Pavel,

On 04/04/2020 21:18, Pavel Machek wrote:
> 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?
>>
>> 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

> 
> (Adding people from module_authors to the list.)
> 
>  								Pavel
>  
>> diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
>> index c3610247a90e..c9756c0a78df 100644
>> --- a/drivers/media/usb/gspca/sq930x.c
>> +++ b/drivers/media/usb/gspca/sq930x.c
>> @@ -7,6 +7,7 @@
>>   * Copyright (C) 2007 Sam Revitch <samr7@cs.washington.edu>
>>   */
>>  
>> +#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];
>>
>>
>> -- 
>> (english) http://www.livejournal.com/~pavelmachek
>> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: gspca webcam: need to plug it 5 times before it works
  2020-04-04 19:18   ` Pavel Machek
  2020-04-14  8:59     ` Hans Verkuil
@ 2020-05-11 10:08     ` Hans Verkuil
  1 sibling, 0 replies; 5+ messages in thread
From: Hans Verkuil @ 2020-05-11 10:08 UTC (permalink / raw)
  To: Pavel Machek, kernel list, linux-media, samr7, gerard
  Cc: linux, kilgota, moinejf

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

On 04/04/2020 21:18, Pavel Machek wrote:
> 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?
>>
>> 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
>  
>> diff --git a/drivers/media/usb/gspca/sq930x.c b/drivers/media/usb/gspca/sq930x.c
>> index c3610247a90e..c9756c0a78df 100644
>> --- a/drivers/media/usb/gspca/sq930x.c
>> +++ b/drivers/media/usb/gspca/sq930x.c
>> @@ -7,6 +7,7 @@
>>   * Copyright (C) 2007 Sam Revitch <samr7@cs.washington.edu>
>>   */
>>  
>> +#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];
>>
>>
>> -- 
>> (english) http://www.livejournal.com/~pavelmachek
>> (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
> 
> 
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-05-11 10:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-04 18:47 gspca webcam: need to plug it 5 times before it works Pavel Machek
2020-04-04 19:15 ` Pavel Machek
2020-04-04 19:18   ` Pavel Machek
2020-04-14  8:59     ` Hans Verkuil
2020-05-11 10:08     ` Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).