3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

client: switch adapter to use proxy property completion

In addition, it defines the value options for the Power property
This commit is contained in:
Tim Kourt 2018-07-25 12:54:44 -07:00 committed by Denis Kenzior
parent 687dcc6145
commit 5549219217

View File

@ -2,7 +2,7 @@
* *
* Wireless daemon for Linux * Wireless daemon for Linux
* *
* Copyright (C) 2017 Intel Corporation. All rights reserved. * Copyright (C) 2017-2018 Intel Corporation. All rights reserved.
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -116,7 +116,9 @@ static void update_powered(void *data, struct l_dbus_message_iter *variant)
static const struct proxy_interface_property adapter_properties[] = { static const struct proxy_interface_property adapter_properties[] = {
{ "Name", "s", update_name, get_name }, { "Name", "s", update_name, get_name },
{ "Powered", "b", update_powered, get_powered_tostr, true }, { "Powered", "b", update_powered, get_powered_tostr, true,
properties_builder_append_on_off_variant,
properties_on_off_opts },
{ "Vendor", "s", update_vendor }, { "Vendor", "s", update_vendor },
{ "Model", "s", update_model }, { "Model", "s", update_model },
{ } { }
@ -275,28 +277,9 @@ static enum cmd_status cmd_set_property(const char *adapter_name, char *args)
return CMD_STATUS_OK; return CMD_STATUS_OK;
} }
static char *cmd_set_property_completion(const char *text, int state) static char *set_property_cmd_arg_completion(const char *text, int state)
{ {
static size_t index; return proxy_property_completion(adapter_properties, text, state);
static size_t len;
const char *prop;
if (!state) {
index = 0;
len = strlen(text);
}
while ((prop = adapter_properties[index].name)) {
if (!adapter_properties[index++].is_read_write)
continue;
if (strncmp(prop, text, len))
continue;
return l_strdup(prop);
}
return NULL;
} }
static const struct command adapter_commands[] = { static const struct command adapter_commands[] = {
@ -307,7 +290,7 @@ static const struct command adapter_commands[] = {
{ "<phy>", "set-property", "<name> <value>", { "<phy>", "set-property", "<name> <value>",
cmd_set_property, "Set property", cmd_set_property, "Set property",
false, false,
cmd_set_property_completion }, set_property_cmd_arg_completion },
{ } { }
}; };