Hi.
I would like to share with you my experience on trying to use nut with a
Liebert GXT3 on a Debian wheezy with nut-server 2.6.4.
Please find my observations below.
(1) I've installed the packaged version of nut-server
# aptitude install nut-server
(2) I did some tuning for my configuration
#Â cat << EOF >> /etc/nut/ups.conf
user=nut
[liebert]
driver=usbhid-ups
port=/dev/usb/hiddev0
productid=0008
EOF
#Â sed -i~ -e 's/MODE=none/Mode=standalone/g' /etc/nut/nut.conf
#Â cat << EOF > /etc/udev/rules.d/90-nut-ups.rules
ACTION=="add|change", SUBSYSTEM=="usb|usb_device", ATTRS{idVendor}=="10af",
ATTRS{idProduct}=="0008", MODE="664", GROUP="nut"
EOF
(3) I did some tests with /lib/nut/usbhid-ups, lsusb and usbhid-dump
It doesn't work out of the box.
After some investigation, it seems that the GXT3 usb device is a bit
susceptible and "crash" after some USB requests.
I used wireshark to check at the protocol level (modprobe usbmon before
launching wireshark). Here is what i can say :
- after usb cable plugin, issue an 'lsusb -v' -> after the GET DESCRIPTOR
Request DEBUG, the device sends Malformed responses.
- after usb cable plugin, issue an 'usbhid-ups ... ' -> after the SET
INTERFACE Request that succeed, all subsequent GET DESCRIPTOR responses are
malformed.
- after usb cable plugin, issue an 'usbhid-dump' -> the device proudly survive
These observations would need more insight.
But as a workaround, I've commented the "usb_set_altinterface(udev, 0);" call
at line 225 of the drivers/libusb.c source file.
Thanks to this hack, the driver can dialog with the device.
# upsdrvctl -u nut start
Network UPS Tools - UPS driver controller 2.6.4
Network UPS Tools - Generic HID driver 0.38 (2.7.2.5)
USB communication driver 0.32
Using subdriver: Belkin HID 0.17
(4) I tryed to launch the server either by hand or with "service nut-server
start".
It doesn't work out of the box due to setuid issues (the program runs as
nobody).
As we can read in the man upsdrvctl :
"This [the setuid user] may be set in ups.conf with "user" in the global
section."
This is also suggested in the Q.6 of the faq.
However, the drivers/upsdrvctl.c do_upsconf_args function do not handle "user"
global declaration (at least in the git repository, i haven't checked the
debian patches).
So i think that either the manual or the implementation is broken.
As a workaround i added an UPSDRVCTL_OPTIONS to the /etc/init.d/nut-server
scripts and set UPS*_OPTIONS to "-u nut".
Thanks to this hack, the driver and the daemon start.
# service nut-server start
[ ok ] Starting NUT - power devices information server and drivers: driver(s).
upsd.
(5) After those steps, everything "seems" to works better :
# upsc liebert@localhost
battery.charge: 99
battery.charge.low: 20
battery.charge.warning: 0
battery.type: PbAc
battery.voltage: 1.0
battery.voltage.nominal: 0.0
device.mfr: Emerson Network Power
device.model: Liebert GXT3
device.serial: 1106000077AF453
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/usb/hiddev0
driver.parameter.productid: 0008
driver.version: 2.7.2.5
driver.version.data: Belkin HID 0.17
driver.version.internal: 0.38
ups.mfr: Emerson Network Power
ups.model: Liebert GXT3
ups.productid: 0008
ups.serial: 1106000077AF453
ups.status: OL CHRG
ups.vendorid: 10af
(6) Future.
I'm not sure that the subdriver is the best match for this device. What do you
think about trying the liebert-hid one ?
If you haven't any solution yet, we can also discuss about a good patch for
solving the "set_altinterface" issue. Any suggestions ?
And about the "user" key of the ups.conf files, can i suggest a patch for
taking it into account in the drivers and the servers ?
I'm waiting for your feedback and comments.
Regards.
Paul.
diff --git a/drivers/libusb.c b/drivers/libusb.c
index fd8f5b9..f901c05 100644
--- a/drivers/libusb.c
+++ b/drivers/libusb.c
@@ -220,8 +220,10 @@ static int libusb_open(usb_dev_handle **udevp, USBDevice_t *curDevice, USBDevice
}
#endif
+#if 0
/* set default interface */
usb_set_altinterface(udev, 0);
+#endif
if (!callback) {
return 1;
--- /etc/init.d/nut-server~ 2012-12-20 16:10:29.000000000 +0100
+++ /etc/init.d/nut-server 2014-10-01 16:14:50.199120226 +0200
@@ -31,7 +31,8 @@
# set upsd specific options. use "man upsd" for more info
# this parameter is now located in nut.conf, and not in /etc/default/nut anymore
# FIXME: retrieved from 'nut' script during update
-UPSD_OPTIONS=""
+UPSD_OPTIONS="-u nut"
+UPSDRVCTL_OPTIONS="-u nut"
# Exit if the package is not installed
[ -x "$upsd" ] || exit 0
@@ -75,7 +76,7 @@
case "$1" in
start)
# First, start driver(s)
- ! $upsdrvctl start >/dev/null 2>&1 && \
+ ! $upsdrvctl $UPSDRVCTL_OPTIONS start >/dev/null 2>&1 && \
log_progress_msg " (driver(s) failed)." || log_progress_msg " driver(s)."
# Then, data server (upsd)
start-stop-daemon -S -p $upsd_pid -x $upsd \
_______________________________________________
Nut-upsuser mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsuser