Marcel Ziswiler
2007-Jan-02 22:59 UTC
[Nut-upsdev] Cpsups driver with a CyberPower OP1000E
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@localhost ups.status OL # /usr/local/ups/bin/upsc myups@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@ziswiler.com Schuelmatt 7 https://www.ziswiler.net CH-6018 Buttisholz mobile: +41 (76) 338-0382 Switzerland phone: +41 (41) 928-0509
Marcel Ziswiler wrote:> 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. > >please, if you can, download the newest trunk and try the new 'powerpanel' driver. the last cpsups driver submitted is/was slightly broken. the new powerpanel driver is the new, working one. I am building it now myself. If you are still having trouble, I can send you the last good update to cpsups.c cpsups.h
Marcel Ziswiler
2007-Jan-02 23:25 UTC
[Nut-upsdev] Cpsups driver with a CyberPower OP1000E
>please, if you can, download the newest trunk and try the new >'powerpanel' driver. the last cpsups driver submitted is/was slightly >broken. the new powerpanel driver is the new, working one. I am >building it now myself. > >If you are still having trouble, I can send you the last good update to >cpsups.c cpsups.hSorry, still no luck: # drivers/powerpanel -a myups -DDD Network UPS Tools - CyberPower text protocol UPS driver 0.10 (2.1.0) Warning: This is an experimental driver. Some features may not function correctly. debug level is '3' command: reply : <none> command: reply : <none> command: reply : <none> command: reply : <none> command: reply : <none> Unable to detect a CyberPower text protocol UPS Can you please send me the latest cpsups one you have. I am wondering whether it has something todo with me using a serial to USB converter, but then that stuff should all be standard by now.
Marcel Ziswiler
2007-Jan-03 01:43 UTC
[Nut-upsdev] Cpsups driver with a CyberPower OP1000E
>it is rumored that the serial<->usb converters sometimes work, and >sometimes don't... i've attached these the last cpsups drivers, give >them a try. is it possible to use a direct serial cable?Those new fancy notebooks don't even feature any legacy parallel or serial ports anymore. Tried your latest as well as powerpanel from trunk on an old machine using straight serial connection without any luck. Same not detecting anything behaviour. Gotta stick to my modified 2.0.5-pre1 for now I guess.
Marcel Ziswiler wrote:> Sorry, still no luck: > # drivers/powerpanel -a myups -DDD > Network UPS Tools - CyberPower text protocol UPS driver 0.10 (2.1.0) > Warning: This is an experimental driver. > Some features may not function correctly.Could you try again with the latest revision from the trunk? Best regards, Arjen
Marcel Ziswiler
2007-Jan-04 01:09 UTC
[Nut-upsdev] Cpsups driver with a CyberPower OP1000E
>Could you try again with the latest revision from the trunk?Sure, works like a charm now: # drivers/powerpanel -a myups -DDD Network UPS Tools - CyberPower text protocol UPS driver 0.11 (2.1.0) Warning: This is an experimental driver. Some features may not function correctly. debug level is '3' command: reply : <none> warning: sent "\r", expected "#2\r" but got ""command: P4 reply : (46 bytes) => 23 31 30 30 30 56 41 20 20 20 20 2c 32 2e 31 30 32 2c 30 30 30 30 30 30 30 30 30 30 30 30 2c 43 59 42 45 52 20 50 4f 57 45 52 20 20 20 20 Detected CYBER POWER 1000VA on /dev/ttyUSB0 command: P3 reply : <none> command: P2 reply : (22 bytes) => 23 31 30 30 30 2c 30 37 30 30 2c 32 33 30 2c 30 34 37 2c 30 36 33 command: P1 reply : (15 bytes) => 23 32 33 30 2c 32 37 30 2c 31 38 30 2c 32 30 command: P6 reply : (40 bytes) => 23 32 36 32 2c 32 36 34 2c 32 36 36 2c 32 36 38 2c 32 37 30 2c 32 37 32 2c 32 37 34 2c 32 37 36 2c 32 37 38 2c 32 38 30 command: P7 reply : (40 bytes) => 23 31 37 30 2c 31 37 32 2c 31 37 34 2c 31 37 36 2c 31 37 38 2c 31 38 30 2c 31 38 32 2c 31 38 34 2c 31 38 36 2c 31 38 38 command: P8 reply : <none> command: D reply : (34 bytes) => 23 49 32 33 31 2e 30 4f 32 33 31 2e 30 4c 30 32 38 42 31 30 30 54 30 33 39 46 30 34 39 2e 39 53 90 80 command: C reply : <none> command: D reply : (34 bytes) => 23 49 32 33 31 2e 30 4f 32 33 31 2e 30 4c 30 32 38 42 31 30 30 54 30 33 39 46 30 34 39 2e 39 53 90 80 dstate_init: sock /var/state/ups/myups open on fd 5 # /usr/local/ups/bin/upsdrvctl start Network UPS Tools - UPS driver controller 2.1.0 Network UPS Tools - CyberPower text protocol UPS driver 0.11 (2.1.0) Warning: This is an experimental driver. Some features may not function correctly. warning: sent "\r", expected "#2\r" but got ""Detected CYBER POWER 1000VA on /dev/ttyUSB0 # /usr/local/ups/sbin/upsd Network UPS Tools upsd 2.1.0 /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 # /usr/local/ups/bin/upsc myups@localhost ups.status OL # /usr/local/ups/bin/upsc myups@localhost battery.charge: 100.0 battery.charge.low: 20 driver.name: powerpanel driver.parameter.pollinterval: 2 driver.parameter.port: /dev/ttyUSB0 driver.version: 2.1.0 driver.version.internal: 0.11 input.frequency: 50 input.frequency.high: 063 input.frequency.low: 047 input.transfer.high: 270 input.transfer.low: 180 input.voltage: 233 input.voltage.nominal: 230 output.voltage: 233 ups.firmware: 2.102 ups.load: 28 ups.mfr: CYBER POWER ups.model: 1000VA ups.power.nominal: 1000 ups.realpower.nominal: 0700 ups.serial: 000000000000 ups.status: OL ups.temperature: 39 Thanks again!