Skip to content

Commit

Permalink
xtensa/esp32s3: add wapi support for getting country code
Browse files Browse the repository at this point in the history
commands on ESP32-S3
  • Loading branch information
nuttxs committed Oct 14, 2024
1 parent 976c417 commit 0e7db60
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/xtensa/src/esp32s3/esp32s3_wifi_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions arch/xtensa/src/esp32s3/esp32s3_wlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0e7db60

Please sign in to comment.