xtensa/esp32s3: add wapi support for getting country code

commands on ESP32-S3
This commit is contained in:
nuttxs 2024-10-14 09:51:05 +08:00 committed by Xiang Xiao
parent 41c4e3a5a1
commit 9308675686
2 changed files with 13 additions and 1 deletions

View file

@ -5884,7 +5884,15 @@ int esp_wifi_sta_country(struct iwreq *iwr, bool set)
}
else
{
return -ENOSYS;
memset(&country, 0x00, sizeof(wifi_country_t));
ret = esp_wifi_get_country(&country);
if (ret)
{
wlerr("Failed to get country info ret=%d\n", ret);
return wifi_errno_trans(ret);
}
memcpy(iwr->u.data.pointer, country.cc, 2);
}
return OK;

View file

@ -1377,6 +1377,10 @@ static int wlan_ioctl(struct net_driver_s *dev,
ret = ops->country(iwr, true);
break;
case SIOCGIWCOUNTRY: /* Set country code */
ret = ops->country(iwr, false);
break;
case SIOCGIWSENS: /* Get sensitivity (dBm) */
ret = ops->rssi(iwr, false);
break;