[Nut-upsdev] Re: Bug#332939: nut-usb: Needs an udev rule for udev
	>= 0.070-3
    Julien BLACHE 
    jblache at debian.org
       
    Mon Oct 10 16:55:40 UTC 2005
    
    
  
Arnaud Quette <aquette.dev at gmail.com> wrote:
> @Julien: can you please have a look at this point for us.
> I've seen you already did it for SANE...
OK, better do it now than put it on the TODO list, right ? :)
Files attached.
hotplug script: don't add 0s to the vendor and product IDs.
udev rules: some explanations ...
  SUBSYSTEM!="usb_device", ACTION!="add", GOTO="libhidups_rules_end"
This line tells udev to jump to the matching LABEL statement if we're
not adding a usb device. Avoids having to test all the rules, speeds
up things.
  # MGE UPS SYSTEMS units
  SYSFS{idVendor}=="0463", SYSFS{idProduct}=="ffff", MODE="660", GROUP="@RUN_AS_USER@"
  ...
Pretty much self-explanatory, really ;) If you need to run a script
for a particular UPS, add ", RUN="/path/to/script" to the rule for
this UPS.
  LABEL="libhidups_rules_end"
The label for the previous GOTO.
Please test the scripts, although being derived from mine, they should
really just work (tm). (apologies and *duh* if they don't ;)
JB.
-- 
 Julien BLACHE <jblache at debian.org>  |  Debian, because code matters more 
 Debian & GNU/Linux Developer        |       <http://www.debian.org>
 Public key available on <http://www.jblache.org> - KeyID: F5D6 5169 
 GPG Fingerprint : 935A 79F1 C8B3 3521 FD62 7CC7 CD61 4FD7 F5D6 5169 
-------------- next part --------------
#!/bin/sh
#
# This file belongs to the nut-usb Debian package
if [ "$ACTION" != "add" ]; then
    exit 0
fi
case $PRODUCT in
    463/ffff/*|463/1/*|51d/2/*)
	chown root:@RUN_AS_USER@ "$DEVICE"
	chmod 0660 "$DEVICE"
	;;
    *)
	exit 0
	;;
esac
exit 0
-------------- next part --------------
#
# This file belongs to the nut-usb Debian package
#
# udev rules file for libhidups
SUBSYSTEM!="usb_device", ACTION!="add", GOTO="libhidups_rules_end"
# MGE UPS SYSTEMS units
SYSFS{idVendor}=="0463", SYSFS{idProduct}=="ffff", MODE="660", GROUP="@RUN_AS_USER@"
SYSFS{idVendor}=="0463", SYSFS{idProduct}=="0001", MODE="660", GROUP="@RUN_AS_USER@"
# APC units
SYSFS{idVendor}=="051d", SYSFS{idProduct}=="0002", MODE="660", GROUP="@RUN_AS_USER@"
LABEL="libhidups_rules_end"
    
    
More information about the Nut-upsdev
mailing list