diff mbox

[wpan-tools,2/2] info: pretty print tx powers output

Message ID 1473854633-4391-3-git-send-email-stefan@osg.samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Stefan Schmidt Sept. 14, 2016, 12:03 p.m. UTC
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 mbox

Patch

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