Hi Martin, > --- > include/device.h | 2 ++ > plugins/supplicant.c | 2 +- > src/device.c | 38 ++++++++++++++++++++++++++++++++++++++ > 3 files changed, 41 insertions(+), 1 deletions(-)
please don't mix these patches. First one that modifies device.[ch] and then the second that uses the new stuff. > diff --git a/include/device.h b/include/device.h > index 5da48bc..f1c12b1 100644 > --- a/include/device.h > +++ b/include/device.h > @@ -89,6 +89,8 @@ int connman_device_set_carrier(struct connman_device > *device, > connman_bool_t carrier); > int connman_device_set_scanning(struct connman_device *device, > connman_bool_t scanning); > +void connman_device_cleanup_scanning(struct connman_device *device); > + > int connman_device_set_disconnected(struct connman_device *device, > connman_bool_t disconnected); > connman_bool_t connman_device_get_disconnected(struct connman_device > *device); > diff --git a/plugins/supplicant.c b/plugins/supplicant.c > index 6134e03..eae81ee 100644 > --- a/plugins/supplicant.c > +++ b/plugins/supplicant.c > @@ -1594,7 +1594,7 @@ static void state_change(struct supplicant_task *task, > DBusMessage *msg) > return; > > if (task->scanning == TRUE && state != WPA_SCANNING) { > - connman_device_set_scanning(task->device, FALSE); > + connman_device_cleanup_scanning(task->device); > task->scanning = FALSE; > } > > diff --git a/src/device.c b/src/device.c > index 1d66936..66adf9f 100644 > --- a/src/device.c > +++ b/src/device.c > @@ -1411,6 +1411,14 @@ int __connman_device_disconnect(struct connman_device > *device) > return 0; > } > > +static void mark_network_available(gpointer key, gpointer value, > + gpointer user_data) > +{ > + struct connman_network *network = value; > + > + connman_network_set_available(network, TRUE); > +} > + > static void mark_network_unavailable(gpointer key, gpointer value, > gpointer user_data) > { > @@ -1442,6 +1450,36 @@ void __connman_device_cleanup_networks(struct > connman_device *device) > remove_unavailable_network, NULL); > } > > +void connman_device_cleanup_scanning(struct connman_device *device) > +{ > + DBusMessage *signal; > + DBusMessageIter entry, value; > + const char *key = "Scanning"; > + > + device->scanning = FALSE; > + > + signal = dbus_message_new_signal(device->element.path, > + CONNMAN_DEVICE_INTERFACE, "PropertyChanged"); > + if (signal == NULL) > + return; > + > + dbus_message_iter_init_append(signal, &entry); > + > + dbus_message_iter_append_basic(&entry, DBUS_TYPE_STRING, &key); > + > + dbus_message_iter_open_container(&entry, DBUS_TYPE_VARIANT, > + DBUS_TYPE_BOOLEAN_AS_STRING, &value); > + dbus_message_iter_append_basic(&value, DBUS_TYPE_BOOLEAN, > + &device->scanning); > + dbus_message_iter_close_container(&entry, &value); > + > + g_dbus_send_message(connection, signal); > + > + g_hash_table_foreach(device->networks, > + mark_network_available, NULL); > + > +} please create an internal helper scanning_changed(device) that handles the D-Bus signal sending code. So we don't have to have that code twice. Regards Marcel _______________________________________________ connman mailing list connman@connman.net http://lists.connman.net/listinfo/connman