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

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

 



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:
+				break;
+		}
+		break;
+	}
+
 	/* Get & Set format */
 	case VIDIOC_G_FMT:
 	{
-- 
2.0.0.rc2

--
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