Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2010 22:32:33 +0200
From:      David DEMELIER <demelier.david@gmail.com>
To:        Warren Block <wblock@wonkity.com>
Cc:        Roland Smith <rsmith@xs4all.nl>, Marco Beishuizen <mbeis@xs4all.nl>, freebsd-questions@freebsd.org
Subject:   Re: Using a scanner (USB) as user and not as root
Message-ID:  <x2rb3954bba1004291332y9b9fea60rf387a81c05582228@mail.gmail.com>
In-Reply-To: <alpine.BSF.2.00.1004281310520.23838@wonkity.com>
References:  <alpine.BSF.2.00.1004281939070.3115@yokozuna.lan> <20100428182223.GA34355@slackbox.erewhon.net> <alpine.BSF.2.00.1004282057490.3115@yokozuna.lan> <alpine.BSF.2.00.1004281310520.23838@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
2010/4/28 Warren Block <wblock@wonkity.com>:
> 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=3D1001(marco) gid=3D0(wheel) groups=3D0(wheel),5(operator),1001(usb)
>>
>> But the permissions are not:
>>
>> ls -l /dev/usb/ /dev/ugen*
>> lrw-rw-r-- =A01 root =A0usb =A09 Apr 28 19:05 /dev/ugen0.1 -> usb/0.1.0
>> lrw-rw-r-- =A01 root =A0usb =A09 Apr 28 19:05 /dev/ugen1.1 -> usb/1.1.0
>> lrw-rw-r-- =A01 root =A0usb =A09 Apr 28 21:05 /dev/ugen1.2 -> usb/1.2.0
>> lrw-rw-r-- =A01 root =A0usb =A09 Apr 28 21:05 /dev/ugen1.3 -> usb/1.3.0
>> lrw-rw-r-- =A01 root =A0usb =A09 Apr 28 19:05 /dev/ugen2.1 -> usb/2.1.0
>>
>> /dev/usb/:
>> total 0
>> crw------- =A01 root =A0operator =A0 =A00, =A087 Apr 28 19:05 0.1.0
>> crw------- =A01 root =A0operator =A0 =A00, =A093 Apr 28 19:05 0.1.1
>> crw------- =A01 root =A0operator =A0 =A00, =A089 Apr 28 19:05 1.1.0
>> crw------- =A01 root =A0operator =A0 =A00, =A094 Apr 28 19:05 1.1.1
>> crw------- =A01 root =A0operator =A0 =A00, 104 Apr 28 21:05 1.2.0
>> crw------- =A01 root =A0operator =A0 =A00, 105 Apr 28 21:05 1.2.1
>> crw------- =A01 root =A0operator =A0 =A00, 117 Apr 28 21:05 1.3.0
>> crw------- =A01 root =A0operator =A0 =A00, 119 Apr 28 21:05 1.3.1
>> crw------- =A01 root =A0operator =A0 =A00, =A091 Apr 28 19:05 2.1.0
>> crw------- =A01 root =A0operator =A0 =A00, =A095 Apr 28 19:05 2.1.1
>
> You can use devd.conf for this:
>
> attach 100 {
> =A0 =A0 =A0 =A0device-name "ugen[0-9].[0-9]";
> =A0 =A0 =A0 =A0match "vendor" "0x04b8";
> =A0 =A0 =A0 =A0match "product" "0x010a";
> =A0 =A0 =A0 =A0action "usb_devaddr=3D`echo $device-name | sed 's#^ugen##'=
` && \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0chown root:saned /dev/usb/${usb_devaddr}.*=
 && \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0chmod 0660 /dev/usb/${usb_devaddr}.*
>
> Copied from a post on -current or similar; apologies to the author, who I=
've
> forgotten. =A0I 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. =A0Or I guess they might be if you reload the ruleset with apply=
set
> after the device is created, but devd is a lot more capable.
>
from devfs.rules(5) :

NAME
     devfs.rules =97 devfs configuration information

DESCRIPTION
     The devfs.rules file provides an easy way to create and apply devfs(8)
     rules, *even for devices that are not available at boot.*

But devfs.rules is specially made for device not available at boot
such as usb keys.

> -Warren Block * Rapid City, South Dakota USA
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.o=
rg"
>



--=20
Demelier David



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