I wanted to connect to a WPA2 EAP network (Eduroam) and found that micropython could not Because I was able to from C I knew I could write a new function into the network library to set up WPA EAP.
Right now my function is definitely a very dirty hack as I don't bother checking the types of the mp_objects I also don't know what sort of state information might be worth saving.
I will most the code for the function when I get home. While I would definitely not want to put that function into micropython as it stands it could start as a base for someone who knows their way around micropython's internals more.
Support for WPA2 EAP networks.
Re: Support for WPA2 EAP networks.
Code: Select all
//Set up EAP
STATIC mp_obj_t esp_seteap(mp_obj_t self_in,mp_obj_t username,mp_obj_t password){
size_t Ilen;
size_t Plen;
const char *EAP_IDENTITY = mp_obj_str_get_data(username,&Ilen);
const char *EAP_PASSWORD = mp_obj_str_get_data(password,&Plen);
ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)));
ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_username((uint8_t *)EAP_IDENTITY, strlen(EAP_IDENTITY)));
//ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_new_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)));
ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_set_password((uint8_t *)EAP_PASSWORD, strlen(EAP_PASSWORD)));
ESP_EXCEPTIONS(esp_wifi_sta_wpa2_ent_enable());
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_3(esp_seteap_obj, esp_seteap);
Code: Select all
{ MP_ROM_QSTR(MP_QSTR_seteap), MP_ROM_PTR(&esp_seteap_obj) },
It makes a new function that takes your username and password that are used for connecting. I am not sure exactly when you would call it to connect but I have had success calling it both before and after activating the interface but always before trying to connect.
Re: Support for WPA2 EAP networks.
Want to bring attention back up to this. As adding PEAP support would help micropython be used in some academic environments more easily.
Also I would submit a PR but I don't know how to add the proper checks around the inputs yet.
Also I would submit a PR but I don't know how to add the proper checks around the inputs yet.
Re: Support for WPA2 EAP networks.
We have a project in development that is now required to have WPA2-Enterprise encryption.
I see the Arduino, Pycom and CircuitPython have this ability.
Has anyone ever seen a library available for micropython?
This is required for most commercial networks and I would hope that micropython would including this connectivity.
I see the Arduino, Pycom and CircuitPython have this ability.
Has anyone ever seen a library available for micropython?
This is required for most commercial networks and I would hope that micropython would including this connectivity.
- Attachments
-
- 2020-10-07 16_01_50-adafruit_esp32spi — Adafruit ESP32SPI Library 1.0 documentation.png (47.35 KiB) Viewed 478 times
Re: Support for WPA2 EAP networks.
Unfortunately no library exists. I was going to try and make a library using the new features that allow C modules to be compiled as libraries but unfortunately they can't use ESP IDF functions not defined in the one table. So your stuck with modifying Micropython itself.