3 @@ -61,6 +61,31 @@ 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));
27 + snprintf(cur, sizeof(buf) - (cur - buf), "] ");
32 static int print_sta_handler(struct nl_msg *msg, void *arg)
34 struct nlattr *tb[NL80211_ATTR_MAX + 1];
35 @@ -81,7 +106,10 @@ static int print_sta_handler(struct nl_m
36 [NL80211_STA_INFO_PLINK_STATE] = { .type = NLA_U8 },
37 [NL80211_STA_INFO_TX_RETRIES] = { .type = NLA_U32 },
38 [NL80211_STA_INFO_TX_FAILED] = { .type = NLA_U32 },
39 + [NL80211_STA_INFO_CHAIN_SIGNAL] = { .type = NLA_NESTED },
40 + [NL80211_STA_INFO_CHAIN_SIGNAL_AVG] = { .type = NLA_NESTED },
44 nla_parse(tb, NL80211_ATTR_MAX, genlmsg_attrdata(gnlh, 0),
45 genlmsg_attrlen(gnlh, 0), NULL);
46 @@ -128,12 +156,18 @@ static int print_sta_handler(struct nl_m
47 if (sinfo[NL80211_STA_INFO_TX_FAILED])
48 printf("\n\ttx failed:\t%u",
49 nla_get_u32(sinfo[NL80211_STA_INFO_TX_FAILED]));
51 + chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL]);
52 if (sinfo[NL80211_STA_INFO_SIGNAL])
53 - printf("\n\tsignal: \t%d dBm",
54 - (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]));
55 + printf("\n\tsignal: \t%d %sdBm",
56 + (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL]),
59 + chain = get_chain_signal(sinfo[NL80211_STA_INFO_CHAIN_SIGNAL_AVG]);
60 if (sinfo[NL80211_STA_INFO_SIGNAL_AVG])
61 - printf("\n\tsignal avg:\t%d dBm",
62 - (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]));
63 + printf("\n\tsignal avg:\t%d %sdBm",
64 + (int8_t)nla_get_u8(sinfo[NL80211_STA_INFO_SIGNAL_AVG]),
67 print_sta_bitrate(sinfo[NL80211_STA_INFO_TX_BITRATE], "tx bitrate");
68 print_sta_bitrate(sinfo[NL80211_STA_INFO_RX_BITRATE], "rx bitrate");