mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
wireless/ieee802154: Finishes promiscuous mode IOCTL
This commit is contained in:
@@ -227,7 +227,10 @@ enum ieee802154_status_e
|
|||||||
IEEE802154_STATUS_TRANSACTION_OVERFLOW,
|
IEEE802154_STATUS_TRANSACTION_OVERFLOW,
|
||||||
IEEE802154_STATUS_TX_ACTIVE,
|
IEEE802154_STATUS_TX_ACTIVE,
|
||||||
IEEE802154_STATUS_UNAVAILABLE_KEY,
|
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 */
|
/* IEEE 802.15.4 PHY/MAC PIB attributes IDs */
|
||||||
|
|||||||
@@ -1493,17 +1493,39 @@ int mac802154_req_set(MACHANDLE mac, FAR struct ieee802154_set_req_s *req)
|
|||||||
{
|
{
|
||||||
case IEEE802154_PIB_MAC_EXTENDED_ADDR:
|
case IEEE802154_PIB_MAC_EXTENDED_ADDR:
|
||||||
{
|
{
|
||||||
/* Set the attribute in the structure to the new value */
|
/* Update the radio's extended address */
|
||||||
|
|
||||||
memcpy(&priv->addr.eaddr[0], &req->attr_value.eaddr[0], 8);
|
|
||||||
|
|
||||||
|
|
||||||
/* The radio device needs to be updated as well */
|
|
||||||
|
|
||||||
memcpy(&radio_arg.eaddr[0], &priv->addr.eaddr[0], 8);
|
memcpy(&radio_arg.eaddr[0], &priv->addr.eaddr[0], 8);
|
||||||
ret = priv->radio->ops->ioctl(priv->radio, PHY802154IOC_SET_EADDR,
|
ret = priv->radio->ops->ioctl(priv->radio, PHY802154IOC_SET_EADDR,
|
||||||
(unsigned long)&radio_arg);
|
(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;
|
ret = IEEE802154_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user