From: Daniel Wagner <wagi@monom.org>
To: connman@lists.linux.dev
Cc: Daniel Wagner <wagi@monom.org>
Subject: [PATCH] iwd: Add support to Scan in AP mode
Date: Mon, 16 Jan 2023 09:16:24 +0100 [thread overview]
Message-ID: <20230116081624.12618-1-wagi@monom.org> (raw)
iwd support scanning in AccessPoint mode, thus forward scan requests
also when the device is in AccessPoint mode.
Signed-off-by: Daniel Wagner <wagi@monom.org>
---
Only compile tested :)
plugins/iwd.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 49 insertions(+), 5 deletions(-)
diff --git a/plugins/iwd.c b/plugins/iwd.c
index 2fe49a23316b..491a0e41da89 100644
--- a/plugins/iwd.c
+++ b/plugins/iwd.c
@@ -633,15 +633,28 @@ static void cm_device_scan_cb(DBusMessage *message, void *user_data)
}
}
-static int cm_device_scan(struct connman_device *device,
- struct connman_device_scan_params *params)
+static void cm_ap_scan_cb(DBusMessage *message, void *user_data)
+{
+ const char *path = user_data;
+ struct iwd_ap *iwdap;
+
+ iwdap = g_hash_table_lookup(access_points, path);
+ if (!iwdap)
+ return;
+
+ if (dbus_message_get_type(message) == DBUS_MESSAGE_TYPE_ERROR) {
+ const char *dbus_error = dbus_message_get_error_name(message);
+
+ DBG("%s scan failed: %s", path, dbus_error);
+ }
+}
+
+static int cm_station_scan(struct connman_device *device,
+ struct connman_device_scan_params *param)
{
struct iwd_device *iwdd = connman_device_get_data(device);
struct iwd_station *iwds;
- if (strcmp(iwdd->mode, "station"))
- return -EINVAL;
-
iwds = g_hash_table_lookup(stations, iwdd->path);
if (!iwds)
return -EIO;
@@ -653,6 +666,37 @@ static int cm_device_scan(struct connman_device *device,
return -EINPROGRESS;
}
+static int cm_ap_scan(struct connman_device *device,
+ struct connman_device_scan_params *param)
+{
+ struct iwd_device *iwdd = connman_device_get_data(device);
+ struct iwd_ap *iwdap;
+
+ iwdap = g_hash_table_lookup(access_points, iwdd->path);
+ if (!iwdap)
+ return -EIO;
+
+ if (!g_dbus_proxy_method_call(iwdap->proxy, "Scan",
+ NULL, cm_ap_scan_cb, g_strdup(iwdap->path), g_free))
+ return -EIO;
+
+ return -EINPROGRESS;
+}
+
+static int cm_device_scan(struct connman_device *device,
+ struct connman_device_scan_params *params)
+{
+ struct iwd_device *iwdd = connman_device_get_data(device);
+
+ if (!strcmp(iwdd->mode, "station"))
+ return cm_station_scan(device, params);
+
+ if (!strcmp(iwdd->mode, "ap"))
+ return cm_ap_scan(device, params);
+
+ return -EINVAL;
+}
+
static struct connman_device_driver device_driver = {
.name = "iwd",
.type = CONNMAN_DEVICE_TYPE_WIFI,
--
2.39.0
next reply other threads:[~2023-01-16 8:16 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-16 8:16 Daniel Wagner [this message]
2023-01-16 23:00 ` [PATCH] iwd: Add support to Scan in AP mode KeithG
2023-02-14 18:55 ` KeithG
2023-02-27 7:43 ` Daniel Wagner
2023-05-12 0:35 ` KeithG
2023-05-22 14:23 ` KeithG
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230116081624.12618-1-wagi@monom.org \
--to=wagi@monom.org \
--cc=20230116073300.hy6spqhqitohj3eu@beryllium.lan \
--cc=connman@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).