Activate wpa_supplicant if needed
authorMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Dec 2008 01:08:29 +0000 (02:08 +0100)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 18 Dec 2008 01:08:29 +0000 (02:08 +0100)
plugins/supplicant.c
plugins/supplicant.h
plugins/wifi.c

index da274a0..bca325d 100644 (file)
@@ -1099,8 +1099,28 @@ int __supplicant_disconnect(struct connman_element *element)
        return 0;
 }
 
+void __supplicant_activate(DBusConnection *conn)
+{
+       DBusMessage *message;
+
+       DBG("conn %p", conn);
+
+       message = dbus_message_new_method_call(SUPPLICANT_NAME, "/",
+                               DBUS_INTERFACE_INTROSPECTABLE, "Introspect");
+        if (message == NULL)
+               return;
+
+       dbus_message_set_no_reply(message, TRUE);
+
+       dbus_connection_send(conn, message, NULL);
+
+       dbus_message_unref(message);
+}
+
 int __supplicant_init(DBusConnection *conn)
 {
+       DBG("conn %p", conn);
+
        connection = conn;
 
        if (dbus_connection_add_filter(connection,
@@ -1114,5 +1134,7 @@ int __supplicant_init(DBusConnection *conn)
 
 void __supplicant_exit(void)
 {
+       DBG("conn %p", connection);
+
        dbus_connection_remove_filter(connection, supplicant_filter, NULL);
 }
index 48cf89b..4a746a6 100644 (file)
@@ -58,6 +58,8 @@ struct supplicant_callback {
                                        struct supplicant_network *network);
 };
 
+void __supplicant_activate(DBusConnection *conn);
+
 int __supplicant_init(DBusConnection *conn);
 void __supplicant_exit(void);
 
index 23fbb89..e38f2bb 100644 (file)
@@ -653,6 +653,8 @@ static int wifi_init(void)
 
        if (g_dbus_check_service(connection, SUPPLICANT_NAME) == TRUE)
                supplicant_connect(connection, NULL);
+       else
+               __supplicant_activate(connection);
 
        return 0;
 }