[pvrusb2] sysfs, usdev and udevinfo

Mike Isely isely at isely.net
Tue Apr 22 21:30:52 CDT 2008


On Tue, 22 Apr 2008, xavier.gnata at free.fr wrote:

> Selon Bjorn Danielsson <pvr-usb2 at dax.nu>:
> 
> > 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>
> 
> Hi,
> 
> Indeed it works and I'm using something quite similar but we should be able to
> know which device is the pvrusrb2 related once.
> I have tried to understand who the info should be provided reading the sources
> of a simple usb drivers but I just failed because the strings I was looking for
> were not present...
> 
> Mike, do you I a clever idea??

Yes, I have an idea but I still need to research it.  We had discussed 
this before, but honestly I've been distracted by other issues (see 
recent snapshot release) and I had forgotten about this idea.  But I 
just added this to my notes so I won't forget again.

I strongly suspect that there is a reasonable means to make additional 
metadata available to udev, and the mechanism may involve associating 
additional kobj nodes (a kernel structure) with the device.  Obviously 
the device serial number - which is only available to the driver right 
now - would be a very good candidate for this.  I need to look into this 
though.

  -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