config: convert 'userDescription' to the new scheme.
Signed-off-by: Richard Cochran <richardcochran@gmail.com>master
parent
b708ee3845
commit
bf229e1e0f
7
config.c
7
config.c
|
@ -232,6 +232,7 @@ struct config_item config_tab[] = {
|
|||
PORT_ITEM_INT("udp6_scope", 0x0E, 0x00, 0x0F),
|
||||
GLOB_ITEM_STR("uds_address", "/var/run/ptp4l"),
|
||||
GLOB_ITEM_INT("use_syslog", 1, 0, 1),
|
||||
GLOB_ITEM_STR("userDescription", ""),
|
||||
GLOB_ITEM_INT("verbose", 0, 0, 1),
|
||||
};
|
||||
|
||||
|
@ -460,11 +461,7 @@ static enum parser_result parse_global_setting(const char *option,
|
|||
if (r != NOT_PARSED)
|
||||
return r;
|
||||
|
||||
if (!strcmp(option, "userDescription")) {
|
||||
if (static_ptp_text_set(&cfg->dds.clock_desc.userDescription, value) != 0)
|
||||
return BAD_VALUE;
|
||||
|
||||
} else if (!strcmp(option, "manufacturerIdentity")) {
|
||||
if (!strcmp(option, "manufacturerIdentity")) {
|
||||
if (OUI_LEN != sscanf(value, "%hhx:%hhx:%hhx",
|
||||
&oui[0], &oui[1], &oui[2]))
|
||||
return BAD_VALUE;
|
||||
|
|
7
ptp4l.c
7
ptp4l.c
|
@ -44,7 +44,6 @@ static struct config cfg_settings = {
|
|||
|
||||
.dds = {
|
||||
.clock_desc = {
|
||||
.userDescription = { .max_symbols = 128 },
|
||||
.manufacturerIdentity = { 0, 0, 0 },
|
||||
},
|
||||
},
|
||||
|
@ -206,6 +205,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
dds->clock_desc.productDescription.max_symbols = 64;
|
||||
dds->clock_desc.revisionData.max_symbols = 32;
|
||||
dds->clock_desc.userDescription.max_symbols = 128;
|
||||
|
||||
tmp = config_get_string(cfg, NULL, "productDescription");
|
||||
if (count_char(tmp, ';') != 2 ||
|
||||
|
@ -219,6 +219,11 @@ int main(int argc, char *argv[])
|
|||
fprintf(stderr, "invalid revisionData '%s'.\n", tmp);
|
||||
return -1;
|
||||
}
|
||||
tmp = config_get_string(cfg, NULL, "userDescription");
|
||||
if (static_ptp_text_set(&dds->clock_desc.userDescription, tmp)) {
|
||||
fprintf(stderr, "invalid userDescription '%s'.\n", tmp);
|
||||
return -1;
|
||||
}
|
||||
|
||||
ds->domainNumber = config_get_int(cfg, NULL, "domainNumber");
|
||||
|
||||
|
|
Loading…
Reference in New Issue