On Thu, Aug 20, 2009 at 07:54:37PM +0000, Michal wrote:
> Hello,
> I've got a Canon digital camera set up and working with gphoto2 via 
> devfs+devd but it's not elegant/clean enough:
> attach 0 {
>   device-name "ugen[0-9]+";
>   match "vendor" "0x0123";
>   match "product" "0x3210";
>   match "sernum" "1234567890";
>   action "devfs rule -s 10 add 100 path $device-name* user joe; \
>   devfs rule -s 10 add 200 path usb[0-9] user joe; \
>   devfs rule -s 10 applyset";
> };
> Problem with this solution is that it changes owner for all /dev/usb 
> files i.e. usb, usb0, usb1, usb2 and usb3.
> How can I check exactly which /dev/usb* entry corresponds to my camera?
> And by the way /dev/usb3 means port 3, hub 3 or what are they?
> Tried with:
> usb_number=`sysctl dev.ugen.0.%location | cut -d '=' -f 2` but it turns 
> out that it's not what I'm looking for because sometimes when it returns 
>   "2" then I still need write access to just /dev/usb3.
> Any ideas please?

I'm not exactly sure what you are trying to achieve here. But here is my

Create a group called 'usb'. Make every user that you want to be able to use
usb devices a member of this group. Next, add the following rules to your
active ruleset in /etc/devfs.rules:

add path 'da*' mode 0660 group usb
add path 'msdosfs/*' mode 0660 group usb
add path 'uscanner*' mode 0660 group usb
add path 'usb*' mode 0660 group usb
add path 'ugen*' mode 0660 group usb

If you are using 8-BETA, use 'usb/*' instead of 'usb*'.

This gives the members of the usb group write acces to the relevant devices
for using USB drives, cameras, scanners etc. You might want to add other usb
device nodes (e.g. uhid) if you use those.

R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)

Attachment: pgpip7GfMmRrB.pgp
Description: PGP signature

Reply via email to