From 40b4af190524ecacc10acec49f187d4172189024 Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sat, 17 Nov 2018 22:51:35 +0100 Subject: [PATCH 1/2] cc2538_rf: Add NETOPT_CHANNEL to getters --- cpu/cc2538/radio/cc2538_rf_netdev.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index e63e610d9e..171656da41 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -59,6 +59,13 @@ static int _get(netdev_t *netdev, netopt_t opt, void *value, size_t max_len) } return sizeof(netopt_enable_t); + case NETOPT_CHANNEL: + if (max_len < sizeof(uint16_t)) { + return -EOVERFLOW; + } + *((uint16_t *)value) = (uint16_t)cc2538_get_chan(); + return sizeof(uint16_t); + case NETOPT_CHANNEL_PAGE: if (max_len < sizeof(uint16_t)) { return -EOVERFLOW; From 897044623a6e4055ee8252262caf235a3cd016ca Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Sat, 17 Nov 2018 22:51:59 +0100 Subject: [PATCH 2/2] cc2538_rf: Don't propagate channel to 802154 layer --- cpu/cc2538/radio/cc2538_rf_netdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cpu/cc2538/radio/cc2538_rf_netdev.c b/cpu/cc2538/radio/cc2538_rf_netdev.c index 171656da41..dbe216be8e 100644 --- a/cpu/cc2538/radio/cc2538_rf_netdev.c +++ b/cpu/cc2538/radio/cc2538_rf_netdev.c @@ -175,6 +175,7 @@ static int _set(netdev_t *netdev, netopt_t opt, const void *value, size_t value_ } else { cc2538_set_chan(chan); + res = sizeof(uint16_t); } } break;