V4L/DVB (11948): uvcvideo: Ignore non-UVC trailing interface descriptors.
authorLaurent Pinchart <laurent.pinchart@skynet.be>
Tue, 9 Jun 2009 16:07:44 +0000 (13:07 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 16 Jun 2009 22:07:32 +0000 (19:07 -0300)
Herton Ronaldo Krzesinski from Mandriva reported that one Bison Electronics
webcam exposes a non-UVC interface descriptor. Instead of failing completely,
ignore trailing non-UVC descriptors and move on.

Thanks to Herton for reporting the problem and submitting a patch proposal.

Signed-off-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/uvc/uvc_driver.c

index f7545126951878d4dd5c9d1edbff5d8444fc550f..89927b7aec28dce2dcd9131b7e36339de826436d 100644 (file)
@@ -644,7 +644,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
        _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 @@ static int uvc_parse_streaming(struct uvc_device *dev,
        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: