From 666e83479f4fc9ea78c9aa42ca923b0f57c32e17 Mon Sep 17 00:00:00 2001 From: Koen Zandberg <koen@bergzand.net> Date: Sat, 1 Dec 2018 17:50:00 +0100 Subject: [PATCH] kw2xrf: Fetch short addr from device This change modifies the kw2xrf_get_addr_short function to retrieve the short address from the device and not from netdev --- drivers/kw2xrf/kw2xrf_getset.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/kw2xrf/kw2xrf_getset.c b/drivers/kw2xrf/kw2xrf_getset.c index 3aad766e51..e0a3b0ab97 100644 --- a/drivers/kw2xrf/kw2xrf_getset.c +++ b/drivers/kw2xrf/kw2xrf_getset.c @@ -293,7 +293,11 @@ void kw2xrf_set_addr_long(kw2xrf_t *dev, uint64_t addr) uint16_t kw2xrf_get_addr_short(kw2xrf_t *dev) { - return (dev->netdev.short_addr[0] << 8) | dev->netdev.short_addr[1]; + uint16_t addr; + uint8_t *ap = (uint8_t *)(&addr); + kw2xrf_read_iregs(dev, MKW2XDMI_MACSHORTADDRS0_LSB, ap, + IEEE802154_SHORT_ADDRESS_LEN); + return byteorder_swaps(addr); } uint64_t kw2xrf_get_addr_long(kw2xrf_t *dev) -- GitLab