From 78e37ebf0beec65d99d4368dae03b806a5ba0345 Mon Sep 17 00:00:00 2001 From: Richard Cochran Date: Sun, 3 Mar 2013 20:06:17 +0100 Subject: [PATCH] Add support for the slave_only 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 f5aa3c4..4913d02 100644 --- a/clock.c +++ b/clock.c @@ -216,6 +216,12 @@ static int clock_management_get_response(struct clock *c, struct port *p, datalen = sizeof(*mtd); respond = 1; break; + case SLAVE_ONLY: + mtd = (struct management_tlv_datum *) tlv->data; + mtd->val = c->dds.flags & DDS_SLAVE_ONLY; + 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 7d56183..cd48e19 100644 --- a/pmc.c +++ b/pmc.c @@ -67,7 +67,7 @@ struct management_id idtab[] = { { "PRIORITY1", PRIORITY1, do_get_action }, { "PRIORITY2", PRIORITY2, do_get_action }, { "DOMAIN", DOMAIN, do_get_action }, - { "SLAVE_ONLY", SLAVE_ONLY, not_supported }, + { "SLAVE_ONLY", SLAVE_ONLY, do_get_action }, { "TIME", TIME, not_supported }, { "CLOCK_ACCURACY", CLOCK_ACCURACY, not_supported }, { "UTC_PROPERTIES", UTC_PROPERTIES, not_supported }, @@ -328,6 +328,11 @@ static void pmc_show(struct ptp_message *msg, FILE *fp) fprintf(fp, "DOMAIN " IFMT "domainNumber %hhu", mtd->val); break; + case SLAVE_ONLY: + mtd = (struct management_tlv_datum *) mgt->data; + fprintf(fp, "SLAVE_ONLY " + IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0); + break; case TIME_STATUS_NP: tsn = (struct time_status_np *) mgt->data; fprintf(fp, "TIME_STATUS_NP "