From c079205f0973d01b236cfe70db9c3eb33d32dde4 Mon Sep 17 00:00:00 2001 From: Brandon Bayer Date: Tue, 1 Nov 2016 11:50:38 -0500 Subject: feat: add lora-eui --- configure.in | 2 +- src/eeprom_main.c | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/configure.in b/configure.in index 8e3e1dd..1b58026 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ AC_INIT([src/eeprom_main.c]) -AM_INIT_AUTOMAKE([mts-id-eeprom], [0.2.7]) +AM_INIT_AUTOMAKE([mts-id-eeprom], [0.2.8]) AM_CONFIG_HEADER([config.h]) AC_PROG_CC diff --git a/src/eeprom_main.c b/src/eeprom_main.c index 2f7a819..ad81734 100644 --- a/src/eeprom_main.c +++ b/src/eeprom_main.c @@ -189,6 +189,17 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom) ptr += sprintf(ptr, "%02X", id_eeprom->uuid[i]); } fprintf(file, "uuid: \"%s\"\n", (char*)buf); + + fprintf(file, "lora-eui: \"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\"\n", + id_eeprom->lora_eui[0], + id_eeprom->lora_eui[1], + id_eeprom->lora_eui[2], + id_eeprom->lora_eui[3], + id_eeprom->lora_eui[4], + id_eeprom->lora_eui[5], + id_eeprom->lora_eui[6], + id_eeprom->lora_eui[7]); + fprintf(file, "...\n"); fclose(file); @@ -317,6 +328,16 @@ static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom) ptr += sprintf(ptr, "%02X", id_eeprom->uuid[i]); } log_info("uuid: %s", (char*)buf); + + log_info("lora-eui: \"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\"\n", + id_eeprom->lora_eui[0], + id_eeprom->lora_eui[1], + id_eeprom->lora_eui[2], + id_eeprom->lora_eui[3], + id_eeprom->lora_eui[4], + id_eeprom->lora_eui[5], + id_eeprom->lora_eui[6], + id_eeprom->lora_eui[7]); } static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom) @@ -728,12 +749,11 @@ int main(int argc, char *argv[]) { } if (eui) { if (!accessory_card) { - log_error("EUI only supported on accessory card eeprom"); - usage(stderr); - exit(1); + tmp = hwaddr_aton(eui, id_eeprom.lora_eui, sizeof(id_eeprom.lora_eui)); + } + else { + tmp = hwaddr_aton(eui, ap_eeprom.eui, sizeof(ap_eeprom.eui)); } - - tmp = hwaddr_aton(eui, ap_eeprom.eui, sizeof(ap_eeprom.eui)); if (!tmp) { log_error("invalid EUI %s", eui); usage(stderr); -- cgit v1.2.3