summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2014-08-28 16:31:16 -0500
committerJesse Gilles <jgilles@multitech.com>2014-08-28 16:31:16 -0500
commitacd15bf9f6897fa848754357bc9e3e54b6a84461 (patch)
treee705207d14405e6f4e0314f8a45102606c04fdb7 /src
parent686806dcf7e0b684fdffbbd911cf7befcebcafe5 (diff)
downloadmts-id-eeprom-acd15bf9f6897fa848754357bc9e3e54b6a84461.tar.gz
mts-id-eeprom-acd15bf9f6897fa848754357bc9e3e54b6a84461.tar.bz2
mts-id-eeprom-acd15bf9f6897fa848754357bc9e3e54b6a84461.zip
daughter -> accessory and mts_ap_eeprom_layout rename0.2.4
Diffstat (limited to 'src')
-rw-r--r--src/eeprom_main.c112
1 files changed, 56 insertions, 56 deletions
diff --git a/src/eeprom_main.c b/src/eeprom_main.c
index b4fa197..7be9a07 100644
--- a/src/eeprom_main.c
+++ b/src/eeprom_main.c
@@ -40,7 +40,7 @@
static int eeprom_size = 512;
static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom);
-static void mts_dc_eeprom_inspect(struct mts_dc_eeprom_layout *dc_eeprom);
+static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom);
static int hwaddr_aton(const char *str, uint8_t *buf, size_t len)
{
@@ -154,7 +154,7 @@ static int id_yaml_out(const char *name, struct mts_id_eeprom_layout *id_eeprom)
return 0;
}
-static int dc_yaml_out(const char *name, struct mts_dc_eeprom_layout *dc_eeprom)
+static int ap_yaml_out(const char *name, struct mts_ap_eeprom_layout *ap_eeprom)
{
FILE *file;
@@ -171,17 +171,17 @@ static int dc_yaml_out(const char *name, struct mts_dc_eeprom_layout *dc_eeprom)
fprintf(file, "---\n");
fprintf(file, "\n");
- fprintf(file, "vendor-id: \"%.32s\"\n", dc_eeprom->vendor_id);
- fprintf(file, "product-id: \"%.32s\"\n", dc_eeprom->product_id);
- fprintf(file, "device-id: \"%.32s\"\n", dc_eeprom->device_id);
- fprintf(file, "hw-version: \"%.32s\"\n", dc_eeprom->hw_version);
+ fprintf(file, "vendor-id: \"%.32s\"\n", ap_eeprom->vendor_id);
+ fprintf(file, "product-id: \"%.32s\"\n", ap_eeprom->product_id);
+ fprintf(file, "device-id: \"%.32s\"\n", ap_eeprom->device_id);
+ fprintf(file, "hw-version: \"%.32s\"\n", ap_eeprom->hw_version);
fprintf(file, "mac-addr: \"%02X:%02X:%02X:%02X:%02X:%02X\"\n",
- dc_eeprom->mac_addr[0],
- dc_eeprom->mac_addr[1],
- dc_eeprom->mac_addr[2],
- dc_eeprom->mac_addr[3],
- dc_eeprom->mac_addr[4],
- dc_eeprom->mac_addr[5]);
+ ap_eeprom->mac_addr[0],
+ ap_eeprom->mac_addr[1],
+ ap_eeprom->mac_addr[2],
+ ap_eeprom->mac_addr[3],
+ ap_eeprom->mac_addr[4],
+ ap_eeprom->mac_addr[5]);
fprintf(file, "...\n");
fclose(file);
@@ -256,20 +256,20 @@ static void mts_id_eeprom_inspect(struct mts_id_eeprom_layout *id_eeprom)
id_eeprom->mac_wifi[5]);
}
-static void mts_dc_eeprom_inspect(struct mts_dc_eeprom_layout *dc_eeprom)
+static void mts_ap_eeprom_inspect(struct mts_ap_eeprom_layout *ap_eeprom)
{
- log_info("sizeof: %u", sizeof(struct mts_dc_eeprom_layout));
- log_info("vendor-id: %.32s", dc_eeprom->vendor_id);
- log_info("product-id: %.32s", dc_eeprom->product_id);
- log_info("device-id: %.32s", dc_eeprom->device_id);
- log_info("hw-version: %.32s", dc_eeprom->hw_version);
+ log_info("sizeof: %u", sizeof(struct mts_ap_eeprom_layout));
+ log_info("vendor-id: %.32s", ap_eeprom->vendor_id);
+ log_info("product-id: %.32s", ap_eeprom->product_id);
+ log_info("device-id: %.32s", ap_eeprom->device_id);
+ log_info("hw-version: %.32s", ap_eeprom->hw_version);
log_info("mac-addr: %02X:%02X:%02X:%02X:%02X:%02X",
- dc_eeprom->mac_addr[0],
- dc_eeprom->mac_addr[1],
- dc_eeprom->mac_addr[2],
- dc_eeprom->mac_addr[3],
- dc_eeprom->mac_addr[4],
- dc_eeprom->mac_addr[5]);
+ ap_eeprom->mac_addr[0],
+ ap_eeprom->mac_addr[1],
+ ap_eeprom->mac_addr[2],
+ ap_eeprom->mac_addr[3],
+ ap_eeprom->mac_addr[4],
+ ap_eeprom->mac_addr[5]);
}
static void print_version(const char *name) {
@@ -303,7 +303,7 @@ static void usage(FILE *out) {
fprintf(out, " --capa-clear (clears all flags) |\n");
fprintf(out, " --out-format { bin | yaml (default) } |\n");
fprintf(out, " --update |\n");
- fprintf(out, " --daughter-card\n");
+ fprintf(out, " --accessory-card\n");
fprintf(out, " }\n");
fprintf(out, "\n");
}
@@ -328,7 +328,7 @@ enum {
CMD_OPT_CAPA_CLEAR,
CMD_OPT_OUT_FORMAT,
CMD_OPT_UPDATE,
- CMD_OPT_DAUGHTER_CARD,
+ CMD_OPT_ACCESSORY_CARD,
CMD_OPT_VERSION,
CMD_OPT_HELP,
};
@@ -354,7 +354,7 @@ static struct option long_options[] = {
{"capa-clear", 0, NULL, CMD_OPT_CAPA_CLEAR},
{"out-format", 1, NULL, CMD_OPT_OUT_FORMAT},
{"update", 0, NULL, CMD_OPT_UPDATE},
- {"daughter-card", 0, NULL, CMD_OPT_DAUGHTER_CARD},
+ {"accessory-card", 0, NULL, CMD_OPT_ACCESSORY_CARD},
{"version", 0, NULL, CMD_OPT_VERSION},
{"help", 0, NULL, CMD_OPT_HELP},
{0, 0, 0, 0},
@@ -370,7 +370,7 @@ int main(int argc, char *argv[]) {
char *out_file = "-";
char *out_format = "yaml";
int update = 0;
- int daughter_card = 0;
+ int accessory_card = 0;
char *vendor_id = NULL;
char *product_id = NULL;
@@ -379,10 +379,10 @@ int main(int argc, char *argv[]) {
char *mac_addr = NULL;
struct mts_id_eeprom_layout id_eeprom;
- struct mts_dc_eeprom_layout dc_eeprom;
+ struct mts_ap_eeprom_layout ap_eeprom;
memset(&id_eeprom, 0, eeprom_size);
- memset(&dc_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);
@@ -404,7 +404,7 @@ int main(int argc, char *argv[]) {
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 daughter_card flag only
+ // 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) {
case 0:
@@ -414,8 +414,8 @@ int main(int argc, char *argv[]) {
in_file = optarg;
break;
- case CMD_OPT_DAUGHTER_CARD:
- daughter_card = 1;
+ case CMD_OPT_ACCESSORY_CARD:
+ accessory_card = 1;
break;
case CMD_OPT_VERSION:
@@ -439,8 +439,8 @@ int main(int argc, char *argv[]) {
exit(1);
}
- if (daughter_card) {
- tmp = read(fd, (char *) &dc_eeprom, eeprom_size);
+ if (accessory_card) {
+ tmp = read(fd, (char *) &ap_eeprom, eeprom_size);
} else {
tmp = read(fd, (char *) &id_eeprom, eeprom_size);
}
@@ -453,9 +453,9 @@ int main(int argc, char *argv[]) {
exit(1);
}
- if (daughter_card) {
- log_info("loaded dc eeprom from %s successfully", in_file);
- mts_dc_eeprom_inspect(&dc_eeprom);
+ if (accessory_card) {
+ log_info("loaded ap eeprom from %s successfully", in_file);
+ mts_ap_eeprom_inspect(&ap_eeprom);
} else {
log_info("loaded id eeprom from %s successfully", in_file);
mts_id_eeprom_inspect(&id_eeprom);
@@ -480,7 +480,7 @@ int main(int argc, char *argv[]) {
update = 1;
break;
- case CMD_OPT_DAUGHTER_CARD:
+ case CMD_OPT_ACCESSORY_CARD:
// handled above
break;
@@ -574,40 +574,40 @@ int main(int argc, char *argv[]) {
}
}
- /* these fields can apply to the on board EEPROM or the daughter card EEPROM */
+ /* these fields can apply to the on board EEPROM or the accessory card EEPROM */
if (vendor_id) {
- if (! daughter_card) {
+ if (! accessory_card) {
strncpy(id_eeprom.vendor_id, vendor_id, sizeof(id_eeprom.vendor_id) - 1);
} else {
- strncpy(dc_eeprom.vendor_id, vendor_id, sizeof(dc_eeprom.vendor_id) - 1);
+ strncpy(ap_eeprom.vendor_id, vendor_id, sizeof(ap_eeprom.vendor_id) - 1);
}
}
if (product_id) {
- if (! daughter_card) {
+ if (! accessory_card) {
strncpy(id_eeprom.product_id, product_id, sizeof(id_eeprom.product_id) - 1);
} else {
- strncpy(dc_eeprom.product_id, product_id, sizeof(dc_eeprom.product_id) - 1);
+ strncpy(ap_eeprom.product_id, product_id, sizeof(ap_eeprom.product_id) - 1);
}
}
if (device_id) {
- if (! daughter_card) {
+ if (! accessory_card) {
strncpy(id_eeprom.device_id, device_id, sizeof(id_eeprom.device_id) - 1);
} else {
- strncpy(dc_eeprom.device_id, device_id, sizeof(dc_eeprom.device_id) - 1);
+ strncpy(ap_eeprom.device_id, device_id, sizeof(ap_eeprom.device_id) - 1);
}
}
if (hw_version) {
- if (! daughter_card) {
+ if (! accessory_card) {
strncpy(id_eeprom.hw_version, hw_version, sizeof(id_eeprom.hw_version) - 1);
} else {
- strncpy(dc_eeprom.hw_version, hw_version, sizeof(dc_eeprom.hw_version) - 1);
+ strncpy(ap_eeprom.hw_version, hw_version, sizeof(ap_eeprom.hw_version) - 1);
}
}
if (mac_addr) {
- if (! daughter_card) {
+ if (! accessory_card) {
tmp = hwaddr_aton(mac_addr, id_eeprom.mac_addr, sizeof(id_eeprom.mac_addr));
} else {
- tmp = hwaddr_aton(mac_addr, dc_eeprom.mac_addr, sizeof(dc_eeprom.mac_addr));
+ tmp = hwaddr_aton(mac_addr, ap_eeprom.mac_addr, sizeof(ap_eeprom.mac_addr));
}
if (!tmp) {
log_error("invalid mac-addr %s", optarg);
@@ -625,16 +625,16 @@ int main(int argc, char *argv[]) {
if (out_file) {
if (!strcmp(out_format, "bin")) {
- if (! daughter_card) {
+ if (! accessory_card) {
bin_out(out_file, (char*) &id_eeprom);
} else {
- bin_out(out_file, (char*) &dc_eeprom);
+ bin_out(out_file, (char*) &ap_eeprom);
}
} else if (!strcmp(out_format, "yaml")) {
- if (! daughter_card) {
+ if (! accessory_card) {
id_yaml_out(out_file, &id_eeprom);
} else {
- dc_yaml_out(out_file, &dc_eeprom);
+ ap_yaml_out(out_file, &ap_eeprom);
}
} else {
log_error("un-handled out-format");
@@ -644,8 +644,8 @@ int main(int argc, char *argv[]) {
/* print out what we wrote to the eeprom, unless stdout */
if (strcmp(out_file, "-")) {
log_info("Data written to %s", out_file);
- if (daughter_card) {
- mts_dc_eeprom_inspect(&dc_eeprom);
+ if (accessory_card) {
+ mts_ap_eeprom_inspect(&ap_eeprom);
} else {
mts_id_eeprom_inspect(&id_eeprom);
}