summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Fiore <mfiore@multitech.com>2014-10-09 13:14:44 -0500
committerMike Fiore <mfiore@multitech.com>2014-10-09 13:14:44 -0500
commit3dc67dd080a76b6d7a8ed1a60cd7bee073a23ab5 (patch)
treebfac5f056205aec92c64893de18f3075d896ee36
parentaf9b6ed9b53e34ff170645a114f95e82cbfe0101 (diff)
downloadmts-io-3dc67dd080a76b6d7a8ed1a60cd7bee073a23ab5.tar.gz
mts-io-3dc67dd080a76b6d7a8ed1a60cd7bee073a23ab5.tar.bz2
mts-io-3dc67dd080a76b6d7a8ed1a60cd7bee073a23ab5.zip
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
-rw-r--r--io-module/mts_io.c9
1 files changed, 5 insertions, 4 deletions
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;