*New 12.1 series Release:
2019-11-08: XigmaNAS 12.1.0.4.7091 - released!

*New 11.3 series Release:
2019-10-19: XigmaNAS 11.3.0.4.7014 - released


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

Producing and hosting XigmaNAS costs money. Please consider donating for our project so that 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”