From owner-freebsd-questions@FreeBSD.ORG Wed Apr 28 19:22:12 2010 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 18304106566C for ; Wed, 28 Apr 2010 19:22:12 +0000 (UTC) (envelope-from wblock@wonkity.com) Received: from wonkity.com (wonkity.com [67.158.26.137]) by mx1.freebsd.org (Postfix) with ESMTP id AB2BE8FC16 for ; Wed, 28 Apr 2010 19:22:11 +0000 (UTC) Received: from wonkity.com (localhost [127.0.0.1]) by wonkity.com (8.14.3/8.14.3) with ESMTP id o3SJMAtI023939; Wed, 28 Apr 2010 13:22:10 -0600 (MDT) (envelope-from wblock@wonkity.com) Received: from localhost (wblock@localhost) by wonkity.com (8.14.3/8.14.3/Submit) with ESMTP id o3SJMAkk023936; Wed, 28 Apr 2010 13:22:10 -0600 (MDT) (envelope-from wblock@wonkity.com) Date: Wed, 28 Apr 2010 13:22:10 -0600 (MDT) From: Warren Block To: Marco Beishuizen In-Reply-To: Message-ID: References: <20100428182223.GA34355@slackbox.erewhon.net> User-Agent: Alpine 2.00 (BSF 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.3 (wonkity.com [127.0.0.1]); Wed, 28 Apr 2010 13:22:10 -0600 (MDT) Cc: Roland Smith , freebsd-questions@freebsd.org Subject: Re: Using a scanner (USB) as user and not as root 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: Wed, 28 Apr 2010 19:22:12 -0000 On Wed, 28 Apr 2010, Marco Beishuizen wrote: > On Wed, 28 Apr 2010, Roland Smith wrote: > >> Are the permissions correct? Check with 'ls -l /dev/usb/ /dev/ugen*'. >> Is your user-id in the usb group? Check by running 'id' as the normal user. >> >> If all that is in order, remove all lines except the three above from >> /etc/devfs.rules, and try again. > > Running id as user looks ok: > > uid=1001(marco) gid=0(wheel) groups=0(wheel),5(operator),1001(usb) > > But the permissions are not: > > ls -l /dev/usb/ /dev/ugen* > lrw-rw-r-- 1 root usb 9 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0 > lrw-rw-r-- 1 root usb 9 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0 > lrw-rw-r-- 1 root usb 9 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0 > lrw-rw-r-- 1 root usb 9 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0 > lrw-rw-r-- 1 root usb 9 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0 > > /dev/usb/: > total 0 > crw------- 1 root operator 0, 87 Apr 28 19:05 0.1.0 > crw------- 1 root operator 0, 93 Apr 28 19:05 0.1.1 > crw------- 1 root operator 0, 89 Apr 28 19:05 1.1.0 > crw------- 1 root operator 0, 94 Apr 28 19:05 1.1.1 > crw------- 1 root operator 0, 104 Apr 28 21:05 1.2.0 > crw------- 1 root operator 0, 105 Apr 28 21:05 1.2.1 > crw------- 1 root operator 0, 117 Apr 28 21:05 1.3.0 > crw------- 1 root operator 0, 119 Apr 28 21:05 1.3.1 > crw------- 1 root operator 0, 91 Apr 28 19:05 2.1.0 > crw------- 1 root operator 0, 95 Apr 28 19:05 2.1.1 You can use devd.conf for this: attach 100 { device-name "ugen[0-9].[0-9]"; match "vendor" "0x04b8"; match "product" "0x010a"; action "usb_devaddr=`echo $device-name | sed 's#^ugen##'` && \ chown root:saned /dev/usb/${usb_devaddr}.* && \ chmod 0660 /dev/usb/${usb_devaddr}.* Copied from a post on -current or similar; apologies to the author, who I've forgotten. I thought this was in the default devd.conf as an example, but it appears not. devfs.rules don't apply to devices that are created dynamically after boot-up. Or I guess they might be if you reload the ruleset with applyset after the device is created, but devd is a lot more capable. -Warren Block * Rapid City, South Dakota USA