I am trying to access a Logitech c310 webcam on my beaglebone. It always returns false for any device ID, I am not sure why.
I use the following code.
I met the similar issue. It may be related to user permission. Try using the follow procedure to diagnose the issue.
Run the following command to determine the camera access permission
ls -la /dev/video*
You might get similar output as below (you might get video1 if you have multiple cameras). As you can see, only root user and users in video group have the permission to access the camera.
crw-rw----. 1 root video 188, 0 Apr 3 21:16 /dev/video0
So the fix is simple, add your user account to the video group, using the follow command:
sudo usermod -a -G video
Hope it helps!