Imported Upstream version 2.6.4
This commit is contained in:
parent
fad6ced6f6
commit
fefe62b2bd
257 changed files with 6020 additions and 1394 deletions
|
|
@ -1,7 +1,7 @@
|
|||
/* usbhid-ups.c - Driver for USB and serial (MGE SHUT) HID UPS units
|
||||
*
|
||||
* Copyright (C)
|
||||
* 2003-2009 Arnaud Quette <arnaud.quette@gmail.com>
|
||||
* 2003-2012 Arnaud Quette <arnaud.quette@gmail.com>
|
||||
* 2005 John Stamp <kinsayder@hotmail.com>
|
||||
* 2005-2006 Peter Selinger <selinger@users.sourceforge.net>
|
||||
* 2007-2009 Arjen de Korte <adkorte-guest@alioth.debian.org>
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
#define DRIVER_NAME "Generic HID driver"
|
||||
#define DRIVER_VERSION "0.35"
|
||||
#define DRIVER_VERSION "0.37"
|
||||
|
||||
#include "main.h"
|
||||
#include "libhid.h"
|
||||
|
|
@ -480,7 +480,17 @@ static const char *kelvin_celsius_conversion_fun(double value)
|
|||
{
|
||||
static char buf[20];
|
||||
|
||||
snprintf(buf, sizeof(buf), "%.1f", value - 273.15);
|
||||
/* check if the value is in the Kelvin range, to
|
||||
* detect buggy value (already expressed in °C), as found
|
||||
* on some HP implementation */
|
||||
if ((value >= 273) && (value <= 373)) {
|
||||
/* the value is indeed in °K */
|
||||
snprintf(buf, sizeof(buf), "%.1f", value - 273.15);
|
||||
}
|
||||
else {
|
||||
/* else, this is actually °C, not °K! */
|
||||
snprintf(buf, sizeof(buf), "%.1f", value);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -556,6 +566,11 @@ int instcmd(const char *cmdname, const char *extradata)
|
|||
if (!strcasecmp(cmdname, "shutdown.return")) {
|
||||
int ret;
|
||||
|
||||
/* Ensure "ups.start.auto" is set to "yes", if supported */
|
||||
if (dstate_getinfo("ups.start.auto")) {
|
||||
setvar("ups.start.auto", "yes");
|
||||
}
|
||||
|
||||
ret = instcmd("load.on.delay", dstate_getinfo("ups.delay.start"));
|
||||
if (ret != STAT_INSTCMD_HANDLED) {
|
||||
return ret;
|
||||
|
|
@ -567,6 +582,11 @@ int instcmd(const char *cmdname, const char *extradata)
|
|||
if (!strcasecmp(cmdname, "shutdown.stayoff")) {
|
||||
int ret;
|
||||
|
||||
/* Ensure "ups.start.auto" is set to "no", if supported */
|
||||
if (dstate_getinfo("ups.start.auto")) {
|
||||
setvar("ups.start.auto", "no");
|
||||
}
|
||||
|
||||
ret = instcmd("load.on.delay", "-1");
|
||||
if (ret != STAT_INSTCMD_HANDLED) {
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue