From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH v2 09/13] wiphy: add wiphy_country_is_unknown
Date: Wed, 3 Aug 2022 14:36:40 -0700 [thread overview]
Message-ID: <20220803213644.277534-9-prestwoj@gmail.com> (raw)
In-Reply-To: <20220803213644.277534-1-prestwoj@gmail.com>
A helper to check whether the country code corresponds to a
real country, or some special code indicating the country isn't
yet set. For now, the special codes are OO (world roaming) and
XX (unknown entity).
---
src/wiphy.c | 16 ++++++++++++++++
src/wiphy.h | 1 +
2 files changed, 17 insertions(+)
diff --git a/src/wiphy.c b/src/wiphy.c
index 6a109655..dec4b15e 100644
--- a/src/wiphy.c
+++ b/src/wiphy.c
@@ -800,6 +800,22 @@ void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out)
out[1] = country[1];
}
+bool wiphy_country_is_unknown(struct wiphy *wiphy)
+{
+ char cc[2];
+
+ wiphy_get_reg_domain_country(wiphy, cc);
+
+ /*
+ * Treat OO and XX as an unknown country. Additional codes could be
+ * added here if needed. The purpose of this is to know if we can
+ * expect the disabled frequency list to be updated once a country is
+ * known.
+ */
+ return ((cc[0] == 'O' && cc[1] == 'O') ||
+ (cc[0] == 'X' && cc[1] == 'X'));
+}
+
int wiphy_estimate_data_rate(struct wiphy *wiphy,
const void *ies, uint16_t ies_len,
const struct scan_bss *bss,
diff --git a/src/wiphy.h b/src/wiphy.h
index 1fea6c23..2159fc00 100644
--- a/src/wiphy.h
+++ b/src/wiphy.h
@@ -124,6 +124,7 @@ const uint8_t *wiphy_get_extended_capabilities(struct wiphy *wiphy,
const uint8_t *wiphy_get_rm_enabled_capabilities(struct wiphy *wiphy);
bool wiphy_get_rsnxe(const struct wiphy *wiphy, uint8_t *buf, size_t len);
void wiphy_get_reg_domain_country(struct wiphy *wiphy, char *out);
+bool wiphy_country_is_unknown(struct wiphy *wiphy);
void wiphy_generate_random_address(struct wiphy *wiphy, uint8_t addr[static 6]);
void wiphy_generate_address_from_ssid(struct wiphy *wiphy, const char *ssid,
--
2.34.3
next prev parent reply other threads:[~2022-08-03 21:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-03 21:36 [PATCH v2 01/13] wiphy: fix runtime error from bit shift James Prestwood
2022-08-03 21:36 ` [PATCH v2 02/13] scan: track scanned frequencies for entire request James Prestwood
2022-08-03 21:36 ` [PATCH v2 03/13] nl80211util: add nl80211_parse_supported_frequencies James Prestwood
2022-08-04 15:27 ` Denis Kenzior
2022-08-03 21:36 ` [PATCH v2 04/13] wiphy: track self-managed flag James Prestwood
2022-08-03 21:36 ` [PATCH v2 05/13] wiphy: use nl80211_parse_supported_frequencies James Prestwood
2022-08-03 21:36 ` [PATCH v2 06/13] wiphy: add two regulatory domain state events James Prestwood
2022-08-04 15:31 ` Denis Kenzior
2022-08-03 21:36 ` [PATCH v2 07/13] wiphy: dump wiphy's on regulatory domain change James Prestwood
2022-08-03 21:36 ` [PATCH v2 08/13] wiphy: add wiphy_regdom_is_updating James Prestwood
2022-08-03 21:36 ` James Prestwood [this message]
2022-08-04 16:48 ` [PATCH v2 09/13] wiphy: add wiphy_country_is_unknown Denis Kenzior
2022-08-03 21:36 ` [PATCH v2 10/13] station: do full passive scan if 6GHz is supported but disabled James Prestwood
2022-08-03 21:36 ` [PATCH v2 11/13] scan: split full scans by band to enable 6GHz James Prestwood
2022-08-03 21:36 ` [PATCH v2 12/13] scan: watch for regdom updates " James Prestwood
2022-08-03 21:36 ` [PATCH v2 13/13] wiphy: don't re-dump wiphy if the regdom didn't change James Prestwood
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=20220803213644.277534-9-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@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