summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorAndre Heider <a.heider@gmail.com>2022-11-23 12:23:08 +0100
committerAndre Heider <a.heider@gmail.com>2023-01-23 14:51:28 +0100
commited2ee96e4404f603539a19c2c6857a69173d15e3 (patch)
treee7480de3a273194b1aeddb62cd6bf0c59f9a0654 /libs
parenteae86ee9bd58b7b2447e58bb99bf709afe1b2ac2 (diff)
rpcd-mod-luci: add "hwmodes_text" to the iwinfo info output
This is a preformatted string like "ac/ax/b/g/n" for presentation. Signed-off-by: Andre Heider <a.heider@gmail.com>
Diffstat (limited to 'libs')
-rw-r--r--libs/rpcd-mod-luci/src/luci.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libs/rpcd-mod-luci/src/luci.c b/libs/rpcd-mod-luci/src/luci.c
index 88bc004615..422555453d 100644
--- a/libs/rpcd-mod-luci/src/luci.c
+++ b/libs/rpcd-mod-luci/src/luci.c
@@ -81,6 +81,7 @@ static iw_text_t *iw_modenames, *iw_authnames, *iw_kmgmtnames,
*iw_ciphernames, *iw_htmodenames, *iw_80211names;
static struct iwinfo_ops *(*iw_backend)(const char *);
static void (*iw_close)(void);
+static size_t (*iw_format_hwmodes)(int, char *, size_t);
static void
invoke_data_cb(struct ubus_request *req, int type, struct blob_attr *msg)
@@ -938,8 +939,9 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
void *o, *o2, *a;
glob_t paths;
int nret, i;
+ char text[32];
- if (!iw_backend || !iw_close || !iw_modenames || !iw_80211names ||
+ if (!iw_backend || !iw_close || !iw_format_hwmodes || !iw_modenames || !iw_80211names ||
!iw_htmodenames || !iw_authnames || !iw_kmgmtnames || !iw_ciphernames) {
if (glob("/usr/lib/libiwinfo.so*", 0, NULL, &paths) != 0)
return false;
@@ -954,6 +956,7 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
iw_backend = dlsym(iwlib, "iwinfo_backend");
iw_close = dlsym(iwlib, "iwinfo_close");
+ iw_format_hwmodes = dlsym(iwlib, "iwinfo_format_hwmodes");
iw_modenames = dlsym(iwlib, "IWINFO_OPMODE_NAMES");
iw_80211names = dlsym(iwlib, "IWINFO_80211_NAMES");
iw_htmodenames = dlsym(iwlib, "IWINFO_HTMODE_NAMES");
@@ -961,7 +964,7 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
iw_kmgmtnames = dlsym(iwlib, "IWINFO_KMGMT_NAMES");
iw_ciphernames = dlsym(iwlib, "IWINFO_CIPHER_NAMES");
- if (!iw_backend || !iw_close || !iw_modenames || !iw_80211names ||
+ if (!iw_backend || !iw_close || !iw_format_hwmodes || !iw_modenames || !iw_80211names ||
!iw_htmodenames || !iw_authnames || !iw_kmgmtnames || !iw_ciphernames)
return false;
}
@@ -983,10 +986,14 @@ static bool rpc_luci_get_iwinfo(struct blob_buf *buf, const char *devname,
iw_call_num(iw->frequency, devname, buf, "frequency");
iw_call_num(iw->frequency_offset, devname, buf, "frequency_offset");
- if (!iw->hwmodelist(devname, &nret))
+ if (!iw->hwmodelist(devname, &nret)) {
iw_add_bit_array(buf, "hwmodes", nret,
iw_80211names, IWINFO_80211_COUNT, true, 0);
+ if (iw_format_hwmodes(nret, text, sizeof(text)) > 0)
+ blobmsg_add_string(buf, "hwmodes_text", text);
+ }
+
if (!iw->htmodelist(devname, &nret))
iw_add_bit_array(buf, "htmodes", nret & ~IWINFO_HTMODE_NOHT,
iw_htmodenames, IWINFO_HTMODE_COUNT, false, 0);