From owner-freebsd-questions@FreeBSD.ORG Thu Aug 20 21:37:25 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8DAB7106568C for ; Thu, 20 Aug 2009 21:37:25 +0000 (UTC) (envelope-from rsmith@xs4all.nl) Received: from smtp-vbr11.xs4all.nl (smtp-vbr11.xs4all.nl [194.109.24.31]) by mx1.freebsd.org (Postfix) with ESMTP id 047548FC3D for ; Thu, 20 Aug 2009 21:37:24 +0000 (UTC) Received: from slackbox.xs4all.nl (slackbox.xs4all.nl [213.84.242.160]) by smtp-vbr11.xs4all.nl (8.13.8/8.13.8) with ESMTP id n7KLbMPA013866; Thu, 20 Aug 2009 23:37:23 +0200 (CEST) (envelope-from rsmith@xs4all.nl) Received: by slackbox.xs4all.nl (Postfix, from userid 1001) id B3018B85D; Thu, 20 Aug 2009 23:37:22 +0200 (CEST) Date: Thu, 20 Aug 2009 23:37:22 +0200 From: Roland Smith To: Michal Message-ID: <20090820213722.GB3586@slackbox.xs4all.nl> References: <4A8DA9FD.6080904@infosec.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="QTprm0S8XgL7H0Dt" Content-Disposition: inline In-Reply-To: <4A8DA9FD.6080904@infosec.pl> X-GPG-Fingerprint: 1A2B 477F 9970 BA3C 2914 B7CE 1277 EFB0 C321 A725 X-GPG-Key: http://www.xs4all.nl/~rsmith/pubkey.txt X-GPG-Notice: If this message is not signed, don't assume I sent it! User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: by XS4ALL Virus Scanner Cc: freebsd-questions@freebsd.org Subject: Re: digital camera and devd X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Aug 2009 21:37:25 -0000 --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--