aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-12-12 10:59:29 +0100
committerAleksander Morgado <aleksander@aleksander.es>2019-12-16 14:39:22 +0100
commit7d1e949137bf5d7d354f8d4508f876b2a07312fc (patch)
tree057018b439e66c2f6d7459c1a9f3ff973f6eb17c
parentf157d02fc668777ccd7de559c6e1b8400c102412 (diff)
ublox: ignore error when disconnecting last LTE bearer
This is required in the TOBY-L2 and TOBY-L4 modules in order to report a proper disconnection, even if there is none in reality. The default LTE bearer is always reported connected while registered in LTE. Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/166
-rw-r--r--plugins/ublox/mm-broadband-bearer-ublox.c32
1 files changed, 28 insertions, 4 deletions
diff --git a/plugins/ublox/mm-broadband-bearer-ublox.c b/plugins/ublox/mm-broadband-bearer-ublox.c
index 40dab597..377ead59 100644
--- a/plugins/ublox/mm-broadband-bearer-ublox.c
+++ b/plugins/ublox/mm-broadband-bearer-ublox.c
@@ -670,10 +670,34 @@ cgact_deactivate_ready (MMBaseModem *modem,
GError *error = NULL;
response = mm_base_modem_at_command_finish (modem, res, &error);
- if (!response)
- g_task_return_error (task, error);
- else
- g_task_return_boolean (task, TRUE);
+ if (!response) {
+ /* TOBY-L4 and TOBY-L2 L2 don't allow to disconnect the last LTE bearer
+ * as that would imply de-registration from the LTE network, so we just
+ * assume that it's disconnected from the user point of view.
+ *
+ * TOBY-L4 reports this as a generic unknown Packet Domain Error, which
+ * is a bit unfortunate:
+ * AT+CGACT=0,1
+ * +CME ERROR: 148
+ *
+ * TOBY-L2 reports this as "LAST PDN disconnection not allowed" but using
+ * the legacy numeric value before 3GPP Rel 11 (i.e. 151 instead of 171).
+ * AT+CGACT=0,1
+ * +CME ERROR: 151
+ */
+ if (!g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_GPRS_UNKNOWN) &&
+ !g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_GPRS_LAST_PDN_DISCONNECTION_NOT_ALLOWED) &&
+ !g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_GPRS_LAST_PDN_DISCONNECTION_NOT_ALLOWED_LEGACY)) {
+ g_task_return_error (task, error);
+ g_object_unref (task);
+ return;
+ }
+
+ mm_dbg ("ignored error when disconnecting last LTE bearer: %s", error->message);
+ g_clear_error (&error);
+ }
+
+ g_task_return_boolean (task, TRUE);
g_object_unref (task);
}