Since p2p technology does not own any devices, but wifi does, when wifi
devices delcare a "scan done", it will check relevantly if it's not a
p2p scan which ended.
---
include/device.h | 3 ++-
plugins/bluetooth_legacy.c | 6 ++++--
plugins/wifi.c | 25 +++++++++++++++----------
src/connman.h | 3 ++-
src/device.c | 4 ++--
src/technology.c | 5 ++---
6 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/include/device.h b/include/device.h
index 721cc84..14ad1bb 100644
--- a/include/device.h
+++ b/include/device.h
@@ -23,6 +23,7 @@
#define __CONNMAN_DEVICE_H
#include <connman/network.h>
+#include <connman/service.h>
#ifdef __cplusplus
extern "C" {
@@ -80,7 +81,7 @@ int connman_device_set_powered(struct connman_device *device,
bool powered);
bool connman_device_get_powered(struct connman_device *device);
int connman_device_set_scanning(struct connman_device *device,
- bool scanning);
+ enum connman_service_type type, bool scanning);
bool connman_device_get_scanning(struct connman_device *device);
void connman_device_reset_scanning(struct connman_device *device);
diff --git a/plugins/bluetooth_legacy.c b/plugins/bluetooth_legacy.c
index 9ddbf6d..2d7a9e0 100644
--- a/plugins/bluetooth_legacy.c
+++ b/plugins/bluetooth_legacy.c
@@ -582,7 +582,8 @@ static gboolean adapter_changed(DBusConnection *conn,
dbus_bool_t val;
dbus_message_iter_get_basic(&value, &val);
- connman_device_set_scanning(device, val);
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_BLUETOOTH, val);
} else if (g_str_equal(key, "Devices")) {
check_networks(&value);
}
@@ -763,7 +764,8 @@ update:
connman_device_set_string(device, "Path", path);
connman_device_set_powered(device, powered);
- connman_device_set_scanning(device, scanning);
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_BLUETOOTH, scanning);
if (!powered) {
remove_device_networks(device);
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 6da3c53..99f029f 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -240,7 +240,7 @@ static void stop_autoscan(struct connman_device *device)
reset_autoscan(device);
- connman_device_set_scanning(device, false);
+ connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_WIFI, false);
}
static void wifi_remove(struct connman_device *device)
@@ -569,9 +569,10 @@ static int throw_wifi_scan(struct connman_device *device,
ret = g_supplicant_interface_scan(wifi->interface, NULL,
callback, device);
- if (ret == 0)
- connman_device_set_scanning(device, true);
- else
+ if (ret == 0) {
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_WIFI, true);
+ } else
connman_device_unref(device);
return ret;
@@ -637,8 +638,10 @@ static void scan_callback(int result, GSupplicantInterface
*interface,
scanning = connman_device_get_scanning(device);
- if (scanning)
- connman_device_set_scanning(device, false);
+ if (scanning) {
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_WIFI, false);
+ }
if (result != -ENOLINK)
start_autoscan(device);
@@ -889,7 +892,8 @@ static int wifi_disable(struct connman_device *device)
/* In case of a user scan, device is still referenced */
if (connman_device_get_scanning(device)) {
- connman_device_set_scanning(device, false);
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_WIFI, false);
connman_device_unref(wifi->device);
}
@@ -1145,9 +1149,10 @@ static int wifi_scan(struct connman_device *device,
ret = g_supplicant_interface_scan(wifi->interface, scan_params,
scan_callback, device);
- if (ret == 0)
- connman_device_set_scanning(device, true);
- else {
+ if (ret == 0) {
+ connman_device_set_scanning(device,
+ CONNMAN_SERVICE_TYPE_WIFI, true);
+ } else {
g_supplicant_free_scan_params(scan_params);
connman_device_unref(device);
diff --git a/src/connman.h b/src/connman.h
index a02c84d..4366e19 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -513,7 +513,8 @@ int __connman_technology_remove_rfkill(unsigned int index,
enum connman_service_type type);
void __connman_technology_scan_started(struct connman_device *device);
-void __connman_technology_scan_stopped(struct connman_device *device);
+void __connman_technology_scan_stopped(struct connman_device *device,
+ enum connman_service_type type);
void __connman_technology_add_interface(enum connman_service_type type,
int index, const char *ident);
void __connman_technology_remove_interface(enum connman_service_type type,
diff --git a/src/device.c b/src/device.c
index bc835be..3856080 100644
--- a/src/device.c
+++ b/src/device.c
@@ -733,7 +733,7 @@ void connman_device_reset_scanning(struct connman_device
*device)
* Change scanning state of device
*/
int connman_device_set_scanning(struct connman_device *device,
- bool scanning)
+ enum connman_service_type type, bool scanning)
{
DBG("device %p scanning %d", device, scanning);
@@ -756,7 +756,7 @@ int connman_device_set_scanning(struct connman_device
*device,
__connman_device_cleanup_networks(device);
- __connman_technology_scan_stopped(device);
+ __connman_technology_scan_stopped(device, type);
__connman_service_auto_connect(CONNMAN_SERVICE_CONNECT_REASON_AUTO);
diff --git a/src/technology.c b/src/technology.c
index 2893761..590571c 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -979,14 +979,13 @@ void __connman_technology_scan_started(struct
connman_device *device)
DBG("device %p", device);
}
-void __connman_technology_scan_stopped(struct connman_device *device)
+void __connman_technology_scan_stopped(struct connman_device *device,
+ enum connman_service_type type)
{
int count = 0;
struct connman_technology *technology;
- enum connman_service_type type;
GSList *list;
- type = __connman_device_get_service_type(device);
technology = technology_find(type);
DBG("technology %p device %p", technology, device);
--
1.8.3.2
_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman