From 87b4f282dbc689a0ac08e757a924dc574d6bf1ec Mon Sep 17 00:00:00 2001 From: Tim Kourt Date: Mon, 1 May 2017 10:23:47 -0700 Subject: [PATCH] client: device dependency binder --- client/device.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/client/device.c b/client/device.c index cc3812dd..e9f77fa4 100644 --- a/client/device.c +++ b/client/device.c @@ -345,13 +345,33 @@ static void device_destroy(void *data) static bool device_bind_interface(const struct proxy_interface *proxy, const struct proxy_interface *dependency) { - return true; + const char *interface = proxy_interface_get_interface(dependency); + + if (!strcmp(interface, IWD_WSC_INTERFACE)) { + struct device *device = proxy_interface_get_data(proxy); + + device->wsc = dependency; + + return true; + } + + return false; } static bool device_unbind_interface(const struct proxy_interface *proxy, const struct proxy_interface *dependency) { - return true; + const char *interface = proxy_interface_get_interface(dependency); + + if (!strcmp(interface, IWD_WSC_INTERFACE)) { + struct device *device = proxy_interface_get_data(proxy); + + device->wsc = NULL; + + return true; + } + + return false; } static void display_device_inline(const char *margin, const void *data)