On Wed, 18 Mar 2009 22:23:37 +0100
Janne Grunau <j...@jannau.net> wrote:

> Hi Mauro,
> 
> please pull from http://hg.jannau.net/hdpvr-merge/ for the Hauppauge HD
> PVR driver.
> 
> The repo has only two changesets. One adding V4L2_CID_SHARPNESS to a
> method in v4l2-common.c and the complete driver. The history of the
> driver will be available at http://hg.jannau.net/hdpvr/ so I think it's
> not worth adding the complete history to the kernel repo.
> 
> [Janne Grunau <j...@jannau.net>]
>      adds V4L2_CID_SHARPNESS to v4l2_ctrl_query_fill()
>      V4L2 Driver for the Hauppauge HD PVR usb capture device
> 
> diffstat
> linux/drivers/media/video/hdpvr/Kconfig           |   10
> linux/drivers/media/video/hdpvr/Makefile          |    7
> linux/drivers/media/video/hdpvr/hdpvr-control.c   |  201 +++
> linux/drivers/media/video/hdpvr/hdpvr-core.c      |  446 +++++++
> linux/drivers/media/video/hdpvr/hdpvr-i2c.c       |  145 ++
> linux/drivers/media/video/hdpvr/hdpvr-video.c     | 1228 
> ++++++++++++++++++++++
> linux/drivers/media/video/hdpvr/hdpvr.h           |  298 +++++
> linux/drivers/media/video/Kconfig                 |    2
> linux/drivers/media/video/Makefile                |    2
> linux/drivers/media/video/v4l2-common.c           |    1
> linux/include/linux/i2c-id.h                      |    1
> 11 files changed, 2341 insertions(+)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Hi Janne,

Everything looks ok, except for this part of your code:

+static long hdpvr_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+       struct hdpvr_fh *fh = (struct hdpvr_fh *)filp->private_data;
+       struct hdpvr_device *dev = fh->dev;
+       int res;
+
+       if (video_is_unregistered(dev->video_dev))
+               return -EIO;
+
+       mutex_lock(&dev->io_mutex);
+       switch (cmd) {
+       case VIDIOC_TRY_ENCODER_CMD:
+       case VIDIOC_ENCODER_CMD: {
+               struct v4l2_encoder_cmd *enc = (struct v4l2_encoder_cmd *)arg;
+               int try = cmd == VIDIOC_TRY_ENCODER_CMD;
+
+               memset(&enc->raw, 0, sizeof(enc->raw));
+               switch (enc->cmd) {
+               case V4L2_ENC_CMD_START:
+                       enc->flags = 0;
+                       if (try)
+                               return 0;
+                       res = hdpvr_start_streaming(dev);
+                       break;
+               case V4L2_ENC_CMD_STOP:
+                       if (try)
+                               return 0;
+                       res = hdpvr_stop_streaming(dev);
+                       break;
+               default:
+                       v4l2_dbg(MSG_INFO, hdpvr_debug, dev->video_dev,
+                                "Unsupported encoder cmd %d\n", enc->cmd);
+                       return -EINVAL;
+               }
+               break;
+       }
+       default:
+               res = video_ioctl2(filp, cmd, arg);
+       }
+       mutex_unlock(&dev->io_mutex);
+       return res;
+}

Why haven't you just used the two video_ioctl2 handlers for vidioc_encoder_cmd
and vidioc_try_encoder_cmd, like ivtv and cx18, instead of the above code?

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

Reply via email to