diff options
author | Denis Kenzior <denkenz@gmail.com> | 2009-11-18 10:34:23 -0600 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2009-11-18 10:34:23 -0600 |
commit | 41050ef7b12f704fb01f8226e5991000adbea7be (patch) | |
tree | 2ab2d4d1cba8afed3a6b6a5dbe4956454b2d3e8d | |
parent | d111fc3ceed0336055eb9964c6650409bc1d0c0b (diff) | |
download | ofono-41050ef7b12f704fb01f8226e5991000adbea7be.tar.bz2 |
Implement CGREG query
Some modems do not properly send CGREG notifications when the context is
attached / detached. We manually query the registration state of GPRS
to make sure that if the modem is indeed attached, the state is
reflected properly
-rw-r--r-- | src/gprs.c | 22 |
1 files changed, 21 insertions, 1 deletions
@@ -360,6 +360,8 @@ static void pri_activate_callback(const struct ofono_error *error, DBusConnection *conn = ofono_dbus_get_connection(); dbus_bool_t value; + DBG("%p %s", ctx, interface); + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_debug("Activating context failed with error: %s", telephony_error_to_str(error)); @@ -866,16 +868,34 @@ static void gprs_attached_update(struct ofono_gprs *gprs) "Attached", DBUS_TYPE_BOOLEAN, &value); } -static void gprs_attach_callback(const struct ofono_error *error, void *data) +static void registration_status_cb(const struct ofono_error *error, + int status, int lac, int ci, int tech, + void *data) { struct ofono_gprs *gprs = data; + if (error->type == OFONO_ERROR_TYPE_NO_ERROR) + ofono_gprs_status_notify(gprs, status, lac, ci, tech); + gprs->flags &= ~GPRS_FLAG_ATTACHING; +} + +static void gprs_attach_callback(const struct ofono_error *error, void *data) +{ + struct ofono_gprs *gprs = data; if (error->type == OFONO_ERROR_TYPE_NO_ERROR) { gprs->driver_attached = !gprs->driver_attached; gprs_attached_update(gprs); } + + if (gprs->driver->registration_status) { + gprs->driver->registration_status(gprs, registration_status_cb, + gprs); + return; + } + + gprs->flags &= ~GPRS_FLAG_ATTACHING; } static void gprs_netreg_update(struct ofono_gprs *gprs) |