Hi Felix,
On Monday 10 September 2007, Felix Domke wrote:
> Hi,
>
> i've spent some time on the Microsoft Xbox Live Vision cam (it's pretty
> cheap, USB 2.0, nearly uvc 1.0 compliant, has a pretty good image
> quality, manual focus, allegedly a 1280x960 sensor (i haven't checked,
> it might just upscale, but i don't think so), and supports MJPG and YUYV).
*nearly* UVC compliant ? *sigh*... Can't they test their hardware with
Linux ? :-)
> Out of the box, the cam didn't work with linux-uvc - the cam crashed
> after the initial SET_CUR on the VideoStreaming ctrl, and didn't
> responded to any USB control packets anymore (not even a simple,
> non-video related GET_DESCRIPTOR etc.).
>
> I've compared what the UVC driver did (not much, as the cam crashed
> really early) with what the Xbox 360 did (using a USB sniffer), and
> found out the following two things:
>
> a.) you need to SET_INTERFACE before doing any SET_CUR, or the cam will
> crash. (I don't know the USB specs good enough, but I think the cam is
> correct here - the cam offers multiple interfaces, because it supports
> some "Authentication Mechanism", so you need to select the video part
> first. Of course the cam should not crash, rather STALL or whatever.)
SET_INTERFACE shouldn't be required. Upon being plugged in, the webcam should
select the default alternate setting.
Selecting the default alternate setting when initialising the camera shouldn't
hurt. I'll experiment with a few devices and commit a patch afterwards.
> b.) The cam requires about ~3sec time after the initial SET_INTERFACE.
Now this is bad news. What happens if you query controls during those ~3sec ?
Those the webcam timeout but stay functional, or does it crash ?
> I've added the two hacks (not meant for inclusion, just to describe the
> problem):
>
> Index: uvc_driver.c
> ===================================================================
> --- uvc_driver.c (revision 125)
> +++ uvc_driver.c (working copy)
> @@ -1530,6 +1530,8 @@
> dev->intf = usb_get_intf(intf);
> dev->intfnum = intf->cur_altsetting->desc.bInterfaceNumber;
> dev->quirks = id->driver_info;
> +
> + usb_set_interface(udev, 1, 0);
>
> /* Parse the Video Class control descriptor */
> if (uvc_parse_control(dev) < 0) {
>
> Index: uvcvideo.h
> ===================================================================
> --- uvcvideo.h (revision 125)
> +++ uvcvideo.h (working copy)
> @@ -241,8 +241,8 @@
> /* Maximum number of video buffers. */
> #define UVC_MAX_VIDEO_BUFFERS 32
>
> -#define UVC_CTRL_CONTROL_TIMEOUT 300
> -#define UVC_CTRL_STREAMING_TIMEOUT 1000
> +#define UVC_CTRL_CONTROL_TIMEOUT 5000
> +#define UVC_CTRL_STREAMING_TIMEOUT 5000
>
> /* Devices quirks */
> #define UVC_QUIRK_STATUS_INTERVAL 0x00000001
>
>
> With those two changes, the cam works really nice with luvcview.
> uvccapture made some trouble, but that might be caused by something else.
>
> Maybe someone a little more intimate could see if this can be added in a
> nice way. But I think increasing the timeouts shouldn't hurt (you could
> still add a dummy GET_CUR after the set_interface with an increased
> timeout, if you don't want to change the timeout globally), and i
> believe the set_interface should be done in any way.
I'll test the SET_INTERFACE part and commit it soon. Regarding the timeouts,
what happens if you modify the streaming timeout only ?
Best regards,
Laurent Pinchart
_______________________________________________
Linux-uvc-devel mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/linux-uvc-devel