summaryrefslogtreecommitdiff
path: root/io-module/mts-io.c
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2018-05-29 10:50:32 -0500
committerJohn Klug <john.klug@multitech.com>2018-06-25 11:58:18 -0500
commit5a6e4e142175354a321b3bbf8157ca197821c7f4 (patch)
tree7c7d68a9a1b4ca35ce692d8eaf141592c75e4bdc /io-module/mts-io.c
parent2a98dad0a63a8b549a3ba4571dff9f4a33f58dd7 (diff)
downloadmts-io-5a6e4e142175354a321b3bbf8157ca197821c7f4.tar.gz
mts-io-5a6e4e142175354a321b3bbf8157ca197821c7f4.tar.bz2
mts-io-5a6e4e142175354a321b3bbf8157ca197821c7f4.zip
Remove BUTTON INTERFACE feature test macro
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r--io-module/mts-io.c97
1 files changed, 4 insertions, 93 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index e51bd4b..45ef966 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -93,6 +93,9 @@ static void radio_reset_timer_callback(unsigned long data);
/* generic GPIO support */
#include "gpio.c"
+/* generic Button support */
+//#include "buttons.c"
+
/* reset button handling */
#define RESET_CHECK_PER_SEC 8
#define RESET_INTERVAL (HZ / RESET_CHECK_PER_SEC)
@@ -165,86 +168,6 @@ has_radio(const char *product_id, size_t len)
}
-#ifndef NEW_BUTTON_INTERFACE
-static void reset_callback(struct work_struct *ignored);
-
-static DECLARE_DELAYED_WORK(reset_work, reset_callback);
-static void reset_callback(struct work_struct *ignored)
-{
- struct gpio_pin *pin;
- int reset_pressed = 0;
- struct pid *vpid = NULL;
-
- mutex_lock(&mts_io_mutex);
-
- pin = gpio_pin_by_attr_name("reset");
- if (pin) {
- reset_pressed = !gpio_get_value(pin->pin.gpio);
- }
-
- if (reset_pid > 0) {
- vpid = find_vpid(reset_pid);
- }
-
- if (vpid) {
- if (reset_pressed) {
- reset_count++;
- } else {
- //Reset button has not been pressed
- if (reset_count > 0 && reset_count < reset_short_interval) {
- kill_pid(vpid, reset_short_signal, 1);
- } 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_interval && ! sent_extra_long) {
- kill_pid(vpid, reset_extra_long_signal, 1);
- sent_extra_long = true;
- }
- } else {
- reset_count = 0;
- }
-
- mutex_unlock(&mts_io_mutex);
-
- 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, const 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);
@@ -298,10 +221,6 @@ static ssize_t mts_attr_store_reset_monitor(struct device *dev,
return count;
}
-static DEVICE_ATTR_MTS(dev_attr_reset_monitor, "reset-monitor",
- mts_attr_show_reset_monitor, mts_attr_store_reset_monitor);
-static DEVICE_ATTR_RO_MTS(dev_attr_reset, "reset", mts_attr_show_gpio_pin);
-#endif
/* active-low socket modem reset */
static ssize_t mts_attr_store_radio_reset(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
@@ -1209,13 +1128,9 @@ static int __init mts_io_init(void)
log_debug("could not request pin %s (%d) but it could have already been requested under a different pin name", pin->name, ret);
}
}
-#ifndef NEW_BUTTON_INTERFACE
- // start the reset handler
- reset_callback(NULL);
-#else
// start general buttons processing
init_buttons();
-#endif
+
/* init timers */
setup_timer(&radio_reset_timer, radio_reset_timer_callback, 0);
setup_timer(&radio_reset_available_timer, radio_reset_available_timer_callback, 0);
@@ -1230,11 +1145,7 @@ static void __exit mts_io_exit(void)
/* delete radio_reset_available_timer */
del_timer(&radio_reset_available_timer);
-#ifndef NEW_BUTTON_INTERFACE
- cancel_delayed_work_sync(&reset_work);
-#else
cleanup_buttons();
-#endif
cleanup();
log_info("exiting");