fixed a couple of omissions, untested
authorJohn Tsiombikas <nuclear@mutantstargoat.com>
Fri, 12 May 2017 02:31:28 +0000 (05:31 +0300)
committerJohn Tsiombikas <nuclear@mutantstargoat.com>
Fri, 12 May 2017 02:31:28 +0000 (05:31 +0300)
vdummy.c

index bf04eec..fcc68c0 100644 (file)
--- a/vdummy.c
+++ b/vdummy.c
@@ -5,10 +5,13 @@
 #include <linux/slab.h>
 #include <asm/uaccess.h>
 #include <linux/videodev2.h>
+#include <media/videobuf2-v4l2.h>
 #include <media/videobuf2-vmalloc.h>
 #include <media/v4l2-dev.h>
 #include <media/v4l2-ioctl.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-ctrls.h>
+#include <media/v4l2-event.h>
 
 struct buffer {
        struct vb2_buffer vb;
@@ -73,6 +76,7 @@ static int init(void)
        }
 
        mutex_init(&mutex);
+       spin_lock_init(&blist_lock);
 
        vbops.queue_setup = queue_setup;
        vbops.buf_prepare = buf_prepare;
@@ -101,12 +105,16 @@ static int init(void)
        if(!(vdev = video_device_alloc())) {
                return -ENOMEM;
        }
+       memset(vdev, 0, sizeof *vdev);
        vdev->release = video_device_release;
        strcpy(vdev->name, KBUILD_MODNAME);
        vdev->fops = &fops;
        vdev->ioctl_ops = &iops;
        vdev->vfl_type = VFL_TYPE_GRABBER;
+       vdev->vfl_dir = VFL_DIR_RX;
        vdev->v4l2_dev = &v4l2_dev;
+       vdev->lock = &mutex;
+       vdev->queue = &vbq;
 
        fops.owner = THIS_MODULE;
        fops.open = v4l2_fh_open;
@@ -131,6 +139,9 @@ static int init(void)
        iops.vidioc_expbuf = vb2_ioctl_expbuf;
        iops.vidioc_streamon = vb2_ioctl_streamon;
        iops.vidioc_streamoff = vb2_ioctl_streamoff;
+       iops.vidioc_log_status = v4l2_ctrl_log_status;
+       iops.vidioc_subscribe_event = v4l2_ctrl_subscribe_event;
+       iops.vidioc_unsubscribe_event = v4l2_event_unsubscribe;
 
        if((res = video_register_device(vdev, VFL_TYPE_GRABBER, -1)) != 0) {
                printk(KERN_ALERT "vdummy: failed to register video device\n");