Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Aug 2009 23:37:22 +0200
From:      Roland Smith <rsmith@xs4all.nl>
To:        Michal <ml@infosec.pl>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: digital camera and devd
Message-ID:  <20090820213722.GB3586@slackbox.xs4all.nl>
In-Reply-To: <4A8DA9FD.6080904@infosec.pl>
References:  <4A8DA9FD.6080904@infosec.pl>

next in thread | previous in thread | raw e-mail | index | archive | help

--QTprm0S8XgL7H0Dt
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Thu, Aug 20, 2009 at 07:54:37PM +0000, Michal wrote:
> Hello,
>=20
> I've got a Canon digital camera set up and working with gphoto2 via=20
> devfs+devd but it's not elegant/clean enough:
>=20
> 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";
> };
>=20
> Problem with this solution is that it changes owner for all /dev/usb=20
> files i.e. usb, usb0, usb1, usb2 and usb3.
>=20
> 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=3D`sysctl dev.ugen.0.%location | cut -d '=3D' -f 2` but it tur=
ns=20
> out that it's not what I'm looking for because sometimes when it returns=
=20
>   "2" then I still need write access to just /dev/usb3.
>=20
> Any ideas please?

I'm not exactly sure what you are trying to achieve here. But here is my
=A40,02:

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.

Roland
--=20
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)

--QTprm0S8XgL7H0Dt
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.12 (FreeBSD)

iEYEARECAAYFAkqNwhIACgkQEnfvsMMhpyXfuACcCZ7kaNmMR2ogYTuWthEIqyoF
s1gAnAqi9puQWbELrWPfbEA09pbj5qvJ
=FD9f
-----END PGP SIGNATURE-----

--QTprm0S8XgL7H0Dt--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090820213722.GB3586>