Marco Walther
2020-Nov-24 18:05 UTC
[Nut-upsuser] [EXTERNAL] trying to talk to TrippLite SMX1500LCD using RPI & NUT
On 11/24/20 9:11 AM, Kirk Bocek wrote:> > On 11/24/2020 8:10 AM, David Zomaya wrote: >>>> Only when I physically unplug it and plug it in again will it start. >>>> Is there a way I can do something about that? >>>> Because after that, I tried all kinds of ways to see if I can talk >>>> to the thing but I am completely failing in it. >> Once the UPS drops, is it gone from lsusb too? >> I believe there were some similar SMX/SMART1500LCDT reports on the >> list in the past. >> >> Thank you, >> David Zomaya >> Tripp Lite > Yes I have one that *completely* dropped off. Nothing in lsusb. The > unit worked intermittantly when first installed. Then the USB > interface just disappeared even after power cycling the unit. I've > been lazy about calling tech support.I have one of those SMART1500LCDT which become unresponsive on USB once in a while. It looks like lsusb still finds the UPS in my case. My solution was an USB hub which can power down different ports via software control from the host;-) root at odroid-www:~/bin# cat check_ups.sh #!/bin/bash while true do x=$(curl -s -o - 'http://192.168.1.5:85/cgi-bin/nut/upsstats.cgi?host=tripplite at 127.0.0.1:3493' | sed 's:<[^>]*>::g' | awk 'BEGIN {s = 0; } $1 == "Status:" { s = 1; next; } s == 1 { print $0; s = 0; }') if [ "$x" != "ONLINE" ] then logger -p daemon.warning "Triplite is not offline, trying to restart USB -b 001 -d $(lsusb | awk '/0409:0058/ { print substr($4, 0, length($4) - 1); }') -P 1" /root/bin/hub-ctrl -b 001 -d $(lsusb | awk '/0409:0058/ { print substr($4, 0, length($4) - 1); }') -P 1 -p 0 sleep 5 /root/bin/hub-ctrl -b 001 -d $(lsusb | awk '/0409:0058/ { print substr($4, 0, length($4) - 1); }') -P 1 -p 1 sleep 30 else sleep 300 fi done -- Marco> > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at alioth-lists.debian.net > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser
Stuart D Gathman
2020-Nov-24 18:42 UTC
[Nut-upsuser] [EXTERNAL] trying to talk to TrippLite SMX1500LCD using RPI & NUT
On Tue, 24 Nov 2020, Marco Walther wrote:> On 11/24/20 9:11 AM, Kirk Bocek wrote: >> >> On 11/24/2020 8:10 AM, David Zomaya wrote: >>>>> Only when I physically unplug it and plug it in again will it start.You need a USB hub that supports either mandatory all ports off (even though it is mandatory, very few hubs sold actually implement it), or optional PPPS (per port power switching). With older kernels, I was able to use hub-ctrl to power off the port with the UPS, and then power it on again - which has the same effect as unplugging the cable. I put all this into a package (trippfix on github) for CentOS-6. With newer kernels, e.g. CentOS-8, the kernel knows how to deal with this kind of braindamage, and will do the PPPS power cycle automatically (which won't work, of course, unless you have a hub that actually supports it). So with C8, I don't need my package. Here is an example from dmesg of the kernel doing the power cycle automatically: [1909765.932951] usb 2-1.4-port4: disabled by hub (EMI?), re-enabling... [1909765.933328] usb 2-1.4.4: USB disconnect, device number 17 [1909766.898490] usb 2-1.4-port4: Cannot enable. Maybe the USB cable is bad? [1909767.754326] usb 2-1.4-port4: Cannot enable. Maybe the USB cable is bad? [1909767.754586] usb 2-1.4-port4: attempt power cycle [1909768.774301] usb 2-1.4.4: new low-speed USB device number 20 using ehci-pci [1909768.817887] usb 2-1.4.4: New USB device found, idVendor=09ae, idProduct=3016, bcdDevice= 0.02>>>>> Is there a way I can do something about that?Get a hub that supports PPPS. Since all USB microcontrollers on the market support PPPS, you can also add it yourself if you are so inclined: http://hackaday.com/2014/02/05/software-controlled-per-port-power-switching-for-usb-hubs/ For a list of working hubs when I bought mine in 2016: https://github.com/codazoda/hub-ctrl.c This is not something NUT can really do anything about (other than the driver recovering properly when the UPS goes away and then comes back). It is braindead USB hardware in many Tripplite boxes. My Tripplite does really well at handling the surges that come with power failures and switching to alternate circuits or home generator power. So it was worth it to work around its USB braindamage. Buying a higher end device might have been more cost effecting considering my time - but wouldn't be nearly as fun...