If we are scanning then don't try to run autoconnect while
we are adding network from scan, at the end of scan auto
connect will be called.
---
include/device.h | 2 ++
src/device.c | 6 ++++++
src/service.c | 8 ++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/include/device.h b/include/device.h
index c5e005d..609ae0b 100644
--- a/include/device.h
+++ b/include/device.h
@@ -100,6 +100,8 @@ void connman_device_unregister(struct connman_device
*device);
void *connman_device_get_data(struct connman_device *device);
void connman_device_set_data(struct connman_device *device, void *data);
+connman_bool_t is_device_scanning(struct connman_device *device);
+
struct connman_device_driver {
const char *name;
enum connman_device_type type;
diff --git a/src/device.c b/src/device.c
index b8110c4..667fed6 100644
--- a/src/device.c
+++ b/src/device.c
@@ -810,6 +810,12 @@ void __connman_device_cleanup_networks(struct
connman_device *device)
remove_unavailable_network, NULL);
}
+connman_bool_t is_device_scanning(struct connman_device *device)
+{
+
+ return device->scanning;
+}
+
/**
* connman_device_set_scanning:
* @device: device structure
diff --git a/src/service.c b/src/service.c
index 626cd31..f417a80 100644
--- a/src/service.c
+++ b/src/service.c
@@ -4014,6 +4014,7 @@ static void update_from_network(struct connman_service
*service,
struct connman_service * __connman_service_create_from_network(struct
connman_network *network)
{
struct connman_service *service;
+ struct connman_device *device;
const char *ident, *group;
char *name;
@@ -4071,8 +4072,11 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
service_register(service);
- if (service->favorite == TRUE)
- __connman_service_auto_connect();
+ if (service->favorite == TRUE) {
+ device = connman_network_get_device(service->network);
+ if (device && is_device_scanning(device) == FALSE)
+ __connman_service_auto_connect();
+ }
return service;
}
--
1.7.2.3
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman