mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +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:
parent
be5e955e65
commit
4f1c661273
@ -740,11 +740,17 @@ no_agent:
|
||||
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)
|
||||
{
|
||||
if (!command_is_interactive_mode())
|
||||
goto get_objects;
|
||||
|
||||
l_dbus_add_signal_watch(dbus, IWD_SERVICE, IWD_ROOT_PATH,
|
||||
L_DBUS_INTERFACE_OBJECT_MANAGER,
|
||||
"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,
|
||||
"PropertiesChanged", L_DBUS_MATCH_NONE,
|
||||
properties_changed_callback, NULL);
|
||||
get_objects:
|
||||
l_dbus_method_call(dbus, IWD_SERVICE, IWD_ROOT_PATH,
|
||||
L_DBUS_INTERFACE_OBJECT_MANAGER,
|
||||
"GetManagedObjects", NULL,
|
||||
get_managed_objects_callback,
|
||||
NULL, NULL);
|
||||
|
||||
get_managed_objects();
|
||||
}
|
||||
|
||||
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,
|
||||
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,
|
||||
NULL, NULL);
|
||||
else
|
||||
get_managed_objects();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user