diff --git a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c index 071c251647915..4db4390e7011a 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c +++ b/arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c @@ -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; diff --git a/arch/xtensa/src/esp32s3/esp32s3_wlan.c b/arch/xtensa/src/esp32s3/esp32s3_wlan.c index 638d802a9a9ac..d7c0578d0b86c 100644 --- a/arch/xtensa/src/esp32s3/esp32s3_wlan.c +++ b/arch/xtensa/src/esp32s3/esp32s3_wlan.c @@ -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;