Re: /etc/udev/rules.d and permissions in /dev/usb



in message <878xu6gkhx.fsf@xxxxxxxxxxxxxxxxxx>, Nix
('nix-razor-pit@xxxxxxxxxxxxx') wrote:

> Ian's covered most of the points, but...
>
> On Sun, 25 Dec 2005, Simon Brooke suggested tentatively:
>> Dec 25 14:29:13 gododdin udev[18868]: configured rule in
>> '/etc/udev/rules.d/udev.rules[23]' applied, 'hiddev0' becomes 'usb/%k'
>> Dec 25 14:29:13 gododdin udev[18868]: creating device node
>> '/dev/usb/hiddev0'
>>
>> So I created a new rule:
>>
>> -[root]-> cat /etc/udev/rules.d/010apcups.rules
>> # Simon's experiment for the UPS, 25:12:2005
>> BUS="usb", KERNEL="hiddev*", SYSFS{product}="American PowerConversion
>> Smart-UPS1000 FW:600.1.I USB FW:1.3", OWNER="nut"
>>
>> After creating the rule I restarted udev, then unplugged and replugged
>> the UPS' usb plug. My rule did not fire. It seems to me this means one
>> of
>>
>> (a) I've got the syntax wrong, in which case could someone correct it?
>
> It's wrong ;) you want
>
> BUS=="usb", KERNEL=="hiddev*", SYSFS{product}=="American
> PowerConversion Smart-UPS1000 FW:600.1.I USB FW:1.3", OWNER="nut"
>
> == is comparison, = is assignment.
>
> (It also seems terribly specific to me. Do you really care about the
> FW:600 stuff? You can use globs in these fields...)

OK, thanks, that's brilliant. It gave me just enough to discover that
what I really wanted was:

BUS=="usb", KERNEL=="hiddev*", SYSFS{product}=="Smart-UPS 1000 *",
OWNER="nut", GROUP="nut", NAME="usb/%k"

The string in the 'product' pseudo file did not include 'American
PowerConversion' - so where it is coming from for the log message I
don't know.

It also seems that once one rule has fired, further rules are not sought,
so you need to do everything in one.

However, if the cable gets disconnected, even though when it is
reconnected the device node is now created with the right permissions,
upsmon does not re-establish communication, but just continues to whinge

Dec 29 00:59:13 gododdin upsmon[5141]: Poll UPS
[SmartUPS-1000@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx] failed - Driver not
connected

what I need to do is force '/etc/init.d/ups-monitor restart' to run after
the device is recreated - any suggestion how to do this?

--
simon@xxxxxxxxxxxxxx (Simon Brooke) http://www.jasmine.org.uk/~simon/
Windows 95:
You, you, you! You make a grown man cry...
M. Jagger/K. Richards
.



Relevant Pages

  • Re: [PATCH] Watchdog device node name unification
    ... On Sun, 2005-08-14 at 01:43 +0200, Olaf Hering wrote: ... > On Sun, Aug 14, Christoph Hellwig wrote: ... >> have any relation with the name of the device node. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Cant write to /dev/null
    ... Sun and said: ... No other device node in /dev ... The before-the-epoch date on the node is almost certainly because ... I don't know why devfs does this, ...
    (comp.os.linux.misc)