From 0cc813312f9bf446614d6aed6a85b1ee0b006451 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 25 Jul 2011 00:05:06 -0500 Subject: [PATCH] gsm: don't clear operator name or number when at least one of PS or CS is registered The operator name/number isn't really tied to CS or PS registration, since we retrieve it using AT+COPS. But when one of CS or PS became unregistered the operator name and number would get cleared out. We only want to clear it out when *both* CS and PS are unregistered. Fixes an issue with the location API where location would not be reported when one of CS or PS became unregistered, because the location bits want an operator name before they return the location. --- src/mm-generic-gsm.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index 541c2dda..dc2d4ddc 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -2442,6 +2442,19 @@ reg_info_updated (MMGenericGsm *self, changed = TRUE; } + /* Don't clear oper code or oper num if at least one of CS or PS state + * is home or roaming. + */ + if ( priv->reg_status[0] == MM_MODEM_GSM_NETWORK_REG_STATUS_HOME + || priv->reg_status[0] == MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING + || priv->reg_status[1] == MM_MODEM_GSM_NETWORK_REG_STATUS_HOME + || priv->reg_status[1] == MM_MODEM_GSM_NETWORK_REG_STATUS_ROAMING) { + if (update_code && oper_code == NULL) + update_code = FALSE; + if (update_name && oper_name == NULL) + update_name = FALSE; + } + if (update_code) { if (g_strcmp0 (oper_code, priv->oper_code) != 0) { g_free (priv->oper_code);