Commit bcb30277 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

shell/cmd_ptp: report current status too

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 75b10836
......@@ -26,11 +26,25 @@ struct subcmd {
{"slave", wrc_ptp_set_mode, WRC_MODE_SLAVE},
};
static char *is_run[] = {"stopped", "running"};
static char *is_mech[] = {[PP_E2E_MECH] = "e2e", [PP_P2P_MECH] = "p2p"};
static char *is_mode[] = {[WRC_MODE_GM] = "gm", [WRC_MODE_MASTER] = "master",
[WRC_MODE_SLAVE] = "slave"};
static int cmd_ptp(const char *args[])
{
int i;
struct subcmd *c;
if (!args[0]) {
pp_printf("%s; %s %s\n",
is_run[wrc_ptp_run(-1)],
is_mech[wrc_ptp_sync_mech(-1)],
is_mode[wrc_ptp_get_mode()]);
return 0;
}
for (i = 0, c = subcmd; i < ARRAY_SIZE(subcmd); i++, c++)
if (!strcasecmp(args[0], c->name))
return c->fun(c->arg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment