Imported Upstream version 2.6.1
This commit is contained in:
parent
459aaf9392
commit
a367d9bc54
178 changed files with 4651 additions and 3279 deletions
|
|
@ -258,6 +258,11 @@ static int main_arg(char *var, char *val)
|
|||
return 1; /* handled */
|
||||
}
|
||||
|
||||
if (!strcmp(var, "ignorelb")) {
|
||||
dstate_setinfo("driver.flag.ignorelb", "enabled");
|
||||
return 1; /* handled */
|
||||
}
|
||||
|
||||
/* any other flags are for the driver code */
|
||||
if (!val)
|
||||
return 0;
|
||||
|
|
@ -600,6 +605,28 @@ int main(int argc, char **argv)
|
|||
upsdrv_initinfo();
|
||||
upsdrv_updateinfo();
|
||||
|
||||
if (dstate_getinfo("driver.flag.ignorelb")) {
|
||||
int have_lb_method = 0;
|
||||
|
||||
if (dstate_getinfo("battery.charge") && dstate_getinfo("battery.charge.low")) {
|
||||
upslogx(LOG_INFO, "using 'battery.charge' to set battery low state");
|
||||
have_lb_method++;
|
||||
}
|
||||
|
||||
if (dstate_getinfo("battery.runtime") && dstate_getinfo("battery.runtime.low")) {
|
||||
upslogx(LOG_INFO, "using 'battery.runtime' to set battery low state");
|
||||
have_lb_method++;
|
||||
}
|
||||
|
||||
if (!have_lb_method) {
|
||||
fatalx(EXIT_FAILURE,
|
||||
"The 'ignorelb' flag is set, but there is no way to determine the\n"
|
||||
"battery state of charge.\n\n"
|
||||
"Only set this flag if both 'battery.charge' and 'battery.charge.low'\n"
|
||||
"and/or 'battery.runtime' and 'battery.runtime.low' are available.\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* now we can start servicing requests */
|
||||
dstate_init(progname, upsname);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue