mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Pavel Machek <pavel@ucw.cz>,
	kernel list <linux-kernel@vger.kernel.org>,
	linux-media@vger.kernel.org, samr7@cs.washington.edu,
	gerard@gkall.hobby.nl
Cc: linux@rainbow-software.org, kilgota@auburn.edu, moinejf@free.fr
Subject: Re: gspca webcam: need to plug it 5 times before it works
Date: Mon, 11 May 2020 12:08:19 +0200	[thread overview]
Message-ID: <1e034f42-6997-d778-dce2-e5d641d91d0e@xs4all.nl> (raw)
In-Reply-To: <20200404191846.GA20044@duo.ucw.cz>

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
> 
> 
> 


      parent reply	other threads:[~2020-05-11 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04 18:47 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1e034f42-6997-d778-dce2-e5d641d91d0e@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=gerard@gkall.hobby.nl \
    --cc=kilgota@auburn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux@rainbow-software.org \
    --cc=moinejf@free.fr \
    --cc=pavel@ucw.cz \
    --cc=samr7@cs.washington.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®