cdma: accept SID 0 in some cases
Most AT command references allow modems to report SID 0, even though SID 0 is not a valid SID and is not assigned to any CDMA network. Some Sierra 5725 cards have been seen to report valid class and band from the +CSS response but a SID 0. Accept SID 0 when at least one other element of the +CSS response indicates that the modem has service. Otherwise, report "no service" as before.
This commit is contained in:
@@ -904,7 +904,7 @@ normalize_band (const char *long_band, int *out_class)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
normalize_sid (const char *sid)
|
convert_sid (const char *sid)
|
||||||
{
|
{
|
||||||
long int tmp_sid;
|
long int tmp_sid;
|
||||||
|
|
||||||
@@ -942,7 +942,12 @@ serving_system_done (MMSerialPort *port,
|
|||||||
|
|
||||||
num = sscanf (reply, "? , %d", &sid);
|
num = sscanf (reply, "? , %d", &sid);
|
||||||
if (num == 1) {
|
if (num == 1) {
|
||||||
/* UTStarcom and Huawei modems that use IS-707-A format */
|
/* UTStarcom and Huawei modems that use IS-707-A format; note that
|
||||||
|
* this format obviously doesn't have other indicators like band and
|
||||||
|
* class and thus SID 0 will be reported as "no service" (see below).
|
||||||
|
*/
|
||||||
|
class = 0;
|
||||||
|
band = 'Z';
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
} else {
|
} else {
|
||||||
GRegex *r;
|
GRegex *r;
|
||||||
@@ -976,7 +981,7 @@ serving_system_done (MMSerialPort *port,
|
|||||||
|
|
||||||
/* sid */
|
/* sid */
|
||||||
str = g_match_info_fetch (match_info, 3);
|
str = g_match_info_fetch (match_info, 3);
|
||||||
sid = normalize_sid (str);
|
sid = convert_sid (str);
|
||||||
g_free (str);
|
g_free (str);
|
||||||
|
|
||||||
success = TRUE;
|
success = TRUE;
|
||||||
@@ -987,11 +992,28 @@ serving_system_done (MMSerialPort *port,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
/* 99999 means unknown/no service */
|
gboolean class_ok = FALSE, band_ok = FALSE;
|
||||||
|
|
||||||
|
/* Normalize the SID */
|
||||||
if (sid < 0 || sid > 32767)
|
if (sid < 0 || sid > 32767)
|
||||||
sid = 99999;
|
sid = 99999;
|
||||||
|
|
||||||
if (sid == 0 || sid == 99999) {
|
if (class == 1 || class == 2)
|
||||||
|
class_ok = TRUE;
|
||||||
|
if (band != 'Z')
|
||||||
|
band_ok = TRUE;
|
||||||
|
|
||||||
|
/* Return 'no service' if none of the elements of the +CSS response
|
||||||
|
* indicate that the modem has service. Note that this allows SID 0
|
||||||
|
* when at least one of the other elements indicates service.
|
||||||
|
* Normally we'd treat SID 0 as 'no service' but some modems
|
||||||
|
* (Sierra 5725) sometimes return SID 0 even when registered.
|
||||||
|
*/
|
||||||
|
if (sid == 0 && !class_ok && !band_ok)
|
||||||
|
sid = 99999;
|
||||||
|
|
||||||
|
/* 99999 means unknown/no service */
|
||||||
|
if (sid == 99999) {
|
||||||
/* NOTE: update reg_state_css_response() if this error changes */
|
/* NOTE: update reg_state_css_response() if this error changes */
|
||||||
info->error = g_error_new_literal (MM_MOBILE_ERROR,
|
info->error = g_error_new_literal (MM_MOBILE_ERROR,
|
||||||
MM_MOBILE_ERROR_NO_NETWORK,
|
MM_MOBILE_ERROR_NO_NETWORK,
|
||||||
|
Reference in New Issue
Block a user