PDA

View Full Version : Webcam detected only as root?



azredwing
10th January 2008, 07:34 AM
Hi all,

I own a Sony VGN-SZ110 and after a long while got the integrated webcam (VGP-VCC2) to work. However, it only works when I'm root! For instance, it works perfectly in Skype 2.0 when I run it as root (or if I call it with sudo) but says that no device exists when I try it as a regular user.

So, how do I get this thing working as non-superuser? (camera is detected as /dev/video0)

Thanks for all the help.

EDIT: lsmod | grep r5u870 /*the r5u870 is the name of the driver*/ yields the following:



r5u870 61508 0
video_buf 22469 1 r5u870
videodev 28097 1 r5u870
v4l2_common 18625 2 r5u870,videodev
v4l1_compat 15941 2 r5u870,videodev


EDIT2: I installed xawtv and used the webcam program. Here are the outputs:

As root:


# webcam
reading config file: /root/.webcamrc
video4linux webcam v1.5 - (c) 1998-2002 Gerd Knorr
grabber config:
size 320x240 [16 bit YUV 4:2:2 (packed, YUYV)]
input (null), norm (null), jpeg quality 75
rotate=0, top=0, left=0, bottom=240, right=320


As regular user


$ webcam
reading config file: /home/cchu/.webcamrc
v4l2: open /dev/video0: Permission denied
v4l2: open /dev/video0: Permission denied
v4l: open /dev/video0: Permission denied
no grabber device available


So obviously I need to set some permissions somewhere. But where? I saw this thread (http://fedoraforum.org/forum/showthread.php?t=94775&highlight=webcam+root) and saw that people resolved their similar problems by editing /etc/udev/rules.d/50-udev.rules :


KERNEL=="video*", MODE="0660"

becomes


KERNEL=="video*", MODE="0666"

However, I don't have this line in my 50-udev.rules. Even if you take video* as a wildcard, no line containing 'video' has a MODE argument.

azredwing
10th January 2008, 09:03 AM
SOLVED! (?)

After searching other forums (and looking into how other distros did it), here's what I did to resolve this problem. Hopefully you can use it.

First, in order to not give your normal account root access, create a new group "video" or something and add yourself to it.

Then just amend /etc/udev/rules.d/50-udev.rules:



KERNEL=="video*", MODE="0666", GROUP="video"


The only issue with this is that 50-udev.rules will rewrite itself after kernel updates, it seems. I will write a script sometime to run at startup to automatically check if the line exists, and if not it will add it to the file, if anyone is interested.

If anyone knows a better way to do this, please let me know.

SlowJet
10th January 2008, 09:08 AM
refer to this page - http://ubuntuforums.org/archive/index.php/t-9466.html

But try this

mkdir /media/webcam

mount /dev/video0 -t vfat -o umask=000 /media/webcam

Are you running automount (autofs)? Seems that this should take care of the mount if you start using the webcam application?

WARNings: Be sure to
umount /media/webcam
before unplugging. (Shouldn't have to do this will automount or the application closing and umount?

/mnt may also work but /media made more sense to me. :)

SJ

azredwing
10th January 2008, 07:56 PM
# mount /dev/video0 -t vfat -o umask=000 /media/webcam
mount: /dev/video0 is not a block device

Peacepunk
12th February 2009, 09:43 AM
As of Fedora 10, there is NO 50-udev.rules anymore; do this instead:

http://forums.fedoraforum.org/showpost.php?p=1165063&postcount=2

Cheers.