Unable to Restart Network/Wifi/Modem/Data connection

So I’m testing my legato device wp85 for situations when Connection is lost. I have it on a Cellular Network with Sim inserted unlocked ready and such. I have a list of checks I go through every second to see my Connection status:

  • Check SIM: if present/ready/state/
  • check modem: if le_data_RequestObjRef_t is NULL or not
  • check network/radio: state/radio power/signal strength
    -ping check: where i try to ping www.sierrawireless.com with a socket connection

Now when I have the SIM is activated, all stages are checked and all is well. When I go deactivate the SIM, it quickly changes and catches this change of state but it never fails till it gets to the last stage: ping in my App. On the outside I have it failing at WifiService && modemDaemon && dcsDaemon/dataConnectionServices with following repeating errors:

INFO | wifiService[556] | WIFICLIENT_DISCONNECT
=ERR= | wifiService[556] | Failed to connect to non-global ctrl_ifname: wlan0  error: No such file or directory
=ERR= | wifiService[556]/daemon T=main | pa_wifi_client_ti.c pa_wifiClient_Disconnect() 1041 | WiFi Client Command Failed: (24832)wlan0 WIFICLIENT_DISCONNECT
DBUG | wifiService[556]/framework T=main | le_wifiClient_server.c Handle_le_wifiClient_Disconnect() 1228 | Sending response to client session 0x27dcc : 4 bytes sent
=ERR= | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c TryStopWifiSession() 1851 | Impossible to disconnect wifi client
INFO | modemDaemon[550]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2040 | called
=ERR= | modemDaemon[550]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 781 | Sending QMI_WDS_START_NETWORK_INTERFACE_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=14.[0x0e]
=ERR= | modemDaemon[550]/le_pa T=main | pa_mdc_qmi.c StartSession() 1690 | Data connection failure Call End provided 44, Code 12
=ERR= | modemDaemon[550]/le_pa T=main | pa_mdc_qmi.c StartSession() 1701 | Data connection failure Verbose Call End provided Type 2, Verbose 201
=ERR= | modemDaemon[550]/modemDaemon T=main | le_mdc.c le_mdc_StartSession() 919 | Get Connection failure 44, 12, 2, 201
=ERR= | modemDaemon[550]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 781 | Sending QMI_WDS_GET_RUNTIME_SETTINGS_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=15.[0x0f]
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c SetDefaultGateway() 1010 | Default gateway or interface is empty
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c LoadSelectedTechProfile() 786 | No value set for 'SSID'!
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c TryStartWifiSession() 1633 | Impossible to use Wifi profile, result -1 (LE_NOT_FOUND)
DBUG | wifiService[556]/daemon T=main | le_wifiClient.c le_wifiClient_Disconnect() 1198 | Disconnect
INFO | wifiService[556] | WIFICLIENT_DISCONNECT
=ERR= | wifiService[556] | Failed to connect to non-global ctrl_ifname: wlan0  error: No such file or directory
=ERR= | wifiService[556]/daemon T=main | pa_wifi_client_ti.c pa_wifiClient_Disconnect() 1041 | WiFi Client Command Failed: (24832)wlan0 WIFICLIENT_DISCONNECT
DBUG | wifiService[556]/framework T=main | le_wifiClient_server.c Handle_le_wifiClient_Disconnect() 1228 | Sending response to client session 0x27dcc : 4 bytes sent
=ERR= | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c TryStopWifiSession() 1851 | Impossible to disconnect wifi client
INFO | modemDaemon[550]/le_pa T=main | pa_mrc_qmi.c pa_mrc_GetNetworkRegState() 2040 | called
=ERR= | modemDaemon[550]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 781 | Sending QMI_WDS_START_NETWORK_INTERFACE_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=14.[0x0e]
=ERR= | modemDaemon[550]/le_pa T=main | pa_mdc_qmi.c StartSession() 1690 | Data connection failure Call End provided 44, Code 12
=ERR= | modemDaemon[550]/le_pa T=main | pa_mdc_qmi.c StartSession() 1701 | Data connection failure Verbose Call End provided Type 2, Verbose 201
=ERR= | modemDaemon[550]/modemDaemon T=main | le_mdc.c le_mdc_StartSession() 919 | Get Connection failure 44, 12, 2, 201
=ERR= | modemDaemon[550]/swiQmi T=main | swiQmi.c swiQmi_CheckResponse() 781 | Sending QMI_WDS_GET_RUNTIME_SETTINGS_REQ_V01 failed: rc=0 (), resp.result=1.[0x01], resp.error=15.[0x0f]
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c SetDefaultGateway() 1010 | Default gateway or interface is empty
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c LoadSelectedTechProfile() 786 | No value set for 'SSID'!
-WRN- | dcsDaemon[546]/dataConnectionService T=main | dcsServer.c TryStartWifiSession() 1633 | Impossible to use Wifi profile, result -1 (LE_NOT_FOUND)
DBUG | wifiService[556]/daemon T=main | le_wifiClient.c le_wifiClient_Disconnect() 1198 | Disconnect
INFO | wifiService[556] | WIFICLIENT_DISCONNECT

Next I Activate the SIM but what I have noticed is that it never changes its behavior: i still fails on all the apps above and in my own App it fails at ping still. Even if I go to the command line and try to ping 8.8.8.8 it fails giving me no Network connection error. The only way I can get it back working is by resetting the whole device (HARD RESET) or reboot via command line.

Any ideas on how to solve this? I want my device to be able to catch the fact that the Connection is back without having to reset it manually?

Thanks,
MG

@jyijyi Any suggestions? :slight_smile:

How about checking the data connection status by “cm data”?
You can also check the sim status by AT command AT+CPIN? and also the signal strength by AT+CSQ and AT!GSTATUS?

@jyijyi I found the AT command to reset modem: AT!RESET. Trying it via command line works BUT:

  1. I found out that every time I enter it to reset the modem, my process ends exiting with code 1 and causes an entire system reboot. How can I stop that?
  2. How can I execute the AT commands from within my code? There has to be a way to do that. Using system() calls to execute anything in the terminal tends to not work. Any ideas?

AT!RESET will reset the system actually.
Even you don’t run your application, AT!RESET will always reboot the whole system.

Please note that according to the link below, AT command is not quite recommended:
https://docs.legato.io/latest/legatoAtServices.html

But if you just want to do some testing, you can try my application attached here.

Sending AT command in Legato application.docx (215.2 KB)