Skip to content

Commit 12e99ef

Browse files
committed
add wep api, restore original espressif comment (wep enabled does not prevent wpa)
1 parent c128eba commit 12e99ef

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

libraries/ESP8266WiFi/keywords.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ psk KEYWORD2
104104
BSSID KEYWORD2
105105
BSSIDstr KEYWORD2
106106
RSSI KEYWORD2
107+
enableInsecureWEP KEYWORD2
107108
beginWPSConfig KEYWORD2
108109
beginSmartConfig KEYWORD2
109110
stopSmartConfig KEYWORD2

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ static bool sta_config_equal(const station_config& lhs, const station_config& rh
8686
// -----------------------------------------------------------------------------------------------------------------------
8787

8888
bool ESP8266WiFiSTAClass::_useStaticIp = false;
89+
bool ESP8266WiFiSTAClass::_useInsecureWEP = false;
8990

9091
/**
9192
* Start Wifi connection
@@ -127,7 +128,7 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
127128
}
128129

129130
conf.threshold.rssi = -127;
130-
conf.open_and_wep_mode_disable = true;
131+
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);
131132

132133
// TODO(#909): set authmode to AUTH_WPA_PSK if passphrase is provided
133134
conf.threshold.authmode = AUTH_OPEN;

libraries/ESP8266WiFi/src/ESP8266WiFiSTA.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,12 @@ class ESP8266WiFiSTAClass {
8282

8383
int32_t RSSI();
8484

85+
static void enableInsecureWEP (bool enable = true) { _useInsecureWEP = enable; }
86+
8587
protected:
8688

8789
static bool _useStaticIp;
90+
static bool _useInsecureWEP;
8891

8992
// ----------------------------------------------------------------------------------------------
9093
// ------------------------------------ STA remote configure -----------------------------------

tools/sdk/include/user_interface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ struct station_config {
251251
// with both ssid[] and bssid[] matched. Please check about this.
252252
uint8 bssid[6];
253253
wifi_fast_scan_threshold_t threshold;
254-
bool open_and_wep_mode_disable; // must be true for WPA
254+
bool open_and_wep_mode_disable; // Can connect to open/wep router by default.
255255
};
256256

257257
bool wifi_station_get_config(struct station_config *config);

0 commit comments

Comments
 (0)