From d11505f7510c31746c9bf642dbbf548991a6a40f Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Mon, 8 Feb 2010 15:32:04 -0600 Subject: Fix: Add recheck flag to gprs When a powered is toggled quickly, we ignore the second request. This flag tells us that we should recheck what the attach status should be once the current operation finishes --- src/gprs.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gprs.c b/src/gprs.c index 4fefc69b..d517367f 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -44,6 +44,7 @@ #define DATA_CONTEXT_INTERFACE "org.ofono.PrimaryDataContext" #define GPRS_FLAG_ATTACHING 0x1 +#define GPRS_FLAG_RECHECK 0x2 #define SETTINGS_STORE "gprs" #define SETTINGS_GROUP "Settings" @@ -976,6 +977,11 @@ static void registration_status_cb(const struct ofono_error *error, ofono_gprs_status_notify(gprs, status, lac, ci, tech); gprs->flags &= ~GPRS_FLAG_ATTACHING; + + if (gprs->flags & GPRS_FLAG_RECHECK) { + gprs->flags &= ~GPRS_FLAG_RECHECK; + gprs_netreg_update(gprs); + } } static void gprs_attach_callback(const struct ofono_error *error, void *data) @@ -994,6 +1000,11 @@ static void gprs_attach_callback(const struct ofono_error *error, void *data) } gprs->flags &= ~GPRS_FLAG_ATTACHING; + + if (gprs->flags & GPRS_FLAG_RECHECK) { + gprs->flags &= ~GPRS_FLAG_RECHECK; + gprs_netreg_update(gprs); + } } static void gprs_netreg_update(struct ofono_gprs *gprs) @@ -1010,8 +1021,10 @@ static void gprs_netreg_update(struct ofono_gprs *gprs) if (gprs->driver_attached == attach) return; - if (gprs->flags & GPRS_FLAG_ATTACHING) + if (gprs->flags & GPRS_FLAG_ATTACHING) { + gprs->flags |= GPRS_FLAG_RECHECK; return; + } gprs->flags |= GPRS_FLAG_ATTACHING; -- cgit v1.2.3