Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Apr 2010 14:41:08 -0600 (MDT)
From:      Warren Block <wblock@wonkity.com>
To:        Marco Beishuizen <mbeis@xs4all.nl>
Cc:        Roland Smith <rsmith@xs4all.nl>, freebsd-questions@freebsd.org
Subject:   Re: Using a scanner (USB) as user and not as root
Message-ID:  <alpine.BSF.2.00.1004291437530.25778@wonkity.com>
In-Reply-To: <alpine.BSF.2.00.1004292210410.2406@yokozuna.lan>
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> <alpine.BSF.2.00.1004292210410.2406@yokozuna.lan>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Apr 2010, Marco Beishuizen wrote:

> On Wed, 28 Apr 2010, Warren Block wrote:
>
>> 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.
>
> Unfortunately this didn't help either (I replaced the vendor and product with 
> the correct digits for my scanner, and the chown with the user name). The usb 
> devices are still owned by root and not accessible as user.

For the sake of completeness: devd has to be restarted after changes to 
devd.conf, and the code above is only executed when the scanner is 
detected (USB cable plugged in or scanner powered on).

-Warren Block * Rapid City, South Dakota USA



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