* [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.
@ 2007-12-05 0:44 Brett T. Warden
2007-12-05 0:46 ` Alan Cox
0 siblings, 1 reply; 4+ messages in thread
From: Brett T. Warden @ 2007-12-05 0:44 UTC (permalink / raw)
To: linux-kernel, trivial; +Cc: Brett T. Warden
Setting aggressive=1 bypasses the friendly auto-detection by polling the status register, and instead attempts to initialize the qcam directly. Not friendly to other parallel devices, but much more reliable than the auto-detection.
Signed-off-by: Brett T. Warden <brett.warden@gmail.com>
---
drivers/media/video/bw-qcam.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 5842352..b74a9cb 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -82,11 +82,16 @@ OTHER DEALINGS IN THE SOFTWARE.
static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */
static unsigned int yieldlines=4; /* Yield after this many during capture */
static int video_nr = -1;
+static unsigned int aggressive; /* Whether to probe aggressively */
module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0);
module_param(video_nr, int, 0);
+/* Set aggressive=1 to avoid detection by polling status register and
+ * immediately attempt to initialize qcam */
+module_param(aggressive, int, 0);
+
static inline int read_lpstatus(struct qcam_device *q)
{
return parport_read_status(q->pport);
@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;
+ if (aggressive)
+ return 1;
+
lastreg = reg = read_lpstatus(q) & 0xf0;
for (i = 0; i < 500; i++)
@@ -354,12 +362,12 @@ static int qc_detect(struct qcam_device *q)
/* Be (even more) liberal in what you accept... */
-/* if (count > 30 && count < 200) */
if (count > 20 && count < 400) {
return 1; /* found */
} else {
printk(KERN_ERR "No Quickcam found on port %s\n",
q->pport->name);
+ printk(KERN_DEBUG "Quickcam detection counter: %u\n", count);
return 0; /* not found */
}
}
--
1.5.2.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.
2007-12-05 0:44 [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization Brett T. Warden
@ 2007-12-05 0:46 ` Alan Cox
[not found] ` <a372714f0712050849x6247f464p86be8598cbf5990b@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Alan Cox @ 2007-12-05 0:46 UTC (permalink / raw)
To: Brett T. Warden; +Cc: linux-kernel, trivial, Brett T. Warden
On Tue, 4 Dec 2007 16:44:41 -0800
"Brett T. Warden" <brett.warden@gmail.com> wrote:
> Setting aggressive=1 bypasses the friendly auto-detection by polling the status register, and instead attempts to initialize the qcam directly. Not friendly to other parallel devices, but much more reliable than the auto-detection.
Someone still has a bw-qcam device ?
The status polling ought to be rock solid - what values do you see ?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.
[not found] ` <a372714f0712050849x6247f464p86be8598cbf5990b@mail.gmail.com>
@ 2007-12-05 16:51 ` Brett Warden
0 siblings, 0 replies; 4+ messages in thread
From: Brett Warden @ 2007-12-05 16:51 UTC (permalink / raw)
To: Alan Cox, linux-kernel, trivial
Sorry, forgot to copy back to the lists.
On Dec 5, 2007 8:49 AM, Brett Warden <brett.warden@gmail.com> wrote:
> On Dec 4, 2007 4:46 PM, Alan Cox <alan@lxorguk.ukuu.org.uk> wrote:
> >
> > Someone still has a bw-qcam device ?
>
> Yes. I haven't found a better option for very-low-light, although I
> admit I haven't looked in a long while. The last one I tried was an
> OV518+, but of course that driver seems to have been abandoned.
>
> > The status polling ought to be rock solid - what values do you see ?
>
> It has been as high as 94-96, but after being connected, powered, and
> used for a while, it drops sometimes into the 40s, but has even been
> as low as 8-14. When it's that low, it never comes back up until
> either I disconnect/reconnect the power, or I force the driver to
> initialize it through this hack. Even after trying that again just
> now, it's ranging from 24-33.
>
> --
> Brett Warden
>
--
Brett Warden
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization.
@ 2008-01-02 23:51 Brett T. Warden
0 siblings, 0 replies; 4+ messages in thread
From: Brett T. Warden @ 2008-01-02 23:51 UTC (permalink / raw)
To: linux-kernel, trivial; +Cc: Bill Davidsen, Alan Cox, Brett T. Warden
Setting aggressive=1 bypasses the friendly auto-detection by polling the status register, and instead attempts to initialize the qcam directly. Not friendly to other parallel devices, but much more reliable than the auto-detection.
Signed-off-by: Brett T. Warden <brett.warden@gmail.com>
---
drivers/media/video/bw-qcam.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c
index 5842352..b74a9cb 100644
--- a/drivers/media/video/bw-qcam.c
+++ b/drivers/media/video/bw-qcam.c
@@ -82,11 +82,16 @@ OTHER DEALINGS IN THE SOFTWARE.
static unsigned int maxpoll=250; /* Maximum busy-loop count for qcam I/O */
static unsigned int yieldlines=4; /* Yield after this many during capture */
static int video_nr = -1;
+static unsigned int aggressive; /* Whether to probe aggressively */
module_param(maxpoll, int, 0);
module_param(yieldlines, int, 0);
module_param(video_nr, int, 0);
+/* Set aggressive=1 to avoid detection by polling status register and
+ * immediately attempt to initialize qcam */
+module_param(aggressive, int, 0);
+
static inline int read_lpstatus(struct qcam_device *q)
{
return parport_read_status(q->pport);
@@ -331,6 +336,9 @@ static int qc_detect(struct qcam_device *q)
int count = 0;
int i;
+ if (aggressive)
+ return 1;
+
lastreg = reg = read_lpstatus(q) & 0xf0;
for (i = 0; i < 500; i++)
@@ -354,12 +362,12 @@ static int qc_detect(struct qcam_device *q)
/* Be (even more) liberal in what you accept... */
-/* if (count > 30 && count < 200) */
if (count > 20 && count < 400) {
return 1; /* found */
} else {
printk(KERN_ERR "No Quickcam found on port %s\n",
q->pport->name);
+ printk(KERN_DEBUG "Quickcam detection counter: %u\n", count);
return 0; /* not found */
}
}
--
1.5.3.7
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-01-02 23:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05 0:44 [PATCH] bw-qcam: Adds module parameter 'aggressive' to skip polite auto-detection prior to direct initialization Brett T. Warden
2007-12-05 0:46 ` Alan Cox
[not found] ` <a372714f0712050849x6247f464p86be8598cbf5990b@mail.gmail.com>
2007-12-05 16:51 ` Brett Warden
2008-01-02 23:51 Brett T. Warden
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).