Microchip-MPLAB-Harmony / wireless_wifi

Harmony Wi-Fi solutions
https://microchip-mplab-harmony.github.io/wireless_wifi/
6 stars 2 forks source link

some manual scan/connect issues #3

Open picerno76 opened 10 months ago

picerno76 commented 10 months ago

I found two reasons for this. 1) sys_wifi.c in SYS_WIFI_CreateSsdiList function if you make more than a scan, from the second time, g_wifiSrvcScanConfig.pSsidList points to g_scanSsidListString so the list becomes empty

if (g_wifiSrvcScanConfig.pSsidList)
 {
    memset(g_scanSsidListString, 0, sizeof(g_scanSsidListString));
    start = g_wifiSrvcScanConfig.pSsidList;'

if you agree, I have fixed this way

if (g_wifiSrvcScanConfig.pSsidList)
{
    g_wifiSrvcScanConfig.pSsidList = SYS_WIFI_SCAN_SSID_LIST;
    memset(g_scanSsidListString, 0, sizeof(g_scanSsidListString));
    start = g_wifiSrvcScanConfig.pSsidList;

2) wdrv_pic32mzw.c in WDRV_PIC32MZW_WIDProcess if a scan returns an empty list, the scanInProgress flag remains true and a new scansion never starts

case DRV_WIFI_WID_GET_SCAN_RESULTS:
{
    const DRV_PIC32MZW_SCAN_RESULTS *const pScanRes = (const DRV_PIC32MZW_SCAN_RESULTS *const)pData;

    if (NULL != pScanRes)
    {
        if((NULL != pCtrl->pfBSSFindNotifyCB) && (0 == pScanRes->ofTotal))
        {
            pCtrl->pfBSSFindNotifyCB(pCtrl->handle, 0, 0, NULL);
            pCtrl->pfBSSFindNotifyCB = NULL;
            break;
        }

        if (0 == pScanRes->index)
        {
            pCtrl->scanInProgress = false;
        }   

        DRV_PIC32MZW_StoreBSSScanResult(pScanRes);
    }

if you agree, I have fixed this way

case DRV_WIFI_WID_GET_SCAN_RESULTS:
{
    const DRV_PIC32MZW_SCAN_RESULTS *const pScanRes = (const DRV_PIC32MZW_SCAN_RESULTS *const)pData;

    if (NULL != pScanRes)
    {
        if (0 == pScanRes->index)
        {
            pCtrl->scanInProgress = false;
        }               

        if((NULL != pCtrl->pfBSSFindNotifyCB) && (0 == pScanRes->ofTotal))
        {
            pCtrl->pfBSSFindNotifyCB(pCtrl->handle, 0, 0, NULL);
            pCtrl->pfBSSFindNotifyCB = NULL;
            break;
        }

        DRV_PIC32MZW_StoreBSSScanResult(pScanRes);
    }

3) if the autoconnect flag isn't set, a manual connection never happens. I have to do like this

SYS_WIFI_CtrlMsg(sysObj.syswifi, SYS_WIFI_GETWIFICONFIG, &config, sizeof(SYS_WIFI_CONFIG));
config.staConfig.autoConnect = true;
SYS_WIFI_CtrlMsg(sysObj.syswifi, SYS_WIFI_CONNECT, &config, sizeof(SYS_WIFI_CONFIG));
aditya-shankar commented 4 months ago

Thanks for reporting these issues. They have been found valid and already assigned to respective teams to address them.

Best Regards