From 9f750dfa80f9e245320fbb607bc8d64e656dc6f2 Mon Sep 17 00:00:00 2001 From: John Klug Date: Wed, 21 Oct 2020 12:24:53 -0500 Subject: Add MTCPM-0.1 hardware version --- io-module/mts-io.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'io-module/mts-io.c') diff --git a/io-module/mts-io.c b/io-module/mts-io.c index 09f0eef..3df4732 100644 --- a/io-module/mts-io.c +++ b/io-module/mts-io.c @@ -684,8 +684,8 @@ mts_id_eeprom_load(void) return -ENODEV; } - // If we are an MTCPM, the base board sets the radio existance. - if (strncmp(id_eeprom.hw_version,HW_VERSION_MTCPM_DASH,sizeof HW_VERSION_MTCPM_DASH) != 0) { + // If we are an MTCPM-0.0, the base board sets the radio existance. + 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); @@ -696,10 +696,10 @@ mts_id_eeprom_load(void) } } - 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) || - ((tmp=HW_VERSION_MTCAP_0_2),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || - ((tmp=HW_VERSION_MTCAP_0_3),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { + if (((tmp=HW_VERSION_MTCAP_0_0),(mts_hw_version=MTCAP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCAP_0_1),(mts_hw_version=MTCAP_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCAP_0_2),(mts_hw_version=MTCAP_0_2),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCAP_0_3),(mts_hw_version=MTCAP_0_3),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { int need_radio_enable = 0; current_blength = attr_blength = sizeof mtcap_0_0_platform_attributes; current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */ @@ -819,8 +819,8 @@ mts_id_eeprom_load(void) set_buttons(mths_buttons_0_0); /* Only one button version */ mts_hw_version = MTHS_0_1; log_info("detected board %s", HW_VERSION_MTHS_0_1); - } 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)) { + } else if (((tmp=HW_VERSION_MTCDT_0_1),(mts_hw_version=MTCDT_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCDTIP_0_0),(mts_hw_version=MTCDTIP_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { current_blength = attr_blength = sizeof mtcdt_0_1_platform_attributes; current_blength -= sizeof(struct attribute *); /* Length without terminating NULL */ @@ -918,6 +918,7 @@ mts_id_eeprom_load(void) attr_group_lora = &mtcdtiphp_0_0_lora_attribute_group; } set_buttons(default_buttons); + mts_hw_version = MTCDTIPHP_0_0; log_info("detected board %s", tmp); } else if ((tmp=HW_VERSION_MTCDT_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) { if(noradio) { @@ -941,13 +942,12 @@ mts_id_eeprom_load(void) mts_hw_version = MTCDT_0_0; set_buttons(default_buttons); log_info("detected board %s", tmp); - - } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTCPM_0_0, strlen(HW_VERSION_MTCPM_0_0)) == 0) { + } else if (((tmp=HW_VERSION_MTCPM_0_0),(mts_hw_version=MTCPM_0_0),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0) || + ((tmp=HW_VERSION_MTCPM_0_1),(mts_hw_version=MTCPM_0_1),strncmp(id_eeprom.hw_version, tmp, strlen(tmp)) == 0)) { attr_group = &mtcpm_platform_attribute_group; gpio_pins = gpio_pins_mtcpm; set_buttons(default_buttons); - mts_hw_version = MTCPM_0_0; - log_info("detected board %s", HW_VERSION_MTCPM_0_0); + log_info("detected board %s", tmp); } else if (strncmp(id_eeprom.product_id, PRODUCT_ID_MT100EOCG, strlen(PRODUCT_ID_MT100EOCG)) == 0) { attr_group = &mt100eocg_platform_attribute_group; gpio_pins = gpio_pins_mt100eocg_0_0; @@ -957,6 +957,7 @@ mts_id_eeprom_load(void) } else { int i; + mts_hw_version = MTHWUNKNOWN; for(i=0;i