summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-11-02 13:10:20 -0600
committerJohn Klug <john.klug@multitech.com>2020-11-02 13:10:20 -0600
commit07b8de9f8b9a8dd650145d46607dd9aeb4dc02aa (patch)
tree4d0fc02f582747707b2c272fdb83561562b121c2
parentec753120385b76ac670c0b8fd8968070f84edf8b (diff)
downloadmts-io-07b8de9f8b9a8dd650145d46607dd9aeb4dc02aa.tar.gz
mts-io-07b8de9f8b9a8dd650145d46607dd9aeb4dc02aa.tar.bz2
mts-io-07b8de9f8b9a8dd650145d46607dd9aeb4dc02aa.zip
Fix conflict between mts-io and mtcdt3b over has-radio attribute4.4.5
-rw-r--r--configure.ac2
-rw-r--r--io-module/machine/mtcpm.c13
-rw-r--r--io-module/mts-io.c24
-rw-r--r--io-module/mts_io_module.h2
4 files changed, 24 insertions, 17 deletions
diff --git a/configure.ac b/configure.ac
index 9332560..7970d9c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([mts-io], [4.4.4])
+AC_INIT([mts-io], [4.4.5])
AC_CONFIG_SRCDIR([util/mts_util_lora2_reset.c])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER([config.h])
diff --git a/io-module/machine/mtcpm.c b/io-module/machine/mtcpm.c
index dfffef6..4a55127 100644
--- a/io-module/machine/mtcpm.c
+++ b/io-module/machine/mtcpm.c
@@ -202,7 +202,6 @@ static struct attribute *mtcpm_platform_attributes[] = {
&dev_attr_usbhub_reset.attr,
&dev_attr_eth_reset.attr,
- &dev_attr_has_radio.attr,
// radio-reset must be first for mtcdt3
&dev_attr_radio_reset.attr,
@@ -214,6 +213,10 @@ static struct attribute *mtcpm_platform_attributes[] = {
NULL,
};
+static struct attribute *mtcpm_has_radio_attribute[] = {
+ &dev_attr_has_radio.attr,
+};
+
static struct attribute *mtcpm_wifi_bt_attributes[] = {
&dev_attr_wifi_reset_mtcpm.attr,
&dev_attr_bt_reset_mtcpm.attr,
@@ -231,12 +234,6 @@ static struct attribute_group mtcpm_platform_attribute_group = {
.attrs = mtcpm_platform_attributes
};
-static int
-is_radio_reset_attr_mtcpm(struct attribute *attr)
-{
- return (attr == &dev_attr_radio_power.attr);
-};
-
static struct attribute *mtcpm_lora_attributes[] = {
&dev_attr_lora_eui_mtcpm.attr,
&dev_attr_lora_product_id_mtcpm.attr,
@@ -296,7 +293,7 @@ static void mts_cpu_dir_delete(void)
}
static int
-is_radio_reset_attr_mtcdt(struct attribute *attr)
+is_radio_reset_attr_mtcpm(struct attribute *attr)
{
return (attr == &dev_attr_radio_reset.attr);
}
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index 807df78..069e84b 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -664,7 +664,8 @@ mts_id_eeprom_load(void)
int current_count; // Number of items in array
struct attribute **all_attrs = NULL;
char *tmp;
- int noradio, has_cellular_capaflag = 0;
+ int noradio = 0; // MTCPM-0.0 does not trim off radio-reset, etc.
+ int has_cellular_capaflag = 0;
int need_append;
int ret;
const struct firmware* fw = NULL;
@@ -685,16 +686,16 @@ mts_id_eeprom_load(void)
return -ENODEV;
}
- // If we are an MTCPM-0.0, the base board sets the radio existance.
+ /* If we are an MTCPM-0.0, the base board sets the radio existance, and we always
+ * add the radio-reset, etc */
if (strncmp(id_eeprom.hw_version,HW_VERSION_MTCPM_0_0,sizeof HW_VERSION_MTCPM_0_0) != 0) {
if (id_eeprom.eeprom_layout_version == 0) {
noradio = ! mts_has_radio(id_eeprom.product_id,sizeof id_eeprom.product_id);
- log_debug("mts_id_eeprom_load: noradio=%d",noradio);
} else {
has_cellular_capaflag = 1;
noradio = ! DEVICE_CAPA(id_eeprom.capa, CAPA_CELLULAR);
- log_debug("mts_id_eeprom_load: noradio=%d",noradio);
}
+ log_debug("mts_id_eeprom_load: noradio=%d",noradio);
}
if (((tmp=HW_VERSION_MTCAP_0_0),(mts_hw_version=MTCAP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) ||
@@ -959,12 +960,12 @@ mts_id_eeprom_load(void)
current_blength = attr_blength = sizeof mtcpm_platform_attributes;
current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */
- /* See if we have no radio, and if so, prune out the stuff that follows */
+ /* See if we have no radio (never executed for MTCPM_0_0), and if so, prune out the stuff that follows */
if(noradio) {
struct attribute **ap = mtcpm_platform_attribute_group.attrs;
while(1) {
if(ap[j] == NULL) {
- log_info("Did not find radio power attribute. Possible driver fault.");
+ log_info("Did not find radio reset attribute. Possible driver fault.");
break;
}
j++;
@@ -977,7 +978,10 @@ mts_id_eeprom_load(void)
}
}
}
-
+ if (tmp != HW_VERSION_MTCPM_0_0) {
+ attr_blength += sizeof mtcpm_has_radio_attribute;
+ need_append = 1;
+ }
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
attr_blength += sizeof mtcpm_wifi_bt_attributes;
need_append = 1;
@@ -990,6 +994,12 @@ mts_id_eeprom_load(void)
freelater = all_attrs = kmalloc(attr_blength,GFP_KERNEL);
current_count = current_blength/(sizeof (struct attribute *));
memcpy(all_attrs,mtcpm_platform_attributes,current_blength);
+ if(tmp != HW_VERSION_MTCPM_0_0) {
+ log_info("Adding has_radio to mts-io driver");
+ memcpy(all_attrs + current_count,mtcpm_has_radio_attribute,sizeof mtcpm_has_radio_attribute);
+ current_count += sizeof mtcpm_has_radio_attribute / (sizeof (struct attribute *));
+ }
+
if(DEVICE_CAPA(id_eeprom.capa, CAPA_WIFI)) {
log_info("Adding WiFi/BT to mts-io driver");
memcpy(all_attrs + current_count,mtcpm_wifi_bt_attributes,sizeof mtcpm_wifi_bt_attributes);
diff --git a/io-module/mts_io_module.h b/io-module/mts_io_module.h
index 9ddae6d..fde8d60 100644
--- a/io-module/mts_io_module.h
+++ b/io-module/mts_io_module.h
@@ -5,7 +5,7 @@
* MTAC cards.
*/
-#define DRIVER_VERSION "v4.4.4"
+#define DRIVER_VERSION "v4.4.5"
#define DRIVER_AUTHOR "Multitech Systems"
#define DRIVER_DESC "MTS-IO Controller"
#define DRIVER_NAME "mts-io"