This email list is read-only.  Emails sent to this list will be discarded
----------------------------------
 plugins/supplicant.c |   22 ++++++++++++++++++++++
 plugins/supplicant.h |    2 ++
 plugins/wifi.c       |   30 ++++++++++--------------------
 3 files changed, 34 insertions(+), 20 deletions(-)

New commits:
commit 71187176982da82f48deb8504fc033fb72c78f74
Author: Marcel Holtmann <[email protected]>
Date:   Thu Dec 18 02:21:42 2008 +0100

    Fix duplicate wireless scan results

commit f883452f576d8f9e51d2b474f5a5d4d33ab093f9
Author: Marcel Holtmann <[email protected]>
Date:   Thu Dec 18 02:08:29 2008 +0100

    Activate wpa_supplicant if needed


Diff in this email is a maximum of 400 lines.
diff --git a/plugins/supplicant.c b/plugins/supplicant.c
index da274a0..bca325d 100644
--- a/plugins/supplicant.c
+++ b/plugins/supplicant.c
@@ -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);
 }
diff --git a/plugins/supplicant.h b/plugins/supplicant.h
index 48cf89b..4a746a6 100644
--- a/plugins/supplicant.h
+++ b/plugins/supplicant.h
@@ -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);
 
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 23fbb89..f215352 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -140,7 +140,7 @@ static struct connman_element *find_current_element(struct 
wifi_data *data,
                struct connman_element *element = list->data;
 
                if (connman_element_match_static_property(element,
-                                       "Name", &identifier) == TRUE)
+                                               "Name", &identifier) == TRUE)
                        return element;
        }
 
@@ -156,7 +156,7 @@ static struct connman_element *find_pending_element(struct 
wifi_data *data,
                struct connman_element *element = list->data;
 
                if (connman_element_match_static_property(element,
-                                       "Name", &identifier) == TRUE)
+                                               "Name", &identifier) == TRUE)
                        return element;
        }
 
@@ -170,11 +170,6 @@ static gboolean inactive_scan(gpointer user_data)
 
        DBG("");
 
-       if (data->cleanup_timer > 0) {
-               g_source_remove(data->cleanup_timer);
-               data->cleanup_timer = 0;
-       }
-
        __supplicant_scan(device);
 
        data->inactive_timer = 0;
@@ -290,12 +285,14 @@ static void clear_results(struct connman_element *device)
        DBG("pending %d", g_slist_length(data->pending));
        DBG("current %d", g_slist_length(data->current));
 
+       if (data->cleanup_timer > 0) {
+               g_source_remove(data->cleanup_timer);
+               cleanup_pending(data);
+       }
+
        data->pending = data->current;
        data->current = NULL;
 
-       if (data->cleanup_timer > 0)
-               return;
-
        data->cleanup_timer = g_timeout_add_seconds(CLEANUP_TIMEOUT,
                                                        cleanup_pending, data);
 }
@@ -457,7 +454,7 @@ static int wifi_disable(struct connman_element *element)
 
        if (data->cleanup_timer > 0) {
                g_source_remove(data->cleanup_timer);
-               data->cleanup_timer = 0;
+               cleanup_pending(data);
        }
 
        if (data->inactive_timer > 0) {
@@ -467,15 +464,6 @@ static int wifi_disable(struct connman_element *element)
 
        __supplicant_disconnect(element);
 
-       for (list = data->pending; list; list = list->next) {
-               struct connman_element *network = list->data;
-
-               connman_element_unref(network);
-       }
-
-       g_slist_free(data->pending);
-       data->pending = NULL;
-
        for (list = data->current; list; list = list->next) {
                struct connman_element *network = list->data;
 
@@ -653,6 +641,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;
 }
_______________________________________________
Commits mailing list
[email protected]
https://lists.moblin.org/mailman/listinfo/commits

Reply via email to