mirror of
https://github.com/apache/nuttx.git
synced 2026-09-22 14:41:29 +08:00
wireless/bcm43xxx: add get country code support
Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
@@ -1781,3 +1781,33 @@ int bcmf_wl_set_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr)
|
||||
|
||||
return bcmf_wl_set_country_code(priv, interface, iwr->u.data.pointer);
|
||||
}
|
||||
|
||||
int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr)
|
||||
{
|
||||
uint8_t country[4] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
uint32_t out_len;
|
||||
int interface;
|
||||
int ret;
|
||||
|
||||
interface = bcmf_wl_get_interface(priv, iwr);
|
||||
|
||||
if (interface < 0 || iwr->u.data.pointer == NULL)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
out_len = sizeof(country);
|
||||
ret = bcmf_cdc_iovar_request(priv, interface, false,
|
||||
IOVAR_STR_COUNTRY, country,
|
||||
&out_len);
|
||||
if (ret == OK)
|
||||
{
|
||||
memcpy(iwr->u.data.pointer, country, 2);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -183,5 +183,6 @@ int bcmf_wl_get_rssi(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
||||
int bcmf_wl_get_iwrange(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
||||
|
||||
int bcmf_wl_set_country(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
||||
int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
||||
|
||||
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_DRIVER_H */
|
||||
|
||||
@@ -1137,6 +1137,10 @@ static int bcmf_ioctl(FAR struct net_driver_s *dev, int cmd,
|
||||
ret = bcmf_wl_set_country(priv, (struct iwreq *)arg);
|
||||
break;
|
||||
|
||||
case SIOCGIWCOUNTRY: /* Get country code */
|
||||
ret = bcmf_wl_get_country(priv, (struct iwreq *)arg);
|
||||
break;
|
||||
|
||||
default:
|
||||
nerr("ERROR: Unrecognized IOCTL command: %x\n", cmd);
|
||||
ret = -ENOTTY; /* Special return value for this case */
|
||||
|
||||
Reference in New Issue
Block a user