-
Notifications
You must be signed in to change notification settings - Fork 196
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
How to get a list of access points? #314
Comments
you got an Error inside the wifi driver : |
I haven't even heard of that protocol before, so no idea.
STA mode means connecting to an existing WiFi network right? I'm not trying to do that. I'm trying to print a list of visible wifi networks without doing any connection. Like the promiscuous mode from back in the Backtrack days. Or is that not a supported use case? |
yes you dont need to connect to anything. what i want you to do is not opening an AP mode and STA mode at the same time. you even can start in None Mode. |
with the set_configuration method you can set it to None / Ap / sta /mixed . Please test it with None or Sta and run a scan. |
Setting it to None didn't work, but setting it to Client mode did the trick! Thanks! |
In any case this error still is really wired. The AP should not crash if its get something send it's not compatible with ( if that's the case here) so we would still need to dick deeper. |
So it would be cool if you could sniff the packets you receive and check if you get something like a NAN package. I think this would be a bug in the upstream esp-idf impl |
If you want me to run some code for diagnost purposes, feel free to give me a snippet. |
If you could do one test where you configure the EspWifi ( so you have netif running) just in AP mode - and just set a simple test ssid and pw ( rest of the config can be filled with ..default::Default) and connect with your phone ore something and see if it still crashes? |
the only related problem on esp-idf i could find is espressif/esp-idf#12473 though also a relative new issue |
I used the following code: fn wifi_ap() -> Result<()> {
log::info!("Setting up WiFi radio");
let sysloop = EspSystemEventLoop::take().with_context(|| "Error getting SysEventLoop handle")?;
let peripherals = Peripherals::take()?;
let nvs = EspDefaultNvsPartition::take().with_context(|| "Error retrieving default NVS partitions")?;
let mut wifi = BlockingWifi::wrap(
EspWifi::new(peripherals.modem, sysloop.clone(), Some(nvs))?,
// WifiDriver::new(peripherals.modem, sysloop.clone(), Some(nvs))?,
sysloop)?;
let wifi = wifi.wifi_mut();
log::info!("Starting Wifi");
wifi.set_configuration(&Configuration::AccessPoint( AccessPointConfiguration {
ssid: "ESP32".into(),
password: "AchtTekens".into(),
auth_method: AuthMethod::WPA2Personal,
..Default::default()
}))?;
log::info!("Starting WiFi AP");
wifi.start()?;
loop {
let netif = wifi.ap_netif();
log::info!("AP Info: {} - {:?}", netif.get_name(), netif.get_ip_info()?);
FreeRtos::delay_ms(1000);
}
} And that worked flawlessly. Could connect with my phone and it kept running:
|
hmm, so in the first case you used the mixed mode i think, have to look up the default. Could you try again with that? Thanks for testing. Maybe it was a spurious error cause we really need such a packet in the time-frame you are opening the driver and wait for something. Maybe the internal driver got in some wrong state in his state-machine, still it sounds super fishy |
From my testing so far it doesn't matter if I use If I set it in mixed mode, it works fine. I think it's a driver initialisation error. You just have to set any configuration or it crashes. |
Ok ty for your testing. Did it always crash with the same error? |
Always with |
I'm new to ESP32's and as an exercise I am trying to simply print out a list of access points the wifi adapter can see.
Code here.
This is the output:
Can someone tell my why the Wifi is getting dropped and what I am doing wrong?
The text was updated successfully, but these errors were encountered: