Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUT with IPPON Back Pro and Smart Winner #242

Open
grumbler66rus opened this issue Nov 15, 2015 · 4 comments
Open

NUT with IPPON Back Pro and Smart Winner #242

grumbler66rus opened this issue Nov 15, 2015 · 4 comments
Labels
Ippon Ippon branded devices Phoenixtec (USB 0x06DA/0xFFFF) This USB chip VID/PID is used in many devices, some with different protocols - detection may be hard USB

Comments

@grumbler66rus
Copy link

The blazer_USB peridocally looses connection with several IPPON UPS:

  • IPPON Back Pro (desktop UPS)
  • IPPON Smart Winner (rackmount UPS)

I make workaround: the script called by upsmon daemon (the token "NOTIFYCMD" of the upsmon.conf), this script unload blazer_usb and load it's again.

The script:
#!/bin/bash
# notifycmdhandler - script for NOTIFYCMD in the upsmon.conf
# It can use the environment variables NOTIFYTYPE and UPSNAME to know what has happened and on which UPS.
# Please insert into /etc/sudoers followed line:
# upsmon ALL=(root) NOPASSWD: /bin/service upsdrv restart
#
# NUT driver; vendor ID and product ID of USB device
NUTDRIVERNAME=blazer_usb
UPSUSBVID=06da
UPSUSBPID=0003
# Programs
GREP=/bin/grep
SUDO="/usr/bin/sudo -S"
LSUSB=/usr/bin/lsusb
SERVICE=/bin/service
LOGGER=/usr/bin/logger
# Functions
try_restart_blaser_usb(){
# check usb device presented if the blazer_usb driver is used
# if result of grep is zero then device is connected and we may restart of blazer_usb (this is should restore connection the NUT with UPS)
[[ ${NUTDRIVERNAME} == "blazer_usb" && -n ${UPSUSBVID} && -n ${UPSUSBPID} ]] && {LSUSB} | ${GREP} -q ${UPSUSBVID}:${UPSUSBPID}
if [[ $? -eq 0 ]]
then
${SUDO} ${SERVICE} upsdrv restart 2>&1 | logger -p daemon.info -t notifycmdhander
${LOGGER} -p daemon.info -t notifycmdhander "${SUDO} /bin/bash -c "set | /bin/grep UID" (restart service upsdrv) with result: $?"
else
${LOGGER} -p daemon.info -t notifycmdhander "USB device ${UPSUSBVID}:${UPSUSBPID}" not found (NUTDRIVERNAME=${NUTDRIVERNAME})
fi
}
# Main code
[[ ${UPSNAME} ]] || { ${LOGGER} -p daemon.error UPSNAME is not defined! ; exit 1 }
[[ ${NOTIFYTYPE} ]] || { ${LOGGER} -p daemon.error NOTIFYTYPE is nod defined! ; exit 1 }
if [[ "${NOTIFYTYPE}" == "NOCOMM" ]]; then
# Fix event "NOCOMM" (wall message like "UPS IPPON@localhost is unavailable")
[[ ${NUTDRIVERNAME} == "blazer_usb" ]] && try_restart_blaser_usb
fi

@clepple
Copy link
Member

clepple commented Nov 16, 2015

The blazer_USB peridocally looses connection with several IPPON UPS:

IPPON Back Pro (desktop UPS)
IPPON Smart Winner (rackmount UPS)
A few questions:

• Which version of NUT are you using?
• What OS/kernel are you using?

This really seems like something that the driver should be able to handle, since it should get an error code from libusb when the UPS disconnects.

Can you try this UPS with nutdrv_qx? It is the successor to the blazer_* drivers.

@grumbler66rus
Copy link
Author

• Which version of NUT are you using?
• What OS/kernel are you using?

NUT 2.6.5
Linux 3.8.13.4-std-def-alt1.M70P.2 x86_64
libusb 1.0.9

This really seems like something that the driver should be able to
handle, since it should get an error code from libusb when the UPS
disconnects.

Can you try this UPS with nutdrv_qx? It is the successor to the
blazer_* drivers.

I may doing this some time later (it is need to build latest version of
NUT from sources), and I may make this test with IPPON Back Pro only.

@clepple
Copy link
Member

clepple commented Nov 18, 2015

• Which version of NUT are you using?
• What OS/kernel are you using?

NUT 2.6.5
Linux 3.8.13.4-std-def-alt1.M70P.2 x86_64
libusb 1.0.9

Note that NUT has not been tested as extensively with libusb-1.x and libusb-compat (versus libusb-0.1.x). It should work, but since it is not easy to simulate USB errors, the equivalent error-handling code has not been exercised as much.

This really seems like something that the driver should be able to
handle, since it should get an error code from libusb when the UPS
disconnects.

Can you try this UPS with nutdrv_qx? It is the successor to the
blazer_* drivers.

I may doing this some time later (it is need to build latest version of
NUT from sources), and I may make this test with IPPON Back Pro only.

With either nutdrv_qx or blazer_usb, you can kill the driver process, and start it manually (not via upsdrvctl) with extra -D flags to try to catch the error message when the UPS disconnects.

@grumbler66rus
Copy link
Author

start it manually (not via upsdrvctl) with extra -D flags
to try to catch the error message when the UPS disconnects.

