summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2016-09-06 15:30:39 +1000
committerDamien George <damien.p.george@gmail.com>2016-09-06 15:30:39 +1000
commitb4be5a8f3499ca19bdc9ac3ef94625529141b0ff (patch)
tree16f9f62b54dbc150ab87c03df1215a4c56bc9f98
parent4a9542c0c0319ac268d227ea8daf4c36ac7e870d (diff)
downloadmicropython-b4be5a8f3499ca19bdc9ac3ef94625529141b0ff.tar.gz
micropython-b4be5a8f3499ca19bdc9ac3ef94625529141b0ff.zip
esp8266/modnetwork: Fix wlan.scan() method so it returns all networks.
According to the Arduino ESP8266 implementation the first argument to the wifi scan callback is actually a bss_info pointer. This patch fixes the iteration over this data so the first 2 entries are no longer skipped. Fixes issue #2372.
-rw-r--r--esp8266/modnetwork.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/esp8266/modnetwork.c b/esp8266/modnetwork.c
index 7cfa3ff77a..7031197fa5 100644
--- a/esp8266/modnetwork.c
+++ b/esp8266/modnetwork.c
@@ -130,17 +130,16 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_1(esp_status_obj, esp_status);
STATIC mp_obj_t *esp_scan_list = NULL;
-STATIC void esp_scan_cb(scaninfo *si, STATUS status) {
+STATIC void esp_scan_cb(void *result, STATUS status) {
if (esp_scan_list == NULL) {
// called unexpectedly
return;
}
- if (si->pbss && status == 0) {
+ if (result && status == 0) {
// we need to catch any memory errors
nlr_buf_t nlr;
if (nlr_push(&nlr) == 0) {
- struct bss_info *bs;
- STAILQ_FOREACH(bs, si->pbss, next) {
+ for (struct bss_info *bs = result; bs; bs = STAILQ_NEXT(bs, next)) {
mp_obj_tuple_t *t = mp_obj_new_tuple(6, NULL);
#if 1
// struct bss_info::ssid_len is not documented in SDK API Guide,