[PATCH wpan-tools 6/6] phy: add support for cca mode 3 and/or handling

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

 



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

diff --git a/src/nl802154.h b/src/nl802154.h
index 963feda..904bebb 100644
--- a/src/nl802154.h
+++ b/src/nl802154.h
@@ -83,6 +83,7 @@ enum nl802154_attrs {
 	NL802154_ATTR_TX_POWER,
 
 	NL802154_ATTR_CCA_MODE,
+	NL802154_ATTR_CCA_MODE3_AND,
 
 	NL802154_ATTR_MAX_FRAME_RETRIES,
 
diff --git a/src/phy.c b/src/phy.c
index cfdf056..1698cc2 100644
--- a/src/phy.c
+++ b/src/phy.c
@@ -100,7 +100,7 @@ static int handle_cca_mode_set(struct nl802154_state *state,
 			       int argc, char **argv,
 			       enum id_input id)
 {
-	unsigned long cca_mode;
+	unsigned long cca_mode, cca_mode3_and;
 	char *end;
 
 	if (argc < 1)
@@ -111,6 +111,18 @@ static int handle_cca_mode_set(struct nl802154_state *state,
 	if (*end != '\0')
 		return 1;
 
+	if (cca_mode == 3) {
+		if (argc < 2)
+			return 1;
+
+		/* CCA_MODE */
+		cca_mode3_and = strtoul(argv[1], &end, 10);
+		if (*end != '\0')
+			return 1;
+
+		NLA_PUT_U8(msg, NL802154_ATTR_CCA_MODE3_AND, cca_mode3_and);
+	}
+
 	NLA_PUT_U8(msg, NL802154_ATTR_CCA_MODE, cca_mode);
 
 	return 0;
@@ -118,5 +130,5 @@ static int handle_cca_mode_set(struct nl802154_state *state,
 nla_put_failure:
 	return -ENOBUFS;
 }
-COMMAND(set, cca_mode, "<mode>",
+COMMAND(set, cca_mode, "<mode|3 <1|0>>",
 	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