I runned blazer_usb:
/lib/nut/blazer_usb -a IPPON -r /var/lib/nut -u upsdrv -DDDD
Result:
...
293767.586757 send: Q1
293767.836896 read: (227.2 227.6 227.6 013 50.1 13.5 25.0 00001001
293769.628938 send: No such device or address
293769.628979 blazer_status: short reply
293769.628985 Communications with UPS lost: status read failed!
293771.598680 Checking device (8087/0024) (001/002)
293771.598834 Failed to open device, skipping. (No such device or address)
293771.613086 Checking device (1D6B/0002) (001/001)
293771.613100 Failed to open device, skipping. (No such device or address)
293771.613105 Checking device (06DA/0003) (001/011)
293771.613110 Failed to open device, skipping. (No such device or address)

293771.613113 Checking device (0419/3201) (001/012)
293771.613118 Failed to open device, skipping. (No such device or address)
293771.613122 Checking device (8087/0024) (002/002)
293771.613127 Failed to open device, skipping. (No such device or address)
293771.613131 Checking device (1D6B/0002) (002/001)
293771.613135 Failed to open device, skipping. (No such device or address)
293771.613138 Checking device (0409/0058) (002/003)
293771.613143 Failed to open device, skipping. (No such device or address)
293771.613147 Checking device (03F0/0A01) (002/008)
293771.613151 Failed to open device, skipping. (No such device or address)
293771.613154 No appropriate HID device found
293771.613164 blazer_status: short reply
293771.613168 Communications with UPS lost: status read failed!

At these time:
Nov 21 21:34:34 sd kernel: [2307548.097872] usb 1-1.1: USB disconnect, device number 11
Nov 21 21:34:34 sd kernel: [2307548.296645] usb 1-1.1: new low-speed USB device number 13 using ehci-pci
Nov 21 21:34:34 sd kernel: [2307548.429161] hid-generic 0003:06DA:0003.0007: hiddev0,hidraw0: USB HID v1.11 Device [OMRON USB UPS] on usb-0000:00:1a.0-1.1/input0

Resume: device drops the USB connection and immediately restore it, but blazer_usb can't reconnect.

Also I compiled nutdrv_qx from latest sources and try run it now, but unsussessful:
# ./nutdrv_qx -a X -r /var/lib/nut -u upsdrv -DDDDD -x subdriver=ippon -x vendorid=06da -x productid=0003 -x bus=1
Network UPS Tools - Generic Q* USB driver 0.23 (2.7.3-139-g638f1b8)
USB communication driver 0.33
0.000000 send_to_all: SETINFO driver.parameter.subdriver "ippon"
0.000017 send_to_all: SETINFO driver.parameter.bus "1"
0.000021 debug level is '5'
0.000110 chrooted into /var/lib/nut
0.000172 upsdrv_initups...
0.000213 No appropriate HID device found
0.000220 No supported devices found. Please check your device availability with 'lsusb'
and make sure you have an up-to-date version of NUT. If this does not help,
try running the driver with at least 'subdriver', 'vendorid' and 'productid'
options specified. Please refer to the man page for details about these options
(man 8 nutdrv_qx).

Next I run blazer_usb again:
# /lib/nut/blazer_usb -a IPPON -r /var/lib/nut -u upsdrv -DDDD
Network UPS Tools - Megatec/Q1 protocol USB driver 0.09 (2.6.5)
0.000000 debug level is '4'
0.000846 Checking device (8087/0024) (001/002)
0.000861 - VendorID: 8087
0.000864 - ProductID: 0024
0.000866 - Manufacturer: unknown
0.000869 - Product: unknown
0.000871 - Serial Number: unknown
0.000874 - Bus: 001
0.000876 Trying to match device
0.000888 Device does not match - skipping
0.000895 Checking device (1D6B/0002) (001/001)
0.000934 - VendorID: 1d6b
0.000937 - ProductID: 0002
0.000940 - Manufacturer: Linux 3.8.13.4-std-def-alt1.M70P.2 ehci_hcd
0.000943 - Product: EHCI Host Controller
0.000945 - Serial Number: 0000:00:1a.0
0.000947 - Bus: 001
0.000950 Trying to match device
0.000953 Device does not match - skipping
0.000958 Checking device (06DA/0003) (001/013)
0.008502 - VendorID: 06da
0.008523 - ProductID: 0003
0.008527 - Manufacturer: unknown
0.008530 - Product: USB UPS
0.008533 - Serial Number: unknown
0.008535 - Bus: 001
0.008538 Trying to match device
0.008559 Device matches
0.008574 failed to claim USB device: Device or resource busy
0.008857 detached kernel driver from USB device...
0.010811 chrooted into /var/lib/nut
0.010831 Trying megatec protocol...
0.012621 send: Q1
0.264759 read: (229.4 229.4 229.4 020 50.1 13.5 25.0 00001001
0.264817 Status read in 1 tries
0.264821 Supported UPS detected with megatec protocol
0.266619 send: F
0.456758 read: #220.0 003 12.00 50.0
0.456790 Ratings read in 1 tries
0.456795 No values provided for battery high/low voltages in ups.conf

0.456802 Using 'guestimation' (low: 10.400000, high: 13.000000)!
0.456806 Battery runtime will not be calculated (runtimecal not set)
0.459616 send: Q1
0.712755 read: (229.4 228.9 229.4 020 50.1 13.5 25.0 00001001
0.729746 dstate_init: sock /var/lib/upsd/blazer_usb-IPPON open on fd 9
0.732238 send: Q1
0.984748 read: (228.9 229.4 228.9 020 50.1 13.5 25.0 00001001
1.072188 new connection on fd 10
2.733585 send: Q1
2.984721 read: (228.9 228.9 229.4 020 50.1 13.5 25.0 00001001
...

@jimklimov jimklimov added Ippon Ippon branded devices Phoenixtec (USB 0x06DA/0xFFFF) This USB chip VID/PID is used in many devices, some with different protocols - detection may be hard USB labels Dec 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ippon Ippon branded devices Phoenixtec (USB 0x06DA/0xFFFF) This USB chip VID/PID is used in many devices, some with different protocols - detection may be hard USB
Projects
None yet
Development

No branches or pull requests

3 participants