From patchwork Mon Nov 7 14:59:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Berg X-Patchwork-Id: 9415353 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7B7BB60585 for ; Mon, 7 Nov 2016 15:00:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CF4228C42 for ; Mon, 7 Nov 2016 15:00:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5CC3828C55; Mon, 7 Nov 2016 15:00:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1C0F28C42 for ; Mon, 7 Nov 2016 15:00:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932319AbcKGPAA (ORCPT ); Mon, 7 Nov 2016 10:00:00 -0500 Received: from s3.sipsolutions.net ([5.9.151.49]:36830 "EHLO sipsolutions.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932294AbcKGO76 (ORCPT ); Mon, 7 Nov 2016 09:59:58 -0500 Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1c3lOu-00031L-Fo; Mon, 07 Nov 2016 15:59:56 +0100 From: Benjamin Berg To: Johannes Berg Cc: linux-wireless@vger.kernel.org, sw@simonwunderlich.de, Benjamin Berg Subject: [PATCH 8/8] Print frequency of radar events. Date: Mon, 7 Nov 2016 15:59:43 +0100 Message-Id: <20161107145943.16761-9-benjamin@sipsolutions.net> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161107145943.16761-1-benjamin@sipsolutions.net> References: <20161107145943.16761-1-benjamin@sipsolutions.net> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Benjamin Berg Signed-off-by: Simon Wunderlich Signed-off-by: Benjamin Berg --- event.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/event.c b/event.c index 446debb..8014d73 100644 --- a/event.c +++ b/event.c @@ -584,30 +584,32 @@ 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)"); + case NL80211_CMD_RADAR_DETECT: { + enum nl80211_radar_event event_type; + uint32_t freq; + + if (!tb[NL80211_ATTR_RADAR_EVENT] || !tb[NL80211_ATTR_WIPHY_FREQ]) + printf("BAD radar event"); + freq = nla_get_u32(tb[NL80211_ATTR_WIPHY_FREQ]); + event_type = nla_get_u32(tb[NL80211_ATTR_RADAR_EVENT]); + + switch (event_type) { + case NL80211_RADAR_DETECTED: + printf("%d MHz: radar detected\n", freq); + break; + case NL80211_RADAR_CAC_FINISHED: + printf("%d MHz: CAC finished\n", freq); + break; + case NL80211_RADAR_CAC_ABORTED: + printf("%d MHz: CAC was aborted\n", freq); + break; + case NL80211_RADAR_NOP_FINISHED: + printf("%d MHz: NOP finished\n", freq); + break; + default: + printf("%d MHz: unknown radar event\n", freq); + } } - printf("\n"); break; case NL80211_CMD_DEL_WIPHY: printf("delete wiphy\n");