[PATCH wpan-tools] info: change dbm format string

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

 



This patch changes the dbm format string to %.3g instead %.2g. The
reason is that it shows not well for a 3-digit number like "-100" is
shown as "-1e+02". A format string of %.3g will fix that.

Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
Reported-by: Craig Younkins <craig@xxxxxxxxxxxxx>
---
 src/info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/info.c b/src/info.c
index c749866..b74442d 100644
--- a/src/info.c
+++ b/src/info.c
@@ -163,7 +163,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 
 			printf("\ttx_powers: ");
 			nla_for_each_nested(nl_pwrs, tb_caps[NL802154_CAP_ATTR_TX_POWERS], rem_pwrs)
-				printf("%.2g,", MBM_TO_DBM(nla_get_s32(nl_pwrs)));
+				printf("%.3g,", MBM_TO_DBM(nla_get_s32(nl_pwrs)));
 			/* TODO */
 			printf("\b \n");
 		}
@@ -174,7 +174,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 
 			printf("\tcca_ed_levels: ");
 			nla_for_each_nested(nl_levels, tb_caps[NL802154_CAP_ATTR_CCA_ED_LEVELS], rem_levels)
-				printf("%.2g,", MBM_TO_DBM(nla_get_s32(nl_levels)));
+				printf("%.3g,", MBM_TO_DBM(nla_get_s32(nl_levels)));
 			/* TODO */
 			printf("\b \n");
 		}
-- 
2.3.7

--
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