[Apcupsd-commits] apcupsd/src/drivers/usb usb.c,1.16,1.17
Brought to you by:
adk0212
From: Adam K. <ad...@us...> - 2005-08-23 22:58:59
|
Update of /cvsroot/apcupsd/apcupsd/src/drivers/usb In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21663/src/drivers/usb Modified Files: usb.c Log Message: Use CI_RETPCT instead of CI_APCDelayBeforeStartup which is not only cleaner but also causes RETPCT to be properly reported for USB models. Index: usb.c =================================================================== RCS file: /cvsroot/apcupsd/apcupsd/src/drivers/usb/usb.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- usb.c 15 Aug 2005 22:00:37 -0000 1.16 +++ usb.c 23 Aug 2005 22:58:51 -0000 1.17 @@ -137,7 +137,7 @@ {CI_BattReplaceDate, 0xFF860016, P_ANY, T_APCDATE, false}, /* APCBattReplaceDate */ {CI_NONE, 0xFF860042, P_ANY, T_NONE, false}, /* APC_UPS_FirmwareRevision */ {CI_NONE, 0xFF860079, P_ANY, T_NONE, false}, /* APC_USB_FirmwareRevision */ - {CI_APCBattCapBeforeStartup, 0xFF860019, P_ANY, T_CAPACITY, false}, /* APCBattCapBeforeStartup */ + {CI_RETPCT, 0xFF860019, P_ANY, T_CAPACITY, false}, /* APCBattCapBeforeStartup */ {CI_APCDelayBeforeStartup, 0xFF86007E, P_ANY, T_UNITS, false}, /* APCDelayBeforeStartup */ {CI_APCDelayBeforeShutdown, 0xFF86007D, P_ANY, T_UNITS, false}, /* APCDelayBeforeShutdown */ {CI_BUPBattCapBeforeStartup, 0x00860012, P_ANY, T_NONE, false}, /* BUPBattCapBeforeStartup */ @@ -624,12 +624,25 @@ return 1; } -/* How long to wait before killing output power */ +/* + * How long to wait before killing output power. + * This value is NOT used on BackUPS Pro models. + */ #define SHUTDOWN_DELAY 60 -/* How many seconds of good utility power before turning output back on */ +/* + * How many seconds of good utility power before turning output back on. + * This value is NOT used on BackUPS Pro models. + */ #define STARTUP_DELAY 10 +/* + * What percentage battery charge before turning output back on. + * On at least some models this must be a multiple of 15%. + * This value is NOT used on BackUPS Pro models. + */ +#define STARTUP_PERCENT 0 + int usb_ups_kill_power(UPSINFO *ups) { char *func; @@ -651,9 +664,9 @@ * to fail. The value we program here should be made configurable * some day. */ - if (UPS_HAS_CAP(CI_APCBattCapBeforeStartup)) { - func = "CI_APCBattCapBeforeStartup"; - if (!usb_write_int_to_ups(ups, CI_APCBattCapBeforeStartup, 0, func)) + if (UPS_HAS_CAP(CI_RETPCT)) { + func = "CI_RETPCT"; + if (!usb_write_int_to_ups(ups, CI_RETPCT, STARTUP_PERCENT, func)) Dmsg1(100, "Unable to set %s (not an error)\n", func); } @@ -702,7 +715,7 @@ */ if (UPS_HAS_CAP(CI_APCDelayBeforeStartup)) { func = "CI_APCDelayBeforeStartup"; - if (!usb_write_int_to_ups(ups, CI_APCDelayBeforeStartup, 10, func)) { + if (!usb_write_int_to_ups(ups, CI_APCDelayBeforeStartup, STARTUP_DELAY, func)) { Dmsg1(100, "Unable to set %s (not an error)\n", func); } } |