]> git.ipfire.org Git - thirdparty/iw.git/commitdiff
iw: event: add sta opmode changed command
authorMarkus Theil <markus.theil@tu-ilmenau.de>
Tue, 10 Dec 2019 14:43:56 +0000 (15:43 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Fri, 13 Dec 2019 09:43:41 +0000 (10:43 +0100)
Parsing this command helps tracking num spatial stream
and bandwidth changes.

Signed-off-by: Markus Theil <markus.theil@tu-ilmenau.de>
Link: https://lore.kernel.org/r/20191210144356.15377-1-markus.theil@tu-ilmenau.de
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
event.c

diff --git a/event.c b/event.c
index b0d75bd9eab8f19d9c81d3545e40dcbab4f660de..aaeca2cbbf3a0574fbf2e425e7d39e9cd0d269e1 100644 (file)
--- a/event.c
+++ b/event.c
@@ -731,6 +731,29 @@ static void parse_set_interface(struct nlattr **attrs)
        printf("\n");
 }
 
+static void parse_sta_opmode_changed(struct nlattr **attrs)
+{
+       char macbuf[ETH_ALEN*3];
+
+       printf("sta opmode changed");
+
+       if (attrs[NL80211_ATTR_MAC]) {
+               mac_addr_n2a(macbuf, nla_data(attrs[NL80211_ATTR_MAC]));
+               printf(" %s", macbuf);
+       }
+
+       if (attrs[NL80211_ATTR_SMPS_MODE])
+               printf(" smps mode %d", nla_get_u8(attrs[NL80211_ATTR_SMPS_MODE]));
+
+       if (attrs[NL80211_ATTR_CHANNEL_WIDTH])
+               printf(" chan width %d", nla_get_u8(attrs[NL80211_ATTR_CHANNEL_WIDTH]));
+
+       if (attrs[NL80211_ATTR_NSS])
+               printf(" nss %d", nla_get_u8(attrs[NL80211_ATTR_NSS]));
+
+       printf("\n");
+}
+
 static int print_event(struct nl_msg *msg, void *arg)
 {
        struct genlmsghdr *gnlh = nlmsg_data(nlmsg_hdr(msg));
@@ -1076,6 +1099,9 @@ static int print_event(struct nl_msg *msg, void *arg)
        case NL80211_CMD_SET_INTERFACE:
                parse_set_interface(tb);
                break;
+       case NL80211_CMD_STA_OPMODE_CHANGED:
+               parse_sta_opmode_changed(tb);
+               break;
        default:
                printf("unknown event %d (%s)\n",
                       gnlh->cmd, command_name(gnlh->cmd));