summaryrefslogtreecommitdiff
path: root/recipes-bsp/multitech/mts-id-eeprom
diff options
context:
space:
mode:
authorMykyta Dorokhin <mykyta.dorokhin@globallogic.com>2017-01-31 13:41:42 +0200
committerJohn Klug <john.klug@multitech.com>2017-04-24 11:43:22 -0500
commit77874198b9a976bdc1b11da983394f7ec266c257 (patch)
tree564d9d6abc3c05a5c5e2f4b81fd47f66d90ec2ad /recipes-bsp/multitech/mts-id-eeprom
parentb166ae6ba45d2b1069a948e24b1148bf7db196a8 (diff)
downloadmeta-multitech-77874198b9a976bdc1b11da983394f7ec266c257.tar.gz
meta-multitech-77874198b9a976bdc1b11da983394f7ec266c257.tar.bz2
meta-multitech-77874198b9a976bdc1b11da983394f7ec266c257.zip
Add password creation utility to mts-id-eeprom
Diffstat (limited to 'recipes-bsp/multitech/mts-id-eeprom')
-rw-r--r--recipes-bsp/multitech/mts-id-eeprom/eeprom.patch262
1 files changed, 262 insertions, 0 deletions
diff --git a/recipes-bsp/multitech/mts-id-eeprom/eeprom.patch b/recipes-bsp/multitech/mts-id-eeprom/eeprom.patch
new file mode 100644
index 0000000..4c19e22
--- /dev/null
+++ b/recipes-bsp/multitech/mts-id-eeprom/eeprom.patch
@@ -0,0 +1,262 @@
+diff -uNr old/src/eeprom_main.c new/src/eeprom_main.c
+--- old/src/eeprom_main.c 2017-04-04 12:38:41.561484898 -0500
++++ new/src/eeprom_main.c 2017-04-04 12:30:33.877499336 -0500
+@@ -1,7 +1,7 @@
+ /*
+ * Create an image file for the MTCDP ID EEPROM
+ *
+- * Copyright (C) 2016 by Multi-Tech Systems
++ * Copyright (C) 2013 by Multi-Tech Systems
+ *
+ * Author: James Maki <jmaki@multitech.com>
+ *
+@@ -160,7 +160,6 @@
+ fprintf(file, "capa-adc: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_ADC) ? "true" : "false");
+ fprintf(file, "capa-wifi: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_WIFI) ? "true" : "false");
+ fprintf(file, "capa-bluetooth: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_BLUETOOTH) ? "true" : "false");
+- fprintf(file, "capa-lora: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_LORA) ? "true" : "false");
+
+ fprintf(file, "capa: \"");
+
+@@ -188,20 +187,6 @@
+ 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, "lora-product-id: \"%.32s\"\n", id_eeprom->lora_product_id);
+- fprintf(file, "lora-hw-version: \"%.32s\"\n", id_eeprom->lora_hw_version);
+-
+ fprintf(file, "...\n");
+
+ fclose(file);
+@@ -307,7 +292,6 @@
+ log_info("capa-adc: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_ADC) ? "yes" : "no");
+ log_info("capa-wifi: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_WIFI) ? "yes" : "no");
+ log_info("capa-bluetooth: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_BLUETOOTH) ? "yes" : "no");
+- log_info("capa-lora: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_LORA) ? "yes" : "no");
+
+ log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X",
+ id_eeprom->mac_bluetooth[0],
+@@ -329,19 +313,6 @@
+ 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\"",
+- 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]);
+-
+- log_info("lora-product-id: %.32s", id_eeprom->lora_product_id);
+- log_info("lora-hw-version: %.32s", id_eeprom->lora_hw_version);
+ }
+
+ static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom)
+@@ -391,9 +362,7 @@
+ fprintf(out, " --mac-addr <mac-addr> |\n");
+ fprintf(out, " --mac-bluetooth <mac-addr> |\n");
+ fprintf(out, " --mac-wifi <mac-addr> |\n");
+- fprintf(out, " --lora-eui <EUI-64> |\n");
+- fprintf(out, " --lora-hw-version <hw-version> |\n");
+- fprintf(out, " --lora-product-id <product-id> |\n");
++ fprintf(out, " --eui <EUI-64> |\n");
+ fprintf(out, " --imei <imei> |\n");
+ fprintf(out, " --capa-gps |\n");
+ fprintf(out, " --capa-din |\n");
+@@ -401,9 +370,7 @@
+ fprintf(out, " --capa-adc |\n");
+ fprintf(out, " --capa-wifi |\n");
+ fprintf(out, " --capa-bluetooth |\n");
+- fprintf(out, " --capa-lora |\n");
+ fprintf(out, " --capa-clear (clears all flags) |\n");
+- fprintf(out, " --hex-to-bin | \n");
+ fprintf(out, " --out-format { bin | yaml (default) } |\n");
+ fprintf(out, " --update |\n");
+ fprintf(out, " --accessory-card\n");
+@@ -422,9 +389,7 @@
+ CMD_OPT_MAC_ADDR,
+ CMD_OPT_MAC_BLUETOOTH,
+ CMD_OPT_MAC_WIFI,
+- CMD_OPT_LORA_EUI,
+- CMD_OPT_LORA_HW_VERSION,
+- CMD_OPT_LORA_PRODUCT_ID,
++ CMD_OPT_EUI,
+ CMD_OPT_IMEI,
+ CMD_OPT_CAPA_GPS,
+ CMD_OPT_CAPA_DIN,
+@@ -432,15 +397,12 @@
+ CMD_OPT_CAPA_ADC,
+ CMD_OPT_CAPA_WIFI,
+ CMD_OPT_CAPA_BLUETOOTH,
+- CMD_OPT_CAPA_LORA,
+ CMD_OPT_CAPA_CLEAR,
+ CMD_OPT_OUT_FORMAT,
+ CMD_OPT_UPDATE,
+ CMD_OPT_ACCESSORY_CARD,
+-
+ CMD_OPT_VERSION,
+ CMD_OPT_HELP,
+- CMD_OPT_HEX_TO_BIN,
+ };
+
+ static char *short_options = "f:";
+@@ -452,12 +414,10 @@
+ {"device-id", 1, NULL, CMD_OPT_DEVICE_ID},
+ {"uuid", 1, NULL, CMD_OPT_UUID},
+ {"hw-version", 1, NULL, CMD_OPT_HW_VERSION},
+- {"lora-product-id", 1, NULL, CMD_OPT_LORA_PRODUCT_ID},
+- {"lora-hw-version", 1, NULL, CMD_OPT_LORA_HW_VERSION},
+ {"mac-addr", 1, NULL, CMD_OPT_MAC_ADDR},
+ {"mac-bluetooth", 1, NULL, CMD_OPT_MAC_BLUETOOTH},
+ {"mac-wifi", 1, NULL, CMD_OPT_MAC_WIFI},
+- {"lora-eui", 1, NULL, CMD_OPT_LORA_EUI},
++ {"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},
+@@ -465,9 +425,7 @@
+ {"capa-adc", 0, NULL, CMD_OPT_CAPA_ADC},
+ {"capa-wifi", 0, NULL, CMD_OPT_CAPA_WIFI},
+ {"capa-bluetooth", 0, NULL, CMD_OPT_CAPA_BLUETOOTH},
+- {"capa-lora", 0, NULL, CMD_OPT_CAPA_LORA},
+ {"capa-clear", 0, NULL, CMD_OPT_CAPA_CLEAR},
+- {"hex-to-bin", 0, NULL, CMD_OPT_HEX_TO_BIN},
+ {"out-format", 1, NULL, CMD_OPT_OUT_FORMAT},
+ {"update", 0, NULL, CMD_OPT_UPDATE},
+ {"accessory-card", 0, NULL, CMD_OPT_ACCESSORY_CARD},
+@@ -494,9 +452,7 @@
+ char *uuid = NULL;
+ char *hw_version = NULL;
+ char *mac_addr = NULL;
+- char *lora_eui = NULL;
+- char *lora_product_id = NULL;
+- char *lora_hw_version = NULL;
++ char *eui = NULL;
+
+ struct mts_id_eeprom_layout id_eeprom;
+ struct mts_ap_eeprom_layout ap_eeprom;
+@@ -616,10 +572,6 @@
+ product_id = optarg;
+ break;
+
+- case CMD_OPT_LORA_PRODUCT_ID:
+- lora_product_id = optarg;
+- break;
+-
+ case CMD_OPT_DEVICE_ID:
+ device_id = optarg;
+ break;
+@@ -641,10 +593,6 @@
+ hw_version = optarg;
+ break;
+
+- case CMD_OPT_LORA_HW_VERSION:
+- lora_hw_version = optarg;
+- break;
+-
+ case CMD_OPT_MAC_ADDR:
+ mac_addr = optarg;
+ break;
+@@ -667,8 +615,8 @@
+ }
+ break;
+
+- case CMD_OPT_LORA_EUI:
+- lora_eui = optarg;
++ case CMD_OPT_EUI:
++ eui = optarg;
+ break;
+
+ case CMD_OPT_IMEI:
+@@ -699,10 +647,6 @@
+ DEVICE_CAPA_SET(id_eeprom.capa, CAPA_BLUETOOTH);
+ break;
+
+- case CMD_OPT_CAPA_LORA:
+- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_LORA);
+- break;
+-
+ case CMD_OPT_CAPA_CLEAR:
+ memset(id_eeprom.capa, 0, sizeof(id_eeprom.capa));
+ break;
+@@ -716,22 +660,7 @@
+ out_format = optarg;
+
+ break;
+- case CMD_OPT_HEX_TO_BIN:
+- {
+- char buf[1025];
+- char outbuf[1024];
+- size_t sz, len;
+- while((sz=read(0,buf,sizeof buf)) > 0) {
+- buf[sz] = 0;
+- sz = asciiHexToBin(buf,outbuf);
+- len = write(1,outbuf,sz);
+- if(len != sz) {
+- log_error("failure to write to stdout: %s",strerror(errno));
+- exit(1);
+- }
+- }
+- exit(0);
+- }
++
+ default:
+ usage(stderr);
+ exit(1);
+@@ -779,35 +708,16 @@
+ exit(1);
+ }
+ }
+- // on-board lora product id
+- if (lora_product_id) {
+- if (! accessory_card) {
+- strncpy(id_eeprom.lora_product_id, lora_product_id, sizeof(id_eeprom.lora_product_id) - 1);
+- } else {
+- log_error("--lora-product-id option is not supported on accessory card eeprom");
+- usage(stderr);
+- exit(1);
+- }
+- }
+- // on-board lora hw version
+- if (lora_hw_version) {
+- if (! accessory_card) {
+- strncpy(id_eeprom.lora_hw_version, lora_hw_version, sizeof(id_eeprom.lora_hw_version) - 1);
+- } else {
+- log_error("--lora-hw-version option is not supported on accessory card eeprom");
++ if (eui) {
++ if (!accessory_card) {
++ log_error("EUI only supported on accessory card eeprom");
+ usage(stderr);
+ exit(1);
+ }
+- }
+- if (lora_eui) {
+- if (!accessory_card) {
+- tmp = hwaddr_aton(lora_eui, id_eeprom.lora_eui, sizeof(id_eeprom.lora_eui));
+- }
+- else {
+- tmp = hwaddr_aton(lora_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", lora_eui);
++ log_error("invalid EUI %s", eui);
+ usage(stderr);
+ exit(1);
+ }