mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:32:42 +01:00
dbus: Use recently added l_dbus_name_acquire
Use the backend-independent l_dbus_name_acquire.
This commit is contained in:
parent
945b48bfc9
commit
fb1adcae2a
33
src/dbus.c
33
src/dbus.c
@ -170,31 +170,18 @@ void dbus_pending_reply(struct l_dbus_message **msg,
|
|||||||
*msg = NULL;
|
*msg = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void request_name_callback(struct l_dbus_message *message,
|
static void request_name_callback(struct l_dbus *dbus, bool success,
|
||||||
void *user_data)
|
bool queued, void *user_data)
|
||||||
{
|
{
|
||||||
const char *error, *text;
|
if (!success)
|
||||||
uint32_t result;
|
l_error("Name request failed");
|
||||||
|
|
||||||
if (l_dbus_message_get_error(message, &error, &text)) {
|
|
||||||
l_error("error=%s", error);
|
|
||||||
l_error("message=%s", text);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!l_dbus_message_get_arguments(message, "u", &result))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void request_name_setup(struct l_dbus_message *message, void *user_data)
|
|
||||||
{
|
|
||||||
const char *name = "net.connman.iwd";
|
|
||||||
|
|
||||||
l_dbus_message_set_arguments(message, "su", name, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ready_callback(void *user_data)
|
static void ready_callback(void *user_data)
|
||||||
{
|
{
|
||||||
|
l_dbus_name_acquire(g_dbus, "net.connman.iwd", false, false, true,
|
||||||
|
request_name_callback, NULL);
|
||||||
|
|
||||||
manager_init(g_dbus);
|
manager_init(g_dbus);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,12 +228,6 @@ bool dbus_init(bool enable_debug, bool use_kdbus)
|
|||||||
l_dbus_set_ready_handler(g_dbus, ready_callback, g_dbus, NULL);
|
l_dbus_set_ready_handler(g_dbus, ready_callback, g_dbus, NULL);
|
||||||
l_dbus_set_disconnect_handler(g_dbus, disconnect_callback, NULL, NULL);
|
l_dbus_set_disconnect_handler(g_dbus, disconnect_callback, NULL, NULL);
|
||||||
|
|
||||||
l_dbus_method_call(g_dbus, "org.freedesktop.DBus",
|
|
||||||
"/org/freedesktop/DBus",
|
|
||||||
"org.freedesktop.DBus", "RequestName",
|
|
||||||
request_name_setup,
|
|
||||||
request_name_callback, NULL, NULL);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user