Commit 07c2ccca authored by Tomasz Wlostowski's avatar Tomasz Wlostowski

shell (mode command): return current mode if no parameters given

parent 6bc87954
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
int cmd_mode(const char *args[]) int cmd_mode(const char *args[])
{ {
int mode; int mode;
static const char *modes[]={"unknown","grandmaster","master","slave"};
if(!strcasecmp(args[0], "gm")) if(!strcasecmp(args[0], "gm"))
mode = WRC_MODE_GM; mode = WRC_MODE_GM;
...@@ -19,8 +20,9 @@ int cmd_mode(const char *args[]) ...@@ -19,8 +20,9 @@ int cmd_mode(const char *args[])
mode = WRC_MODE_MASTER; mode = WRC_MODE_MASTER;
else if(!strcasecmp(args[0], "slave")) else if(!strcasecmp(args[0], "slave"))
mode = WRC_MODE_SLAVE; mode = WRC_MODE_SLAVE;
else else {
return -EINVAL; mprintf("%s\n", modes[wrc_ptp_get_mode()]);
return 0;
}
return wrc_ptp_set_mode(mode); return wrc_ptp_set_mode(mode);
} }
\ No newline at end of file
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