3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-04 02:18:49 +02:00

core: First command should be to read protocol features

This commit is contained in:
Marcel Holtmann 2014-08-07 13:13:31 -07:00
parent b7a421673c
commit a17584e680

View File

@ -329,6 +329,33 @@ static void wiphy_regulatory_notify(struct l_genl_msg *msg, void *user_data)
}
}
static void protocol_features_callback(struct l_genl_msg *msg, void *user_data)
{
struct l_genl_attr attr;
uint16_t type, len;
const void *data;
uint32_t features = 0;
if (!l_genl_attr_init(&attr, msg))
return;
while (l_genl_attr_next(&attr, &type, &len, &data)) {
switch (type) {
case NL80211_ATTR_PROTOCOL_FEATURES:
if (len != sizeof(uint32_t)) {
l_warn("Invalid protocol features attribute");
return;
}
features = *((uint32_t *) data);
break;
}
}
if (features & NL80211_PROTOCOL_FEATURE_SPLIT_WIPHY_DUMP)
l_debug("Found split wiphy dump support");
}
static void nl80211_appeared(void *user_data)
{
struct l_genl_msg *msg;
@ -362,6 +389,12 @@ static void nl80211_appeared(void *user_data)
wiphy_list = l_queue_new();
msg = l_genl_msg_new(NL80211_CMD_GET_PROTOCOL_FEATURES);
if (!l_genl_family_send(nl80211, msg, protocol_features_callback,
NULL, NULL))
l_error("Getting protocol features 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");