Abraham vd Merwe wrote:
Hi! I'm using the videodevX driver (20011221 snapshot). Somehow when I do an mmap() from my user application it never calls the mmap() function in the V4L2 driver. (I put printk's all over the mmap function in the videodevX module and in my driver's mmap function - neither of them gets called at all). Any ideas why this is happening? My user app basically does the following: open(/dev/v4l2/capture0) ioctl(VIDIOC_QUERYCAP) ioctl(VIDIOC_G_FMT) ioctl(VIDIOC_REQBUFS) ioctl(VIDIOC_G_PARM) ioctl(VIDIOC_S_PARM) ioctl(VIDIOC_QUERYBUF) mmap(offset + length I got from QUERYBUF) All the ioctl's work as expected and calls through to my driver. It is just mmap() that fails with EPERM without even calling into the v4l2 module: ------------< snip <------< snip <------< snip <------------ root@frodo:/# ./stream 30 area-sensor.c: line 280: as_open() capture device: /dev/v4l2/capture0 area-sensor.c: line 434: as_ioctl() frame buffer device: /dev/fb/0 capture rate: 30 frames per second area-sensor.c: line 434: as_ioctl() area-sensor.c: line 434: as_ioctl() area-sensor.c: line 434: as_ioctl() area-sensor.c: line 434: as_ioctl() area-sensor.c: line 434: as_ioctl() area-sensor.c: line 345: as_close() area-sensor: freeing irq 1 unable to map frame buffer memory at 0x18000000 (length 262144 bytes) to a virtual address! (Permission denied) root@frodo:/# ------------< snip <------< snip <------< snip <------------
Make sure you open the capture device O_RDWR, and mmap with the following flags: MAP_SHARED, and protection: PROT_READ|PROT_WRITE.
This should solve the EPERM problems. -justin