summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2019-11-05 11:43:54 -0600
committerJohn Klug <john.klug@multitech.com>2019-11-05 11:43:54 -0600
commitcdb74e3a58a544540ff3281a57f1f97e1466c2d3 (patch)
tree1cf7fcdc6d7b78ca1d525e286b2e574fd4e62a51 /src
parentae139bfe0a2983a6c71f0a79e316555ab707b088 (diff)
downloadmts-id-eeprom-cdb74e3a58a544540ff3281a57f1f97e1466c2d3.tar.gz
mts-id-eeprom-cdb74e3a58a544540ff3281a57f1f97e1466c2d3.tar.bz2
mts-id-eeprom-cdb74e3a58a544540ff3281a57f1f97e1466c2d3.zip
Fix up the main board UUID, mac address
Diffstat (limited to 'src')
-rw-r--r--src/eeprom_main.c33
1 files changed, 30 insertions, 3 deletions
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index 93812f6..5446750 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -175,14 +175,14 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom)
}
fprintf(file, "\"\n");
- fprintf(file, "mac-bluetooth: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
+ fprintf(file, "mac-bluetooth: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
id_eeprom->mac_bluetooth[0],
id_eeprom->mac_bluetooth[1],
id_eeprom->mac_bluetooth[2],
id_eeprom->mac_bluetooth[3],
id_eeprom->mac_bluetooth[4],
id_eeprom->mac_bluetooth[5]);
- fprintf(file, "mac-wifi: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
+ fprintf(file, "mac-wifi: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
id_eeprom->mac_wifi[0],
id_eeprom->mac_wifi[1],
id_eeprom->mac_wifi[2],
@@ -262,7 +262,10 @@ static int ap_yaml_out(const char *name, struct mts_ap_eeprom_layout *ap_eeprom)
#ifdef MTCDT3B
static int mtcdt3b_yaml_out(const char *name, struct mtcdt3b_eeprom_layout *mtcdt3b_eeprom)
{
+ int i;
FILE *file;
+ char buf[64] = {0};
+ char *ptr;
if (!strcmp(name, "-")) {
file = stdout;
@@ -281,6 +284,11 @@ static int mtcdt3b_yaml_out(const char *name, struct mtcdt3b_eeprom_layout *mtcd
fprintf(file, "product-id: \"%.32s\"\n", mtcdt3b_eeprom->product_id);
fprintf(file, "device-id: \"%.32s\"\n", mtcdt3b_eeprom->device_id);
fprintf(file, "hw-version: \"%.32s\"\n", mtcdt3b_eeprom->hw_version);
+ ptr = (char*)buf;
+ for(i = 0; i < 16; i++) {
+ ptr += sprintf(ptr, "%02X", mtcdt3b_eeprom->uuid[i]);
+ }
+ fprintf(file, "uuid: \"%s\"\n", (char*)buf);
fprintf(file, "mac-addr: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
mtcdt3b_eeprom->mac_addr[0],
mtcdt3b_eeprom->mac_addr[1],
@@ -440,11 +448,22 @@ static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom)
#ifdef MTCDT3B
static void mtcdt3b_eeprom_inspect(struct mtcdt3b_eeprom_layout *mtcdt3b_eeprom)
{
- log_info("sizeof: %u", sizeof(struct mtcdt3b_eeprom_layout));
+ int i;
+ char buf[64] = {0};
+ char* ptr;
+
+ log_info("sizeof: %u", sizeof(struct mtcdt3b_eeprom_layout));
log_info("vendor-id: %.32s", mtcdt3b_eeprom->vendor_id);
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);
+
+ ptr = (char*)buf;
+ for(i = 0; i < 16; i++) {
+ ptr += sprintf(ptr, "%02X", mtcdt3b_eeprom->uuid[i]);
+ }
+ log_info("uuid: %s", (char*)buf);
+
log_info("mac-addr: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
mtcdt3b_eeprom->mac_addr[0],
mtcdt3b_eeprom->mac_addr[1],
@@ -785,6 +804,14 @@ int main(int argc, char *argv[]) {
usage(stderr);
exit(1);
}
+
+#ifdef MTCDT3B
+ if(asciiHexToBin(optarg, mtcdt3b_eeprom.uuid) != sizeof(mtcdt3b_eeprom.uuid)) {
+ log_error("invalid uuid %s", optarg);
+ usage(stderr);
+ exit(1);
+ } else
+#endif
if(asciiHexToBin(optarg, id_eeprom.uuid) != sizeof(id_eeprom.uuid)) {
log_error("invalid uuid %s", optarg);
usage(stderr);