mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
Add command friendly-name to sink controller
This commit is contained in:
parent
ba99934e25
commit
8e8ce044f9
1 changed files with 36 additions and 0 deletions
|
@ -189,6 +189,41 @@ static int cmd_show(char **args, unsigned int n)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* cmd: set-friendly-name
|
||||||
|
*/
|
||||||
|
|
||||||
|
static int cmd_set_friendly_name(char **args, unsigned int n)
|
||||||
|
{
|
||||||
|
struct ctl_link *l = NULL;
|
||||||
|
const char *name;
|
||||||
|
|
||||||
|
if (n < 1) {
|
||||||
|
cli_command_printf("To what?\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (n > 1) {
|
||||||
|
l = ctl_wifi_search_link(wifi, args[0]);
|
||||||
|
if (!l) {
|
||||||
|
cli_error("unknown link %s", args[0]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
name = args[1];
|
||||||
|
} else {
|
||||||
|
name = args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
l = l ? : running_link;
|
||||||
|
if (!l) {
|
||||||
|
cli_error("no running link");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctl_link_set_friendly_name(l, name);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* cmd: run
|
* cmd: run
|
||||||
*/
|
*/
|
||||||
|
@ -381,6 +416,7 @@ static const struct cli_cmd cli_cmds[] = {
|
||||||
{ "show", "<link|peer>", CLI_M, CLI_LESS, 1, cmd_show, "Show detailed object information" },
|
{ "show", "<link|peer>", CLI_M, CLI_LESS, 1, cmd_show, "Show detailed object information" },
|
||||||
{ "run", "<link>", CLI_M, CLI_EQUAL, 1, cmd_run, "Run sink on given link" },
|
{ "run", "<link>", CLI_M, CLI_EQUAL, 1, cmd_run, "Run sink on given link" },
|
||||||
{ "bind", "<link>", CLI_M, CLI_EQUAL, 1, cmd_bind, "Like 'run' but bind the link name to run when it is hotplugged" },
|
{ "bind", "<link>", CLI_M, CLI_EQUAL, 1, cmd_bind, "Like 'run' but bind the link name to run when it is hotplugged" },
|
||||||
|
{ "set-friendly-name", "[link] <name>", CLI_M, CLI_LESS, 2, cmd_set_friendly_name, "Set friendly name of an object" },
|
||||||
{ "set-managed", "<link> <yes|no>", CLI_M, CLI_EQUAL, 2, cmd_set_managed, "Manage or unmnage a link" },
|
{ "set-managed", "<link> <yes|no>", CLI_M, CLI_EQUAL, 2, cmd_set_managed, "Manage or unmnage a link" },
|
||||||
{ "quit", NULL, CLI_Y, CLI_MORE, 0, cmd_quit, "Quit program" },
|
{ "quit", NULL, CLI_Y, CLI_MORE, 0, cmd_quit, "Quit program" },
|
||||||
{ "exit", NULL, CLI_Y, CLI_MORE, 0, cmd_quit, NULL },
|
{ "exit", NULL, CLI_Y, CLI_MORE, 0, cmd_quit, NULL },
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue