-
Notifications
You must be signed in to change notification settings - Fork 492
Description
I'm not sure if this is a bug or not, but sdk_wifi_station_scan doesn't seem to work properly for 32 character SSID's. Example output from wifi_scan example:
----------------------------------------------------------------------------------
Wi-Fi networks
----------------------------------------------------------------------------------
UPC240176871 (70:85:c6:e5:5b:7e) RSSI: -87, security: WPA2/PSK
7GPowerOverWifi_MSDos_compatible␆�␃ (38:43:7d:8e:3a:32) RSSI: -44, security: WPA2/PSK
012345678901234567890123456789 (b0:89:00:22:00:48) RSSI: -42, security: WPA2/PSK
Second wifi name should be "7GPowerOverWifi_MSDos_compatible", but there are extra unprintable characters at the end.
Connection to said wifi works fine, but the extra characters are printed on connection:
connected with 7GPowerOverWifi_MSDos_compatible␃␅␃, channel 6
One of the causes is probably in include/espressif/esp_sta.h:
struct sdk_station_config {
uint8_t ssid[32]; /* Null terminated string */
uint8_t password[64]; /* Null terminated string */
uint8_t bssid_set; /* One if bssid is used, otherwise zero. */
uint8_t bssid[6]; /* The BSSID bytes */
};
All ssids are stored as uint8_t[32], which means that the 32 byte ssid shouldn't fit.
Another thing is the fact that in wifi_scan example any characters after 32 should be cut by:
printf("%32s (" MACSTR ") RSSI: %02d, security: %s\n", ssid, MAC2STR(bss->bssid), bss->rssi, auth_modes[bss->authmode]);
This means that printf string limiting isn't working. Indeed
printf("%2s","0123456789");
outputs
0123456789
However
%.*s
format seems to be working as expected.