Enabling a USB Camera in Ubuntu 14.04
In theory, the USB camera should work as plug-in play, but I found when I upgraded to Ubuntu 14.04 that something was not working. This post assumes that your hardware is supportable with the uvcvideo driver. To start off, please confirm the following (In truth, there is more confirmation than actual work).
1. The USB Camera is recognized. The good old ‘dmesg’ should do the trick:
$ dmesg | grep -i usb
After digging in the output, found the following:
[ 1.774055] usb 2-3: new high-speed USB device number 3 using ehci-pci
[ 1.951988] usb 2-3: New USB device found, idVendor=056e, idProduct=700e
[ 1.951995] usb 2-3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 1.952000] usb 2-3: Product: UCAM-DLE300T series
[ 1.952004] usb 2-3: Manufacturer: ELECOM
Yup, there is my cheap USB camera.
2. That the uvcvideo driver is loaded
$ lsmod | grep uvcvideo uvcvideo 80885 0 videobuf2_vmalloc 13216 1 uvcvideo videobuf2_core 40664 1 uvcvideo videodev 134688 2 uvcvideo,videobuf2_core
If nothing shows up, you can try loading it:
$ sudo modprobe uvcvideo
3. The device is actually recognized
The video should be under /dev, but the number may depend on how many devices you have hooked-up.
$ ls /dev/video* /dev/video0
Only one for me.
4. Your user is in the video group.
This should be added by default, but just in case.
$ grep dave /etc/group | grep video video:x:44:dave
If your user is not there, you can add if you have root permissions.
$ sudo usermod -a -G video $USER
So all should be well if you are up to here. Now for the crux of the problem. Take a look at the permissions of your ‘/dev/video*’.
$ ls -l /dev/video* crw------- 1 root root 81, 0 May 6 00:58 /dev/video0
Hey, only root has access to this device! To resolve, we need two steps:
1. Change the group ownership to video
$ sudo chown root:video /dev/video0
2. Add read/write permissions for the group.
$ sudo chmod g+rw /dev/video0
Now that the permissions are corrected, take a deep breath and test (I use ‘mplayer’ for command line testing, but you can use ‘cheese’, ‘skype’, etc)
mplayer tv:// -tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30