[media] pwc: Don't return EINVAL when an unsupported pixelformat is requested

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>
This commit is contained in:
Hans de Goede 2013-01-25 06:53:07 -03:00 коммит произвёл Mauro Carvalho Chehab
Родитель 78f968fa26
Коммит f192747955
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

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