bcm63xx: add initial support for bcm6368 boards
[openwrt.git] / package / iw / patches / 110-per_chain_signal_strength.patch
1 --- a/station.c
2 +++ b/station.c
3 @@ -61,6 +61,33 @@ static void print_sta_bitrate(struct nla
4 }
5 }
6
7 +static char *get_chain_signal(struct nlattr *attr_list)
8 +{
9 + struct nlattr *attr;
10 + static char buf[64];
11 + char *cur = buf;
12 + int i = 0, rem;
13 + const char *prefix;
14 +
15 + if (!attr_list)
16 + return "";
17 +
18 + nla_for_each_nested(attr, attr_list, rem) {
19 + if (i++ > 0)
20 + prefix = ", ";
21 + else
22 + prefix = "[";
23 +
24 + cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix,
25 + (int8_t) nla_get_u8(attr));
26 + }
27 +
28 + if (i)
29 + snprintf(cur, sizeof(buf) - (cur - buf), "] ");
30 +
31 + return buf;
32 +}
33 +
34 static int print_sta_handler(struct nl_msg *msg, void *arg)
35 {
36 struct nlattr *tb[NL80211_ATTR_MAX + 1];
37 @@ -84,7 +111,10 @@ static int print_sta_handler(struct nl_m
38 [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
39 [NL80211_STA_INFO_STA_FLAGS] =
40 { .minlen = sizeof(struct nl80211_sta_flag_update) },
41 + [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
42 + [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
43 };
44 + char *chain;
45
46 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
47 genlmsg_attrlen(gnlh, 0), NULL);
48 @@ -131,12 +161,18 @@ static int print_sta_handler(struct nl_m
49 if (sinfo[NL80211_STA_INFO_TX_FAILED])
50 printf("\n\ttx failed:\t%u",
51 nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED]));
52 +
53 + chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
54 if (sinfo[NL80211_STA_INFO_SIGNAL])
55 - printf("\n\tsignal: \t%d dBm",
56 - (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
57 + printf("\n\tsignal: \t%d %sdBm",
58 + (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
59 + chain);
60 +
61 + chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
62 if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
63 - printf("\n\tsignal avg:\t%d dBm",
64 - (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]));
65 + printf("\n\tsignal avg:\t%d %sdBm",
66 + (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
67 + chain);
68
69 print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate");
70 print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate");
This page took 0.050706 seconds and 5 git commands to generate.