Imported Upstream version 2.6.0
This commit is contained in:
parent
26fb71b504
commit
459aaf9392
510 changed files with 40508 additions and 18859 deletions
|
|
@ -118,6 +118,24 @@ static const valtab_t yes_no_info[] = {
|
|||
{ NULL }
|
||||
};
|
||||
|
||||
/* Older models report the model in a numeric format 'rOnn' */
|
||||
static const struct {
|
||||
const char *val;
|
||||
const char *model;
|
||||
} modeltab[] = {
|
||||
{ "rO10", "OP1000AVR" },
|
||||
{ "rO27", "OP320AVR" },
|
||||
{ "rO29", "OP500AVR" },
|
||||
{ "rO31", "OP800AVR" },
|
||||
{ "rO33", "OP850AVR" },
|
||||
{ "rO37", "OP900AVR" },
|
||||
{ "rO39", "OP650AVR" },
|
||||
{ "rO41", "OP700AVR" },
|
||||
{ "rO43", "OP1250AVR" },
|
||||
{ "rO45", "OP1500AVR" },
|
||||
{ NULL }
|
||||
};
|
||||
|
||||
static const struct {
|
||||
const char *var;
|
||||
const char *get;
|
||||
|
|
@ -300,7 +318,7 @@ static int powpan_setvar(const char *varname, const char *val)
|
|||
return STAT_SET_UNKNOWN;
|
||||
}
|
||||
|
||||
static void powpan_initinfo()
|
||||
static void powpan_initinfo(void)
|
||||
{
|
||||
int i, j;
|
||||
char *s;
|
||||
|
|
@ -313,7 +331,18 @@ static void powpan_initinfo()
|
|||
* was used for autodetection of the UPS. No need to do it again.
|
||||
*/
|
||||
if ((s = strtok((char *)&powpan_answer[1], ".")) != NULL) {
|
||||
dstate_setinfo("ups.model", "%s", rtrim(s, ' '));
|
||||
for (i = 0; modeltab[i].val != NULL; i++) {
|
||||
if (!strncmp(s, modeltab[i].val, strlen(modeltab[i].val))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (modeltab[i].model) {
|
||||
/* model found in table */
|
||||
dstate_setinfo("ups.model", "%s", modeltab[i].model);
|
||||
} else {
|
||||
/* report model value as is */
|
||||
dstate_setinfo("ups.model", "%s", rtrim(s, ' '));
|
||||
}
|
||||
}
|
||||
if ((s = strtok(NULL, ".")) != NULL) {
|
||||
dstate_setinfo("input.voltage.nominal", "%d", (unsigned char)s[0]);
|
||||
|
|
@ -429,7 +458,7 @@ static int powpan_status(status_t *status)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int powpan_updateinfo()
|
||||
static int powpan_updateinfo(void)
|
||||
{
|
||||
status_t status;
|
||||
|
||||
|
|
@ -513,7 +542,7 @@ static int powpan_updateinfo()
|
|||
return (status.flags[0] & 0x80) ? 1 : 0;
|
||||
}
|
||||
|
||||
static int powpan_initups()
|
||||
static int powpan_initups(void)
|
||||
{
|
||||
int ret, i;
|
||||
|
||||
|
|
@ -581,6 +610,11 @@ static int powpan_initups()
|
|||
type = OP;
|
||||
}
|
||||
|
||||
/* This is for an older model series, that reports the model numerically */
|
||||
if (!strncmp((char *)&powpan_answer[1], "rO", 2)) {
|
||||
type = OP;
|
||||
}
|
||||
|
||||
if (getval("ondelay")) {
|
||||
fatalx(EXIT_FAILURE, "Setting 'ondelay' not supported by %s driver", powpan_binary.version);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue