[Nut-upsuser] Return on experience with an Emerson/Liebert GXT3
paul.chavent at fnac.net
paul.chavent at fnac.net
Wed Oct 1 13:46:58 UTC 2014
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 at 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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drivers_libusb_c.patch
Type: text/x-patch
Size: 363 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20141001/7983d1ca/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: etc_init.d_nut-server.patch
Type: text/x-patch
Size: 871 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20141001/7983d1ca/attachment-0001.bin>
More information about the Nut-upsuser
mailing list