summaryrefslogtreecommitdiff
path: root/io-module/mts_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mts_io.c')
-rw-r--r--io-module/mts_io.c43
1 files changed, 40 insertions, 3 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 12650b1..8a2de67 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -110,6 +110,8 @@ bool sent_extra_long = false;
static int reset_short_signal = SIGUSR1;
static int reset_long_signal = SIGUSR2;
static int reset_extra_long_signal = SIGHUP;
+static int reset_short_interval = RESET_HOLD_COUNT;
+static int reset_long_interval = RESET_LONG_HOLD_COUNT;
static void reset_callback(struct work_struct *ignored);
@@ -137,16 +139,16 @@ static void reset_callback(struct work_struct *ignored)
reset_count++;
} else {
//Reset button has not been pressed
- if (reset_count > 0 && reset_count < RESET_HOLD_COUNT) {
+ if (reset_count > 0 && reset_count < reset_short_interval) {
kill_pid(vpid, reset_short_signal, 1);
- } else if (reset_count >= RESET_HOLD_COUNT && reset_count < RESET_LONG_HOLD_COUNT) {
+ } else if (reset_count >= reset_short_interval && reset_count < reset_long_interval) {
kill_pid(vpid, reset_long_signal, 1);
}
reset_count = 0;
sent_extra_long = false;
}
- if (reset_count >= RESET_LONG_HOLD_COUNT && ! sent_extra_long) {
+ if (reset_count >= reset_long_interval && ! sent_extra_long) {
kill_pid(vpid, reset_extra_long_signal, 1);
sent_extra_long = true;
}
@@ -159,6 +161,41 @@ static void reset_callback(struct work_struct *ignored)
schedule_delayed_work(&reset_work, RESET_INTERVAL);
}
+static ssize_t mts_attr_show_reset_monitor_intervals(struct device *dev, struct device_attribute *attr, char *buf)
+{
+ int ret;
+
+ mutex_lock(&mts_io_mutex);
+
+ ret = sprintf(buf, "%d %d\n", reset_short_interval / RESET_CHECK_PER_SEC, reset_long_interval / RESET_CHECK_PER_SEC);
+
+ mutex_unlock(&mts_io_mutex);
+
+ return ret;
+}
+
+static ssize_t mts_attr_store_reset_monitor_intervals(struct device *dev, struct device_attribute *attr, char *buf, size_t count)
+{
+ int short_int;
+ int long_int;
+
+ if (sscanf(buf, "%i %i", &short_int, &long_int) != 2) {
+ return -EINVAL;
+ }
+
+ mutex_lock(&mts_io_mutex);
+
+ reset_short_interval = short_int * RESET_CHECK_PER_SEC;
+ reset_long_interval = long_int * RESET_CHECK_PER_SEC;
+
+ mutex_unlock(&mts_io_mutex);
+
+ return count;
+}
+
+static DEVICE_ATTR_MTS(dev_attr_reset_monitor_intervals, "reset-monitor-intervals",
+ mts_attr_show_reset_monitor_intervals, mts_attr_store_reset_monitor_intervals);
+
static ssize_t mts_attr_show_reset_monitor(struct device *dev,
struct device_attribute *attr,
char *buf)