I got the src through leaf in VSCode
/home/pm/.leaf/wp76-legato_21.05.2.rc2-202302240920
I don’t see any changes in modules/wifi/service compared to the one currently used
/home/pm/.leaf/wp77-legato_21.05.0-202110290357
Would it be correct that wifi service is handled by scripts so if i make changes to tiwifi.sh and pa_wifi.sh or is there more to it?
I got something working using the examples but it seems to be a lot more complicated compared to using le_data where everything is kinda handled automatic.
I found some description on using wifi with le_data
config set dataConnectionService:/wifi/SSID TEST-MOBILE
config set dataConnectionService:/wifi/passphrase password
config set dataConnectionService:/wifi/secProtocol 3
Is the secProtocol the same as this enum ?
and does it need to be set or is it enough with just a password ?
typedef enum
{
LE_WIFICLIENT_SECURITY_NONE = 0,
///< no security.
LE_WIFICLIENT_SECURITY_WEP = 1,
///< Using WEP.
LE_WIFICLIENT_SECURITY_WPA_PSK_PERSONAL = 2,
///< Using WPA
LE_WIFICLIENT_SECURITY_WPA2_PSK_PERSONAL = 3,
///< Using WPA2
LE_WIFICLIENT_SECURITY_WPA_EAP_PEAP0_ENTERPRISE = 4,
///< Using WPA Enterprise
LE_WIFICLIENT_SECURITY_WPA2_EAP_PEAP0_ENTERPRISE = 5
///< Using WPA2 Enterprise
}
le_wifiClient_SecurityProtocol_t;
There was a few hints in the log
wifiService[9567]/daemon T=main | le_wifiClient.c le_wifiClient_LoadSsid() 2134 | No wifi security protocol set at wifiService:/wifi/channel/wptest/secProtocol
dcsDaemon[26583]/dcs T=main | dcsTech.c dcsTech_Start() 336 | Request to start channel wptest of technology wifi
secStore[26692]/le_pa_secStoreTz T=main | pa_secStoreTz.c ConfigTreeRead() 989 | Node not exist!! ‘/sys/259/apps/wifiService/wifiService/channel/wptest/passphrase’
wifiService[26701]/daemon T=main | le_wifiClient.c WifiClient_LoadCfg_WpaPsk() 1911 | Failed to read passphrase from secStore path wifiService/channel/wptest/passphrase for SSID wptest; retcode -1
so after adding le_wifiClient_ConfigurePsk() it connected to the wifi.
le_cfg_SetString(iteratorRef, CFG_NODE_SSID, “wptest”);
le_cfg_SetString(iteratorRef, CFG_NODE_SECPROTOCOL, “3”);
le_cfg_SetString(iteratorRef, CFG_NODE_PASSPHRASE, “password”);
// Commit the transaction to make sure these new settings get written to the tree.
le_cfg_CommitTxn(iteratorRef);
If i removed power from the wifi it retried a few times, gave up and connected to the cell which is good,
but is there a way to make it reconnect to the wifi again when it comes back ?
Jan 6 15:29:56 swi-mdm9x28-wp user.err Legato: =ERR= | MCExe[26994]/mc T=WiFi | WiFi.cpp testScanResult() 97 | le_wifiClient_GetSsid OK, ssidLength 6;SSID: “wptest”
Jan 6 15:29:56 swi-mdm9x28-wp user.err Legato: =ERR= | MCExe[26994]/mc T=WiFi | WiFi.cpp testScanResult() 105 | FOUND SSID
Jan 6 15:29:56 swi-mdm9x28-wp user.err Legato: =ERR= | MCExe[26994]/mc T=WiFi | mainComponent.cpp resetDataConnection() 713 | resetDataConnection!!!
Jan 6 15:29:56 swi-mdm9x28-wp user.err Legato: =ERR= | MCExe[26994]/mc T=WiFi | mainComponent.cpp resetDataConnection() 718 | le_data_Release
Jan 6 15:29:57 swi-mdm9x28-wp user.err Legato: =ERR= | MCExe[26994]/mc T=WiFi | mainComponent.cpp resetDataConnection() 723 | le_data_Request
Jan 6 15:29:57 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[26960]/dcsDaemon T=main | dcsServer.c ProcessCommand() 1395 | Sharing the already connected data channel 1 of technology 1
I even tried le_mrc_SetRadioPower(LE_OFF) and le_mrc_SetRadioPower(LE_ON)
in between le_data_Release and le_data_Request with some sleep(1) in between but it kept using the cell ?
so le_data_Request() only establish wifi connection after power reset?
How about setting the sleep time to be longer like one minute?
I think you need to wait for the data channel to be totally released in the data event handler called by le_data_AddConnectionStateHandler().
BTW, you can also see if you need to set the rank of technology like this: