summaryrefslogtreecommitdiff
path: root/io-module/mts-io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io-module/mts-io.c')
-rw-r--r--io-module/mts-io.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/io-module/mts-io.c b/io-module/mts-io.c
index a20cd39..cb1c48e 100644
--- a/io-module/mts-io.c
+++ b/io-module/mts-io.c
@@ -40,6 +40,7 @@
#include <linux/kmod.h>
#include <linux/ctype.h>
#include <linux/io.h>
+#include <linux/leds.h>
#include <linux/module.h>
#include <linux/firmware.h>
@@ -608,6 +609,12 @@ static ssize_t mts_attr_show_product_info(struct device *dev,
id_eeprom.lora_eui[5],
id_eeprom.lora_eui[6],
id_eeprom.lora_eui[7]);
+#ifdef MTRE
+ } else if (strcmp(attr->attr.name, "oem-string1") == 0) {
+ value = sprintf(buf, "%.32s\n", id_eeprom.oem_string1);
+ } else if (strcmp(attr->attr.name, "oem-string2") == 0) {
+ value = sprintf(buf, "%.32s\n", id_eeprom.oem_string2);
+#endif
}
else {
log_error("attribute '%s' not found", attr->attr.name);
@@ -633,6 +640,12 @@ static DEVICE_ATTR_RO_MTS(dev_attr_imei, "imei",
mts_attr_show_product_info);
static DEVICE_ATTR_RO_MTS(dev_attr_eth_mac, "mac-eth",
mts_attr_show_product_info);
+#ifdef MTRE
+static DEVICE_ATTR_RO_MTS(dev_attr_oem_string1, "oem-string1",
+ mts_attr_show_product_info);
+static DEVICE_ATTR_RO_MTS(dev_attr_oem_string2, "oem-string2",
+ mts_attr_show_product_info);
+#endif
static int get_radio_model_from_product_id(void) {
int rc = RADIO_UNKNOWN;
@@ -648,10 +661,14 @@ static int get_radio_model_from_product_id(void) {
/* include on-board lora peripheral */
#include "mts_lora.c"
+/* interface to Linux /sys/class/leds/ devices */
+#include "mts_leds.c"
+
/* include per-device pins and attributes */
#include "machine/mtcdt.c"
#include "machine/mtcap.c"
#include "machine/mtr.c"
+#include "machine/mtre.c"
#include "machine/mths.c"
#include "machine/mtcpm.c"
#include "machine/mt100eocg.c"
@@ -786,6 +803,13 @@ mts_id_eeprom_load(void)
attr_group_lora = &mtcap_0_0_lora_attribute_group;
}
log_info("detected board %s", tmp);
+ } else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTRE, strlen(HW_VERSION_MTRE)) == 0) {
+ attr_group = &mtre_0_0_platform_attribute_group;
+ gpio_pins = gpio_pins_mtre_0_0;
+ set_buttons(default_buttons);
+ mts_leds = mtre_0_0_leds;
+ mts_hw_version = MTRE_0_0;
+ log_info("detected board %s", HW_VERSION_MTRE);
} else if (strncmp(id_eeprom.hw_version, HW_VERSION_MTR_0_0, strlen(HW_VERSION_MTR_0_0)) == 0) {
attr_group = &mtr_platform_attribute_group;
gpio_pins = gpio_pins_mtr_0_0;
@@ -1122,6 +1146,10 @@ mts_id_eeprom_load(void)
log_info("lora-product-id: %.32s", id_eeprom.lora_product_id);
log_info("lora-hw-version: %.32s", id_eeprom.lora_hw_version);
}
+#ifdef MTRE
+ log_info("oem-string1: %.32s", id_eeprom.oem_string1);
+ log_info("oem-string2: %.32s", id_eeprom.oem_string2);
+#endif
return 0;
}
@@ -1199,6 +1227,10 @@ static int __init mts_io_init(void)
mts_load_lora_port();
}
+ if (mts_leds) {
+ mts_leds_register();
+ }
+
ret = mts_capab_dir_create(mts_hw_version);
if (ret) {
cleanup();
@@ -1269,6 +1301,11 @@ static void __exit mts_io_exit(void)
}
cleanup();
+
+ if (mts_leds) {
+ mts_leds_unregister();
+ }
+
if (DEVICE_CAPA(id_eeprom.capa, CAPA_LORA) && attr_group_lora) {
mts_teardown_lora_port();
}