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 1/2] device: add stop_scan method to device interface
(Vasyl Vavrychuk)
2. [PATCH 2/2] wifi: stop scan on p2p technology disable
(Vasyl Vavrychuk)
----------------------------------------------------------------------
Message: 1
Date: Fri, 8 Dec 2017 16:19:06 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 1/2] device: add stop_scan method to device interface
Message-ID: <[email protected]>
---
include/device.h | 2 ++
src/connman.h | 1 +
src/device.c | 47 ++++++++++++++++++++++++++++++++++++++---------
3 files changed, 41 insertions(+), 9 deletions(-)
diff --git a/include/device.h b/include/device.h
index 9ac800a2..a1c9770c 100644
--- a/include/device.h
+++ b/include/device.h
@@ -124,6 +124,8 @@ struct connman_device_driver {
const char *ssid, unsigned int ssid_len,
const char *identity, const char* passphrase,
const char *security, void *user_data);
+ void (*stop_scan) (enum connman_service_type type,
+ struct connman_device *device);
int (*set_regdom) (struct connman_device *device,
const char *alpha2);
};
diff --git a/src/connman.h b/src/connman.h
index f84583b1..92bb8e5d 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -565,6 +565,7 @@ int __connman_device_request_hidden_scan(struct
connman_device *device,
const char *ssid, unsigned int ssid_len,
const char *identity, const char *passphrase,
const char *security, void *user_data);
+void __connman_device_stop_scan(enum connman_service_type type);
bool __connman_device_isfiltered(const char *devname);
diff --git a/src/device.c b/src/device.c
index a563f464..38e74760 100644
--- a/src/device.c
+++ b/src/device.c
@@ -152,6 +152,27 @@ enum connman_service_type
__connman_device_get_service_type(
return CONNMAN_SERVICE_TYPE_UNKNOWN;
}
+static bool device_has_service_type(
+ struct connman_device *device, enum
connman_service_type service_type)
+{
+ enum connman_service_type device_service_type =
+ __connman_device_get_service_type(device);
+
+ /*
+ * For devices whose device_service_type is unknown we should allow to
decide whether
+ * they support specific service_type by themself.
+ */
+ if (device_service_type == CONNMAN_SERVICE_TYPE_UNKNOWN)
+ return true;
+
+ if (device_service_type == CONNMAN_SERVICE_TYPE_WIFI) {
+ return service_type == CONNMAN_SERVICE_TYPE_WIFI ||
+ service_type == CONNMAN_SERVICE_TYPE_P2P;
+ } else {
+ return service_type == device_service_type;
+ }
+}
+
static gboolean device_pending_reset(gpointer user_data)
{
struct connman_device *device = user_data;
@@ -1066,16 +1087,9 @@ int __connman_device_request_scan(enum
connman_service_type type)
for (list = device_list; list; list = list->next) {
struct connman_device *device = list->data;
- enum connman_service_type service_type =
- __connman_device_get_service_type(device);
- if (service_type != CONNMAN_SERVICE_TYPE_UNKNOWN) {
- if (type == CONNMAN_SERVICE_TYPE_P2P) {
- if (service_type != CONNMAN_SERVICE_TYPE_WIFI)
- continue;
- } else if (service_type != type)
- continue;
- }
+ if (!device_has_service_type(device, type))
+ continue;
err = device_scan(type, device);
if (err == 0 || err == -EALREADY || err == -EINPROGRESS) {
@@ -1108,6 +1122,21 @@ int __connman_device_request_hidden_scan(struct
connman_device *device,
passphrase, security, user_data);
}
+void __connman_device_stop_scan(enum connman_service_type type)
+{
+ GSList *list;
+
+ for (list = device_list; list; list = list->next) {
+ struct connman_device *device = list->data;
+
+ if (!device_has_service_type(device, type))
+ continue;
+
+ if (device->driver && device->driver->stop_scan)
+ device->driver->stop_scan(type, device);
+ }
+}
+
static char *index2ident(int index, const char *prefix)
{
struct ifreq ifr;
--
2.11.0
------------------------------
Message: 2
Date: Fri, 8 Dec 2017 16:19:07 +0200
From: Vasyl Vavrychuk <[email protected]>
To: [email protected]
Cc: Vasyl Vavrychuk <[email protected]>
Subject: [PATCH 2/2] wifi: stop scan on p2p technology disable
Message-ID: <[email protected]>
Scaning of p2p technology means that device is advertised as Wi-Fi P2P
endpoint. When we disable p2p we want this to stop.
---
plugins/wifi.c | 19 +++++++++++++++++++
src/technology.c | 1 +
2 files changed, 20 insertions(+)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index e27f3939..4e5c2723 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1986,6 +1986,24 @@ static int wifi_scan(enum connman_service_type type,
return ret;
}
+static void wifi_stop_scan(enum connman_service_type type,
+ struct connman_device *device)
+{
+ struct wifi_data *wifi = connman_device_get_data(device);
+
+ DBG("device %p wifi %p", device, wifi);
+
+ if (!wifi)
+ return;
+
+ if (type == CONNMAN_SERVICE_TYPE_P2P) {
+ if (wifi->p2p_find_timeout) {
+ g_source_remove(wifi->p2p_find_timeout);
+ p2p_find_stop(device);
+ }
+ }
+}
+
static void wifi_regdom_callback(int result,
const char *alpha2,
void *user_data)
@@ -2025,6 +2043,7 @@ static struct connman_device_driver wifi_ng_driver = {
.enable = wifi_enable,
.disable = wifi_disable,
.scan = wifi_scan,
+ .stop_scan = wifi_stop_scan,
.set_regdom = wifi_set_regdom,
};
diff --git a/src/technology.c b/src/technology.c
index d2f0ae2b..3df051e0 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -787,6 +787,7 @@ static int technology_disable(struct connman_technology
*technology)
if (technology->type == CONNMAN_SERVICE_TYPE_P2P) {
technology->enable_persistent = false;
+ __connman_device_stop_scan(CONNMAN_SERVICE_TYPE_P2P);
return technology_disabled(technology);
} else if (technology->type == CONNMAN_SERVICE_TYPE_WIFI) {
struct connman_technology *p2p;
--
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 8
**************************************