On Sunday 03 May 2009 13:34:05 Ralph spitzner wrote: > I've tried to get the driver to work with various applications > (Skype, kopete what have you) to no avail. > > Then I tried the capture.c example from the v4l page. > The captest gets an "invalid argument" error on > <skipped> > libv4l is versioned 0.5.97 (same result with 0.5.8) > > Any zen on this one ? > > regards > -rasp
The thing is memory got overwritten in videobuf-core.c, 249, function videobuf_status(). I've checked out other drivers and no driver checks for memory == V4L2_MEMORY_MMAP in querybuf ioctl (even uvc) (I'm using 2.6.30_rc4-git1) So here's a fix in attachment: 0003-Don-t-check-memory-type-in-querybuf- ioctl.patch Regards Vasily
From fb1ff8d9148d9ddd44235786739a15538114257f Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick <[email protected]> Date: Wed, 6 May 2009 09:26:37 +0300 Subject: [PATCH 3/3] Don't check memory type in querybuf ioctl Signed-off-by: Vasily Khoruzhick <[email protected]> --- sn9c20x-v4l2.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/sn9c20x-v4l2.c b/sn9c20x-v4l2.c index 5362991..5c8aedc 100644 --- a/sn9c20x-v4l2.c +++ b/sn9c20x-v4l2.c @@ -1171,8 +1171,7 @@ int sn9c20x_vidioc_querybuf(struct file *file, void *priv, UDIA_DEBUG("QUERY BUFFERS %d %d\n", buffer->index, dev->queue.count); - if (buffer->memory != V4L2_MEMORY_MMAP || - buffer->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + if (buffer->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; if (!v4l_has_privileges(file)) -- 1.6.2.3
From e079153ab5174c26258b004a9dac8930e8322fe5 Mon Sep 17 00:00:00 2001 From: Brian Johnson <[email protected]> Date: Sat, 2 May 2009 16:51:58 -0400 Subject: [PATCH 1/3] Fix bug when setting resolution lower than lowest available resolution Signed-off-by: Brian Johnson <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]> --- sn9c20x-bridge.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/sn9c20x-bridge.c b/sn9c20x-bridge.c index 2cfc4a7..c961489 100644 --- a/sn9c20x-bridge.c +++ b/sn9c20x-bridge.c @@ -1045,6 +1045,12 @@ int sn9c20x_get_closest_resolution(struct usb_sn9c20x *dev, { int i; + if (*width < sn9c20x_modes[0].width) + *width = sn9c20x_modes[0].width; + + if (*height < sn9c20x_modes[0].height) + *height = sn9c20x_modes[0].height; + for (i = SN9C20X_N_MODES - 1; i >= 0; i--) { if (*width >= sn9c20x_modes[i].width && *height >= sn9c20x_modes[i].height) -- 1.6.2.3
From f67a13b73c4b637fb494cf7810803589cd77204c Mon Sep 17 00:00:00 2001 From: Brian Johnson <[email protected]> Date: Sat, 2 May 2009 20:11:11 -0400 Subject: [PATCH 2/3] Implement ENUM_FRAMESIZES Signed-off-by: Brian Johnson <[email protected]> Signed-off-by: Vasily Khoruzhick <[email protected]> --- sn9c20x-v4l2.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/sn9c20x-v4l2.c b/sn9c20x-v4l2.c index 2c99fbc..5362991 100644 --- a/sn9c20x-v4l2.c +++ b/sn9c20x-v4l2.c @@ -704,6 +704,36 @@ int sn9c20x_vidioc_querycap(struct file *file, void *priv, /** * @param file * @param priv + * @param cap + * + * @return 0 + * + */ +int sn9c20x_vidioc_enum_framesizes(struct file *file, void *priv, + struct v4l2_frmsizeenum *size) +{ + struct usb_sn9c20x *dev; + + dev = video_get_drvdata(priv); + + UDIA_DEBUG("ENUM_FRAMESIZES\n"); + + if (size->index >= SN9C20X_N_MODES) + return -EINVAL; + + size->type = V4L2_FRMSIZE_TYPE_DISCRETE; + size->discrete.width = sn9c20x_modes[size->index].width; + size->discrete.height = sn9c20x_modes[size->index].height; + + UDIA_DEBUG("Framesize: %dx%d\n", size->discrete.width, + size->discrete.height); + + return 0; +} + +/** + * @param file + * @param priv * @param input * * @return 0 or negative error code @@ -1347,7 +1377,22 @@ static long v4l_sn9c20x_ioctl(struct file *fp, return -EFAULT; #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 29) - err = video_ioctl2(inode, fp, cmd, arg); + switch (cmd) { + case VIDIOC_ENUM_FRAMESIZES: + { + struct v4l2_frmsizeenum size; + if (copy_from_user(&size, (void __user *)arg, sizeof(size))) + return -EFAULT; + err = sn9c20x_vidioc_enum_framesizes(fp, + fp->private_data, + &size); + if (copy_to_user((void __user *)arg, &size, sizeof(size))) + return -EFAULT; + break; + } + default: + err = video_ioctl2(inode, fp, cmd, arg); + } #else err = video_ioctl2(fp, cmd, arg); #endif @@ -1359,6 +1404,9 @@ static long v4l_sn9c20x_ioctl(struct file *fp, #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27) static const struct v4l2_ioctl_ops sn9c20x_v4l2_ioctl_ops = { .vidioc_querycap = sn9c20x_vidioc_querycap, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) + .vidioc_enum_framesizes = sn9c20x_vidioc_enum_framesizes, +#endif .vidioc_enum_fmt_vid_cap = sn9c20x_vidioc_enum_fmt_cap, .vidioc_try_fmt_vid_cap = sn9c20x_vidioc_try_fmt_cap, .vidioc_s_fmt_vid_cap = sn9c20x_vidioc_s_fmt_cap, -- 1.6.2.3
signature.asc
Description: This is a digitally signed message part.
