MODULE_LICENSE("GPL");
MODULE_AUTHOR("John Tsiombikas");
-MODULE_DESCRIPTION("v4l2 test module");
+MODULE_DESCRIPTION("Dummy V4L2 device");
static struct mutex mutex;
static struct video_device *vdev;
static void shutdown(void)
{
+ hrtimer_cancel(&timer);
video_unregister_device(vdev);
v4l2_device_unregister(&v4l2_dev);
kfree(frame);
static int ioctl_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
{
strcpy(cap->driver, KBUILD_MODNAME);
- strcpy(cap->card, "Test V4L2 device");
+ strcpy(cap->card, "Dummy V4L2 device");
strcpy(cap->bus_info, "nobus");
cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING;
cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
static void stop_streaming(struct vb2_queue *vbq)
{
- while(hrtimer_try_to_cancel(&timer) == -1);
+ hrtimer_cancel(&timer);
streaming = 0;
clear_queue(VB2_BUF_STATE_ERROR);
spin_unlock(&blist_lock);
if(buf) {
- printk(KERN_INFO "vdummy: copying frame: %d\n", seqno);
-
+ mutex_lock(&mutex);
memcpy(vb2_plane_vaddr(&buf->vb.vb2_buf, 0), frame, frame_size);
buf->vb.vb2_buf.timestamp = ktime_get_ns();
+ printk(KERN_INFO "vdummy: copying frame: %d ts: %lu\n", seqno,
+ (unsigned long)buf->vb.vb2_buf.timestamp);
buf->vb.sequence = seqno++;
buf->vb.field = V4L2_FIELD_NONE;
vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_DONE);
vb2_set_plane_payload(&buf->vb.vb2_buf, 0, frame_size);
+ mutex_unlock(&mutex);
}
return 0;
}