diff options
-rw-r--r-- | instr-daemon.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/instr-daemon.c b/instr-daemon.c index 19536d3..e8d9897 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -355,7 +355,17 @@ static gboolean finish_boot (void) static gboolean periodic_poll (void) { - if (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL)) { + gboolean power_fail; + + power_fail = (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL)); + + if (power_fail) { + // verify after a short delay (25 ms), to ignore short power glitches + g_usleep (25e3); + power_fail = (globals.HWDetect.beaglebone && bus_getpin (POWER_FAIL)); + } + + if (power_fail) { globals.Sys.shutdown_started = TRUE; |