From 2686706f60afea402bbcfe9d5468956c2097eb43 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Wed, 15 Sep 2010 01:13:09 +0000 Subject: [PATCH] Prevent deep sleep before asking for the PIN code (fixes registration) --- src/plugins/openmoko.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/plugins/openmoko.c b/src/plugins/openmoko.c index 51f54b3..d374b02 100644 --- a/src/plugins/openmoko.c +++ b/src/plugins/openmoko.c @@ -90,6 +90,11 @@ static int _openmoko_event(PhonePlugin * plugin, PhoneEvent event, ...) /* restore regular audio */ _event_mixer_set(plugin, "stereoout.state"); break; + case PHONE_EVENT_FUNCTIONAL: + /* FIXME prevent deep sleep only optionally */ + plugin->helper->queue(plugin->helper->phone, + "AT%SLEEP=2"); + break; case PHONE_EVENT_NOTIFICATION_OFF: /* FIXME implement */ break; @@ -116,11 +121,6 @@ static int _openmoko_event(PhonePlugin * plugin, PhoneEvent event, ...) case PHONE_EVENT_VIBRATOR_ON: _event_vibrator(plugin, TRUE); break; - case PHONE_EVENT_SIM_VALID: - /* prevent deep sleep */ - plugin->helper->queue(plugin->helper->phone, - "AT%SLEEP=2"); - break; default: /* not relevant */ break; } @@ -170,7 +170,11 @@ static int _event_power_on(PhonePlugin * plugin, gboolean power) snprintf(buf, sizeof(buf), "%s: %s", path, strerror(errno)); ret = plugin->helper->error(NULL, buf, 1); } - close(fd); + if(close(fd) != 0) + { + snprintf(buf, sizeof(buf), "%s: %s", path, strerror(errno)); + ret = plugin->helper->error(NULL, buf, 1); + } return ret; }