Chat freely about anything...

User avatar
By march_seven
#32436 Hi all

My environment is :VS2013 + VisualGDB

I running wifi as AP , and i adding the password function when config the wifi ,

Code: Select all struct ip_info info;
   struct softap_config cfg;
   wifi_softap_get_config(&cfg);
   strcpy((char *)cfg.ssid, "ESP8266_Mrtech_RTOS");
   cfg.ssid_len = strlen((char*)cfg.ssid);
   strcpy((char *)cfg.password, "123456");// password no work
   wifi_softap_set_config_current(&cfg);
   wifi_set_opmode(SOFTAP_MODE);


but when i connect the wifi AP, it does not request me to put the password。
and i could connect without password。


why does ”strcpy((char *)cfg.password, "123456");“ have not work!

BR!!
User avatar
By kolban
#32473 It is also possible that you haven't set the "authmode" property within your `struct softap_config`. The default value is AUTH_OPEN which means that there is no password (even if you supply one). Maybe try setting the value to AUTH_WPA2_PSK and see if that works.
User avatar
By march_seven
#32521
kolban wrote:It is also possible that you haven't set the "authmode" property within your `struct softap_config`. The default value is AUTH_OPEN which means that there is no password (even if you supply one). Maybe try setting the value to AUTH_WPA2_PSK and see if that works.



thank you !

you are right ! we need to change the mode

Code: Select all   struct ip_info info;
   struct softap_config cfg;
   wifi_softap_get_config(&cfg);
   strcpy((char *)cfg.ssid, "ESP8266_Mrtech_RTOS");
   cfg.ssid_len = strlen((char*)cfg.ssid);
   strcpy((char *)cfg.password, "123456789");// password no work
   cfg.authmode = AUTH_WPA2_PSK;
   wifi_softap_set_config_current(&cfg);
   wifi_set_opmode(SOFTAP_MODE);


but there is need to change that the password should be more than 8 byte