Hi,
Sorry to answer my own question.
I have looked at the differences bettween minicom and the debug output
for the cpsups driver. It seems that this unit is faster then previous
models at putting text on the serial line. The delays are cutting off
the first 9 characters, they never enter the buffer in the
ser_get_line function.
I have attached to the bottom of this email a patch that works on my
ups, I dont know if it breaks previous models.
The patch removes the prefix carrage return on all commands issued to
the usp. By initally sending a carrage return, then the comand, it
seems that the device responds with two lines
#2
#I118.0O119.0L004B100T028F060.0S..
The #2 line is invoked by the inital carrage return, the second line
is the data we are interrested in. The driver looks for #2, if it
finds it, it immediatly re-reads the serial data. This is where the
driver losses data.
If the inital carrage return is not sent then we can grab just the
data we are interrested in.
Please let me know if I can provide any more information to get
support for this ups included into the svn source.
---------Output of upsc
battery.charge: 100.0
battery.runtime: 1:57
driver.name: cpsups
driver.parameter.port: /dev/ttyS0
driver.version: 2.1.0
driver.version.internal: .04
input.frequency: 60
input.voltage: 117
output.voltage: 117
ups.load: 3
ups.mfr: Unknown
ups.model: Unknown #BC1200 (1.650)
ups.power.nominal: 1
ups.runtime: 1
ups.status: OL
ups.temperature: 41
------Patch
--- nutdevsrcorig/drivers/cpsups.c 2006-05-26 11:58:00.000000000 -0400
+++ nutdevsrc/drivers/cpsups.c 2006-05-30 07:08:43.897174638 -0400
@@ -120,7 +120,7 @@
int i, ret;
for (i = 0; i < MAXTRIES; i++) {
- ser_send_pace(upsfd, UPSDELAY, "\rP4\r");
+ ser_send_pace(upsfd, UPSDELAY, "P4\r");
ret = ser_get_line(upsfd, buf, bufsize, ENDCHAR, "",
SER_WAIT_SEC, SER_WAIT_USEC);
@@ -245,7 +245,7 @@
int i, ret;
for (i = 0; i < MAXTRIES; i++) {
- ser_send_pace(upsfd, UPSDELAY, "\rP4\r");
+ ser_send_pace(upsfd, UPSDELAY, "P4\r");
upsdebugx(3, "ups_sync: send [%s]",
"\\rP4\\r");
ret = ser_get_line(upsfd, buf, sizeof(buf), ENDCHAR,
"",
@@ -292,7 +292,7 @@
char temp[256];
for (i = 0; i < MAXTRIES; i++) {
- ser_send_pace(upsfd, UPSDELAY, "\rD\r");
+ ser_send_pace(upsfd, UPSDELAY, "D\r");
ret = ser_get_line(upsfd, temp, sizeof(temp), ENDCHAR,
"",
SER_WAIT_SEC, SER_WAIT_USEC);
@@ -347,7 +347,7 @@
char buf[256];
int ret;
- ret = ser_send_pace(upsfd, UPSDELAY, "\rD\r");
+ ret = ser_send_pace(upsfd, UPSDELAY, "D\r");
if (ret < 1) {
ser_comm_fail("ser_send_pace failed");
-----------------END PATCH
On 5/29/06, Paul Kimberley <paul.kimberley@gmail.com>
wrote:> Hi,
>
> I have a new ups a cyberpower 1200AVR/BC1200. It has both a serial
> port and a USB port.
>
> It appears the serial port uses a protocol that is ALMOST the same as
> the cpsups driver. For example sending the "\rP4\r"
initialization
> string returns "#2", where the driver has a constrant that
"#25-50"
> must be returned.
>
> Using the developer branch, the usb support with the newhisups driver
> the protocol seems to be different then other cyberpower units.
>
> Is there anything I can do to assist or sped along the inclusion for
> support of this ups into nut?
>
> Thank,
>
> -Paul
>