[Nut-upsuser] newhidups, usb permissions and Debian
Randall Skelton
randall.skelton at gmail.com
Wed Jul 12 19:08:11 UTC 2006
Hi all,
I've tried installing NUT from both the Debian packages and the
2.0.4-pre1 source but I'm unable to sort out the USB permissions when
using the newhidups driver and an APC XS series UPS. In each case,
I'm able to run newhidups as user root but running it as user nut
fails:
--- as 'nut'
# /lib/nut/newhidups -u nut -a apc1
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)
No matching USB/HID UPS found
daffodil:/etc/hotplug/usb# /lib/nut/newhidups -u nut -DDDDD -a apc1
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)
debug level is '5'
Checking device (0000/0000) (005/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 005
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (004/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 004
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (003/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 003
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (002/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 002
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (001/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: unknown
- Product: unknown
- Serial Number: unknown
- Bus: 001
Trying to match device
Device does not match - skipping
No appropriate HID device found
No matching USB/HID UPS found
--- as 'root'
# /lib/nut/newhidups -u root -DDDDD -a apc1
Network UPS Tools: New USB/HID UPS driver 0.28 (2.0.3)
debug level is '5'
Checking device (0000/0000) (005/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: Linux 2.6.15.4.rhs.20060221 ehci_hcd
- Product: EHCI Host Controller
- Serial Number: 0000:00:1d.7
- Bus: 005
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (004/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: Linux 2.6.15.4.rhs.20060221 uhci_hcd
- Product: UHCI Host Controller
- Serial Number: 0000:00:1d.3
- Bus: 004
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (003/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: Linux 2.6.15.4.rhs.20060221 uhci_hcd
- Product: UHCI Host Controller
- Serial Number: 0000:00:1d.2
- Bus: 003
Trying to match device
Device does not match - skipping
Checking device (0000/0000) (002/001)
- VendorID: 0000
- ProductID: 0000
- Manufacturer: Linux 2.6.15.4.rhs.20060221 uhci_hcd
- Product: UHCI Host Controller
- Serial Number: 0000:00:1d.1
- Bus: 002
Trying to match device
Device does not match - skipping
Checking device (051D/0002) (001/013)
- VendorID: 051d
- ProductID: 0002
- Manufacturer: American Power Conversion
- Product: Back-UPS BR 800 FW:9.o2 .D USB FW:o2
- Serial Number: QB0425139488
- Bus: 001
Trying to match device
Device matches
failed to claim USB device, trying 2 more time(s)...
detaching kernel driver from USB device...
trying again to claim USB device...
HID descriptor retrieved (Reportlen = 1217)
Report descriptor retrieved (Reportlen = 1217)
Found HID device
Report Descriptor size = 1217
Report Descriptor: (200 bytes) => 05 84 09 04 A1 01 09 24 A1 02 85 01
09 FE 79 01
Detected a UPS: American Power Conversion/Back-UPS BR 800 FW:9.o2 .D USB FW:o2
Using subdriver: APC HID 0.8
...
My permissions on the usb device are set by the usual hotplug scripts:
# lsusb
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 013: ID 051d:0002 American Power Conversion Back-UPS
Pro 500/1000/1500
Bus 001 Device 001: ID 0000:0000
daffodil:/etc/hotplug/usb# ls -l /proc/bus/usb/
001/ 002/ 003/ 004/ 005/ devices
# ls -l /proc/bus/usb/001/013
-rw-rw---- 1 root nut 52 Jul 12 14:45 /proc/bus/usb/001/013
The hotplug scripts read:
/etc/hotplug/usb# ls -l
-rw-r--r-- 1 root root 1502 Jul 12 14:45 libhid.usermap
-rwxr-xr-x 1 root root 490 Mar 13 03:14 libhidups
---
/etc/hotplug/usb# cat libhidups
#!/bin/bash
# taken from libgphoto2
GROUP=nut
# for previous udev versions
if [ "$ACTION" = "add" ] && [ -f "$DEVICE" ]
then
# check if $GROUP really exists
if getent group $GROUP > /dev/null; then
chmod 660 "$DEVICE"
chown root:$GROUP "$DEVICE"
fi
fi
# for recent udev versions
if [ "$ACTION" = "add" ] && [ -r "$DEVNAME" ]
then
# check if $GROUP really exists
if getent group $GROUP > /dev/null; then
chmod 660 "$DEVNAME"
chown root:$GROUP "$DEVNAME"
fi
fi
daff
---
/etc/hotplug/usb# cat libhid.usermap
# This file is installed by the Network UPS Tools package.
#
# Sample entry (replace 0xVVVV and 0xPPPP with vendor ID and product
ID respectively) :
# libhidups 0x0003 0xVVVV 0xPPPP 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
#
# usb module match_flags idVendor idProduct bcdDevice_lo
bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol
bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info
#
# MGE UPS SYSTEMS units
libhidups 0x0003 0x0463 0xffff 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
libhidups 0x0003 0x0463 0x0001 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
# APC units
libhidups 0x0003 0x051d 0x0002 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
# Powerware USB
libhidups 0x0003 0x0592 0x0002 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
# Tripp Lite
libhidups 0x0003 0x09ae 0x0001 0x0000 0x0000
0x00 0x00 0x00 0x00 0x00
0x00 0x00000000
I've been playing with this for most of the afternoon but I'm out of
ideas. Any and all suggestions are greatly appreciated!
Cheers,
Randall
More information about the Nut-upsuser
mailing list