From 3dc67dd080a76b6d7a8ed1a60cd7bee073a23ab5 Mon Sep 17 00:00:00 2001 From: Mike Fiore Date: Thu, 9 Oct 2014 13:14:44 -0500 Subject: mts-io: fix reset-monitor bug if button is held longer than value for extra long signal, don't reset the count until button is let go of --- io-module/mts_io.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'io-module') diff --git a/io-module/mts_io.c b/io-module/mts_io.c index 6ce8981..12650b1 100644 --- a/io-module/mts_io.c +++ b/io-module/mts_io.c @@ -106,6 +106,7 @@ static DEFINE_MUTEX(mts_io_mutex); static pid_t reset_pid = -1; static pid_t reset_count = 0; +bool sent_extra_long = false; static int reset_short_signal = SIGUSR1; static int reset_long_signal = SIGUSR2; static int reset_extra_long_signal = SIGHUP; @@ -138,16 +139,16 @@ static void reset_callback(struct work_struct *ignored) //Reset button has not been pressed if (reset_count > 0 && reset_count < RESET_HOLD_COUNT) { kill_pid(vpid, reset_short_signal, 1); - reset_count = 0; } else if (reset_count >= RESET_HOLD_COUNT && reset_count < RESET_LONG_HOLD_COUNT) { - reset_count = 0; kill_pid(vpid, reset_long_signal, 1); } - } - if (reset_count >= RESET_LONG_HOLD_COUNT) { reset_count = 0; + sent_extra_long = false; + } + if (reset_count >= RESET_LONG_HOLD_COUNT && ! sent_extra_long) { kill_pid(vpid, reset_extra_long_signal, 1); + sent_extra_long = true; } } else { reset_count = 0; -- cgit v1.2.3