Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: wifi: esp_at: escape SSID and PSK #69223

Conversation

mniestroj
Copy link
Member

@mniestroj mniestroj commented Feb 20, 2024

According to [1], SSID and PSK need to be escaped:

Escape character syntax is needed if SSID or password contains any
special characters, such as , or " or \

Implement character escaping to fix connection attempt to WiFi APs
containing special characters as part of SSID, like "My_2,4GHz_AP".
Increase "connect command" buffer length to handle worst-case scenario of
all the SSID and PSK characters being special characters.

[1] https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32/AT_Command_Set/Wi-Fi_AT_Commands.html#id6

Fixes: #69222

jukkar
jukkar previously approved these changes Feb 20, 2024
According to [1], SSID and PSK need to be escaped:

  Escape character syntax is needed if SSID or password contains any
  special characters, such as , or " or \

Implement character escaping to fix connection attempt to WiFi APs
containing special characters as part of SSID, like "My_2,4GHz_AP".
Increase "connect command" buffer length to handle worst-case scenario of
all the SSID and PSK characters being special characters.

[1] https://docs.espressif.com/projects/esp-at/en/release-v2.4.0.0/esp32/AT_Command_Set/Wi-Fi_AT_Commands.html#id6

Signed-off-by: Marcin Niestroj <[email protected]>
@mniestroj mniestroj force-pushed the wifi-esp-at-escape-ssid-and-psk branch from 51ccf22 to 20d5357 Compare February 20, 2024 18:43
rlubos
rlubos previously approved these changes Feb 21, 2024
SSIDs can contains commas (,) when receiving scan results (+CWLAP) or
status (+CWJAP) over AT command from ESP-AT chip. This is in conflict with
modem subsystem argument parsing, which separates arguments automatically
whenever comma is encountered.

Use a direct modem command parsing, so that commas within quoted strings
are taken into account to be part of that string, instead of being treated
as delimiter.

This solves `wifi scan` and `wifi status` Zephyr shell commands output, for
networks containing commas (like "My_2,4GHz_AP") as part of SSID.

Signed-off-by: Marcin Niestroj <[email protected]>
@mniestroj
Copy link
Member Author

Hi @jukkar @rlubos , could you please take another look? Thanks!

@fabiobaltieri fabiobaltieri merged commit a6b0600 into zephyrproject-rtos:main Feb 28, 2024
17 checks passed
@mniestroj mniestroj deleted the wifi-esp-at-escape-ssid-and-psk branch February 28, 2024 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

wifi: esp_at: fail to connect to APs with SSID and/or PSK containing special characters
5 participants