mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: kernel list <linux-kernel@vger.kernel.org>,
	hverkuil@xs4all.nl, linux-media@vger.kernel.org
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: Sat, 4 Apr 2020 21:15:30 +0200	[thread overview]
Message-ID: <20200404191530.GA19753@duo.ucw.cz> (raw)
In-Reply-To: <20200404184732.GA17534@duo.ucw.cz>

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

  reply	other threads:[~2020-04-04 19:15 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 [this message]
2020-04-04 19:18   ` Pavel Machek
2020-04-14  8:59     ` Hans Verkuil
2020-05-11 10:08     ` Hans Verkuil

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=20200404191530.GA19753@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=hverkuil@xs4all.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 \
    /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®