summaryrefslogtreecommitdiff
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-05-29 10:50:32 -0500
commit4ef2609858e80c0a6ec78f3358ec57e4a97d510c (patch)
tree7c7d68a9a1b4ca35ce692d8eaf141592c75e4bdc
parentc31d619c83ba2a6c7c803082e804d18da657a389 (diff)
downloadmts-io-4ef2609858e80c0a6ec78f3358ec57e4a97d510c.tar.gz
mts-io-4ef2609858e80c0a6ec78f3358ec57e4a97d510c.tar.bz2
mts-io-4ef2609858e80c0a6ec78f3358ec57e4a97d510c.zip
Remove BUTTON INTERFACE feature test macro
-rw-r--r--io-module/buttons.c4
-rw-r--r--io-module/buttons.h2
-rw-r--r--io-module/mths.c29
-rw-r--r--io-module/mts-io.c97
4 files changed, 6 insertions, 126 deletions
diff --git a/io-module/buttons.c b/io-module/buttons.c
index e7ed9ac..045dd22 100644
--- a/io-module/buttons.c
+++ b/io-module/buttons.c
@@ -232,8 +232,8 @@ int set_buttons (button_info_pt* platform_buttons) {
void init_buttons(void) {
if (buttons == NULL) {
- log_error("Button structure hasn't been set yet");
- return;
+ log_error("Button structure hasn't been set. Use default");
+ set_buttons(default_buttons);
}
button_worker(NULL);
}
diff --git a/io-module/buttons.h b/io-module/buttons.h
index d324929..9a09fac 100644
--- a/io-module/buttons.h
+++ b/io-module/buttons.h
@@ -31,8 +31,6 @@
#include "mts_io.h"
-#define NEW_BUTTON_INTERFACE
-
#define BUTTON_CHECK_PER_SEC 8
#define BUTTON_INTERVAL (HZ / BUTTON_CHECK_PER_SEC)
#define BUTTON_HOLD_COUNT (BUTTON_CHECK_PER_SEC * 3)
diff --git a/io-module/mths.c b/io-module/mths.c
index 1fef07f..c50951e 100644
--- a/io-module/mths.c
+++ b/io-module/mths.c
@@ -687,32 +687,3 @@ static struct attribute *mths_0_0_platform_attributes[] = {
static struct attribute_group mths_0_0_platform_attribute_group = {
.attrs = mths_0_0_platform_attributes
};
-
-#ifdef NEW_BUTTON_INTERFACE
-
-//static const button_info_t user_button_mths = {
-// .name = "User Push Button",
-// .label_pin = "button",
-// .label_monitor = "button-monitor",
-// .label_monitor_intervals = "button-monitor-intervals",
-//
-// /* Signals */
-// .short_signal = SIGUSR1,
-// .long_signal = SIGUSR2,
-// .short_signal = SIGHUP,
-//
-// /* Intervals */
-// .short_interval = BUTTON_HOLD_COUNT,
-// .long_interval = BUTTON_LONG_HOLD_COUNT,
-//};
-//
-//static const button_info_t mths_buttons_0_0[] = {
-// user_button_mths,
-// {},
-//};
-
-
-
-
-
-#endif //NEW_BUTTON_INTERFACE
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");