-->
Page 1 of 2

why does adding password setting failed??

PostPosted: Wed Oct 28, 2015 1:42 am
by march_seven
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!!

Re: why does adding password setting failed??

PostPosted: Wed Oct 28, 2015 1:28 pm
by martinayotte
Password length needs to be between 8-63 characters.

viewtopic.php?f=8&t=4150&p=25193&hilit=password+characters#p25176

Re: why does adding password setting failed??

PostPosted: Wed Oct 28, 2015 1:57 pm
by kolban
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.

Re: why does adding password setting failed??

PostPosted: Thu Oct 29, 2015 2:58 am
by march_seven
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