summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AUTHORS2
-rw-r--r--configure.in2
-rw-r--r--src/eeprom_main.c36
3 files changed, 13 insertions, 27 deletions
diff --git a/AUTHORS b/AUTHORS
index c654a0d..c44cf37 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1 +1 @@
-James Maki <jmaki@multitech.com>
+Multitech Systems
diff --git a/configure.in b/configure.in
index 575cc4b..22b7f6d 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
AC_INIT([src/eeprom_main.c])
-AM_INIT_AUTOMAKE([mts-id-eeprom], [0.3.0])
+AM_INIT_AUTOMAKE([mts-id-eeprom], [0.4.0])
AM_CONFIG_HEADER([config.h])
AC_PROG_CC
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index 0627124..61c6b8c 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -1,9 +1,7 @@
/*
* Create an image file for the MTCDP ID EEPROM
*
- * Copyright (C) 2016 by Multi-Tech Systems
- *
- * Author: James Maki <jmaki@multitech.com>
+ * Copyright (C) 2016, 2019 by Multi-Tech Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -168,6 +166,7 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom)
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-battery: %s\n", DEVICE_CAPA(id_eeprom->capa, CAPA_BATTERY) ? "true" : "false");
fprintf(file, "capa: \"");
@@ -358,6 +357,7 @@ static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom)
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("capa-battery: %s", DEVICE_CAPA(id_eeprom->capa, CAPA_BATTERY) ? "yes" : "no");
log_info("mac-bluetooth: %02X:%02X:%02X:%02X:%02X:%02X",
id_eeprom->mac_bluetooth[0],
@@ -475,6 +475,7 @@ static void usage(FILE *out) {
fprintf(out, " --capa-wifi |\n");
fprintf(out, " --capa-bluetooth |\n");
fprintf(out, " --capa-lora |\n");
+ fprintf(out, " --capa-battery |\n");
fprintf(out, " --capa-clear (clears all flags) |\n");
fprintf(out, " --hex-to-bin | \n");
fprintf(out, " --out-format { bin | yaml (default) } |\n");
@@ -509,6 +510,7 @@ enum {
CMD_OPT_CAPA_WIFI,
CMD_OPT_CAPA_BLUETOOTH,
CMD_OPT_CAPA_LORA,
+ CMD_OPT_CAPA_BATTERY,
CMD_OPT_CAPA_CLEAR,
CMD_OPT_OUT_FORMAT,
CMD_OPT_UPDATE,
@@ -544,6 +546,7 @@ static struct option long_options[] = {
{"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-battery", 0, NULL, CMD_OPT_CAPA_BATTERY},
{"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},
@@ -590,26 +593,6 @@ int main(int argc, char *argv[]) {
memset(&id_eeprom, 0, eeprom_size);
memset(&ap_eeprom, 0, eeprom_size);
-#if 0
- strncpy(id_eeprom.vendor_id, VENDOR_ID_MULTITECH, sizeof(id_eeprom.vendor_id) - 1);
- strncpy(id_eeprom.product_id, PRODUCT_ID_MTCDP_E1_DK, sizeof(id_eeprom.product_id) - 1);
- strncpy(id_eeprom.device_id, "12345678", sizeof(id_eeprom.device_id) - 1);
- strncpy(id_eeprom.hw_version, HW_VERSION_MTCDP_1_0, sizeof(id_eeprom.hw_version) - 1);
-
- hwaddr_aton("00:d0:a0:02:0d:e1", id_eeprom.mac_addr, sizeof(id_eeprom.mac_addr));
- strncpy(id_eeprom.imei, "353626020834450", sizeof(id_eeprom.imei) - 1);
-
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_GPS);
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_DIN);
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_DOUT);
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_ADC);
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_WIFI);
- DEVICE_CAPA_SET(id_eeprom.capa, CAPA_BLUETOOTH);
-
- hwaddr_aton("00:d0:a0:02:0d:e2", id_eeprom.mac_bluetooth, sizeof(id_eeprom.mac_bluetooth));
- hwaddr_aton("00:d0:a0:02:0d:e3", id_eeprom.mac_wifi, sizeof(id_eeprom.mac_wifi));
-#endif
-
// parse options once to get input file and accessory_card flag only
while((i = getopt_long(argc, argv, short_options, long_options, &option_index)) >= 0) {
switch(i) {
@@ -805,8 +788,11 @@ int main(int argc, char *argv[]) {
}
#endif
DEVICE_CAPA_SET(id_eeprom.capa, CAPA_LORA);
- break;
-
+ break;
+ case CMD_OPT_CAPA_BATTERY:
+ DEVICE_CAPA_SET(id_eeprom.capa, CAPA_BATTERY);
+ break;
+
case CMD_OPT_CAPA_CLEAR:
memset(id_eeprom.capa, 0, sizeof(id_eeprom.capa));
break;