esp-wifi icon indicating copy to clipboard operation
esp-wifi copied to clipboard

ESP32: Wifi logs cannot be configured

Open bjoernQ opened this issue 3 years ago • 4 comments

~~Calling esp_wifi_internal_set_log_level or esp_wifi_internal_set_log_mod crashes immediately or cause crashes later (depending on when those are called) - so Wifi logs are never enabled on ESP32 (i.e. it works fine on ESP32C3)~~

Additionally there is a problem with VaList on ESP32 (or Xtensa in general) - that's why it's conditionally compiled only for ESP32C3 in log_writev

bjoernQ avatar Apr 07 '22 08:04 bjoernQ

I've been applying this patch for vaarg support. I've never personally used vaargs, so it's quite possible this patch is buggy, or is missing some other steps?

MabezDev avatar Apr 07 '22 09:04 MabezDev

Awesome - will give it a try. Long time since I built the compiler myself the last time 😄

bjoernQ avatar Apr 07 '22 09:04 bjoernQ

Just to be clear, it's already included in the esp-* branch patch set, so it should already be working.

MabezDev avatar Apr 07 '22 10:04 MabezDev

~~The va_list implementation seems to be fine since I can use it with some C code written myself and compiled with GCC. However, the va_list I get from the WiFi driver looks different. For now, I just print the format string on ESP32 which is better than having nothing. Still an interesting and valid issue so keep it open~~

No idea what I tested back then - here is an issue including a way to reproduce it easily: https://github.com/esp-rs/rust/issues/177

bjoernQ avatar Apr 11 '22 06:04 bjoernQ

Unfortunately https://github.com/esp-rs/rust/issues/171 doesn't fix this

bjoernQ avatar May 16 '23 15:05 bjoernQ

Alternatively, we could implement syslog, log_write and log_writev in C until a fix is available.

bjoernQ avatar May 17 '23 15:05 bjoernQ

This is an ugly hack but it works. It's not very invasive because it replaces only exactly the function call that bugs out. Not likely woth a PR but if anyone is interested in trying it out, here it is (implemented for esp32 only): https://github.com/esp-rs/esp-wifi/commit/8befe40fc4b859d95d877c95af8b4f810ed6ce06

karlri avatar Jun 29 '23 13:06 karlri