Skip to contentSkip to conversation

phy: fix cca ed level parameter parsing

PATCH In review Alexander Aring 2 participants 6 messages May 27, 2015 IEEE 802.15.4

lore
Share & tools
lore

Alexander Aring

author maintainer
#0 lore raw

PATCH 1/3 phy: fix cca ed level parameter parsing

This patch fix the parsing of cca ed level parameter which is now an floating point dbm value.

---
 src/phy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/phy.c +2 -2
index 285801c..8adffcc 100644
@@ -121,14 +121,14 @@ static int handle_cca_ed_level(struct nl802154_state *state,
 			       int argc, char **argv,
 			       enum id_input id)
 {
-	long level;
+	float level;
 	char *end;
 
 	if (argc < 1)
 		return 1;
 
 	/* CCA_ED_LEVEL */
-	level = strtol(argv[0], &end, 10);
+	level = strtof(argv[0], &end);
 	if (*end != '\0')
 		return 1;
 
Signature · 1 line
2.4.1
author maintainer
#1 lore raw

PATCH 2/3 info: fix tx power printout

This patch uses the format string "%.3g" instead "%.2g" for current tx power value. This is the same format string like we use to printout all supported tx power values.

---
 src/info.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/info.c +1 -1
index b74442d..79b101e 100644
@@ -95,7 +95,7 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 	}
 
 	if (tb_msg[NL802154_ATTR_TX_POWER])
-		printf("tx_power: %.2g\n", MBM_TO_DBM(nla_get_s32(tb_msg[NL802154_ATTR_TX_POWER])));
+		printf("tx_power: %.3g\n", MBM_TO_DBM(nla_get_s32(tb_msg[NL802154_ATTR_TX_POWER])));
 
 	if (tb_msg[NL802154_ATTR_WPAN_PHY_CAPS]) {
 		struct nlattr *tb_caps[NL802154_CAP_ATTR_MAX + 1];
Signature · 1 line
2.4.1
author maintainer
#3 lore raw

PATCH 3/3 info: add support for cca ed level info

In reply to Alexander Aring

This patch adds support for dumping the current cca ed level value.

---
 src/info.c | 3 +++
 1 file changed, 3 insertions(+)
src/info.c +3 -0
index 79b101e..e8f5dda 100644
@@ -94,6 +94,9 @@ static int print_phy_handler(struct nl_msg *msg, void *arg)
 		printf("\n");
 	}
 
+	if (tb_msg[NL802154_ATTR_CCA_ED_LEVEL])
+		printf("cca_ed_level: %.3g\n", MBM_TO_DBM(nla_get_s32(tb_msg[NL802154_ATTR_CCA_ED_LEVEL])));
+
 	if (tb_msg[NL802154_ATTR_TX_POWER])
 		printf("tx_power: %.3g\n", MBM_TO_DBM(nla_get_s32(tb_msg[NL802154_ATTR_TX_POWER])));
 
Signature · 1 line
2.4.1