Thread: [Linux-uvc-devel] PATCH: Acer Crystal Eye WebCam (064e:a101 Suyin Corp.)
Linux UVC driver and tools
Brought to you by:
pinchartl
|
From: Michael S. <spa...@gm...> - 2008-06-04 15:51:38
|
Hi, I've got an Acer laptop with a Crystal Eye WebCam which identifies as follows: Bus 003 Device 002: ID 064e:a101 Suyin Corp. This is listed as a supported device here: http://linux-uvc.berlios.de/#devices But in practice using the current subversion checkout: URL: svn://svn.berlios.de/linux-uvc/linux-uvc/trunk Repository Root: svn://svn.berlios.de/linux-uvc Repository UUID: 790547d8-3c09-0410-a358-857946b093de Revision: 212 Node Kind: directory Schedule: normal Last Changed Author: pinchartl Last Changed Rev: 212 Last Changed Date: 2008-05-29 15:56:11 +0100 (Thu, 29 May 2008) When compiled and running (say), luvcview, I get this error: ~/Incoming> luvcview luvcview 0.2.4 [snip] Unable to start capture: Protocol error Error grabbing Cleanup done. Exiting ... I get similar errors from other software (eg opencv, python v4l2 bindings, etc): ~/Incoming> ./WebCam.py Traceback (most recent call last): File "./WebCam.py", line 238, in <module> VideoCaptureSource(fps=32), File "./WebCam.py", line 139, in __init__ self.camera.start() EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 71, Protocol error It turns out that, for whatever reason, when the above error occurs, it switches on the webcam. (a little green light comes on). Rerunning results in the program then normally working (but green light goes out on exit, etc). Then failing when rerun again (leaving light on), etc. Anyway, I hunted down the problem - the "Protocol Error" is actually caused by this line: uvc_video.c if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) return ret; So it's *something* to do with the device presumably not always being switched "on" I guess. How that is supposed to be done, I don't know. HOWEVER, I have made a patch to uvc_video.c that works: ~/linux-uvc> svn diff Index: uvc_video.c =================================================================== --- uvc_video.c (revision 212) +++ uvc_video.c (working copy) @@ -750,8 +750,13 @@ if (i >= intf->num_altsetting) return -EIO; - if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) - return ret; + if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) { + if (ret == -71) { // If we get this error, give it another go & retry + if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) + return ret; + } else + return ret; + } ret = uvc_init_video_isoc(video, ep); } else { You'll note that I just blindly give the same call another go. The first one manages to switch the green light on, the second causes it to be useful/usable. This rather surprisingly worked, and so this has fixed this issue with this webcam as used by the following software: * pygame.camera * opencv * luvcview * Skype If this isn't the "correct" way of doing this,please let me know what to test and I'll try a different patch :-) BTW, many thanks for writing this module - it's great/really useful :-) Regards, Michael. |
|
From: MIchael S. <spa...@gm...> - 2008-06-06 02:02:27
|
Hi,
[ I tried sending this yesterday, but it doesn't seem to have hit the
archives, and I did't receive a copy, so I'm resending it. Apologies
if its seen twice! ]
I've got an Acer laptop with a built in Crystal Eye WebCam which identifies
as follows:
Bus 003 Device 002: ID 064e:a101 Suyin Corp.
This is listed as a supported device here:
http://linux-uvc.berlios.de/#devices
But in practice using the current subversion checkout:
Repository Root: svn://svn.berlios.de/linux-uvc
Repository UUID: 790547d8-3c09-0410-a358-857946b093de
Revision: 212
Node Kind: directory
Schedule: normal
Last Changed Author: pinchartl
Last Changed Rev: 212
Last Changed Date: 2008-05-29 15:56:11 +0100 (Thu, 29 May 2008)
When compiled and running (say), luvcview, I get this error:
~/Incoming> luvcview
luvcview 0.2.4
[... snip ...]
Unable to start capture: Protocol error
Error grabbing
Cleanup done. Exiting ...
I get similar errors from other software (eg opencv, python v4l2
bindings, etc):
~/Incoming> ./WebCam.py
Traceback (most recent call last):
File "./WebCam.py", line 238, in <module>
VideoCaptureSource(fps=32),
File "./WebCam.py", line 139, in __init__
self.camera.start()
EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 71, Protocol error
It turns out that, for whatever reason, when the above error occurs,
it switches on the webcam. (a little green light comes on). Rerunning
results in the program then normally working (but green light goes out
on exit, etc). Then failing when rerun again (leaving light on), etc.
Anyway, I hunted down the problem - the "Protocol Error" is actually
caused by this line...
uvc_video.c
if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
return ret;
... switching it "on" I guess. How that is supposed to be done, I don't
know, but it does switch it on. So, I fiddled...
And based on that, I have made a patch to uvc_video.c that works:
~/linux-uvc> svn diff
Index: uvc_video.c
===================================================================
--- uvc_video.c (revision 212)
+++ uvc_video.c (working copy)
@@ -750,8 +750,13 @@
if (i >= intf->num_altsetting)
return -EIO;
- if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
- return ret;
+ if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) {
+ if (ret == -71) { // If we get this error, give it another go & retry
+ if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
+ return ret;
+ } else
+ return ret;
+ }
ret = uvc_init_video_isoc(video, ep);
} else {
You'll note that I just blindly give the same call another go - I realise
this is probably wrong, but I don't know what the right thing would be.
It does have the merit of working. It seems that this is because the
first call manages to switch the green light on, and the second causes
it to be useful/usable.
This has rather surprisingly worked, and so this has fixed this issue with
this webcam as used by the following software:
* pygame.camera
* opencv
* luvcview
* Skype
As a result, hopefully the patch above is useful.
If this isn't the "correct" way of doing this,please let me know what
to test and I'll try a different patch :-)
BTW, many thanks for writing this module - it's great/really useful :-)
Best Regards,
Michael.
|
|
From: Laurent P. <lau...@sk...> - 2008-06-07 00:12:51
|
Hi Michael, On Wednesday 04 June 2008, Michael Sparks wrote: > Hi, > > I've got an Acer laptop with a Crystal Eye WebCam which identifies as > follows: > > Bus 003 Device 002: ID 064e:a101 Suyin Corp. > > This is listed as a supported device here: > http://linux-uvc.berlios.de/#devices > > But in practice using the current subversion checkout: > > URL: svn://svn.berlios.de/linux-uvc/linux-uvc/trunk > Repository Root: svn://svn.berlios.de/linux-uvc > Repository UUID: 790547d8-3c09-0410-a358-857946b093de > Revision: 212 > Node Kind: directory > Schedule: normal > Last Changed Author: pinchartl > Last Changed Rev: 212 > Last Changed Date: 2008-05-29 15:56:11 +0100 (Thu, 29 May 2008) > > When compiled and running (say), luvcview, I get this error: > ~/Incoming> luvcview > luvcview 0.2.4 > > [snip] > Unable to start capture: Protocol error > Error grabbing > Cleanup done. Exiting ... *sigh*. I hate protocol errors. They are most of the time caused by buggy devices, and buggy devices mean I have to find a software workaround :-S > I get similar errors from other software (eg opencv, python v4l2 bindings, > etc): ~/Incoming> ./WebCam.py > Traceback (most recent call last): > File "./WebCam.py", line 238, in <module> > VideoCaptureSource(fps=32), > File "./WebCam.py", line 139, in __init__ > self.camera.start() > EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 71, Protocol error > > It turns out that, for whatever reason, when the above error occurs, > it switches on the webcam. (a little green light comes on). Rerunning > results in the program then normally working (but green light goes out > on exit, etc). Then failing when rerun again (leaving light on), etc. > > Anyway, I hunted down the problem - the "Protocol Error" is actually > caused by this line: > uvc_video.c > > if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) > < 0) return ret; > > So it's *something* to do with the device presumably not always being > switched "on" I guess. How that is supposed to be done, I don't know. > > HOWEVER, I have made a patch to uvc_video.c that works: > > ~/linux-uvc> svn diff > Index: uvc_video.c > =================================================================== > --- uvc_video.c (revision 212) > +++ uvc_video.c (working copy) > @@ -750,8 +750,13 @@ > if (i >= intf->num_altsetting) > return -EIO; > > - if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) > < 0) - return ret; > + if ((ret = usb_set_interface(video->dev->udev, > intfnum, i)) < 0) { > + if (ret == -71) { // If we get this error, > give it another go & retry > + if ((ret = > usb_set_interface(video->dev->udev, intfnum, i)) < 0) > + return ret; > + } else > + return ret; > + } > > ret = uvc_init_video_isoc(video, ep); > } else { > > You'll note that I just blindly give the same call another go. The > first one manages to > switch the green light on, the second causes it to be useful/usable. > > This rather surprisingly worked, and so this has fixed this issue with > this webcam as used by the following software: > * pygame.camera > * opencv > * luvcview > * Skype > > If this isn't the "correct" way of doing this,please let me know what > to test and I'll try a different patch :-) Could you please try to blindly ignore the usb_set_interface return value ? I'd like to know if the second call is really required. What kernel version are you running ? > BTW, many thanks for writing this module - it's great/really useful :-) You're welcome. Now if we could convince webcam manufacturers to use the Linux driver for testing purpose I'd be much happier :-) Best regards, Laurent Pinchart |
|
From: MIchael S. <spa...@gm...> - 2008-06-07 00:43:27
|
Hi Laurent,
Many thanks for getting back to me :)
On Friday 06 June 2008 23:12:50 Laurent Pinchart wrote:
..
> *sigh*. I hate protocol errors. They are most of the time caused by buggy
> devices, and buggy devices mean I have to find a software workaround :-S
I guessed that might be the case :-/
> Could you please try to blindly ignore the usb_set_interface return value ?
> I'd like to know if the second call is really required.
I've tried changing it to specifically ignore that error:
Index: uvc_video.c
===================================================================
--- uvc_video.c (revision 213)
+++ uvc_video.c (working copy)
@@ -750,8 +750,10 @@
if (i >= intf->num_altsetting)
return -EIO;
- if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
- return ret;
+ if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) {
+ if (ret != -71) // Let's try blindly ignoring protocol errors as requested
+ return ret;
+ }
ret = uvc_init_video_isoc(video, ep);
} else {
Any when I now retry, I get the following error:
~/> ./WebCam.py
Traceback (most recent call last):
File "./WebCam.py", line 214, in <module>
VideoCapturePlayer().run() # Runs at full speed - basic test case
File "./WebCam.py", line 27, in __init__
self.camera.start()
EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 90, Message too long
For good measure I also tried this ...
Index: uvc_video.c
===================================================================
--- uvc_video.c (revision 213)
+++ uvc_video.c (working copy)
@@ -749,10 +749,13 @@
if (i >= intf->num_altsetting)
return -EIO;
+
+ ret = usb_set_interface(video->dev->udev, intfnum, i);
+// if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0) {
+// if (ret != -71) // Let's try blindly ignoring protocol errors as requested
+// return ret;
+// }
- if ((ret = usb_set_interface(video->dev->udev, intfnum, i)) < 0)
- return ret;
-
ret = uvc_init_video_isoc(video, ep);
} else {
/* Bulk endpoint, proceed to URB initialization. */
... ie completely ignoring the return code, and again I get this error:
~/> ./WebCam.py
Traceback (most rcall last):
File "./WebCam.py", line 214, in <module>
VideoCapturePlayer().run() # Runs at full speed - basic test case
File "./WebCam.py", line 27, in __init__
self.camera.start()
EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 90, Message too long
Making it simply retry just seems to work.
> What kernel version are you running ?
This is the output from uname -a & /proc/version
~/> uname -a
Linux kamaelia-NG 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686 i686 i386 GNU/Linux
~/> more /proc/version
Linux version 2.6.22.17-0.1-default (geeko@buildhost) (gcc version 4.2.1 (SUSE Linux)) #1 SMP 2008/02/10 20:01:04 UTC
> > BTW, many thanks for writing this module - it's great/really useful :-)
>
> You're welcome. Now if we could convince webcam manufacturers to use the
> Linux driver for testing purpose I'd be much happier :-)
:-)
Many thanks,
Michael
|
|
From: Laurent P. <lau...@sk...> - 2008-06-07 00:59:11
|
Hi Michael,
On Saturday 07 June 2008, MIchael Sparks wrote:
> Hi Laurent,
>
> Many thanks for getting back to me :)
You're welcome.
> On Friday 06 June 2008 23:12:50 Laurent Pinchart wrote:
> ..
>
> > *sigh*. I hate protocol errors. They are most of the time caused by buggy
> > devices, and buggy devices mean I have to find a software workaround :-S
>
> I guessed that might be the case :-/
>
> > Could you please try to blindly ignore the usb_set_interface return value
> > ? I'd like to know if the second call is really required.
>
> I've tried changing it to specifically ignore that error:
> Index: uvc_video.c
> ===================================================================
> --- uvc_video.c (revision 213)
> +++ uvc_video.c (working copy)
> @@ -750,8 +750,10 @@
> if (i >= intf->num_altsetting)
> return -EIO;
>
> - if ((ret = usb_set_interface(video->dev->udev, intfnum, i))
> < 0) - return ret;
> + if ((ret = usb_set_interface(video->dev->udev, intfnum, i))
> < 0) { + if (ret != -71) // Let's try blindly
> ignoring protocol errors as requested +
> return ret;
> + }
>
> ret = uvc_init_video_isoc(video, ep);
> } else {
>
> Any when I now retry, I get the following error:
>
> ~/> ./WebCam.py
> Traceback (most recent call last):
> File "./WebCam.py", line 214, in <module>
> VideoCapturePlayer().run() # Runs at full speed - basic test case
> File "./WebCam.py", line 27, in __init__
> self.camera.start()
> EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 90, Message too long
>
> For good measure I also tried this ...
>
> Index: uvc_video.c
> ===================================================================
> --- uvc_video.c (revision 213)
> +++ uvc_video.c (working copy)
> @@ -749,10 +749,13 @@
>
> if (i >= intf->num_altsetting)
> return -EIO;
> +
> + ret = usb_set_interface(video->dev->udev, intfnum, i);
> +// if ((ret = usb_set_interface(video->dev->udev, intfnum, i))
> < 0) { +// if (ret != -71) // Let's try blindly
> ignoring protocol errors as requested +//
> return ret;
> +// }
>
> - if ((ret = usb_set_interface(video->dev->udev, intfnum, i))
> < 0) - return ret;
> -
> ret = uvc_init_video_isoc(video, ep);
> } else {
> /* Bulk endpoint, proceed to URB initialization. */
>
> ... ie completely ignoring the return code, and again I get this error:
>
> ~/> ./WebCam.py
> Traceback (most rcall last):
> File "./WebCam.py", line 214, in <module>
> VideoCapturePlayer().run() # Runs at full speed - basic test case
> File "./WebCam.py", line 27, in __init__
> self.camera.start()
> EnvironmentError: ioctl(VIDIOC_STREAMON) failure : 90, Message too long
>
> Making it simply retry just seems to work.
Thanks for testing.
> > What kernel version are you running ?
>
> This is the output from uname -a & /proc/version
>
> ~/> uname -a
> Linux kamaelia-NG 2.6.22.17-0.1-default #1 SMP 2008/02/10 20:01:04 UTC i686
> i686 i386 GNU/Linux
>
> ~/> more /proc/version
> Linux version 2.6.22.17-0.1-default (geeko@buildhost) (gcc version 4.2.1
> (SUSE Linux)) #1 SMP 2008/02/10 20:01:04 UTC
Would you be able to try 2.6.26-rc5 ? I'd like to know if the recent patches
to the EHCI driver solve the issue (or maybe make it worse :-)).
Best regards,
Laurent Pinchart
|