3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

tools: Update test-runner to the new genl api

This commit is contained in:
Denis Kenzior 2019-05-17 16:13:56 -05:00
parent dea23bede7
commit 71ebc00fb7

View File

@ -2434,7 +2434,7 @@ static void iface_dump_done(void *user_data)
l_queue_destroy(wiphy_list, wiphy_free); l_queue_destroy(wiphy_list, wiphy_free);
l_genl_family_unref(data->nl80211); l_genl_family_free(data->nl80211);
l_genl_unref(data->genl); l_genl_unref(data->genl);
l_free(data); l_free(data);
@ -2454,25 +2454,29 @@ static void wiphy_dump_done(void *user_data)
l_error("Getting all interface information failed"); l_error("Getting all interface information failed");
} }
static void nl80211_appeared(void *user_data) static void nl80211_requested(const struct l_genl_family_info *info,
void *user_data)
{ {
struct nl_data *data = user_data; struct nl_data *data = user_data;
struct l_genl_msg *msg; struct l_genl_msg *msg;
wiphy_list = l_queue_new(); if (info == NULL) {
l_info("No nl80211 family found");
goto done;
}
l_debug("Found nl80211 interface"); l_debug("Found nl80211 interface");
data->nl80211 = l_genl_family_new(data->genl, NL80211_GENL_NAME);
wiphy_list = l_queue_new();
msg = l_genl_msg_new(NL80211_CMD_GET_WIPHY); msg = l_genl_msg_new(NL80211_CMD_GET_WIPHY);
if (!l_genl_family_dump(data->nl80211, msg, wiphy_dump_callback, if (!l_genl_family_dump(data->nl80211, msg, wiphy_dump_callback,
data, wiphy_dump_done)) data, wiphy_dump_done))
l_error("Getting all wiphy devices failed"); l_error("Getting all wiphy devices failed");
}
static void nl80211_vanished(void *user_data)
{
l_debug("Lost nl80211 interface");
return;
done:
l_main_quit(); l_main_quit();
} }
@ -2480,12 +2484,9 @@ static void start_hw_discovery(void)
{ {
struct nl_data *data = l_new(struct nl_data, 1); struct nl_data *data = l_new(struct nl_data, 1);
data->genl = l_genl_new_default(); data->genl = l_genl_new();
data->nl80211 = l_genl_family_new(data->genl, NL80211_GENL_NAME); l_genl_request_family(data->genl, NL80211_GENL_NAME,
nl80211_requested, data, NULL);
l_genl_family_set_watches(data->nl80211, nl80211_appeared,
nl80211_vanished, data, NULL);
/* /*
* This is somewhat of a mystery, but it appears that * This is somewhat of a mystery, but it appears that
* calling lshw causes the OS to re-enumerate the USB * calling lshw causes the OS to re-enumerate the USB