summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Klug <john.klug@multitech.com>2020-09-23 16:03:16 -0500
committerJohn Klug <john.klug@multitech.com>2020-09-23 16:03:16 -0500
commit28ef414d796da33428dae2e108106c440f7aac24 (patch)
treea7e3e102a69d5b43cd7efb325f566e9a9c9f03df /src
parentb06196e1591eb06685352c71492819f1564432f7 (diff)
downloadmts-id-eeprom-28ef414d796da33428dae2e108106c440f7aac24.tar.gz
mts-id-eeprom-28ef414d796da33428dae2e108106c440f7aac24.tar.bz2
mts-id-eeprom-28ef414d796da33428dae2e108106c440f7aac24.zip
mts-id-eeprom --capa-cellular
Diffstat (limited to 'src')
-rw-r--r--src/eeprom_main.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index b5fef52..2450df4 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -38,6 +38,8 @@
#include "log.h"
#include "eeprom.h"
+
+#define EEPROM_LAYOUT_VERSION 1
static int eeprom_size = 512;
static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom);
@@ -147,6 +149,7 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom)
fprintf(file, "---\n");
fprintf(file, "\n");
+ fprintf(file, "EEPROM-Layout-Version: \"%u\"\n", id_eeprom->eeprom_layout_version);
fprintf(file, "vendor-id: \"%.32s\"\n", id_eeprom->vendor_id);
fprintf(file, "product-id: \"%.32s\"\n", id_eeprom->product_id);
fprintf(file, "device-id: \"%.32s\"\n", id_eeprom->device_id);
@@ -168,7 +171,7 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom)
fprintf(file, "capa-lora: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_LORA) ? "true" : "false");
fprintf(file, "capa-battery: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_BATTERY) ? "true" : "false");
fprintf(file, "capa-supercap: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_SUPERCAP) ? "true" : "false");
-
+ fprintf(file, "capa-cellular: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_CELLULAR) ? "true" : "false");
fprintf(file, "capa: \"");
for (i = 0; i < sizeof(id_eeprom->capa); i++) {
@@ -357,6 +360,7 @@ static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom)
char* ptr;
log_info("sizeof: %u", sizeof(struct mts_id_eeprom_layout));
+ log_info("EEPROM Layout Version: %u", id_eeprom->eeprom_layout_version);
log_info("vendor-id: %.32s", id_eeprom->vendor_id);
log_info("product-id: %.32s", id_eeprom->product_id);
log_info("device-id: %.32s", id_eeprom->device_id);
@@ -377,6 +381,7 @@ static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom)
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("capa-supercap: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_SUPERCAP) ? "yes" : "no");
+ log_info("capa-cellular: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_CELLULAR) ? "yes" : "no");
log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom->mac_bluetooth[0],
@@ -485,7 +490,8 @@ static void mtcdt3b_eeprom_inspect(struct mtcdt3b_eeprom_layout *mtcdt3b_eeprom)
static void print_version(const char *name) {
printf("%s (" PACKAGE ") " VERSION " (" __DATE__ " " __TIME__ ")\n", name);
- printf("Copyright (C) 2015, 2019 by Multi-Tech Systems\n");
+ printf("EEPROM Version %d\n",EEPROM_LAYOUT_VERSION);
+ printf("Copyright (C) 2015, 2019, 2020 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"
@@ -518,6 +524,7 @@ static void usage(FILE *out) {
fprintf(out, " --capa-lora |\n");
fprintf(out, " --capa-battery |\n");
fprintf(out, " --capa-supercap |\n");
+ fprintf(out, " --capa-cellular |\n");
fprintf(out, " --capa-clear (clears all flags) |\n");
fprintf(out, " --hex-to-bin | \n");
fprintf(out, " --out-format { bin | yaml (default) } |\n");
@@ -555,6 +562,7 @@ enum {
CMD_OPT_CAPA_LORA,
CMD_OPT_CAPA_BATTERY,
CMD_OPT_CAPA_SUPERCAP,
+ CMD_OPT_CAPA_CELLULAR,
CMD_OPT_CAPA_CLEAR,
CMD_OPT_OUT_FORMAT,
CMD_OPT_UPDATE,
@@ -593,6 +601,7 @@ static struct option long_options[] = {
{"capa-lora", 0, NULL, CMD_OPT_CAPA_LORA},
{"capa-battery", 0, NULL, CMD_OPT_CAPA_BATTERY},
{"capa-supercap", 0, NULL, CMD_OPT_CAPA_SUPERCAP},
+ {"capa-cellular", 0, NULL, CMD_OPT_CAPA_CELLULAR},
{"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},
@@ -625,8 +634,6 @@ int main(int argc, char *argv[]) {
int option_index;
int tmp;
int fd;
- int length;
- int init;
char *in_file = NULL;
char *out_file = "-";
char *out_format = "yaml";
@@ -906,6 +913,10 @@ int main(int argc, char *argv[]) {
DEVICE_CAPA_SET(id_eeprom.capa, CAPA_SUPERCAP);
break;
+ case CMD_OPT_CAPA_CELLULAR:
+ DEVICE_CAPA_SET(id_eeprom.capa, CAPA_CELLULAR);
+ break;
+
case CMD_OPT_CAPA_CLEAR:
memset(id_eeprom.capa, 0, sizeof(id_eeprom.capa));
break;
@@ -1150,8 +1161,10 @@ int main(int argc, char *argv[]) {
else if (base_board)
bin_out(out_file, (char*) &mtcdt3b_eeprom);
#endif
- else
+ else {
+ id_eeprom.eeprom_layout_version = EEPROM_LAYOUT_VERSION;
bin_out(out_file, (char*) &id_eeprom);
+ }
} else if (!strcmp(out_format, "yaml")) {
if (accessory_card)
ap_yaml_out(out_file, &ap_eeprom);