Re: [PATCH 4/8] usb: gadget/uvc: also handle v4l2 ioctl ENUM_FMT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.

On 05/28/2014 11:38 AM, Michael Grzeschik wrote:

This patch adds ENUM_FMT as possible ioctl to the uvc v4l2 device.
That makes userspace applications with a generic IOCTL calling
convention make also use of it.

Signed-off-by: Michael Grzeschik <m.grzeschik@xxxxxxxxxxxxxx>
---
  drivers/usb/gadget/uvc_v4l2.c | 24 ++++++++++++++++++++++++
  1 file changed, 24 insertions(+)

diff --git a/drivers/usb/gadget/uvc_v4l2.c b/drivers/usb/gadget/uvc_v4l2.c
index 3223b90..abe0e79 100644
--- a/drivers/usb/gadget/uvc_v4l2.c
+++ b/drivers/usb/gadget/uvc_v4l2.c
@@ -185,6 +185,30 @@ uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
  		break;
  	}

+	case VIDIOC_ENUM_FMT:
+	{
+		struct v4l2_fmtdesc *f = arg;
+
+		switch (f->type) {
+		case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+			switch (f->index) {
+				case 0:
+					strcpy(f->description, "YUV 4:2:2");
+					f->pixelformat = V4L2_PIX_FMT_YUYV;
+					break;
+				case 1:
+					strcpy(f->description, "MJPEG");
+					f->pixelformat = V4L2_PIX_FMT_MJPEG;
+					break;
+				default:
+					return -EINVAL;
+			}
+			default:

*case*/*default* should be at the same level of indentation as the *switch*. scripts/checkpatch.pl should have complained here...

+				break;
+		}
+		break;
+	}
+
  	/* Get & Set format */
  	case VIDIOC_G_FMT:
  	{

WBR, Sergei


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux