I use Raspberry Pi 3 with
Linux RaspberryPi 4.9.59-v7+ onboard together with Logitech HD Webcam C270. It works quite well, I am able to preview video stream in
Qt V4l2 Test Utility, take a photo with
ffmpeg -f video4linux2 -i /dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0 -vframes 2 ~/Desktop/test%3d.jpeg
fswebcam -r 1280x720 ~/Desktop/image.jpg
However, the only odd (1-3-5-etc) shots are taken. On even (2-4-6-etc) ones it says
[video4linux2,v4l2 @ 0xee55c0] Cannot open video device /dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0: Device or resource busy /dev/v4l/by-id/usb-046d_0825_A96450F0-video-index0: Device or resource busy
Trying source module v4l2... Error opening device: /dev/video0 open: Device or resource busy
Why does it happen? I have tried reboot, USB disconnect/connect. It also seems that power delivery is enough, since I use original Raspberry power adapter and can view stable stream on full resolution.
Maybe I can force to close all connections to device after each use?