config: convert 'revisionData' to the new scheme.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2015-08-22 18:21:30 +02:00
parent 4e23ac1b21
commit b708ee3845
2 changed files with 9 additions and 12 deletions

View File

@ -216,6 +216,7 @@ struct config_item config_tab[] = {
GLOB_ITEM_STR("productDescription", ";;"),
PORT_ITEM_STR("ptp_dst_mac", "01:1B:19:00:00:00"),
PORT_ITEM_STR("p2p_dst_mac", "01:80:C2:00:00:0E"),
GLOB_ITEM_STR("revisionData", ";;"),
GLOB_ITEM_INT("sanity_freq_limit", 200000000, 0, INT_MAX),
GLOB_ITEM_INT("slaveOnly", 0, 0, 1),
GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
@ -459,13 +460,7 @@ static enum parser_result parse_global_setting(const char *option,
if (r != NOT_PARSED)
return r;
if (!strcmp(option, "revisionData")) {
if (count_char(value, ';') != 2)
return BAD_VALUE;
if (static_ptp_text_set(&cfg->dds.clock_desc.revisionData, value) != 0)
return BAD_VALUE;
} else if (!strcmp(option, "userDescription")) {
if (!strcmp(option, "userDescription")) {
if (static_ptp_text_set(&cfg->dds.clock_desc.userDescription, value) != 0)
return BAD_VALUE;

12
ptp4l.c
View File

@ -44,11 +44,6 @@ static struct config cfg_settings = {
.dds = {
.clock_desc = {
.revisionData = {
.max_symbols = 32,
.text = ";;",
.length = 2,
},
.userDescription = { .max_symbols = 128 },
.manufacturerIdentity = { 0, 0, 0 },
},
@ -210,6 +205,7 @@ int main(int argc, char *argv[])
config_get_int(cfg, NULL, "offsetScaledLogVariance");
dds->clock_desc.productDescription.max_symbols = 64;
dds->clock_desc.revisionData.max_symbols = 32;
tmp = config_get_string(cfg, NULL, "productDescription");
if (count_char(tmp, ';') != 2 ||
@ -217,6 +213,12 @@ int main(int argc, char *argv[])
fprintf(stderr, "invalid productDescription '%s'.\n", tmp);
return -1;
}
tmp = config_get_string(cfg, NULL, "revisionData");
if (count_char(tmp, ';') != 2 ||
static_ptp_text_set(&dds->clock_desc.revisionData, tmp)) {
fprintf(stderr, "invalid revisionData '%s'.\n", tmp);
return -1;
}
ds->domainNumber = config_get_int(cfg, NULL, "domainNumber");