From 32c8635aefe545c6b97913520d947f1c6ebd84e3 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 3 Mar 2013 20:10:46 +0100 Subject: [PATCH] Add support for the clock_accuracy management request. Signed-off-by: Richard Cochran --- clock.c | 6 ++++++ pmc.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/clock.c b/clock.c index 4913d02..59b8703 100644 --- a/clock.c +++ b/clock.c @@ -222,6 +222,12 @@ static int clock_management_get_response(struct clock *c, struct port *p, datalen = sizeof(*mtd); respond = 1; break; + case CLOCK_ACCURACY: + mtd = (struct management_tlv_datum *) tlv->data; + mtd->val = c->dds.clockQuality.clockAccuracy; + datalen = sizeof(*mtd); + respond = 1; + break; case TIME_STATUS_NP: tsn = (struct time_status_np *) tlv->data; tsn->master_offset = c->master_offset; diff --git a/pmc.c b/pmc.c index cd48e19..a46f4f2 100644 --- a/pmc.c +++ b/pmc.c @@ -69,7 +69,7 @@ struct management_id idtab[] = { { "DOMAIN", DOMAIN, do_get_action }, { "SLAVE_ONLY", SLAVE_ONLY, do_get_action }, { "TIME", TIME, not_supported }, - { "CLOCK_ACCURACY", CLOCK_ACCURACY, not_supported }, + { "CLOCK_ACCURACY", CLOCK_ACCURACY, do_get_action }, { "UTC_PROPERTIES", UTC_PROPERTIES, not_supported }, { "TRACEABILITY_PROPERTIES", TRACEABILITY_PROPERTIES, not_supported }, { "TIMESCALE_PROPERTIES", TIMESCALE_PROPERTIES, not_supported }, @@ -333,6 +333,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) fprintf(fp, "SLAVE_ONLY " IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0); break; + case CLOCK_ACCURACY: + mtd = (struct management_tlv_datum *) mgt->data; + fprintf(fp, "CLOCK_ACCURACY " + IFMT "clockAccuracy 0x%02hhx", mtd->val); + break; case TIME_STATUS_NP: tsn = (struct time_status_np *) mgt->data; fprintf(fp, "TIME_STATUS_NP "