diff --git a/esp-wifi/CHANGELOG.md b/esp-wifi/CHANGELOG.md index c3e00bf62..3f4c839d3 100644 --- a/esp-wifi/CHANGELOG.md +++ b/esp-wifi/CHANGELOG.md @@ -25,6 +25,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Allow `Configuration::None`, set country early, changed default power-save-mode to None (#3364) +- Enterprise WPA fixed for ESP32-S2 (#3406) + ### Removed ## [0.13.0] - 2025-02-24 diff --git a/esp-wifi/src/compat/misc.rs b/esp-wifi/src/compat/misc.rs index 2bea70854..6794619eb 100644 --- a/esp-wifi/src/compat/misc.rs +++ b/esp-wifi/src/compat/misc.rs @@ -83,6 +83,32 @@ unsafe extern "C" fn atoi(str: *const i8) -> i32 { res * sign } +// We cannot just use the ROM function since it calls `__getreent` +// +// From docs: The __getreent() function returns a per-task pointer to struct +// _reent in newlib libc. This structure is allocated on the TCB of each task. +// i.e. it assumes a FreeRTOS task calling it. +#[unsafe(no_mangle)] +pub unsafe extern "C" fn strcasecmp( + s1: *const core::ffi::c_char, + s2: *const core::ffi::c_char, +) -> i32 { + let mut i = 0; + loop { + unsafe { + let s1_i = s1.add(i); + let s2_i = s2.add(i); + + let val = (*s1_i).to_ascii_lowercase() as i32 - (*s2_i).to_ascii_lowercase() as i32; + if val != 0 || *s1_i == 0 { + return val; + } + } + + i += 1; + } +} + #[derive(Debug, Copy, Clone)] #[repr(C)] struct Tm {