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