[PATCH wpan-tools 3/6] phy: add support for setting cca_mode

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

 



Signed-off-by: Alexander Aring <alex.aring@xxxxxxxxx>
---
 src/nl802154.h |  3 +++
 src/phy.c      | 27 +++++++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/src/nl802154.h b/src/nl802154.h
index 1af09ac..762fc38 100644
--- a/src/nl802154.h
+++ b/src/nl802154.h
@@ -44,6 +44,7 @@ enum nl802154_commands {
 	NL802154_CMD_SET_PAN_ID,
 
 	NL802154_CMD_SET_TX_POWER,
+	NL802154_CMD_SET_CCA_MODE,
 
 	/* add new commands above here */
 
@@ -75,6 +76,8 @@ enum nl802154_attrs {
 
 	NL802154_ATTR_TX_POWER,
 
+	NL802154_ATTR_CCA_MODE,
+
 	/* add attributes here, update the policy in nl802154.c */
 
 	__NL802154_ATTR_AFTER_LAST,
diff --git a/src/phy.c b/src/phy.c
index 811fc35..cfdf056 100644
--- a/src/phy.c
+++ b/src/phy.c
@@ -93,3 +93,30 @@ nla_put_failure:
 }
 COMMAND(set, tx_power, "<dBm>",
 	NL802154_CMD_SET_TX_POWER, 0, CIB_PHY, handle_tx_power_set, NULL);
+
+static int handle_cca_mode_set(struct nl802154_state *state,
+			       struct nl_cb *cb,
+			       struct nl_msg *msg,
+			       int argc, char **argv,
+			       enum id_input id)
+{
+	unsigned long cca_mode;
+	char *end;
+
+	if (argc < 1)
+		return 1;
+
+	/* CCA_MODE */
+	cca_mode = strtoul(argv[0], &end, 10);
+	if (*end != '\0')
+		return 1;
+
+	NLA_PUT_U8(msg, NL802154_ATTR_CCA_MODE, cca_mode);
+
+	return 0;
+
+nla_put_failure:
+	return -ENOBUFS;
+}
+COMMAND(set, cca_mode, "<mode>",
+	NL802154_CMD_SET_CCA_MODE, 0, CIB_PHY, handle_cca_mode_set, NULL);
-- 
2.1.0

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