2007-07-27 Sergey Vlasov Fix megatec shutdown to use "ondelay" and "offdelay" from config. * drivers/megatec.c: (upsdrv_initinfo): Move "ondelay" and "offdelay" reading from here ... (upsdrv_initups): ... to here. --- nut-2.0.5/drivers/megatec.c.alt-megatec-shutdown 2007-07-27 14:30:47 +0400 +++ nut-2.0.5/drivers/megatec.c 2007-07-27 15:58:23 +0400 @@ -407,14 +407,6 @@ void upsdrv_initinfo(void) } } - if (getval("ondelay")) { - start_delay = CLAMP(atoi(getval("ondelay")), 0, MAX_START_DELAY); - } - - if (getval("offdelay")) { - shutdown_delay = CLAMP(atoi(getval("offdelay")), 0, MAX_SHUTDOWN_DELAY); - } - /* * Register the available variables. */ @@ -742,6 +734,14 @@ void upsdrv_banner(void) void upsdrv_initups(void) { + if (getval("ondelay")) { + start_delay = CLAMP(atoi(getval("ondelay")), 0, MAX_START_DELAY); + } + + if (getval("offdelay")) { + shutdown_delay = CLAMP(atoi(getval("offdelay")), 0, MAX_SHUTDOWN_DELAY); + } + upsfd = ser_open(device_path); ser_set_speed(upsfd, device_path, B2400); }