[Nut-upsdev] Cpsups driver with a CyberPower OP1000E
Marcel Ziswiler
marcel at ziswiler.com
Tue Jan 2 22:59:36 CET 2007
Hi there
First a big thank you to all nut developers.
I tried the 2.0.4 as well as the 2.0.5-pre1 versions with my CyberPower OP1000E connected to a serial to USB converter. All I got was the following:
# /usr/local/ups/bin/upsdrvctl start
Network UPS Tools - UPS driver controller 2.0.5-pre1
Network UPS Tools - CyberPower text protocol UPS driver .05 (2.0.5-pre1)
Warning: This is an experimental driver.
Some features may not function correctly.
Detected MicroDowell B.Box BP 1000 2.102 on /dev/ttyUSB0
Driver exited abnormally
Looking through the mailing lists a few users have reported the same behaviour but I haven't really seen mentioning any solutions to it. So I recompiled the whole thing for debug and gave it a try. After looking at a few back traces I realized that for my UPS model ups.voltage instead of ups.power.nominal gets set to 1000 in model_set(). Later when doing a dstate_getinfo() on it, it just woes. So I applied the following fix and it works now beautifully:
--- cpsups.c.orig 2007-01-02 00:42:06.000000000 +0100
+++ cpsups.c 2007-01-02 00:46:22.000000000 +0100
@@ -78,7 +78,7 @@
dstate_setinfo("ups.mfr", "%s", "MicroDowell");
dstate_setinfo("ups.model", "B.Box BP 1000 %s", rating);
dstate_setinfo("ups.runtime", "%s", "50");
- dstate_setinfo("ups.voltage", "%s", "1000");
+ dstate_setinfo("ups.power.nominal", "%s", "1000");
return;
}
As follows the output from my now working setup:
# /usr/local/ups/bin/upsdrvctl start
Network UPS Tools - UPS driver controller 2.0.5-pre1
Network UPS Tools - CyberPower text protocol UPS driver .05 (2.0.5-pre1)
Warning: This is an experimental driver.
Some features may not function correctly.
Detected MicroDowell B.Box BP 1000 2.102 on /dev/ttyUSB0
# /usr/local/ups/sbin/upsd
Network UPS Tools upsd 2.0.5-pre1
/var/state/ups is world readable
/usr/local/ups/etc/upsd.conf is world readable
Connected to UPS [myups]: myups
/usr/local/ups/etc/upsd.users is world readable
Synchronizing...done
# /usr/local/ups/bin/upsc myups at localhost ups.status
OL
# /usr/local/ups/bin/upsc myups at localhost
battery.charge: 100.0
battery.runtime: 36:00
driver.name: cpsups
driver.parameter.port: /dev/ttyUSB0
driver.version: 2.0.5-pre1
driver.version.internal: .05
input.frequency: 50
input.voltage: 231
output.voltage: 231
ups.load: 28
ups.mfr: MicroDowell
ups.model: B.Box BP 1000 2.102
ups.power.nominal: 1000
ups.runtime: 50
ups.status: OL
ups.temperature: 39
I of course also tried the SVN version both yesterday as well as today (seeing that there is some activity on the cpsups driver). Unfortunately this 'new' driver does not work for me at all.
Yesterday's SVN gave me the following trying to make:
cpsups.c: In function ‘clr_cps_serial’:
cpsups.c:110: error: ‘TIOCM_DTR’ undeclared (first use in this function)
cpsups.c:110: error: (Each undeclared identifier is reported only once
cpsups.c:110: error: for each function it appears in.)
cpsups.c:112: warning: implicit declaration of function ‘ioctl’
cpsups.c:112: error: ‘TIOCMBIC’ undeclared (first use in this function)
cpsups.c: In function ‘set_cps_serial’:
cpsups.c:117: error: ‘TIOCM_DTR’ undeclared (first use in this function)
cpsups.c:119: error: ‘TIOCMBIS’ undeclared (first use in this function)
make[1]: *** [cpsups.o] Error 1
make[1]: Leaving directory `/usr/local/nut-svn20070101/drivers'
make: *** [all-recursive] Error 1
Applying the following fix at least got it compiled:
--- cpsups.h.orig 2007-01-01 22:24:00.000000000 +0100
+++ cpsups.h 2007-01-01 22:24:09.000000000 +0100
@@ -21,6 +21,10 @@
#include "main.h"
#include "serial.h"
+#define TIOCM_DTR 0002 /* data terminal ready */
+#define TIOCMBIS 0x5416
+#define TIOCMBIC 0x5417
+
struct {
int begin;
int end;
Unfortunately it does no more recognize my UPS at all:
# drivers/cpsups -a myups -DDD
Network UPS Tools - CyberPower text protocol UPS driver .06 (2.1.0)
Warning: This is an experimental driver.
Some features may not function correctly.
debug level is '3'
get_ident: got [], instead of '#2', retrying
get_ident: got [], instead of '#2', retrying
get_ident: got [], instead of '#2', retrying
get_ident: got [], instead of '#2', retrying
get_ident: got [], instead of '#2', retrying
Giving up on hardware detection after 5 tries
Unable to detect a CyberPower text protocol UPS
Today's version seems to have the includes fixed (makes sense due to the reworked autoconf stuff). But still no more detection.
I hope my report can help shed some light. Just let me know if you need me to do any additional testing to help further finalize the cpsups driver.
Cheers
Marcel
--
Marcel Ziswiler mailto:marcel at ziswiler.com
Schuelmatt 7 https://www.ziswiler.net
CH-6018 Buttisholz mobile: +41 (76) 338-0382
Switzerland phone: +41 (41) 928-0509
More information about the Nut-upsdev
mailing list