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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Fixes #7

Signed-off-by: Stefan Schmidt <stefan@xxxxxxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux