wireless/ieee802154: Finishes promiscuous mode IOCTL

This commit is contained in:
Anthony Merlino 2017-05-03 21:52:43 -04:00
parent 2c57c3f83b
commit abc15c8429
2 changed files with 33 additions and 8 deletions

View File

@ -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 */

View File

@ -1493,16 +1493,38 @@ 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;
}