3 @@ -61,6 +61,33 @@ static void print_sta_bitrate(struct nla
7 +static char *get_chain_signal(struct nlattr *attr_list)
10 + static char buf[64];
18 + nla_for_each_nested(attr, attr_list, rem) {
24 + cur += snprintf(cur, sizeof(buf) - (cur - buf), "%s%d", prefix,
25 + (int8_t) nla_get_u8(attr));
29 + snprintf(cur, sizeof(buf) - (cur - buf), "] ");
34 static int print_sta_handler(struct nl_msg *msg, void *arg)
36 struct nlattr *tb[NL80211_ATTR_MAX + 1];
37 @@ -81,7 +108,10 @@ static int print_sta_handler(struct nl_m
38 [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
39 [NL80211_STA_INFO_TX_RETRIES] = { .type = NLA_U32 },
40 [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
41 + [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
42 + [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
46 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
47 genlmsg_attrlen(gnlh, 0), NULL);
48 @@ -128,12 +158,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]));
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]),
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]),
69 print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate");
70 print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate");