Latest News:
2019-02-21: XigmaNAS 11.2.0.4.6536 - released!

Latest BETA Release:
2019-02-21: XigmaNAS 12.0.0.4.6536 - BETA released!

We really need "Your" help on XigmaNAS https://translations.launchpad.net/xigmanas translations. Please help today!

Producing and hosting XigmaNAS cost money, please consider a donation to our project so we can continue to offer you the best.
We need your support! eg: PAYPAL

Hack to reset usb device after "data stale" errors

Uninterruptable Power Supply service using NUT.
Forum rules
Set-Up GuideFAQsForum Rules
Post Reply
elliotn
NewUser
NewUser
Posts: 2
Joined: 20 Dec 2018 00:19
Status: Offline

Hack to reset usb device after "data stale" errors

#1

Post by elliotn » 20 Dec 2018 00:53

I have an APC Back UPS 600 that I was able to get working with the usbhid-ups driver. Unfortunately, it was frequently crapping out due to "data stale" issues. Adding "pollinterval=30" to Additional Drivers reduced the frequency. Unfortunately, once connectivity was lost it was never regained. I was able to manually reestablish connectivity by resetting the usb device.

I'd love to know how to actually solve the "data stale" issue. In the meantime, I added this hack as a cron job to check ups connectivity and reset device if need be. Change the first 3 variables to fit your needs:

#!/bin/bash

# change to fit your environment
UPSNAME="closet"
UPSSTRING="American Power Conversion Back"
RESETATTEMPTS=1

# find device
UPSDEV=$(usbconfig | sed -n -e "/$UPSSTRING/s/:.*//p")
if [ -z "$UPSDEV" ]; then
echo "no matching UPS device found: $UPSSTRING"
exit -1
fi

# reset device if need be
upsc $UPSNAME@localhost > /dev/null 2>&1
if [ $? -ne 0 ]; then
for xxx in $(seq 1 $RESETATTEMPTS); do
usbconfig -d $UPSDEV reset
done
fi

Post Reply

Return to “UPS”