mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-23 22:42:37 +01:00
client: WSC cancel command
This commit is contained in:
parent
87b4f282db
commit
ff5e3f3b52
@ -645,6 +645,20 @@ static const struct command device_commands[] = {
|
||||
{ }
|
||||
};
|
||||
|
||||
const struct proxy_interface *device_wsc_get(const char *device_name)
|
||||
{
|
||||
const struct device *device;
|
||||
const struct proxy_interface *proxy =
|
||||
get_device_proxy_by_name(device_name);
|
||||
|
||||
if (!proxy)
|
||||
return NULL;
|
||||
|
||||
device = proxy_interface_get_data(proxy);
|
||||
|
||||
return device->wsc;
|
||||
}
|
||||
|
||||
char *device_wsc_family_arg_completion(const char *text, int state)
|
||||
{
|
||||
return proxy_property_str_completion(&device_interface_type,
|
||||
|
@ -20,4 +20,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
const struct proxy_interface *device_wsc_get(const char *device_name);
|
||||
|
||||
char *device_wsc_family_arg_completion(const char *text, int state);
|
||||
|
20
client/wsc.c
20
client/wsc.c
@ -29,11 +29,18 @@
|
||||
#include "command.h"
|
||||
#include "dbus-proxy.h"
|
||||
#include "device.h"
|
||||
#include "display.h"
|
||||
|
||||
static struct proxy_interface_type wsc_interface_type = {
|
||||
.interface = IWD_WSC_INTERFACE,
|
||||
};
|
||||
|
||||
static void check_errors_method_callback(struct l_dbus_message *message,
|
||||
void *user_data)
|
||||
{
|
||||
dbus_message_has_error(message);
|
||||
}
|
||||
|
||||
static enum cmd_status cmd_push_button(const char *device_name, char *args)
|
||||
{
|
||||
return CMD_STATUS_UNSUPPORTED;
|
||||
@ -51,7 +58,18 @@ static enum cmd_status cmd_start_pin(const char *device_name, char *args)
|
||||
|
||||
static enum cmd_status cmd_cancel(const char *device_name, char *args)
|
||||
{
|
||||
return CMD_STATUS_UNSUPPORTED;
|
||||
const struct proxy_interface *proxy = device_wsc_get(device_name);
|
||||
|
||||
if (!proxy) {
|
||||
display("Invalid device name '%s'\n", device_name);
|
||||
|
||||
return CMD_STATUS_INVALID_VALUE;
|
||||
}
|
||||
|
||||
proxy_interface_method_call(proxy, "Cancel", "",
|
||||
check_errors_method_callback);
|
||||
|
||||
return CMD_STATUS_OK;
|
||||
}
|
||||
|
||||
static const struct command wsc_commands[] = {
|
||||
|
Loading…
Reference in New Issue
Block a user