Hi Herton, On Wednesday 03 June 2009 23:02:33 Herton Ronaldo Krzesinski wrote: > One webcam I have here exposes an invalid videostreaming interface > format, with trace=0x2 this output is shown on kernel log: > > USB Video Class driver (v0.1.0) > usb 3-7: new high speed USB device using ehci_hcd and address 5 > usb 3-7: configuration #1 chosen from 1 choice > uvcvideo: Found format YUV 4:2:2 (YUYV). > uvcvideo: - 640x480 (18.0 fps) > uvcvideo: - 320x240 (30.0 fps) > uvcvideo: - 160x120 (30.0 fps) > uvcvideo: - 352x288 (30.0 fps) > uvcvideo: - 176x144 (30.0 fps) > uvcvideo: - 1280x1024 (8.0 fps) > uvcvideo: device 5 videostreaminginterface 1 FORMAT error > uvcvideo: Found a Status endpoint (addr 82). > uvcvideo: Found UVC 1.00 device BisonCam, NB Pro (5986:0241) > uvcvideo: No valid video chain found. > > There is an invalid videostreaming interface format exposed, which makes > the webcam to fail to work as the error is treated as fatal, even if we > have already found a valid format.
The invalid descriptor (I'm not sure if it's actually invalid, or just vendor-specific and unsupported) isn't a Class Specific Interface descriptor (bDescriptorType != 36), so it might make sense not to try to parse it instead of trying and failing. > Fix this by not failing entirely if we have found an invalid format, as > we can still have a valid format. The initial problem and solution > (patch) was debugged and done by Clevo (probably by Michael Wang), > which uses the affected webcam in one of their laptops. I'm forwarding > their fix plus additional code that I noticed to be needed for generic > cases that decrements properly streaming->nformats and checks later if > we really found at least one valid format, and if there were really no > valid formats we make sure then to return with error. What about modifying uvc_parse_streaming() to stop parsing the interface descriptors when it encounters a non CS Interface descriptor instead ? Something like diff -r 66a270023c26 linux/drivers/media/video/uvc/uvc_driver.c --- a/linux/drivers/media/video/uvc/uvc_driver.c Sun May 31 22:05:55 2009 +0200 +++ b/linux/drivers/media/video/uvc/uvc_driver.c Thu Jun 04 12:40:09 2009 +0200 @@ -644,7 +644,7 @@ _buflen = buflen; /* Count the format and frame descriptors. */ - while (_buflen > 2) { + while (_buflen > 2 && _buffer[1] == CS_INTERFACE) { switch (_buffer[2]) { case VS_FORMAT_UNCOMPRESSED: case VS_FORMAT_MJPEG: @@ -709,7 +709,7 @@ streaming->nformats = nformats; /* Parse the format descriptors. */ - while (buflen > 2) { + while (buflen > 2 && buffer[1] == CS_INTERFACE) { switch (buffer[2]) { case VS_FORMAT_UNCOMPRESSED: case VS_FORMAT_MJPEG: Best regards, Laurent Pinchart _______________________________________________ Linux-uvc-devel mailing list Linux-uvc-devel@lists.berlios.de https://lists.berlios.de/mailman/listinfo/linux-uvc-devel