Sooo, I've just bought a Raspberry PI for a project, along with a $5 webcam for a Computer Vision experiment. I immediately tried the quality of the camera using "cheese" Linux program on my Ubuntu laptop, and it worked out fine. Unfortunately, in Raspberry PI, the program simply wouldn't detect the camera.
After hours of debugging, apparently the problem was with permission. The webcam enumerates as /dev/video0, which has 0660. Since "cheese" runs as "other", it doesn't have the permission to read it. Manually modifying it through "chmod o+rw /dev/video0" does the job. However, I want a more permanent and elegant solution.
The solution is to use udev. Here're the steps:
1. Get the webcam's vendorId and productId through lsusb/dmesg.
2. Get its DRIVER and SUBSYSTEM (properties required for udev setting) through "udevadm info -a -n [device_path]" (device_path is sth like /dev/video0)
3. Create new rules as instructed here: https://wiki.archlinux.org/index.php/Udev#Video_devices
4. As a reference, in my case the rule file is created here: /etc/udev/rules.d/83-webcam.rules, with the content being: KERNEL=="video[0-9]*", SUBSYSTEM=="video4linux", SUBSYSTEMS=="usb", ATTRS{idVendor}=="05e3", ATTRS{idProduct}=="0510", SYMLINK+="video-cam1", MODE="0666"
What's bold is the part that specifies the permission.
Hope this helps!