iw: print human readable radar events
PATCH 1/1 iw: print human readable radar events
Signed-off-by Helmut Schaa <[email protected]>
--- event.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
event.c +25 -0
@@ -565,6 +565,31 @@ static int print_event(struct nl_msg *msg, void *arg)nla_data (tb[NL80211_ATTR_VENDOR_DATA ]), nla_len(tb[NL80211_ATTR_VENDOR_DATA]));break ; +case NL80211_CMD_RADAR_DETECT : +printf ("radar event " ); +if (tb[NL80211_ATTR_RADAR_EVENT ]) { +switch (nla_get_u32 (tb[NL80211_ATTR_RADAR_EVENT ])) { +case NL80211_RADAR_DETECTED : +printf ("(radar detected)" ); +break ; +case NL80211_RADAR_CAC_FINISHED : +printf ("(cac finished)" ); +break ; +case NL80211_RADAR_CAC_ABORTED : +printf ("(cac aborted)" ); +break ; +case NL80211_RADAR_NOP_FINISHED : +printf ("(nop finished)" ); +break ; +default : +printf ("(unknown)" ); +break ; + }; + }else { +printf ("(unknown)" ); + } +printf ("\n" ); +break ;default :printf ("unknown event %d (%s)\n" , gnlh->cmd,command_name (gnlh->cmd));
Signature · 1 line
1.8.4.5
event.c
Quoted 1 line · Helmut Schaa
event.c +0
-0
[]
Quoted 19 lines
event.c +15
-0@@ -565,6 +565,31 @@ static int print_event(struct nl_msg *msg, void *arg)nla_data (tb[NL80211_ATTR_VENDOR_DATA ]), nla_len(tb[NL80211_ATTR_VENDOR_DATA]));break ; +case NL80211_CMD_RADAR_DETECT : +printf ("radar event " ); +if (tb[NL80211_ATTR_RADAR_EVENT ]) { +switch (nla_get_u32 (tb[NL80211_ATTR_RADAR_EVENT ])) { +case NL80211_RADAR_DETECTED : +printf ("(radar detected)" ); +break ; +case NL80211_RADAR_CAC_FINISHED : +printf ("(cac finished)" ); +break ; +case NL80211_RADAR_CAC_ABORTED : +printf ("(cac aborted)" ); +break ; +case NL80211_RADAR_NOP_FINISHED : +printf ("(nop finished)" );
event.c static int print_event(struct nl_msg *msg, void *arg) · line 592
Quoted 10 lines
event.c +10
-0+break ; +default : +printf ("(unknown)" ); +break ; + }; + }else { +printf ("(unknown)" ); + } +printf ("\n" ); +break ;
Might be better with a const char * use
case NL80211_CMD_RADAR_DETECT: {
const char *type = "unknown";
if (tb[NL80211_ATTR_RADAR_EVENT]) {
switch (nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT])) {
case NL80211_RADAR_DETECTED:
type = "radar detected";
break;
case NL80211_RADAR_CAC_FINISHED:
type = "cac finished";
break;
case NL80211_RADAR_CAC_ABORTED:
type = "cac aborted";
break;
case NL80211_RADAR_NOP_FINISHED:
type = "nop finished";
break;
}
}
printf("radar event: (%s)\n", type);
}Quoted 1 line · Joe Perches
Might be better with a const char * use
Yeah, could do that.
However, this is consistent with the rest of the code in iw, so should be fine as is.
Thanks,
Helmut
Johannes Berg
AppliedApplied.
johannes