All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Helmut Schaa <helmut.schaa@googlemail.com>
Cc: linux-wireless@vger.kernel.org,
	Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [PATCH] iw: print human readable radar events
Date: Fri, 30 Jan 2015 02:36:26 -0800	[thread overview]
Message-ID: <1422614186.2675.2.camel@perches.com> (raw)
In-Reply-To: <1422610964-23252-1-git-send-email-helmut.schaa@googlemail.com>

On Fri, 2015-01-30 at 10:42 +0100, Helmut Schaa wrote:
> diff --git a/event.c b/event.c
[]
> @@ -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;

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);
	}



  reply	other threads:[~2015-01-30 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30  9:42 [PATCH] iw: print human readable radar events Helmut Schaa
2015-01-30 10:36 ` Joe Perches [this message]
2015-02-02 10:01   ` Helmut Schaa
2015-03-03  8:37 ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1422614186.2675.2.camel@perches.com \
    --to=joe@perches.com \
    --cc=helmut.schaa@googlemail.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.