mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
core: Request current regulatory setting when starting up
This commit is contained in:
parent
a17584e680
commit
c9b3adbbcf
29
src/wiphy.c
29
src/wiphy.c
@ -329,6 +329,29 @@ static void wiphy_regulatory_notify(struct l_genl_msg *msg, void *user_data)
|
||||
}
|
||||
}
|
||||
|
||||
static void regulatory_info_callback(struct l_genl_msg *msg, void *user_data)
|
||||
{
|
||||
struct l_genl_attr attr;
|
||||
uint16_t type, len;
|
||||
const void *data;
|
||||
|
||||
if (!l_genl_attr_init(&attr, msg))
|
||||
return;
|
||||
|
||||
while (l_genl_attr_next(&attr, &type, &len, &data)) {
|
||||
switch (type) {
|
||||
case NL80211_ATTR_REG_ALPHA2:
|
||||
if (len != 3) {
|
||||
l_warn("Invalid regulatory alpha2 attribute");
|
||||
return;
|
||||
}
|
||||
|
||||
l_debug("Regulatory alpha2 is %s", (char *) data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void protocol_features_callback(struct l_genl_msg *msg, void *user_data)
|
||||
{
|
||||
struct l_genl_attr attr;
|
||||
@ -395,6 +418,12 @@ static void nl80211_appeared(void *user_data)
|
||||
l_error("Getting protocol features failed");
|
||||
l_genl_msg_unref(msg);
|
||||
|
||||
msg = l_genl_msg_new(NL80211_CMD_GET_REG);
|
||||
if (!l_genl_family_send(nl80211, msg, regulatory_info_callback,
|
||||
NULL, NULL))
|
||||
l_error("Getting regulatory info failed");
|
||||
l_genl_msg_unref(msg);
|
||||
|
||||
msg = l_genl_msg_new(NL80211_CMD_GET_WIPHY);
|
||||
if (!l_genl_family_dump(nl80211, msg, wiphy_dump_callback, NULL, NULL))
|
||||
l_error("Getting all wiphy devices failed");
|
||||
|
Loading…
Reference in New Issue
Block a user