diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-08-28 18:38:58 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 10:27:49 -0200 |
commit | 815adc465de9c8cd1967d0d9d538ed30925423a0 (patch) | |
tree | 5a21ecf655f3ce9fb0e16182e98bdbb7f5f4da78 /drivers/media/usb/uvc/uvc_v4l2.c | |
parent | 30ecb936cbcd83e3735625ac63e1b4466546f5fe (diff) |
[media] uvcvideo: Don't fail when an unsupported format is requested
Return the default format in that case.
This issue was found by the v4l2-compliance tool.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/uvc/uvc_v4l2.c')
-rw-r--r-- | drivers/media/usb/uvc/uvc_v4l2.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index e5817b953938..3bd93736a82a 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -165,17 +165,18 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, fcc[0], fcc[1], fcc[2], fcc[3], fmt->fmt.pix.width, fmt->fmt.pix.height); - /* Check if the hardware supports the requested format. */ + /* Check if the hardware supports the requested format, use the default + * format otherwise. + */ for (i = 0; i < stream->nformats; ++i) { format = &stream->format[i]; if (format->fcc == fmt->fmt.pix.pixelformat) break; } - if (format == NULL || format->fcc != fmt->fmt.pix.pixelformat) { - uvc_trace(UVC_TRACE_FORMAT, "Unsupported format 0x%08x.\n", - fmt->fmt.pix.pixelformat); - return -EINVAL; + if (i == stream->nformats) { + format = stream->def_format; + fmt->fmt.pix.pixelformat = format->fcc; } /* Find the closest image size. The distance between image sizes is |