diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2015-09-25 10:42:30 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2015-09-25 10:42:30 +0200 |
commit | e1203ca62ac13f29185e077b88d8cde0068188ed (patch) | |
tree | f6b49e510ade1408f66e56056095b1738e0beb84 | |
parent | 83ab6e51c36f88d24fd3e55fd99a08756cc12fc9 (diff) |
use NL80211_RATE_INFO_BITRATE (16-bit)
NL80211_RATE_INFO_BITRATE32 is not available widely enough yet (the libc
used by travis doesn’t have it yet, for example).
-rw-r--r-- | src/print_wireless_info.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/print_wireless_info.c b/src/print_wireless_info.c index cd95562..3410ba9 100644 --- a/src/print_wireless_info.c +++ b/src/print_wireless_info.c @@ -144,7 +144,7 @@ static int gwi_sta_cb(struct nl_msg *msg, void *data) { }; static struct nla_policy rate_policy[NL80211_RATE_INFO_MAX + 1] = { - [NL80211_RATE_INFO_BITRATE32] = {.type = NLA_U32}, + [NL80211_RATE_INFO_BITRATE] = {.type = NLA_U16}, }; if (nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0), genlmsg_attrlen(gnlh, 0), NULL) < 0) @@ -162,12 +162,12 @@ static int gwi_sta_cb(struct nl_msg *msg, void *data) { if (nla_parse_nested(rinfo, NL80211_RATE_INFO_MAX, sinfo[NL80211_STA_INFO_RX_BITRATE], rate_policy)) return NL_SKIP; - if (rinfo[NL80211_RATE_INFO_BITRATE32] == NULL) + if (rinfo[NL80211_RATE_INFO_BITRATE] == NULL) return NL_SKIP; - // NL80211_RATE_INFO_BITRATE32 is specified in units of 100 kbit/s, but iw + // NL80211_RATE_INFO_BITRATE is specified in units of 100 kbit/s, but iw // used to specify bit/s, so we convert to use the same code path. - info->bitrate = nla_get_u32(rinfo[NL80211_RATE_INFO_BITRATE32]) * 100 * 1000; + info->bitrate = (int)nla_get_u16(rinfo[NL80211_RATE_INFO_BITRATE]) * 100 * 1000; return NL_SKIP; } |