From patchwork Mon Dec 1 15:53:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5413331 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1D6C0BEEA8 for ; Mon, 1 Dec 2014 15:54:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3CA5B2026C for ; Mon, 1 Dec 2014 15:54:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 57AE22014A for ; Mon, 1 Dec 2014 15:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753975AbaLAPxx (ORCPT ); Mon, 1 Dec 2014 10:53:53 -0500 Received: from mail-wg0-f54.google.com ([74.125.82.54]:64545 "EHLO mail-wg0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753964AbaLAPxw (ORCPT ); Mon, 1 Dec 2014 10:53:52 -0500 Received: by mail-wg0-f54.google.com with SMTP id l2so14558186wgh.41 for ; Mon, 01 Dec 2014 07:53:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=X1Z3fi7qeymxtYjm//0wbXxvm790kjjW67v7dNwSrNk=; b=Y6gI2CGDtvciQ671IG2W65QTuaR5IGtXV/BU2WamVkJ7w3r0SrJgN2OtpdDg2+RAqS heKn6aPYQrOjjHaRxGVizp8/TyjXYMViiflHaY4imWqC/NEl3EzF13gSPfi9vVJ/ShvP KYHYr4uES42JkvdDXsz/KGMP6IMW2RcbAKK2Gd1NuK0BzOOipXu788TTpFJQRzYWU9pa RB5WVDKtogmoE/TMu32sA/EH+WS15bPb5m1+NNktF+ZKg83ffXsq23+eQdV+ujb0vO0i nFWLt6KBMeU4BB4S0YzC2J1jo2I3z+Wp8UoXL/UkqTpSOMb5q5sEY/GiBeymVYvvDVOd gcrw== X-Gm-Message-State: ALoCoQmSTbkHnWq6pOTVSvVs3QAummCkhWzZ9RuHAiPMbmDeb0v9Yg9+WagDZMcW4snjMgiEvlVf X-Received: by 10.180.104.65 with SMTP id gc1mr9549583wib.46.1417449230782; Mon, 01 Dec 2014 07:53:50 -0800 (PST) Received: from athena.amr.corp.intel.com (85-250-108-142.bb.netvision.net.il. [85.250.108.142]) by mx.google.com with ESMTPSA id rx8sm28101207wjb.30.2014.12.01.07.53.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Dec 2014 07:53:50 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , "Luis R. Rodriguez" , Arik Nemtsov Subject: [PATCH v2 4/4] iw: support multiple regdom print Date: Mon, 1 Dec 2014 17:53:44 +0200 Message-Id: <1417449224-10293-4-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1417449224-10293-1-git-send-email-arik@wizery.com> References: <1417449224-10293-1-git-send-email-arik@wizery.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a phy is given, print only its regdomain. Otherwise, use the newly implement dump functionality to print all regdomains in the system. Signed-off-by: Arik Nemtsov --- reg.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/reg.c b/reg.c index a02c982..4e4c707 100644 --- a/reg.c +++ b/reg.c @@ -114,7 +114,6 @@ COMMAND(reg, set, "", "Notify the kernel about the current regulatory domain."); static int print_reg_handler(struct nl_msg *msg, void *arg) - { #define PARSE_FLAG(nl_flag, string_value) do { \ if ((flags & nl_flag)) { \ @@ -150,6 +149,13 @@ static int print_reg_handler(struct nl_msg *msg, void *arg) return NL_SKIP; } + if (tb_msg[NL80211_ATTR_WIPHY]) + printf("phy#%d%s\n", nla_get_u32(tb_msg[NL80211_ATTR_WIPHY]), + tb_msg[NL80211_ATTR_WIPHY_SELF_MANAGED_REG] ? + " (self-managed)" : ""); + else + printf("global\n"); + if (tb_msg[NL80211_ATTR_DFS_REGION]) dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]); else @@ -216,7 +222,9 @@ static int print_reg_handler(struct nl_msg *msg, void *arg) printf("\n"); } - return NL_OK; + + printf("\n"); + return NL_SKIP; #undef PARSE_FLAG } @@ -229,5 +237,8 @@ static int handle_reg_get(struct nl80211_state *state, nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, print_reg_handler, NULL); return 0; } -COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_NONE, handle_reg_get, +COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, NLM_F_DUMP, CIB_NONE, + handle_reg_get, "Print out the kernel's current regulatory domain information."); +COMMAND(reg, get, NULL, NL80211_CMD_GET_REG, 0, CIB_PHY, handle_reg_get, + "Print out the devices' current regulatory domain information.");