aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-03-26 13:20:21 +0200
committerAleksander Morgado <aleksander@lanedo.com>2012-03-26 13:26:05 +0200
commit1bfe358d705f43503516ef81c0ef70bbda9ba2bc (patch)
tree4c654f2f2af6d8079266d72d51879e81cdf51410
parent26e3059aa73a19ba2ec5010da491eae39086fad7 (diff)
option: hso_get_cid() always returns >= 0
This patch fixes undesired disconnection attempts during modem disabling. The new `hso_has_cid()' allows to check whether there is a valid CID stored before trying to get it with `hso_get_cid()', as this last method ensures that a valid CID number is returned, even if there is none. Relevant logs of the issue: modem-manager[24085]: hso_get_cid: runtime check failed: (cid >= 0) modem-manager[24085]: hso_get_cid: runtime check failed: (cid >= 0) modem-manager[24085]: (ttyHS4): --> 'AT_OWANCALL=0,0,1<CR>' modem-manager[24085]: (ttyHS4): <-- '<CR><LF>ERROR<CR><LF>' modem-manager[24085]: Got failure code 100: Unknown error
-rw-r--r--plugins/mm-modem-hso.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/mm-modem-hso.c b/plugins/mm-modem-hso.c
index 5d4201c5..511e8628 100644
--- a/plugins/mm-modem-hso.c
+++ b/plugins/mm-modem-hso.c
@@ -96,6 +96,12 @@ mm_modem_hso_new (const char *device,
/*****************************************************************************/
+static gboolean
+hso_has_cid (MMModemHso *self)
+{
+ return (mm_generic_gsm_get_cid (MM_GENERIC_GSM (self)) >= 0);
+}
+
static gint
hso_get_cid (MMModemHso *self)
{
@@ -155,7 +161,6 @@ _internal_hso_modem_authenticate (MMModemHso *self, MMCallbackInfo *info)
g_assert (primary);
cid = hso_get_cid (self);
- g_warn_if_fail (cid >= 0);
/* Both user and password are required; otherwise firmware returns an error */
if (!priv->username || !priv->password)
@@ -447,7 +452,7 @@ unsolicited_disable_done (MMModem *modem,
}
/* Otherwise, kill any existing connection */
- if (hso_get_cid (MM_MODEM_HSO (modem)) >= 0)
+ if (hso_has_cid (MM_MODEM_HSO (modem)))
hso_call_control (MM_MODEM_HSO (modem), FALSE, TRUE, disable_done, info);
else
disable_done (modem, NULL, info);