[pvrusb2] Permission denied writing to cur_val

Mike Isely isely at isely.net
Thu Oct 23 09:12:44 CDT 2008


On Wed, 22 Oct 2008, Bjorn Danielsson wrote:

> Mike Isely <isely at isely.net> wrote:
> >[...]
> > As for why you need to be root, there isn't much the driver can do about 
> > that.  From the viewpoint of inside the kernel there really isn't a way 
> > to change the owner of those sysfs files.  The permissions can be 
> > adjusted, but it's unwise for those fields to be world-writeable - since 
> > then anything can take over control of the device.  With device control, 
> > usually one changes the gid of the files to match a specific group (e.g. 
> > "video") and then users with permission to operate the device need only 
> > be associated with that group.  But even there the driver can't do 
> > anything even if it wanted to, since the actual integer gid value for, 
> > say, "video" is distro-specific.  One clean, theoretical, way to fix 
> > this is for there to be a udev rule that executes a chgrp on all of 
> > /sys/class/pvrusb2/sn-xxxxxx at the point when the device appears.  
> > That has the additional advantage that udev can know the correct 
> > distro-specific gid value to use.  But I haven't implemented this (this 
> > is a task really outside of the driver).  But it would be a useful 
> > exercrise for someone else to set up.
> 
> I posted such a script a while back:
> 
> http://www.isely.net/pipermail/pvrusb2/2008-April/001772.html
> 
> There was a discussion then about how to find out if the attached
> video device was really a class/pvrusb2 device and not something
> else, but my script does no harm in such a case. It just does a
> bit of unnecessary work. What the script does is chgrp on all
> of /sys/class/pvrusb2/*/ and then adds group write permission
> for every file that has owner write permission.
> 
> The right way to invoke this script seems to be distro-dependent,
> and this is the way to do it in Slackware 12.1:
> 
> 1. Save the script as /lib/udev/rc.video and do chmod +x on it.
> 2. Edit the file /etc/udev/rules.d/40-video.rules and change the
>    line:
> KERNEL=="video[0-9]*",  NAME="v4l/video%n", SYMLINK+="%k", GROUP="video"
>    into:
> KERNEL=="video[0-9]*",  NAME="v4l/video%n", SYMLINK+="%k", GROUP="video", RUN+="rc.video"
> 
> Both the file paths and the contents of the rules-file will most
> likely be different on other distros, and between different versions
> of the same distro.

Bjorn,

Sorry about not mentioning that before.  I did remember something from 
that time period but what I had remembered was that it wasn't a complete 
solution and since I was in a hurry when I wrote the previous reply I 
didn't go digging through the archive to get out a full explanation.

  -Mike

-- 

Mike Isely
isely @ pobox (dot) com
PGP: 03 54 43 4D 75 E5 CC 92 71 16 01 E2 B5 F5 C1 E8


More information about the pvrusb2 mailing list