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