2014-08-13 13:11:25

by Tomasz Bursztyka

[permalink] [raw]
Subject: [PATCH] event: Handle NEW_WIPHY/DEL_WIPHY events properly

A NEW_WIPHY event can be either a new device event or a renaming event
thus precising it in the output. A proper differenciation would require
iw to dump all the existing wiphy devices first to be able to know when
NEW_WIPHY is a newly created device or just a rename, but that's out of
the scope of event.c
Besides that, DEL_WIPHY is a known event, thus handling it as it should.

Signed-off-by: Tomasz Bursztyka <[email protected]>
---
event.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/event.c b/event.c
index 6775eb2..4dab241 100644
--- a/event.c
+++ b/event.c
@@ -310,7 +310,10 @@ static int print_event(struct nl_msg *msg, void *arg)

switch (gnlh->cmd) {
case NL80211_CMD_NEW_WIPHY:
- printf("renamed to %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
+ printf("new or renamed device: %s\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
+ break;
+ case NL80211_CMD_DEL_WIPHY:
+ printf("%s deleted\n", nla_get_string(tb[NL80211_ATTR_WIPHY_NAME]));
break;
case NL80211_CMD_TRIGGER_SCAN:
printf("scan started\n");
--
1.8.5.5



2014-08-15 13:04:37

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] event: Handle NEW_WIPHY/DEL_WIPHY events properly

What project is this for? Ok, I get it - iw, but please says so.

Also, please send patches to the maintainer (i.e. me) not just the list.

Thanks,
johannes