Noticed that mmap calls are failing for standard UVC V4L2 drivers (basic USB webcams) with the latest webcam commit.
This PR reverts changes from commit back to using O_RDWR flag for file open, and PROT_READ | PROT_WRITE flags for mmap calls.
This will allow the library to safely handle all standard v4l2 linux drivers. Even though we are not "writing", the v4l dev docs provide a warning about the requirement for read-write when streaming.
@bpstark Could you provide more details about locking out other processes? It is my understanding that unix.O_RDWR|unix.O_NONBLOCK file flags do not attach a file lock. We would need to explicitly call unix.Flock for that.
Testing
Tested on basic usb webcams that use uvc v4l2 driver (on a Raspberry Pi).
Happy to test out on other common v4l2 interfaces if that helps.
@bpstark Any specific testing I should do on loopbacks?
Description
Noticed that
mmap
calls are failing for standard UVC V4L2 drivers (basic USB webcams) with the latest webcam commit.This PR reverts changes from commit back to using
O_RDWR
flag for file open, andPROT_READ | PROT_WRITE
flags for mmap calls.This will allow the library to safely handle all standard v4l2 linux drivers. Even though we are not "writing", the v4l dev docs provide a warning about the requirement for read-write when streaming.
@bpstark Could you provide more details about locking out other processes? It is my understanding that
unix.O_RDWR|unix.O_NONBLOCK
file flags do not attach a file lock. We would need to explicitly callunix.Flock
for that.Testing