Skip to contentSkip to conversation

V4L: videodev, allow VIDIOCGMBUF

PATCH In review Jiri Slaby 2 participants 4 messages May 8, 2007 Media (V4L/DVB)

lore
Share & tools
lore

Jiri Slaby

author
#0 lore raw

PATCH 1/2 V4L: videodev, allow VIDIOCGMBUF

videodev, allow VIDIOCGMBUF

this is 'v' compat ioctl handled in v4l2

Cc Mauro Carvalho Chehab <[email protected]>

---
commit fdc535e5e7c1b1781e903d4d21e1f657a9ac12c9
tree 8beb32a89d2679b14577762ebec8fb3c1e81fcaf
parent 94b6ccaf1ca50632014202d3eeb99a0e23185ddb
author Jiri Slaby <[email protected]> Sat, 05 May 2007 17:47:31 +0200 committer Jiri Slaby <[email protected]> Sat, 05 May 2007 17:47:31 +0200

 drivers/media/video/videodev.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)
drivers/media/video/videodev.c +4 -1
index a3cef80..099ad99 100644
@@ -438,7 +438,10 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
 	}
 
 	if (_IOC_TYPE(cmd)=='v')
-		return v4l_compat_translate_ioctl(inode,file,cmd,arg,
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+		if (cmd != VIDIOCGMBUF) /* <-- handled below vvv */
+#endif
+			return v4l_compat_translate_ioctl(inode,file,cmd,arg,
 						__video_do_ioctl);
 
 	switch(cmd) {
author
#1 lore raw

PATCH 2/2 V4L: v4l1-compat, fix VIDIOCSPICT for non-OVERLAY

v4l1-compat, fix VIDIOCSPICT for non-OVERLAY

Do not return EINVAL for devices, which don't support overlay.

Cc Mauro Carvalho Chehab <[email protected]>

---
commit 637f1c324c57b002bcc94f68a1150e1ff32593c4
tree cf35d8f5990c1f335778bd85a4461c4e716daeef
parent fdc535e5e7c1b1781e903d4d21e1f657a9ac12c9
author Jiri Slaby <[email protected]> Sun, 06 May 2007 19:48:30 +0200 committer Jiri Slaby <[email protected]> Sun, 06 May 2007 19:48:30 +0200

 drivers/media/video/v4l1-compat.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/media/video/v4l1-compat.c +1 -1
index a861e15..254df73 100644
@@ -653,8 +653,8 @@ v4l_compat_translate_ioctl(struct inode         *inode,
 			err = drv(inode, file, VIDIOC_S_FBUF, &fbuf2);
 			if (err < 0)
 				dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n",err);
-			err = 0; /* likely fails for non-root */
 		}
+		err = 0; /* G_ fails for non-OVERLAY, S_ likely for non-root */
 		break;
 	}
 	case VIDIOCGTUNER: /*  get tuner information  */
#3 lore raw
In reply to Jiri Slaby

Hi Jiri,

drivers/media/video/videodev.c static int __video_do_ioctl(struct inode *inode, struct file *file, · line 445

Quoted 8 lines
	if (_IOC_TYPE(cmd)=='v')
drivers/media/video/videodev.c +4 -1
-		return v4l_compat_translate_ioctl(inode,file,cmd,arg,
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+		if (cmd != VIDIOCGMBUF) /* <-- handled below vvv */
+#endif
+			return v4l_compat_translate_ioctl(inode,file,cmd,arg,
 						__video_do_ioctl);

I've committed two patches on my -git tree that will fix the issue you're pointing.

In fact, all the above code should be handled only if V4L1_COMPAT is enabled. The fixes are at the following patches:

http://git.kernel.org/?p=linux/kernel/git/mchehab/v4l-dvb.git;a=commitdiff;h=11fe647ca79d1e6381f954a7fe790a1157c803dc

http://git.kernel.org/?p=linux/kernel/git/mchehab/v4l-dvb.git;a=commitdiff;h=853fa89dd933b90f820d4bd46a71542bfb3d5967

Cheers,
Mauro