Add support for the clock_accuracy management request.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
master
Richard Cochran 2013-03-03 20:10:46 +01:00
parent 78e37ebf0b
commit 32c8635aef
2 changed files with 12 additions and 1 deletions

View File

@ -222,6 +222,12 @@ static int clock_management_get_response(struct clock *c, struct port *p,
datalen = sizeof(*mtd); datalen = sizeof(*mtd);
respond = 1; respond = 1;
break; 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: case TIME_STATUS_NP:
tsn = (struct time_status_np *) tlv->data; tsn = (struct time_status_np *) tlv->data;
tsn->master_offset = c->master_offset; tsn->master_offset = c->master_offset;

7
pmc.c
View File

@ -69,7 +69,7 @@ struct management_id idtab[] = {
{ "DOMAIN", DOMAIN, do_get_action }, { "DOMAIN", DOMAIN, do_get_action },
{ "SLAVE_ONLY", SLAVE_ONLY, do_get_action }, { "SLAVE_ONLY", SLAVE_ONLY, do_get_action },
{ "TIME", TIME, not_supported }, { "TIME", TIME, not_supported },
{ "CLOCK_ACCURACY", CLOCK_ACCURACY, not_supported }, { "CLOCK_ACCURACY", CLOCK_ACCURACY, do_get_action },
{ "UTC_PROPERTIES", UTC_PROPERTIES, not_supported }, { "UTC_PROPERTIES", UTC_PROPERTIES, not_supported },
{ "TRACEABILITY_PROPERTIES", TRACEABILITY_PROPERTIES, not_supported }, { "TRACEABILITY_PROPERTIES", TRACEABILITY_PROPERTIES, not_supported },
{ "TIMESCALE_PROPERTIES", TIMESCALE_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 " fprintf(fp, "SLAVE_ONLY "
IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0); IFMT "slaveOnly %d", mtd->val & DDS_SLAVE_ONLY ? 1 : 0);
break; 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: case TIME_STATUS_NP:
tsn = (struct time_status_np *) mgt->data; tsn = (struct time_status_np *) mgt->data;
fprintf(fp, "TIME_STATUS_NP " fprintf(fp, "TIME_STATUS_NP "