aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mm-generic-cdma.c26
-rw-r--r--src/mm-modem-helpers.c37
-rw-r--r--src/mm-modem-helpers.h6
3 files changed, 69 insertions, 0 deletions
diff --git a/src/mm-generic-cdma.c b/src/mm-generic-cdma.c
index 6fce3716..728d8766 100644
--- a/src/mm-generic-cdma.c
+++ b/src/mm-generic-cdma.c
@@ -61,6 +61,8 @@ typedef struct {
gboolean evdo_rev0;
gboolean evdo_revA;
gboolean reg_try_css;
+ gboolean has_spservice;
+ gboolean has_speri;
MMModemCdmaRegistrationState cdma_1x_reg_state;
MMModemCdmaRegistrationState evdo_reg_state;
@@ -384,6 +386,26 @@ get_enable_info_done (MMModem *modem,
}
static void
+spservice_done (MMAtSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ if (!error)
+ MM_GENERIC_CDMA_GET_PRIVATE (user_data)->has_spservice = TRUE;
+}
+
+static void
+speri_done (MMAtSerialPort *port,
+ GString *response,
+ GError *error,
+ gpointer user_data)
+{
+ if (!error)
+ MM_GENERIC_CDMA_GET_PRIVATE (user_data)->has_speri = TRUE;
+}
+
+static void
enable_all_done (MMModem *modem, GError *error, gpointer user_data)
{
MMCallbackInfo *info = user_data;
@@ -408,6 +430,10 @@ enable_all_done (MMModem *modem, GError *error, gpointer user_data)
/* Grab device info right away */
mm_modem_get_info (modem, get_enable_info_done, NULL);
+
+ /* Check for support of Sprint-specific phone commands */
+ mm_at_serial_port_queue_command (priv->primary, "+SPSERVICE?", 3, spservice_done, self);
+ mm_at_serial_port_queue_command (priv->primary, "$SPERI?", 3, speri_done, self);
}
out:
diff --git a/src/mm-modem-helpers.c b/src/mm-modem-helpers.c
index dd1b8c36..0a2bb623 100644
--- a/src/mm-modem-helpers.c
+++ b/src/mm-modem-helpers.c
@@ -432,6 +432,43 @@ mm_gsm_parse_creg_response (GMatchInfo *info,
/*************************************************************************/
+gboolean
+mm_cdma_parse_spservice_response (const char *reply,
+ MMModemCdmaRegistrationState *out_cdma_1x_state,
+ MMModemCdmaRegistrationState *out_evdo_state)
+{
+ const char *p;
+
+ g_return_val_if_fail (reply != NULL, FALSE);
+ g_return_val_if_fail (out_cdma_1x_state != NULL, FALSE);
+ g_return_val_if_fail (out_evdo_state != NULL, FALSE);
+
+ p = mm_strip_tag (reply, "+SPSERVICE:");
+ if (!isdigit (*p))
+ return FALSE;
+
+ switch (atoi (p)) {
+ case 0: /* no service */
+ *out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
+ *out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
+ break;
+ case 1: /* 1xRTT */
+ *out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED;
+ *out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
+ break;
+ case 2: /* EVDO rev 0 */
+ case 3: /* EVDO rev A */
+ *out_cdma_1x_state = MM_MODEM_CDMA_REGISTRATION_STATE_UNKNOWN;
+ *out_evdo_state = MM_MODEM_CDMA_REGISTRATION_STATE_REGISTERED;
+ break;
+ default:
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/*************************************************************************/
+
const char *
mm_strip_tag (const char *str, const char *cmd)
{
diff --git a/src/mm-modem-helpers.h b/src/mm-modem-helpers.h
index f25c318a..3e398e59 100644
--- a/src/mm-modem-helpers.h
+++ b/src/mm-modem-helpers.h
@@ -17,6 +17,8 @@
#ifndef MM_MODEM_HELPERS_H
#define MM_MODEM_HELPERS_H
+#include "mm-modem-cdma.h"
+
#define MM_SCAN_TAG_STATUS "status"
#define MM_SCAN_TAG_OPER_LONG "operator-long"
#define MM_SCAN_TAG_OPER_SHORT "operator-short"
@@ -41,5 +43,9 @@ gboolean mm_gsm_parse_creg_response (GMatchInfo *info,
const char *mm_strip_tag (const char *str, const char *cmd);
+gboolean mm_cdma_parse_spservice_response (const char *reply,
+ MMModemCdmaRegistrationState *out_cdma_1x_state,
+ MMModemCdmaRegistrationState *out_evdo_state);
+
#endif /* MM_MODEM_HELPERS_H */