[media] pwc: Don't return EINVAL when an unsupported pixelformat is requested
authorHans de Goede <hdegoede@redhat.com>
Fri, 25 Jan 2013 09:53:07 +0000 (06:53 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 5 Feb 2013 16:54:47 +0000 (14:54 -0200)
Instead chaneg the passed in format to the pwc default pixelformat.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/usb/pwc/pwc-v4l.c

index 545e9bbdeedef22540fa079d900218d0151530b0..aa7449eaca08d027ba752aeddffa9ea883ad7e86 100644 (file)
@@ -434,19 +434,18 @@ static int pwc_vidioc_try_fmt(struct pwc_device *pdev, struct v4l2_format *f)
                case V4L2_PIX_FMT_PWC1:
                        if (DEVICE_USE_CODEC23(pdev->type)) {
                                PWC_DEBUG_IOCTL("codec1 is only supported for old pwc webcam\n");
-                               return -EINVAL;
+                               f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
                        }
                        break;
                case V4L2_PIX_FMT_PWC2:
                        if (DEVICE_USE_CODEC1(pdev->type)) {
                                PWC_DEBUG_IOCTL("codec23 is only supported for new pwc webcam\n");
-                               return -EINVAL;
+                               f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
                        }
                        break;
                default:
                        PWC_DEBUG_IOCTL("Unsupported pixel format\n");
-                       return -EINVAL;
-
+                       f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
        }
 
        size = pwc_get_size(pdev, f->fmt.pix.width, f->fmt.pix.height);