From patchwork Wed Sep 14 12:03:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schmidt X-Patchwork-Id: 9331303 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 66DAD60231 for ; Wed, 14 Sep 2016 12:13:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 592ED29CBC for ; Wed, 14 Sep 2016 12:13:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4DF3929CBE; Wed, 14 Sep 2016 12:13:25 +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 10DA829CBF for ; Wed, 14 Sep 2016 12:13:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760285AbcINMNW (ORCPT ); Wed, 14 Sep 2016 08:13:22 -0400 Received: from proxima.lasnet.de ([78.47.171.185]:58362 "EHLO proxima.lasnet.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755632AbcINMNV (ORCPT ); Wed, 14 Sep 2016 08:13:21 -0400 Received: from localhost.localdomain (p2003004809255E629A8389FFFE20FF3F.dip0.t-ipconnect.de [IPv6:2003:48:925:5e62:9a83:89ff:fe20:ff3f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: stefan@sostec.de) by proxima.lasnet.de (Postfix) with ESMTPSA id 4B5B9C5175; Wed, 14 Sep 2016 14:04:03 +0200 (CEST) From: Stefan Schmidt To: linux-wpan@vger.kernel.org Cc: Alexander Aring , Stefan Schmidt Subject: [PATCH wpan-tools 2/2] info: pretty print tx powers output Date: Wed, 14 Sep 2016 14:03:53 +0200 Message-Id: <1473854633-4391-3-git-send-email-stefan@osg.samsung.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1473854633-4391-1-git-send-email-stefan@osg.samsung.com> References: <1473854633-4391-1-git-send-email-stefan@osg.samsung.com> Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add unit, some spacing and break lines to make the output easier to understand and read. Fixes #7 Signed-off-by: Stefan Schmidt --- src/info.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/info.c b/src/info.c index b06093b..9261454 100644 --- a/src/info.c +++ b/src/info.c @@ -372,11 +372,18 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) if (tb_caps[NL802154_CAP_ATTR_TX_POWERS]) { int rem_pwrs; + int counter = 0; struct nlattr *nl_pwrs; printf("\ttx_powers: "); - nla_for_each_nested(nl_pwrs, tb_caps[NL802154_CAP_ATTR_TX_POWERS], rem_pwrs) - printf("%.3g,", MBM_TO_DBM(nla_get_s32(nl_pwrs))); + nla_for_each_nested(nl_pwrs, tb_caps[NL802154_CAP_ATTR_TX_POWERS], rem_pwrs) { + if (counter % 6 == 0) { + printf("\n\t\t\t%.3g dBM, ", MBM_TO_DBM(nla_get_s32(nl_pwrs))); + } else { + printf("%.3g dBM, ", MBM_TO_DBM(nla_get_s32(nl_pwrs))); + } + counter++; + } /* TODO */ printf("\b \n"); }