From bf229e1e0f8778e7e608bb060da093bc75a032cc Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sat, 22 Aug 2015 18:26:24 +0200 Subject: [PATCH] config: convert 'userDescription' to the new scheme. Signed-off-by: Richard Cochran --- config.c | 7 ++----- ptp4l.c | 7 ++++++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/config.c b/config.c index dc7269a..b99d156 100644 --- a/config.c +++ b/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; diff --git a/ptp4l.c b/ptp4l.c index dd60b06..d4d440b 100644 --- a/ptp4l.c +++ b/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");