summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAntara Borwankar <antara.borwankar@intel.com>2019-06-14 14:56:36 +0530
committerDenis Kenzior <denkenz@gmail.com>2019-06-14 11:42:28 -0500
commit999cf7328262ccffbc956a899513c80f1b5eb01f (patch)
tree1493c82857386071bc12ecbf1ceb74ec77cc1bc2 /drivers
parent686e3fba835fbd43e49d1b0351796990fe6e62e0 (diff)
downloadofono-999cf7328262ccffbc956a899513c80f1b5eb01f.tar.gz
atmodem: fix to activate context with cid zero
xmm7xxx based devices (among others) return 0 as cid for default pdp context. Fix the atmodem gprs driver logic to work with such devices by initializing last_auto_context_id to -1 instead of 0 to indicate a deactivated context.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/atmodem/gprs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index dd734585..fbee5c94 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -48,7 +48,7 @@ static const char *none_prefix[] = { NULL };
struct gprs_data {
GAtChat *chat;
unsigned int vendor;
- unsigned int last_auto_context_id;
+ int last_auto_context_id;
gboolean telit_try_reattach;
int attached;
};
@@ -161,7 +161,7 @@ static void at_cgdcont_read_cb(gboolean ok, GAtResult *result,
return;
}
- if (gd->last_auto_context_id == 0) {
+ if (gd->last_auto_context_id == -1) {
DBG("Context got deactivated while calling CGDCONT");
return;
}
@@ -257,11 +257,11 @@ static void cgev_notify(GAtResult *result, gpointer user_data)
g_at_chat_send(gd->chat, "AT+CGDCONT?", cgdcont_prefix,
at_cgdcont_read_cb, gprs, NULL);
} else if (g_str_has_prefix(event, "ME PDN DEACT")) {
- unsigned int context_id;
+ int context_id;
sscanf(event, "%*s %*s %*s %u", &context_id);
/* Indicate that this cid is not activated anymore */
if (gd->last_auto_context_id == context_id)
- gd->last_auto_context_id = 0;
+ gd->last_auto_context_id = -1;
}
}
@@ -632,6 +632,7 @@ static int at_gprs_probe(struct ofono_gprs *gprs,
gd->chat = g_at_chat_clone(chat);
gd->vendor = vendor;
+ gd->last_auto_context_id = -1;
ofono_gprs_set_data(gprs, gd);