summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in2
-rw-r--r--src/eeprom_main.c57
2 files changed, 45 insertions, 14 deletions
diff --git a/configure.in b/configure.in
index d0fc7d4..39a67c4 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
AC_INIT([src/eeprom_main.c])
-AM_INIT_AUTOMAKE([mts-id-eeprom], [0.4.2])
+AM_INIT_AUTOMAKE([mts-id-eeprom], [0.4.3])
AM_CONFIG_HEADER([config.h])
AC_PROG_CC
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index 8b398c0..1a68199 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -291,6 +291,15 @@ static int mtcdt3b_yaml_out(const char *name, struct mtcdt3b_eeprom_layout *mtcd
mtcdt3b_eeprom->lora_eui[5],
mtcdt3b_eeprom->lora_eui[6],
mtcdt3b_eeprom->lora_eui[7]);
+ fprintf(file, "lora-eui2: \"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\"\n",
+ mtcdt3b_eeprom->lora_eui2[0],
+ mtcdt3b_eeprom->lora_eui2[1],
+ mtcdt3b_eeprom->lora_eui2[2],
+ mtcdt3b_eeprom->lora_eui2[3],
+ mtcdt3b_eeprom->lora_eui2[4],
+ mtcdt3b_eeprom->lora_eui2[5],
+ mtcdt3b_eeprom->lora_eui2[6],
+ mtcdt3b_eeprom->lora_eui2[7]);
fprintf(file, "lora-product-id: \"%.32s\"\n", mtcdt3b_eeprom->lora_product_id);
fprintf(file, "lora-hw-version: \"%.32s\"\n", mtcdt3b_eeprom->lora_hw_version);
@@ -427,18 +436,27 @@ static void mtcdt3b_eeprom_inspect(struct mtcdt3b_eeprom_layout *mtcdt3b_eeprom)
log_info("product-id: %.32s", mtcdt3b_eeprom->product_id);
log_info("device-id: %.32s", mtcdt3b_eeprom->device_id);
log_info("hw-version: %.32s", mtcdt3b_eeprom->hw_version);
- log_info("mtcdt3b-capa-lora: %s", DEVICE_CAPA(mtcdt3b_eeprom->capa, MTCDT3B_CAPA_LORA) ? "yes" : "no");
+ log_info("mtcdt3b-capa-lora: %s", DEVICE_CAPA(mtcdt3b_eeprom->capa, MTCDT3B_CAPA_LORA) ? "yes" : "no");
log_info("lora-eui: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
- mtcdt3b_eeprom->lora_eui[0],
- mtcdt3b_eeprom->lora_eui[1],
- mtcdt3b_eeprom->lora_eui[2],
- mtcdt3b_eeprom->lora_eui[3],
- mtcdt3b_eeprom->lora_eui[4],
- mtcdt3b_eeprom->lora_eui[5],
- mtcdt3b_eeprom->lora_eui[6],
- mtcdt3b_eeprom->lora_eui[7]);
- log_info("lora-product-id: %.32s", mtcdt3b_eeprom->lora_product_id);
- log_info("lora-hw-version: %.32s", mtcdt3b_eeprom->lora_hw_version);
+ mtcdt3b_eeprom->lora_eui[0],
+ mtcdt3b_eeprom->lora_eui[1],
+ mtcdt3b_eeprom->lora_eui[2],
+ mtcdt3b_eeprom->lora_eui[3],
+ mtcdt3b_eeprom->lora_eui[4],
+ mtcdt3b_eeprom->lora_eui[5],
+ mtcdt3b_eeprom->lora_eui[6],
+ mtcdt3b_eeprom->lora_eui[7]);
+ log_info("lora-eui2: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+ mtcdt3b_eeprom->lora_eui2[0],
+ mtcdt3b_eeprom->lora_eui2[1],
+ mtcdt3b_eeprom->lora_eui2[2],
+ mtcdt3b_eeprom->lora_eui2[3],
+ mtcdt3b_eeprom->lora_eui2[4],
+ mtcdt3b_eeprom->lora_eui2[5],
+ mtcdt3b_eeprom->lora_eui2[6],
+ mtcdt3b_eeprom->lora_eui2[7]);
+ log_info("lora-product-id: %.32s", mtcdt3b_eeprom->lora_product_id);
+ log_info("lora-hw-version: %.32s", mtcdt3b_eeprom->lora_hw_version);
}
#endif
@@ -517,6 +535,7 @@ enum {
CMD_OPT_ACCESSORY_CARD,
#ifdef MTCDT3B
CMD_OPT_BASE_BOARD,
+ CMD_OPT_LORA_EUI2,
#endif
CMD_OPT_VERSION,
CMD_OPT_HELP,
@@ -553,7 +572,8 @@ static struct option long_options[] = {
{"update", 0, NULL, CMD_OPT_UPDATE},
{"accessory-card", 0, NULL, CMD_OPT_ACCESSORY_CARD},
#ifdef MTCDT3B
- {"base-board", 0, NULL, CMD_OPT_BASE_BOARD},
+ {"base-board", 0, NULL, CMD_OPT_BASE_BOARD},
+ {"lora-eui2", 1, NULL, CMD_OPT_LORA_EUI2},
#endif
{"version", 0, NULL, CMD_OPT_VERSION},
{"help", 0, NULL, CMD_OPT_HELP},
@@ -573,6 +593,7 @@ int main(int argc, char *argv[]) {
int accessory_card = 0;
#ifdef MTCDT3B
int base_board = 0;
+ char *lora_eui2 = NULL;
#endif
char *vendor_id = NULL;
char *product_id = NULL;
@@ -587,6 +608,7 @@ int main(int argc, char *argv[]) {
struct mts_ap_eeprom_layout ap_eeprom;
#ifdef MTCDT3B
struct mtcdt3b_eeprom_layout mtcdt3b_eeprom;
+ memset (&mtcdt3b_eeprom, 0, eeprom_size);
#endif
memset(&id_eeprom, 0, eeprom_size);
@@ -691,6 +713,9 @@ int main(int argc, char *argv[]) {
case CMD_OPT_BASE_BOARD:
// handled above
break;
+ case CMD_OPT_LORA_EUI2:
+ lora_eui2 = optarg;
+ break;
#endif
case CMD_OPT_OUT_FILE:
@@ -934,7 +959,7 @@ int main(int argc, char *argv[]) {
tmp = hwaddr_aton(lora_eui, ap_eeprom.eui, sizeof(ap_eeprom.eui));
#ifdef MTCDT3B
else if (base_board)
- tmp = hwaddr_aton(lora_eui, mtcdt3b_eeprom.lora_eui, sizeof(ap_eeprom.eui));
+ tmp = hwaddr_aton(lora_eui, mtcdt3b_eeprom.lora_eui, sizeof(mtcdt3b_eeprom.lora_eui));
#endif
else
tmp = hwaddr_aton(lora_eui, id_eeprom.lora_eui, sizeof(id_eeprom.lora_eui));
@@ -946,6 +971,12 @@ int main(int argc, char *argv[]) {
}
}
+#ifdef MTCDT3B
+ if (lora_eui2)
+ if (base_board)
+ tmp = hwaddr_aton(lora_eui2, mtcdt3b_eeprom.lora_eui2, sizeof(mtcdt3b_eeprom.lora_eui2));
+#endif
+
// updating eeprom in place, force bin format
if (update && in_file) {
out_file = in_file;