[Nut-upsdev] Tripp-Lite SU2200XLA problem

Kelvin Ku kelvin at telemetry-investments.com
Tue Mar 9 22:54:04 UTC 2010


Hi,

I kludged support for the TrippLite SU2200XLA into nut-2.4.3 as follows:

--- ./drivers/tripplite-hid.c.0 2010-03-03 15:53:20.000000000 -0500
+++ ./drivers/tripplite-hid.c   2010-03-03 15:53:40.000000000 -0500
@@ -81,6 +81,8 @@
        { USB_DEVICE(TRIPPLITE_VENDORID, 0x4002), battery_scale_1dot0 },
        /* e.g. TrippLite SmartOnline SU1500RTXL2ua */
        { USB_DEVICE(TRIPPLITE_VENDORID, 0x4003), battery_scale_1dot0 },
+       /* e.g. TrippLite SmartOnline SU2200XLA */
+       { USB_DEVICE(TRIPPLITE_VENDORID, 0x4004), battery_scale_1dot0 },
 
        /* HP R/T 2200 INTL (like SMART2200RMXL2U) */
        { USB_DEVICE(HP_VENDORID, 0x1f0a), battery_scale_1dot0 },

--- ./scripts/udev/nut-usbups.rules.in.0        2010-03-03 15:59:45.000000000 -0500
+++ ./scripts/udev/nut-usbups.rules.in  2010-03-03 16:00:43.000000000 -0500
@@ -102,6 +102,8 @@
 ATTR{idVendor}=="09ae", ATTR{idProduct}=="4002", MODE="664", GROUP="@RUN_AS_GROUP@"
 #  e.g. TrippLite SmartOnline SU1500RTXL2ua  - usbhid-ups
 ATTR{idVendor}=="09ae", ATTR{idProduct}=="4003", MODE="664", GROUP="@RUN_AS_GROUP@"
+#  e.g. TrippLite SmartOnline SU2200XLA  - usbhid-ups
+ATTR{idVendor}=="09ae", ATTR{idProduct}=="4004", MODE="664", GROUP="@RUN_AS_GROUP@"
 
 # PowerCOM
 #  PowerCOM IMP - IMPERIAL Series  - usbhid-ups

I believe my configuration and permissions are correct:

$ sudo -u nut tail /etc/ups/ups.conf
#       driver = mydriver
#       port = /dev/ttyS1
#       cable = 1234
#       desc = "Something descriptive"
#
# To find out if your driver supports any extra settings, start it with
# the -h option and/or read the driver's documentation.
[usb]
        driver = usbhid-ups
        port = auto

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 007: ID 09ae:4004 Tripp Lite 
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub

$ ls -l /dev/bus/usb/002/007
crw-rw-r-- 1 root dialout 189, 134 2010-03-09 17:41 /dev/bus/usb/002/007

$ id nut
uid=57(nut) gid=57(nut) groups=57(nut),18(dialout)

However, if I try to run usbhid-ups as user "nut", I get:

$ sudo -u nut ./usbhid-ups -a usb
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: TrippLite HID 0.4
libusb_get_report: could not claim interface 0: Device or resource busy
Got disconnected by another driver: Device or resource busy
Can't initialize data from HID UPS

Whereas if I run it as root:

$ sudo ./usbhid-ups -a usb -u root
Network UPS Tools - Generic HID driver 0.34 (2.4.3)
USB communication driver 0.31
Using subdriver: TrippLite HID 0.4
libusb_get_report: No error
libusb_get_report: No error
libusb_get_report: No error
libusb_get_report: No error
libusb_get_report: No error
...
(last line repeats)

After the last line repeats a few dozen times, the driver is up and running.
Note that it doesn't work without "-u root" since it setuids to user nut before
doing the libusb_get_report call. I also have to run upsd as root (with option
"-u root") in order for it to communicate with the driver:

$ ps -ef | grep /upsd
root     13688     1  0 17:50 ?        00:00:00 /usr/sbin/upsd -u root

$ upsc usb at localhost
battery.charge: 100
battery.runtime: 57120
device.mfr: Tripp Lite      
device.model: TRIPP LITE UPS  
device.serial: 9833DLCPS720000101  
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.version: 2.4.3
driver.version.data: TrippLite HID 0.4
driver.version.internal: 0.34
ups.delay.shutdown: 20
ups.delay.start: 30
ups.mfr: Tripp Lite      
ups.model: TRIPP LITE UPS  
ups.productid: 4004
ups.serial: 9833DLCPS720000101  
ups.status: OL
ups.vendorid: 09ae

Any ideas? Also note that the output from upsc is a bit skimpy. Perhaps another
kludge will reveal more fields, e.g., input/output voltage and current.

Thanks,
Kelvin



More information about the Nut-upsdev mailing list