diff options
author | Andreas Ludviksen <andreas.e.ludviksen@stericsson.com> | 2011-05-26 03:18:54 -0700 |
---|---|---|
committer | Sverre Vegge <sverre.vegge@stericsson.com> | 2011-08-02 22:07:02 +0200 |
commit | ee7f56bc4b07d80275f4227401bcead1b7080a93 (patch) | |
tree | 5dc8d900d447e56535754601e5b271d2a21c6110 | |
parent | f2d38a91471103da2ff67ff85525c6f8b6b5e406 (diff) | |
download | u300-ee7f56bc4b07d80275f4227401bcead1b7080a93.tar.gz |
SHUTDOWN: Adjust property-check according to Android
As long as the sys.shutdown.requested property is set, android
is preparing for shutdown. Regardless of the value. If Dbus
is disabled in the RIL, wait 2 seconds after CFUN=100 is
received before returning to Android. This will allow the
MID some time to do CFUN=0 or toggle GPIO.
Signed-off-by: Sverre Vegge <sverre.vegge@stericsson.com>
-rw-r--r-- | u300-ril-information.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/u300-ril-information.c b/u300-ril-information.c index 691c61e..21553b0 100644 --- a/u300-ril-information.c +++ b/u300-ril-information.c @@ -214,21 +214,29 @@ void requestRadioPower(void *data, size_t datalen, RIL_Token t) /* * Check Android system property if system is shutting down. - * Note: Android sets sys.shutdown.requested=0 when shutting down. + * Note: If property is set a shutdown is taking place, regardless + * of value. */ getRet = property_get(property, systemShutdown, NULL); - if (getRet > 0 && !strncmp(systemShutdown, "0", 1)) { + if (getRet > 0) { /* Modem shutdown */ LOGI("Android shutdown received. Shutting down modem."); err = at_send_command("AT+CFUN=100", &atresponse); if (err < 0 || atresponse->success == 0) LOGE("Failed to perform modem shutdown"); +#ifndef EXTERNAL_MODEM_CONTROL_MODULE_DISABLED /* loop until MID reports that modem is shut down */ while (g_shutdownCompleted == false) { usleep(100*1000); } +#else + /* No indication on Dbus available. Allow 2 sec for other parts + * of the system to have a chance to prepare for shutdown. + */ + usleep(2000*1000); +#endif /* EXTERNAL_MODEM_CONTROL_MODULE_DISABLED */ } else { /* Turn radio off */ err = at_send_command("AT+CFUN=4", &atresponse); |