[pvrusb2] sysfs, usdev and udevinfo

Bjorn Danielsson pvr-usb2 at dax.nu
Mon Apr 21 10:13:02 CDT 2008


xavier.gnata at free.fr wrote:
>[...]
> The only pb is the /sys/.../pvrusb2/... owner is root. That is why I need udev
> to change the permission.

I just started playing with the sysfs interface, and I tried the following
approach for changing the permissions. Each time a video device is added
(any video device) udev runs the following script that adds group-write
permissions to the entire /sys/class/pvrusb2 tree.

#!/bin/sh
GROUP=video
CLASSDIR=/sys/class/pvrusb2
if [ "$ACTION" = "add" -a -d $CLASSDIR ]; then
    GLOB=$CLASSDIR/*/
    chgrp -R $GROUP $GLOB
    find $GLOB -perm -u+w -print | xargs chmod g+w
fi

Not very elegant since it doesn't care about which device was attached,
but it works.

-- 
Bjorn Danielsson  <pvr-usb2 at dax.nu>


More information about the pvrusb2 mailing list