diff --git a/include/nuttx/wireless/ieee802154/ieee802154_mac.h b/include/nuttx/wireless/ieee802154/ieee802154_mac.h index 87efa3662cc..9ab06ada2fa 100644 --- a/include/nuttx/wireless/ieee802154/ieee802154_mac.h +++ b/include/nuttx/wireless/ieee802154/ieee802154_mac.h @@ -227,7 +227,10 @@ enum ieee802154_status_e IEEE802154_STATUS_TRANSACTION_OVERFLOW, IEEE802154_STATUS_TX_ACTIVE, IEEE802154_STATUS_UNAVAILABLE_KEY, - IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE + IEEE802154_STATUS_UNSUPPORTED_ATTRIBUTE, + IEEE802154_STATUS_FAILED /* This value is not outlined in the standard. It is + * a catch-all for any failures that are not outlined + * in the standard */ }; /* IEEE 802.15.4 PHY/MAC PIB attributes IDs */ diff --git a/wireless/ieee802154/mac802154.c b/wireless/ieee802154/mac802154.c index 2b373a51da0..be79dad0295 100644 --- a/wireless/ieee802154/mac802154.c +++ b/wireless/ieee802154/mac802154.c @@ -1493,17 +1493,39 @@ int mac802154_req_set(MACHANDLE mac, FAR struct ieee802154_set_req_s *req) { case IEEE802154_PIB_MAC_EXTENDED_ADDR: { - /* Set the attribute in the structure to the new value */ - - memcpy(&priv->addr.eaddr[0], &req->attr_value.eaddr[0], 8); - - - /* The radio device needs to be updated as well */ + /* Update the radio's extended address */ memcpy(&radio_arg.eaddr[0], &priv->addr.eaddr[0], 8); ret = priv->radio->ops->ioctl(priv->radio, PHY802154IOC_SET_EADDR, (unsigned long)&radio_arg); - + if (ret < 0) + { + return -IEEE802154_STATUS_FAILED; + } + + /* Set the attribute in the table */ + + memcpy(&priv->addr.eaddr[0], &req->attr_value.eaddr[0], 8); + + ret = IEEE802154_STATUS_SUCCESS; + } + break; + case IEEE802154_PIB_MAC_PROMISCUOUS_MODE: + { + /* Try and enable/disable promiscuous mode at the radio */ + + radio_arg.promisc = priv->promisc_mode; + ret = priv->radio->ops->ioctl(priv->radio, PHY802154IOC_SET_PROMISC, + (unsigned long)&radio_arg); + if (ret < 0) + { + return -IEEE802154_STATUS_FAILED; + } + + /* Set the attribute in the table */ + + priv->promisc_mode = req->attr_value.promics_mode; + ret = IEEE802154_STATUS_SUCCESS; } break;