Hi Guys!
I'm back and work on this driver again.
First,
I checked out the HEAD rev and tried the liebert driver.
it gave wrong model,firmware,serial, mfr date value. caused by len variable
in line 97 and after
I use my ups with usb -> serial converter.
these patches attached
Did you try the liebert-esp2 driver in ON Battery mode ?
Because If I switch my ups on battery (plugged off the input) then liebert
driver force shutdown PC and shutdown UPS.
Battery is full charged. UPS doesnt recieve LOW BATTERY EVENT.
the shutdown function is missing from liebert-esp2 driver, this is the
reason the force shutdown ?
Thanks your advice an help.
--
Best Regards,
Robert
Index: drivers/liebert-esp2.c
===================================================================
--- drivers/liebert-esp2.c (revision 2462)
+++ drivers/liebert-esp2.c (working copy)
@@ -75,7 +75,7 @@
upsdebug_hex(2, "send", command, ret);
- ret = ser_get_buf(upsfd, reply, 8, 1, 0);
+ ret = ser_get_buf_len(upsfd, reply, 8, 1, 0);
if (ret < 0) {
upsdebug_with_errno(2, "read");
return -1;
@@ -95,16 +95,15 @@
{
struct {
const char *var;
- const int len;
} vartab[] = {
- { "ups.model", 15 },
- { "ups.firmware", 8 },
- { "ups.serial", 10 },
- { "ups.mfr.date", 4 },
+ { "ups.model"},
+ { "ups.firmware"},
+ { "ups.serial"},
+ { "ups.mfr.date"},
{ NULL }
};
- char buf[LARGEBUF];
+ char buf[LARGEBUF],*s;
int i, index;
dstate_setinfo("ups.mfr", "%s", "Liebert");
@@ -132,12 +131,9 @@
fatalx(EXIT_FAILURE, "ESP-II capable UPS not detected");
}
- for (index = 0, i = 0; vartab[i].var; index += vartab[i].len, i++) {
- char val[SMALLBUF];
- snprintf(val, sizeof(val), "%.*s", vartab[i].len, &buf[index]);
-
- dstate_setinfo(vartab[i].var, "%s", rtrim(val, ' '));
+ for (s = strtok(buf, " "), i = 0; s && vartab[i].var; s = strtok(NULL, " "), i++) {
+ dstate_setinfo(vartab[i].var, "%s", s);
}
upsh.instcmd = instcmd;
_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev