summaryrefslogtreecommitdiff
path: root/io-module
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2017-09-06 15:13:02 -0500
committerJohn Klug <john.klug@multitech.com>2017-09-06 15:13:02 -0500
commit7c991bb57b5201e35f422938a584af94582d9781 (patch)
tree20d37a01d62adf3c80526113c5b2dd07b6d73d84 /io-module
parent5aaa14e344864f613b8177bad78734f8ab1f7817 (diff)
downloadmts-io-7c991bb57b5201e35f422938a584af94582d9781.tar.gz
mts-io-7c991bb57b5201e35f422938a584af94582d9781.tar.bz2
mts-io-7c991bb57b5201e35f422938a584af94582d9781.zip
Fix up MTCDTIP detection
Diffstat (limited to 'io-module')
-rw-r--r--io-module/mts_io.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/io-module/mts_io.c b/io-module/mts_io.c
index 8ec9d9c..697852a 100644
--- a/io-module/mts_io.c
+++ b/io-module/mts_io.c
@@ -47,7 +47,7 @@
#include "mts_io.h"
-#define DRIVER_VERSION "v1.5.15"
+#define DRIVER_VERSION "v1.5.16"
#define DRIVER_AUTHOR "James Maki <jmaki@multitech.com>"
#define DRIVER_DESC "MTS-IO Controller"
#define DRIVER_NAME "mts-io"
@@ -824,6 +824,7 @@ mts_id_eeprom_load(void)
int current_blength; // Current length in bytes of attribute array
int current_count; // Number of items in array
struct attribute **all_attrs = NULL;
+ char *tmp;
//The mts_id_eeprom buffer is initialize once on boot
//reloading the mts_io.ko module will not reinitialize this buffer
@@ -833,15 +834,8 @@ mts_id_eeprom_load(void)
if (mts_id_eeprom[0] == 0xFF) {
log_error("uninitialized eeprom");
return -EIO;
- } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCAP_0_0, strlen(HW_VERSION_MTCAP_0_0)) == 0) {
- attr_group = &mtcap_0_0_platform_attribute_group;
- gpio_pins = gpio_pins_mtcap_0_0;
- if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA)) {
- attr_group_lora = &mtcap_0_0_lora_attribute_group;
- }
- mts_hw_version = MTCAP_0_0;
- log_info("detected board %s", HW_VERSION_MTCAP_0_0);
- } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCAP_0_1, strlen(HW_VERSION_MTCAP_0_1)) == 0) {
+ } else if (((tmp=HW_VERSION_MTCAP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) ||
+ ((tmp=HW_VERSION_MTCAP_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) {
int j=0;
/* See if we have no radio, and if so, prune out the stuff that follows */
if((strncmp(id_eeprom.product_id, PRODUCT_ID_MTCAP, sizeof PRODUCT_ID_MTCAP - 1) == 0) &&
@@ -887,9 +881,8 @@ mts_id_eeprom_load(void)
gpio_pins = gpio_pins_mtrv1_0_1;
mts_hw_version = MTRV1_0_1;
log_info("detected board %s", HW_VERSION_MTRV1_0_1);
- } else if ((strncmp(id_eeprom.hw_version, HW_VERSION_MTCDT_0_1, strlen(HW_VERSION_MTCDT_0_1)) == 0) ||
- (strncmp(id_eeprom.hw_version, HW_VERSION_MTCDTIP_0_0, strlen(HW_VERSION_MTCDTIP_0_0) == 0)))
- {
+ } else if (((tmp=HW_VERSION_MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) ||
+ ((tmp=HW_VERSION_MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) {
attr_blength = sizeof mtcdt_0_1_platform_attributes;
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
attr_blength += sizeof mtcdt_0_1_wifi_bt_attributes;
@@ -917,10 +910,7 @@ mts_id_eeprom_load(void)
attr_group = &mtcdt_0_1_platform_attribute_group;
gpio_pins = gpio_pins_mtcdt_0_1;
- if(strncmp(id_eeprom.hw_version, HW_VERSION_MTCDT_0_1, strlen(HW_VERSION_MTCDT_0_1)) == 0)
- log_info("detected board %s", HW_VERSION_MTCDT_0_1);
- else
- log_info("detected board %s", HW_VERSION_MTCDTIP_0_0);
+ log_info("detected board %s", tmp);
} else {
attr_group = &mtcdt_platform_attribute_group;
gpio_pins = gpio_pins_mtcdt_0_0;