config: convert 'revisionData' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
4e23ac1b21
commit
b708ee3845
9
config.c
9
config.c
|
@ -216,6 +216,7 @@ struct config_item config_tab[] = {
|
||||||
GLOB_ITEM_STR("productDescription", ";;"),
|
GLOB_ITEM_STR("productDescription", ";;"),
|
||||||
PORT_ITEM_STR("ptp_dst_mac", "01:1B:19:00:00:00"),
|
PORT_ITEM_STR("ptp_dst_mac", "01:1B:19:00:00:00"),
|
||||||
PORT_ITEM_STR("p2p_dst_mac", "01:80:C2:00:00:0E"),
|
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("sanity_freq_limit", 200000000, 0, INT_MAX),
|
||||||
GLOB_ITEM_INT("slaveOnly", 0, 0, 1),
|
GLOB_ITEM_INT("slaveOnly", 0, 0, 1),
|
||||||
GLOB_ITEM_DBL("step_threshold", 0.0, 0.0, DBL_MAX),
|
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)
|
if (r != NOT_PARSED)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!strcmp(option, "revisionData")) {
|
if (!strcmp(option, "userDescription")) {
|
||||||
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 (static_ptp_text_set(&cfg->dds.clock_desc.userDescription, value) != 0)
|
if (static_ptp_text_set(&cfg->dds.clock_desc.userDescription, value) != 0)
|
||||||
return BAD_VALUE;
|
return BAD_VALUE;
|
||||||
|
|
||||||
|
|
12
ptp4l.c
12
ptp4l.c
|
@ -44,11 +44,6 @@ static struct config cfg_settings = {
|
||||||
|
|
||||||
.dds = {
|
.dds = {
|
||||||
.clock_desc = {
|
.clock_desc = {
|
||||||
.revisionData = {
|
|
||||||
.max_symbols = 32,
|
|
||||||
.text = ";;",
|
|
||||||
.length = 2,
|
|
||||||
},
|
|
||||||
.userDescription = { .max_symbols = 128 },
|
.userDescription = { .max_symbols = 128 },
|
||||||
.manufacturerIdentity = { 0, 0, 0 },
|
.manufacturerIdentity = { 0, 0, 0 },
|
||||||
},
|
},
|
||||||
|
@ -210,6 +205,7 @@ int main(int argc, char *argv[])
|
||||||
config_get_int(cfg, NULL, "offsetScaledLogVariance");
|
config_get_int(cfg, NULL, "offsetScaledLogVariance");
|
||||||
|
|
||||||
dds->clock_desc.productDescription.max_symbols = 64;
|
dds->clock_desc.productDescription.max_symbols = 64;
|
||||||
|
dds->clock_desc.revisionData.max_symbols = 32;
|
||||||
|
|
||||||
tmp = config_get_string(cfg, NULL, "productDescription");
|
tmp = config_get_string(cfg, NULL, "productDescription");
|
||||||
if (count_char(tmp, ';') != 2 ||
|
if (count_char(tmp, ';') != 2 ||
|
||||||
|
@ -217,6 +213,12 @@ int main(int argc, char *argv[])
|
||||||
fprintf(stderr, "invalid productDescription '%s'.\n", tmp);
|
fprintf(stderr, "invalid productDescription '%s'.\n", tmp);
|
||||||
return -1;
|
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");
|
ds->domainNumber = config_get_int(cfg, NULL, "domainNumber");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue