Skip to content

Commit

Permalink
bestfcom: allow for variable whitespace in FE Model string
Browse files Browse the repository at this point in the history
  • Loading branch information
clepple committed Feb 11, 2014
1 parent 9ff6a2b commit 6f5cd40
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions drivers/bestfcom.c
Expand Up @@ -45,7 +45,7 @@
#include "serial.h"

#define DRIVER_NAME "Best Ferrups/Fortress driver"
#define DRIVER_VERSION "0.12"
#define DRIVER_VERSION "0.13"

/* driver description structure */
upsdrv_info_t upsdrv_info = {
Expand Down Expand Up @@ -527,7 +527,7 @@ Released: 08/01/1995

void upsdrv_init_nofc(void)
{
char tmp[256], rstring[1024];
char tmp[256], rstring[1024], *model;

/* This is a Best UPS
* Set initial values for old Fortress???
Expand Down Expand Up @@ -576,11 +576,19 @@ void upsdrv_init_nofc(void)
fc.watts = 3000;
}
} else
if (strstr(rstring, "Model: FE")
|| strstr(rstring, "Model: FE")){
fc.model = FExxxx;
fc.type = FERRUPS;
snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups");
if ((model = strstr(rstring, "Model:"))) {
model += sizeof("Model:");
while(*model == ' ' || *model == '\t') {
model++;
}
if(strncmp(model, "FE", 2)) {
fc.model = FExxxx;
fc.type = FERRUPS;
/* fc.va and fc.watts are detected below */
snprintf(fc.name, sizeof(fc.name), "%s", "Ferrups");
} else {
upsdebugx(2, "Found 'Model:' string, but unknown model name prefix: '%s'", model);
}
} else
if (strlen(rstring) < 300 ) {
/* How does the old Fortress respond to this? */
Expand Down

0 comments on commit 6f5cd40

Please sign in to comment.