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

client: Fail in non-interactive mode if iwd service isn’t running

In non-interactive mode request the managed object right away and do
not wait for the service to appear. This way client can fail right
away instead of endlessly waiting in non-interactive mode.
This commit is contained in:
Tim Kourt 2019-11-08 11:32:23 -08:00 committed by Denis Kenzior
parent be5e955e65
commit 4f1c661273

View File

@ -740,11 +740,17 @@ no_agent:
display_enable_cmd_prompt(); display_enable_cmd_prompt();
} }
static void get_managed_objects(void)
{
l_dbus_method_call(dbus, IWD_SERVICE, IWD_ROOT_PATH,
L_DBUS_INTERFACE_OBJECT_MANAGER,
"GetManagedObjects", NULL,
get_managed_objects_callback,
NULL, NULL);
}
static void service_appeared_callback(struct l_dbus *dbus, void *user_data) static void service_appeared_callback(struct l_dbus *dbus, void *user_data)
{ {
if (!command_is_interactive_mode())
goto get_objects;
l_dbus_add_signal_watch(dbus, IWD_SERVICE, IWD_ROOT_PATH, l_dbus_add_signal_watch(dbus, IWD_SERVICE, IWD_ROOT_PATH,
L_DBUS_INTERFACE_OBJECT_MANAGER, L_DBUS_INTERFACE_OBJECT_MANAGER,
"InterfacesAdded", L_DBUS_MATCH_NONE, "InterfacesAdded", L_DBUS_MATCH_NONE,
@ -759,12 +765,8 @@ static void service_appeared_callback(struct l_dbus *dbus, void *user_data)
L_DBUS_INTERFACE_PROPERTIES, L_DBUS_INTERFACE_PROPERTIES,
"PropertiesChanged", L_DBUS_MATCH_NONE, "PropertiesChanged", L_DBUS_MATCH_NONE,
properties_changed_callback, NULL); properties_changed_callback, NULL);
get_objects:
l_dbus_method_call(dbus, IWD_SERVICE, IWD_ROOT_PATH, get_managed_objects();
L_DBUS_INTERFACE_OBJECT_MANAGER,
"GetManagedObjects", NULL,
get_managed_objects_callback,
NULL, NULL);
} }
static void service_disappeared_callback(struct l_dbus *dbus, static void service_disappeared_callback(struct l_dbus *dbus,
@ -834,9 +836,13 @@ bool dbus_proxy_init(void)
l_dbus_set_disconnect_handler(dbus, dbus_disconnect_callback, NULL, l_dbus_set_disconnect_handler(dbus, dbus_disconnect_callback, NULL,
NULL); NULL);
l_dbus_add_service_watch(dbus, IWD_SERVICE, service_appeared_callback, if (command_is_interactive_mode())
l_dbus_add_service_watch(dbus, IWD_SERVICE,
service_appeared_callback,
service_disappeared_callback, service_disappeared_callback,
NULL, NULL); NULL, NULL);
else
get_managed_objects();
return true; return true;
} }