[Nut-upsdev] Problem with bestfcom and old Ferrups
Chris Adams
cmadams at hiwaay.net
Thu Feb 7 03:45:16 UTC 2008
Once upon a time, Charles Lepple <clepple at gmail.com> said:
> It looks like they got changed properly; however, the safest thing
> might be for you to resend the patch as an attachment, since that
> would be the version that you are testing.
Okay. Here it is.
--
Chris Adams <cmadams at hiwaay.net>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
-------------- next part --------------
diff -urN nut-2.2.1-dist/drivers/bestfcom.c nut-2.2.1/drivers/bestfcom.c
--- nut-2.2.1-dist/drivers/bestfcom.c 2007-12-17 09:13:09.000000000 -0600
+++ nut-2.2.1/drivers/bestfcom.c 2008-02-06 13:39:50.000000000 -0600
@@ -423,6 +423,9 @@
} else {
fatalx(EXIT_FAILURE, "Error connecting to UPS.");
}
+ /* old Ferrups prompt for new time so send a blank line */
+ execute("\r", buf, sizeof(buf));
+ ser_get_line(upsfd, buf, sizeof(buf), '>', "\012", 3, 0);
}
/* power down the attached load immediately */
@@ -570,7 +573,8 @@
fc.watts = 3000;
}
} else
- if (strstr(rstring, "Model: FE")){
+ if (strstr(rstring, "Model: FE")
+ || strstr(rstring, "Model: FE")){
fc.model = FExxxx;
fc.type = FERRUPS;
snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups");
@@ -591,15 +595,15 @@
case FDxxxx:
/* determine shutdown battery voltage */
if (execute("d 27\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "27 LowBatt %f", &fc.emptyvolts);
+ sscanf(tmp, "27 LowBatt %f", &fc.emptyvolts);
}
/* determine near low battery voltage */
if (execute("d 30\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "30 NLBatt %f", &fc.lowvolts);
+ sscanf(tmp, "30 NLBatt %f", &fc.lowvolts);
}
/* determine fully charged battery voltage */
if (execute("d 28\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "28 Hi Batt %f", &fc.fullvolts);
+ sscanf(tmp, "28 Hi Batt %f", &fc.fullvolts);
}
fc.fullvolts = 13.70;
/* determine "ideal" voltage by a guess */
@@ -607,19 +611,19 @@
break;
case FExxxx:
if (execute("d 45\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "45 RatedVA %d", &fc.va); /* 4300 */
+ sscanf(tmp, "45 RatedVA %d", &fc.va); /* 4300 */
}
if (execute("d 46\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "46 RatedW %d", &fc.watts); /* 3000 */
+ sscanf(tmp, "46 RatedW %d", &fc.watts); /* 3000 */
}
if (execute("d 65\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "65 LoBatV %f", &fc.emptyvolts); /* 41.00 */
+ sscanf(tmp, "65 LoBatV %f", &fc.emptyvolts); /* 41.00 */
}
if (execute("d 66\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "66 NLBatV %f", &fc.lowvolts); /* 44.00 */
+ sscanf(tmp, "66 NLBatV %f", &fc.lowvolts); /* 44.00 */
}
if (execute("d 67\r", tmp, sizeof(tmp)) > 0) {
- sscanf(tmp, "67 HiBatV %f", &fc.fullvolts); /* 59.60 */
+ sscanf(tmp, "67 HiBatV %f", &fc.fullvolts); /* 59.60 */
}
fc.idealbvolts = ((fc.fullvolts - fc.emptyvolts) * 0.7) + fc.emptyvolts;
if (fc.va < 1.0) {
@@ -741,6 +745,7 @@
execute("fc\r", rstring, sizeof(rstring));
if (strlen(rstring) < 80 ) {
+ ser_get_line(upsfd, rstring, sizeof(rstring), '>', "\012", 3, 0);
upsdrv_init_nofc();
} else {
upsdrv_init_fc(rstring);
More information about the Nut-upsdev
mailing list