summaryrefslogtreecommitdiff
path: root/src/eeprom_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eeprom_main.c')
-rw-r--r--src/eeprom_main.c44
1 files changed, 42 insertions, 2 deletions
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index 7be9a07..dab3933 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -182,6 +182,15 @@ static int ap_yaml_out(const char *name, struct mts_ap_eeprom_layout *ap_eeprom)
ap_eeprom->mac_addr[3],
ap_eeprom->mac_addr[4],
ap_eeprom->mac_addr[5]);
+ fprintf(file, "eui: \"%02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X\"\n",
+ ap_eeprom->eui[0],
+ ap_eeprom->eui[1],
+ ap_eeprom->eui[2],
+ ap_eeprom->eui[3],
+ ap_eeprom->eui[4],
+ ap_eeprom->eui[5],
+ ap_eeprom->eui[6],
+ ap_eeprom->eui[7]);
fprintf(file, "...\n");
fclose(file);
@@ -270,11 +279,20 @@ static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom)
ap_eeprom->mac_addr[3],
ap_eeprom->mac_addr[4],
ap_eeprom->mac_addr[5]);
+ log_info("eui: %02X:%02X:%02X:%02X:%02X:%02X:%02X:%02X",
+ ap_eeprom->eui[0],
+ ap_eeprom->eui[1],
+ ap_eeprom->eui[2],
+ ap_eeprom->eui[3],
+ ap_eeprom->eui[4],
+ ap_eeprom->eui[5],
+ ap_eeprom->eui[6],
+ ap_eeprom->eui[7]);
}
static void print_version(const char *name) {
printf("%s (" PACKAGE ") " VERSION " (" __DATE__ " " __TIME__ ")\n", name);
- printf("Copyright (C) 2010 by Multi-Tech Systems\n");
+ printf("Copyright (C) 2015 by Multi-Tech Systems\n");
printf(
"This program is free software; you may redistribute it under the terms of\n"
"the GNU General Public License version 2 or (at your option) any later version.\n"
@@ -293,6 +311,7 @@ static void usage(FILE *out) {
fprintf(out, " --mac-addr <mac-addr> |\n");
fprintf(out, " --mac-bluetooth <mac-addr> |\n");
fprintf(out, " --mac-wifi <mac-addr> |\n");
+ fprintf(out, " --eui <EUI-64> |\n");
fprintf(out, " --imei <imei> |\n");
fprintf(out, " --capa-gps |\n");
fprintf(out, " --capa-din |\n");
@@ -318,6 +337,7 @@ enum {
CMD_OPT_MAC_ADDR,
CMD_OPT_MAC_BLUETOOTH,
CMD_OPT_MAC_WIFI,
+ CMD_OPT_EUI,
CMD_OPT_IMEI,
CMD_OPT_CAPA_GPS,
CMD_OPT_CAPA_DIN,
@@ -344,6 +364,7 @@ static struct option long_options[] = {
{"mac-addr", 1, NULL, CMD_OPT_MAC_ADDR},
{"mac-bluetooth", 1, NULL, CMD_OPT_MAC_BLUETOOTH},
{"mac-wifi", 1, NULL, CMD_OPT_MAC_WIFI},
+ {"eui", 1, NULL, CMD_OPT_EUI},
{"imei", 1, NULL, CMD_OPT_IMEI},
{"capa-gps", 0, NULL, CMD_OPT_CAPA_GPS},
{"capa-din", 0, NULL, CMD_OPT_CAPA_DIN},
@@ -377,6 +398,7 @@ int main(int argc, char *argv[]) {
char *device_id = NULL;
char *hw_version = NULL;
char *mac_addr = NULL;
+ char *eui = NULL;
struct mts_id_eeprom_layout id_eeprom;
struct mts_ap_eeprom_layout ap_eeprom;
@@ -526,6 +548,10 @@ int main(int argc, char *argv[]) {
}
break;
+ case CMD_OPT_EUI:
+ eui = optarg;
+ break;
+
case CMD_OPT_IMEI:
strncpy(id_eeprom.imei, optarg, sizeof(id_eeprom.imei) - 1);
break;
@@ -610,7 +636,21 @@ int main(int argc, char *argv[]) {
tmp = hwaddr_aton(mac_addr, ap_eeprom.mac_addr, sizeof(ap_eeprom.mac_addr));
}
if (!tmp) {
- log_error("invalid mac-addr %s", optarg);
+ log_error("invalid mac-addr %s", mac_addr);
+ usage(stderr);
+ exit(1);
+ }
+ }
+ if (eui) {
+ if (!accessory_card) {
+ log_error("EUI only supported on accessory card eeprom");
+ usage(stderr);
+ exit(1);
+ }
+
+ tmp = hwaddr_aton(eui, ap_eeprom.eui, sizeof(ap_eeprom.eui));
+ if (!tmp) {
+ log_error("invalid EUI %s", eui);
usage(stderr);
exit(1);
}