Skip to content

some manual scan/connect issues #3

@picerno76

Description

@picerno76

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;
  1. 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);
    }
  1. 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));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions