Send connman mailing list submissions to
[email protected]
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.01.org/mailman/listinfo/connman
or, via email, send a message with subject or body 'help' to
[email protected]
You can reach the person managing the list at
[email protected]
When replying, please edit your Subject line so it is more specific
than "Re: Contents of connman digest..."
Today's Topics:
1. [PATCH 0/4] d-bus reply to "scan p2p" is not send if wifi/p2p
scanning interleave in some unlucky way (Vasyl Vavrychuk)
2. [PATCH 1/4] device: disable scanning with unknown service
type (Vasyl Vavrychuk)
3. [PATCH 2/4] p2p: fix no d-bus reply for 'scan p2p' due to
conflict with wifi scan (Vasyl Vavrychuk)
4. [PATCH 3/4] technology: checking for device service type
became redundant (Vasyl Vavrychuk)
5. [PATCH 4/4] wifi: use better criteria if we are P2P scanning
in places where possible (Vasyl Vavrychuk)
----------------------------------------------------------------------
Message: 1
Date: Wed, 27 Dec 2017 00:45:46 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected], [email protected],
Daniel Wagner <[email protected]>, [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 0/4] d-bus reply to "scan p2p" is not send if wifi/p2p
scanning interleave in some unlucky way
Message-ID: <[email protected]>
* On connman start there is wifi scan started
https://gitlab.com/snippets/1690556#L472.
* Then suppose we call "scan p2p" from connmanctl.
* Suppose `scan_callback` from wifi scan is received sooner than
`p2p_find_stop` called.
This callback will put device scanning property to 0.
https://gitlab.com/snippets/1690556#L896
* Then after p2p_find_stop callback https://gitlab.com/snippets/1690556#L978
call to `connman_device_set_scanning` will not send reply_scan_pending for
p2p technology because scanning property was already set to 0.
On connmanctl side error is
Error /net/connman/technology/p2p: Did not receive a reply. Possible causes
include: the remote application did not send a reply, the message bus security
policy blocked the reply, the reply timeout expired, or the network connection
was broken.
This is happening because we can start/stop scanning for device in
per-service-type manner but this is not taken into account in
`connman_device_set_scanning` code chunk
if (device->scanning == scanning)
return -EALREADY;
Vasyl Vavrychuk (4):
device: disable scanning with unknown service type
p2p: fix no d-bus reply for 'scan p2p' due to conflict with wifi scan
technology: checking for device service type became redundant
wifi: use better criteria if we are P2P scanning in places where
possible
include/device.h | 3 ++-
plugins/wifi.c | 14 +++++++-------
src/device.c | 27 +++++++++++++++++++++------
src/service.c | 3 ++-
src/technology.c | 5 +----
5 files changed, 33 insertions(+), 19 deletions(-)
--
2.11.0
------------------------------
Message: 2
Date: Wed, 27 Dec 2017 00:45:47 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected], [email protected],
Daniel Wagner <[email protected]>, [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 1/4] device: disable scanning with unknown service
type
Message-ID: <[email protected]>
Later we would put some special meaning in unkown service type.
---
src/device.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/device.c b/src/device.c
index f6f2e10e..c6bdc50b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -745,6 +745,9 @@ int connman_device_set_scanning(struct connman_device
*device,
if (!device->driver || !device->driver->scan)
return -EINVAL;
+ if (type == CONNMAN_SERVICE_TYPE_UNKNOWN)
+ return -EINVAL;
+
if (device->scanning == scanning)
return -EALREADY;
--
2.11.0
------------------------------
Message: 3
Date: Wed, 27 Dec 2017 00:45:48 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected], [email protected],
Daniel Wagner <[email protected]>, [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 2/4] p2p: fix no d-bus reply for 'scan p2p' due to
conflict with wifi scan
Message-ID: <[email protected]>
* On connman start there is wifi scan started
https://gitlab.com/snippets/1690556#L472.
* Then suppose we call "scan p2p" from connmanctl.
* Suppose scan_callback from wifi scan is received sooner than p2p_find_stop
called.
This callback will put device scanning property to 0.
https://gitlab.com/snippets/1690556#L896
* Then after p2p_find_stop callback https://gitlab.com/snippets/1690556#L978
call to connman_device_set_scanning will not send reply_scan_pending
for p2p technology because scanning property was already set to 0.
This is happening because we can start/stop scanning for device in
per-service-type manner but this is not taken into account in
connman_device_set_scanning.
---
include/device.h | 3 ++-
plugins/wifi.c | 8 ++++----
src/device.c | 24 ++++++++++++++++++------
src/service.c | 3 ++-
src/technology.c | 2 +-
5 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/include/device.h b/include/device.h
index a1c9770c..5a3ddc22 100644
--- a/include/device.h
+++ b/include/device.h
@@ -82,7 +82,8 @@ int connman_device_set_powered(struct connman_device *device,
bool connman_device_get_powered(struct connman_device *device);
int connman_device_set_scanning(struct connman_device *device,
enum connman_service_type type, bool scanning);
-bool connman_device_get_scanning(struct connman_device *device);
+bool connman_device_get_scanning(struct connman_device *device,
+ enum connman_service_type type);
void connman_device_reset_scanning(struct connman_device *device);
int connman_device_set_string(struct connman_device *device,
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 609131b6..8b94fb78 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1216,7 +1216,7 @@ static int throw_wifi_scan(struct connman_device *device,
if (wifi->tethering)
return -EBUSY;
- if (connman_device_get_scanning(device))
+ if (connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_WIFI))
return -EALREADY;
connman_device_ref(device);
@@ -1290,7 +1290,7 @@ static void scan_callback(int result,
GSupplicantInterface *interface,
return scan_callback(ret, interface, user_data);
}
- scanning = connman_device_get_scanning(device);
+ scanning = connman_device_get_scanning(device,
CONNMAN_SERVICE_TYPE_WIFI);
if (scanning) {
connman_device_set_scanning(device,
@@ -1598,7 +1598,7 @@ static int wifi_disable(struct connman_device *device)
}
/* In case of a user scan, device is still referenced */
- if (connman_device_get_scanning(device)) {
+ if (connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_WIFI)) {
connman_device_set_scanning(device,
CONNMAN_SERVICE_TYPE_WIFI, false);
connman_device_unref(wifi->device);
@@ -1886,7 +1886,7 @@ static int wifi_scan(enum connman_service_type type,
DBG("device %p wifi %p hidden ssid %s", device, wifi->interface, ssid);
- scanning = connman_device_get_scanning(device);
+ scanning = connman_device_get_scanning(device,
CONNMAN_SERVICE_TYPE_WIFI);
if (!ssid || ssid_len == 0 || ssid_len > 32) {
if (scanning)
diff --git a/src/device.c b/src/device.c
index c6bdc50b..c088cb0f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -52,7 +52,7 @@ struct connman_device {
* request
*/
bool powered;
- bool scanning;
+ bool scanning[MAX_CONNMAN_SERVICE_TYPES];
char *name;
char *node;
char *address;
@@ -588,6 +588,7 @@ int connman_device_set_powered(struct connman_device
*device,
bool powered)
{
enum connman_service_type type;
+ int i;
DBG("device %p powered %d", device, powered);
@@ -609,7 +610,8 @@ int connman_device_set_powered(struct connman_device
*device,
__connman_technology_enabled(type);
- device->scanning = false;
+ for (i = 0; i < MAX_CONNMAN_SERVICE_TYPES; i++)
+ device->scanning[i] = false;
if (device->driver && device->driver->scan)
device->driver->scan(CONNMAN_SERVICE_TYPE_UNKNOWN, device,
@@ -719,9 +721,19 @@ void __connman_device_cleanup_networks(struct
connman_device *device)
remove_unavailable_network, NULL);
}
-bool connman_device_get_scanning(struct connman_device *device)
+bool connman_device_get_scanning(struct connman_device *device,
+ enum connman_service_type type)
{
- return device->scanning;
+ int i;
+
+ if (type != CONNMAN_SERVICE_TYPE_UNKNOWN)
+ return device->scanning[type];
+
+ for (i = 0; i < MAX_CONNMAN_SERVICE_TYPES; i++)
+ if (device->scanning[i])
+ return TRUE;
+
+ return FALSE;
}
void connman_device_reset_scanning(struct connman_device *device)
@@ -748,10 +760,10 @@ int connman_device_set_scanning(struct connman_device
*device,
if (type == CONNMAN_SERVICE_TYPE_UNKNOWN)
return -EINVAL;
- if (device->scanning == scanning)
+ if (device->scanning[type] == scanning)
return -EALREADY;
- device->scanning = scanning;
+ device->scanning[type] = scanning;
if (scanning) {
__connman_technology_scan_started(device);
diff --git a/src/service.c b/src/service.c
index 197f2660..532978b3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -7129,7 +7129,8 @@ struct connman_service *
__connman_service_create_from_network(struct connman_ne
if (service->favorite) {
device = connman_network_get_device(service->network);
- if (device && !connman_device_get_scanning(device)) {
+ if (device &&
+ !connman_device_get_scanning(device,
CONNMAN_SERVICE_TYPE_UNKNOWN)) {
switch (service->type) {
case CONNMAN_SERVICE_TYPE_UNKNOWN:
diff --git a/src/technology.c b/src/technology.c
index 3df051e0..041a8118 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1026,7 +1026,7 @@ void __connman_technology_scan_stopped(struct
connman_device *device,
if (__connman_device_get_service_type(other_device) != type)
continue;
- if (connman_device_get_scanning(other_device))
+ if (connman_device_get_scanning(other_device, type))
count += 1;
}
--
2.11.0
------------------------------
Message: 4
Date: Wed, 27 Dec 2017 00:45:49 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected], [email protected],
Daniel Wagner <[email protected]>, [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 3/4] technology: checking for device service type
became redundant
Message-ID: <[email protected]>
Now connman_device_get_scanning receives service_type and performs
scanning checking for that service type by itself.
---
src/technology.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/technology.c b/src/technology.c
index 041a8118..4c1cbbbb 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -1023,9 +1023,6 @@ void __connman_technology_scan_stopped(struct
connman_device *device,
if (device == other_device)
continue;
- if (__connman_device_get_service_type(other_device) != type)
- continue;
-
if (connman_device_get_scanning(other_device, type))
count += 1;
}
--
2.11.0
------------------------------
Message: 5
Date: Wed, 27 Dec 2017 00:45:50 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected], [email protected],
Daniel Wagner <[email protected]>, [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 4/4] wifi: use better criteria if we are P2P scanning
in places where possible
Message-ID: <[email protected]>
---
plugins/wifi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 8b94fb78..f99340de 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -900,7 +900,7 @@ static void wifi_remove(struct connman_device *device)
remove_pending_wifi_device(wifi);
- if (wifi->p2p_find_timeout) {
+ if (connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_P2P)) {
g_source_remove(wifi->p2p_find_timeout);
connman_device_unref(wifi->device);
}
@@ -1590,7 +1590,7 @@ static int wifi_disable(struct connman_device *device)
stop_autoscan(device);
- if (wifi->p2p_find_timeout) {
+ if (connman_device_get_scanning(device, CONNMAN_SERVICE_TYPE_P2P)) {
g_source_remove(wifi->p2p_find_timeout);
wifi->p2p_find_timeout = 0;
connman_device_set_scanning(device, CONNMAN_SERVICE_TYPE_P2P,
false);
@@ -1997,7 +1997,7 @@ static void wifi_stop_scan(enum connman_service_type type,
return;
if (type == CONNMAN_SERVICE_TYPE_P2P) {
- if (wifi->p2p_find_timeout) {
+ if (connman_device_get_scanning(device,
CONNMAN_SERVICE_TYPE_P2P)) {
g_source_remove(wifi->p2p_find_timeout);
p2p_find_stop(device);
}
--
2.11.0
------------------------------
Subject: Digest Footer
_______________________________________________
connman mailing list
[email protected]
https://lists.01.org/mailman/listinfo/connman
------------------------------
End of connman Digest, Vol 26, Issue 20
***************************************