MediaTek-Labs / Arduino-Add-On-for-LinkIt-SDK

Arduino board support package for LinkIt 7697
https://docs.labs.mediatek.com/resource/linkit7697-arduino/en
34 stars 33 forks source link

Examples->LWiFi->ScanNetworks won't print specific AP if the BSSID starts with 0x00 #71

Closed AcSiPCCW closed 6 years ago

AcSiPCCW commented 6 years ago

In ard_mtk.c, get_scan_list() strlen((char*)ptr->bssid) would be zero if the BSSID starts with 0x00.

pablosun commented 6 years ago

Looks like a typo bug: the intention of the check should be checking the ssid instead of the bssid, as the BSSID is of fixed-length and should never be treated as text strings.

// BUG: why check bssid when we're only dealing with ssid???
if (strlen((char*)ptr->bssid) != 0 && ssid_checkout((char*)ptr->ssid, i)) {
    Rssi[i] = ptr->rssi;
    memcpy(Ssid[i], ptr->ssid, ptr->ssid_length);
    Encr[i] = (uint8_t)ptr->encrypt_type;
    ++i;
}