diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2011-01-22 13:12:15 +0100 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2011-01-22 13:12:15 +0100 |
commit | 62686f7719598790edf27b3ac940a4de023a2973 (patch) | |
tree | db41ce3a6afea0a0b43749a61b16b2a22ddff33c /drivers/atmodem | |
parent | 55209a77c1d327465f4004fef6916a7de4138981 (diff) | |
download | ofono-62686f7719598790edf27b3ac940a4de023a2973.tar.bz2 |
atmodem: Add support for Gobi technology change handling
Diffstat (limited to 'drivers/atmodem')
-rw-r--r-- | drivers/atmodem/gprs.c | 8 | ||||
-rw-r--r-- | drivers/atmodem/network-registration.c | 42 |
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c index 203a5f2e..0127a3a4 100644 --- a/drivers/atmodem/gprs.c +++ b/drivers/atmodem/gprs.c @@ -121,6 +121,14 @@ static void at_gprs_registration_status(struct ofono_gprs *gprs, cbd->user = gd; switch (gd->vendor) { + case OFONO_VENDOR_GOBI: + /* + * Send *CNTI=0 to find out the current tech, it will be + * intercepted in gobi_cnti_notify in network registration + */ + g_at_chat_send(gd->chat, "AT*CNTI=0", none_prefix, + NULL, NULL, NULL); + break; case OFONO_VENDOR_NOVATEL: /* * Send $CNTI=0 to find out the current tech, it will be diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c index 4b8cc34b..7a39fc9a 100644 --- a/drivers/atmodem/network-registration.c +++ b/drivers/atmodem/network-registration.c @@ -196,6 +196,14 @@ static void at_registration_status(struct ofono_netreg *netreg, g_at_chat_send(nd->chat, "AT*ERINFO?", none_prefix, NULL, NULL, NULL); break; + case OFONO_VENDOR_GOBI: + /* + * Send *CNTI=0 to find out the current tech, it will be + * intercepted in gobi_cnti_notify + */ + g_at_chat_send(nd->chat, "AT*CNTI=0", none_prefix, + NULL, NULL, NULL); + break; case OFONO_VENDOR_NOVATEL: /* * Send $CNTI=0 to find out the current tech, it will be @@ -974,6 +982,31 @@ static void mbm_erinfo_notify(GAtResult *result, gpointer user_data) } } +static void gobi_cnti_notify(GAtResult *result, gpointer user_data) +{ + //struct ofono_netreg *netreg = user_data; + //struct netreg_data *nd = ofono_netreg_get_data(netreg); + GAtResultIter iter; + const char *tech; + int option; + + g_at_result_iter_init(&iter, result); + + if (g_at_result_iter_next(&iter, "*CNTI:") == FALSE) + return; + + if (g_at_result_iter_next_number(&iter, &option) == FALSE) + return; + + if (option != 0) + return; + + if (g_at_result_iter_next_unquoted_string(&iter, &tech) == FALSE) + return; + + ofono_info("CNTI: %s", tech); +} + static void nw_cnti_notify(GAtResult *result, gpointer user_data) { //struct ofono_netreg *netreg = user_data; @@ -1182,6 +1215,15 @@ static void at_creg_set_cb(gboolean ok, GAtResult *result, gpointer user_data) g_at_chat_send(nd->chat, "AT+CIND=?", cind_prefix, cind_support_cb, netreg, NULL); return; + case OFONO_VENDOR_GOBI: + /* + * Gobi devices don't support unsolicited notifications + * of technology changes, but register a handle for + * CNTI so we get notified by any query. + */ + g_at_chat_register(nd->chat, "*CNTI:", gobi_cnti_notify, + FALSE, netreg, NULL); + break; case OFONO_VENDOR_NOVATEL: /* * Novatel doesn't support unsolicited notifications |