nl80211: Add a driver ops function to check WoWLAN status
Add function that returns whether WoWLAN has been enabled for the device or not. Signed-off-by: Alfonso Sanchez-Beato <alfonso.sanchez-beato@canonical.com>
This commit is contained in:
parent
59536a33d8
commit
82ba4f2d1b
2 changed files with 47 additions and 0 deletions
|
@ -3512,6 +3512,12 @@ struct wpa_driver_ops {
|
||||||
int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
|
int (*br_set_net_param)(void *priv, enum drv_br_net_param param,
|
||||||
unsigned int val);
|
unsigned int val);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* get_wowlan - Get wake-on-wireless status
|
||||||
|
* @priv: Private driver interface data
|
||||||
|
*/
|
||||||
|
int (*get_wowlan)(void *priv);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_wowlan - Set wake-on-wireless triggers
|
* set_wowlan - Set wake-on-wireless triggers
|
||||||
* @priv: Private driver interface data
|
* @priv: Private driver interface data
|
||||||
|
|
|
@ -9398,6 +9398,46 @@ static int nl80211_set_qos_map(void *priv, const u8 *qos_map_set,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int get_wowlan_handler(struct nl_msg *msg, void *arg)
|
||||||
|
{
|
||||||
|
struct nlattr *tb[NL80211_ATTR_MAX + 1];
|
||||||
|
struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
|
||||||
|
int *wowlan_enabled = arg;
|
||||||
|
|
||||||
|
nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
|
||||||
|
genlmsg_attrlen(gnlh, 0), NULL);
|
||||||
|
|
||||||
|
*wowlan_enabled = !!tb[NL80211_ATTR_WOWLAN_TRIGGERS];
|
||||||
|
|
||||||
|
return NL_SKIP;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static int nl80211_get_wowlan(void *priv)
|
||||||
|
{
|
||||||
|
struct i802_bss *bss = priv;
|
||||||
|
struct wpa_driver_nl80211_data *drv = bss->drv;
|
||||||
|
struct nl_msg *msg;
|
||||||
|
int wowlan_enabled;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: Getting wowlan status");
|
||||||
|
|
||||||
|
msg = nl80211_drv_msg(drv, 0, NL80211_CMD_GET_WOWLAN);
|
||||||
|
|
||||||
|
ret = send_and_recv_msgs(drv, msg, get_wowlan_handler, &wowlan_enabled);
|
||||||
|
if (ret) {
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: Getting wowlan status failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
wpa_printf(MSG_DEBUG, "nl80211: wowlan is %s",
|
||||||
|
wowlan_enabled ? "enabled" : "disabled");
|
||||||
|
|
||||||
|
return wowlan_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static int nl80211_set_wowlan(void *priv,
|
static int nl80211_set_wowlan(void *priv,
|
||||||
const struct wowlan_triggers *triggers)
|
const struct wowlan_triggers *triggers)
|
||||||
{
|
{
|
||||||
|
@ -11269,6 +11309,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
|
||||||
#endif /* ANDROID */
|
#endif /* ANDROID */
|
||||||
.vendor_cmd = nl80211_vendor_cmd,
|
.vendor_cmd = nl80211_vendor_cmd,
|
||||||
.set_qos_map = nl80211_set_qos_map,
|
.set_qos_map = nl80211_set_qos_map,
|
||||||
|
.get_wowlan = nl80211_get_wowlan,
|
||||||
.set_wowlan = nl80211_set_wowlan,
|
.set_wowlan = nl80211_set_wowlan,
|
||||||
.set_mac_addr = nl80211_set_mac_addr,
|
.set_mac_addr = nl80211_set_mac_addr,
|
||||||
#ifdef CONFIG_MESH
|
#ifdef CONFIG_MESH
|
||||||
|
|
Loading…
Reference in a new issue