[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-wpan
Subject:    [PATCH wpan-tools 2/2] info: pretty print tx powers output
From:       Stefan Schmidt <stefan () osg ! samsung ! com>
Date:       2016-09-14 12:03:53
Message-ID: 1473854633-4391-3-git-send-email-stefan () osg ! samsung ! com
[Download RAW message or body]

Add unit, some spacing and break lines to make the output easier to understand
and read.

Fixes #7

Signed-off-by: Stefan Schmidt <stefan@osg.samsung.com>
---
 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");
 		}
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-wpan" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic