paul.chavent at fnac.net
2014-Oct-01 13:46 UTC
[Nut-upsuser] Return on experience with an Emerson/Liebert GXT3
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>
Charles Lepple
2014-Oct-02 01:03 UTC
[Nut-upsuser] Return on experience with an Emerson/Liebert GXT3
On Oct 1, 2014, at 9:46 AM, paul.chavent at fnac.net wrote:> (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.We independently ran across problems with the usb_set_altinterface() call. The plan is to remove it before 2.7.3 is released: https://github.com/networkupstools/nut/issues/138 That issue also includes an override setting, so if I can't get any other testers, I plan to merge it as-is.> # 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).It should run as user "nut" in Debian. You may want to reinstall the nut-server package, and check the post-inst error messages to make sure that the "nut" user is created, and that it is in the "nut" group as well.> 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).Not sure that is where the "user" declaration is being parsed. upsdrvctl just passes arguments to the drivers via the command line (including "-u", although that is not read from the configuration file, but from upsdrvctl's command line).> So i think that either the manual or the implementation is broken.Can you show us the exact configuration syntax you are using?> (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 ?You are welcome to try the liebert-hid subdriver, but it does not look similar. There are some fixes that were added in 2.6.4 to try and work around incorrect exponents in the voltages. You can try starting the usbhid-ups driver directly, adding "-DDD" to see if any messages are logged about "assuming correction factor =". It could be that we did not cover all the different ways those values could be wrong. -- Charles Lepple clepple at gmail
paul.chavent at fnac.net
2014-Oct-02 01:03 UTC
[Nut-upsuser] Return on experience with an Emerson/Liebert GXT3
> https://github.com/networkupstools/nut/issues/138 > That issue also includes an override setting, so if I can't get any other testers, I plan to merge it as-is.Ok, great.> It should run as user "nut" in Debian. You may want to reinstall the nut-server package, and check the post-inst error messages to make sure that the "nut" user is created, and that it is in the "nut" group as well.The user nut and the group nut have been created..> Not sure that is where the "user" declaration is being parsed. upsdrvctl just passes arguments to the drivers via the command line (including "-u", although that is not read from the configuration file, but from upsdrvctl's command line).https://github.com/networkupstools/nut/blob/master/drivers/upsdrvctl.c#L60 I'm quite sure that it is the place where the config file is parsed... And the init script of the debian package don't explicitly append "-u nut" in wheezy. See the attached patch in my first message.> Can you show us the exact configuration syntax you are using?8<-----/etc/nut/ups.conf------ user = nut [liebert] ??? driver = usbhid-ups ??? port = /dev/usb/hiddev0 ??? productid = 0008 8<----------------> There are some fixes that were added in 2.6.4 to try and work around incorrect exponents in the voltages. You can try starting the usbhid-ups driver directly, adding "-DDD" to see if any messages are logged about "assuming correction factor =". It could be that we did not cover all the different ways those values could be wrong.Ok, i will give it a try. Regards. Paul.
Charles Lepple
2014-Oct-02 12:39 UTC
[Nut-upsuser] Return on experience with an Emerson/Liebert GXT3
On Oct 1, 2014, at 9:03 PM, paul.chavent at fnac.net wrote:>> It should run as user "nut" in Debian. You may want to reinstall the nut-server package, and check the post-inst error messages to make sure that the "nut" user is created, and that it is in the "nut" group as well. > > The user nut and the group nut have been created..Ah, right, because you are using the Debian upsdrvctl with a hand-compiled driver. I would recommend copying the whole Debian ./configure line, including the part that sets the default user and group to "nut".> >> Not sure that is where the "user" declaration is being parsed. upsdrvctl just passes arguments to the drivers via the command line (including "-u", although that is not read from the configuration file, but from upsdrvctl's command line). > > https://github.com/networkupstools/nut/blob/master/drivers/upsdrvctl.c#L60 > > I'm quite sure that it is the place where the config file is parsed...What I should have said is that upsdrvctl is not where the "user = " is being interpreted (although you are correct, it is parsed and ignored). I was thinking of this line in the driver core: https://github.com/networkupstools/nut/blob/master/drivers/main.c#L295> And the init script of the debian package don't explicitly append "-u nut" in wheezy. See the attached patch in my first message.Since we don't ship that init file in the generic NUT source package anymore, that will need to be discussed with the Debian maintainers - probably at http://bugs.debian.org>> Can you show us the exact configuration syntax you are using? > > 8<-----/etc/nut/ups.conf------ > user = nut > > [liebert] > driver = usbhid-ups > port = /dev/usb/hiddev0 > productid = 0008 > 8<---------------- > >> There are some fixes that were added in 2.6.4 to try and work around incorrect exponents in the voltages. You can try starting the usbhid-ups driver directly, adding "-DDD" to see if any messages are logged about "assuming correction factor =". It could be that we did not cover all the different ways those values could be wrong. > > Ok, i will give it a try. > > Regards. > > Paul.-- Charles Lepple clepple at gmail