Reset modem API function

I have been trying to find API to use to reset my modem whenever i have connection issues and unable to connect properly. Currently I’m reseting the whole device by unplugging then plugging back in, but I need to strictly reset the modem in this case. I have found function that gives me info as to why a reset happened:

le_info_GetResetInformation() which can give LE_INFO_RESET_USER which mean reset requested by user which makes me believe that there is a function that I can use to reset the modem when required. Any ideas where it is found? I have checked almost all Modem related Apps from Modem Data Control to Modem Info APIs but can’t seem to find it.

In the Modem Demo i have noticed that calling le_data_Release(…) and then le_data_Request() is their idea of reseting a connection when required. There has to be a function I can call to reset the modem.

have you tried system() API to call “reboot” command? (without sandbox)

No I have not. Will try and let you know. Thanks @jyijyi

Hey all,

I tried running a system call to reboot in a super desperate measure and I don’t think I ever got it working (I think it’s because reboot must be called with sudo or by a root user). I found using the Legato watchdog worked really well for masking problems like this.

The flow I used to achieve this was:

  1. Configure the app to expect a watchdog kick roughly on the same interval you’re expecting some data related event (pushing sensor data every 3 minutes in my case). Almost all of this config is in your application definition (.adef) file:
  2. Kick the watchdog in COMPONENT_INIT to make sure the watchdog starts with the app
  3. Send a kick each time the data event happens successfully

If a kick is ever missed, the watchdog will follow the action specified by watchdogAction in your corresponding .adef file (reboot in my case). This is obviously a very brute force oriented solution, but nonetheless, it works extremely well.

If you’re looking for something a little cleaner, checkout the le_mrc interface. I haven’t really used this API much, but to my knowledge, some potentially dangerous calls exist in this API, so proceed carefully!

Let me know if some sample code would help clarify any of this and I’ll be happy to provide some.


I just tried with WP8548 with faultAction in adef file.


	( hello )

maxCoreDumpFileBytes: 512K
maxFileBytes: 512K

faultAction: reboot


Once in the code, you have exit(1), the system will reboot.



I too needed this some time ago and implemented it much like @jyijyi using faultAction: reboot in the adef file. It has the added benefit of allowing the app to run sandboxed and let the supervisor deal with fault recovery.

I went a step further and bundled this functionality up in a separate app with the intention of adding more “custom” APIs for other system functions I might need available to any app running on my system.

Basically, my utility app .c file consisted of something like this:

void sys_util_Reboot()
	LE_INFO("User-initiated system reboot...");
	kill(getpid(), SIGINT);

    LE_INFO("*** Starting System Utility Service ***");

With a simple .api file containing:

 * Function that reboots the system.

Hope this helps.

1 Like

This is a cool solution, thanks for sharing!