[question] v4l read() operation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

If I register a video device with this fops:

static const struct v4l2_file_operations v4l2_fops = {
        .owner      = THIS_MODULE,
        .open        = xxx_open,
        .unlocked_ioctl = xxx_unlocked_ioctl,
        .poll           = xxx_poll,
        .mmap      = xxx_mmap,
};

then if I "cat" the device

$ cat /dev/video0

Who is supporting read() ?

I thought it could be v4l2_read(),
however this function seems to return EINVAL:

static ssize_t v4l2_read(struct file *filp, char __user *buf,
                size_t sz, loff_t *off)
{
        struct video_device *vdev = video_devdata(filp);
        int ret = -ENODEV;

        if (!vdev->fops->read)
                return -EINVAL;
        if (vdev->lock && mutex_lock_interruptible(vdev->lock))
                return -ERESTARTSYS;
        if (video_is_registered(vdev))
                ret = vdev->fops->read(filp, buf, sz, off);
        if (vdev->lock)
                mutex_unlock(vdev->lock);
        return ret;
}

Thanks,
Ezequiel.

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux