diff --git a/Makefile.am b/Makefile.am index c0bb72d6..e98037c4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -90,7 +90,7 @@ client_iwctl_SOURCES = client/main.c \ client/adapter.c \ client/command.h client/command.c \ client/dbus-proxy.h client/dbus-proxy.c \ - client/device.c \ + client/device.h client/device.c \ client/display.h client/display.c \ client/known-networks.c \ client/network.h client/network.c \ diff --git a/client/device.c b/client/device.c index 9dbecfeb..cc3812dd 100644 --- a/client/device.c +++ b/client/device.c @@ -28,6 +28,7 @@ #include "command.h" #include "dbus-proxy.h" +#include "device.h" #include "display.h" #include "network.h" @@ -624,6 +625,13 @@ static const struct command device_commands[] = { { } }; +char *device_wsc_family_arg_completion(const char *text, int state) +{ + return proxy_property_str_completion(&device_interface_type, + match_by_partial_name, "Name", + text, state); +} + static char *family_arg_completion(const char *text, int state) { static bool first_pass; diff --git a/client/device.h b/client/device.h new file mode 100644 index 00000000..96004d5f --- /dev/null +++ b/client/device.h @@ -0,0 +1,23 @@ +/* + * + * Wireless daemon for Linux + * + * Copyright (C) 2017 Intel Corporation. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +char *device_wsc_family_arg_completion(const char *text, int state); diff --git a/client/wsc.c b/client/wsc.c index 8f4e1f56..1c1e74ed 100644 --- a/client/wsc.c +++ b/client/wsc.c @@ -28,6 +28,7 @@ #include "command.h" #include "dbus-proxy.h" +#include "device.h" static struct proxy_interface_type wsc_interface_type = { .interface = IWD_WSC_INTERFACE, @@ -63,10 +64,22 @@ static const struct command wsc_commands[] = { { } }; +static char *family_arg_completion(const char *text, int state) +{ + return device_wsc_family_arg_completion(text, state); +} + +static char *entity_arg_completion(const char *text, int state) +{ + return command_entity_arg_completion(text, state, wsc_commands); +} + static struct command_family wsc_command_family = { .caption = "WiFi Simple Configuration", .name = "wsc", .command_list = wsc_commands, + .family_arg_completion = family_arg_completion, + .entity_arg_completion = entity_arg_completion, }; static int wsc_command_family_init(void)