broadband-modem: use several SIM errors to flag the modem as GSM/UMTS
When using CPIN? to detect capabilities, use several possible +CME errors as indication that the modem is at least GSM/UMTS. E.g. to avoid situations like this one where the modem doesn't even get into Failed state as we cannot gather capabilities: debug_log(): (ttyMux1): --> 'AT+GCAP<CR>' debug_log(): (ttyMux1): <-- '<CR><LF>+CME ERROR: 100<CR><LF>' mm_serial_parser_v1_parse(): Got failure code 100: Unknown error debug_log(): (ttyMux1): --> 'ATI<CR>' debug_log(): (ttyMux1): <-- '<CR><LF>Cinterion<CR><LF>EHS5-E<CR><LF>REVISION 03.001<CR><LF><CR><LF>OK<CR><LF>' debug_log(): (ttyMux1): --> 'AT+CPIN?<CR>' debug_log(): (ttyMux1): <-- '<CR><LF>+CME ERROR: 10<CR><LF>' mm_serial_parser_v1_parse(): Got failure code 10: SIM not inserted debug_log(): (ttyMux1): --> 'AT+CGMM<CR>' debug_log(): (ttyMux1): <-- '<CR><LF>EHS5-E<CR><LF>' debug_log(): (ttyMux1): <-- '<CR><LF>OK<CR><LF>' iface_modem_initialize_ready(): Modem couldn't be initialized: couldn't load current capabilities: Failed to determine modem capabilities.
This commit is contained in:
@@ -481,8 +481,18 @@ parse_caps_cpin (MMBaseModem *self,
|
||||
GVariant **result,
|
||||
GError **result_error)
|
||||
{
|
||||
if (!response)
|
||||
if (!response) {
|
||||
if (error &&
|
||||
(g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_NOT_INSERTED) ||
|
||||
g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_FAILURE) ||
|
||||
g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_BUSY) ||
|
||||
g_error_matches (error, MM_MOBILE_EQUIPMENT_ERROR, MM_MOBILE_EQUIPMENT_ERROR_SIM_WRONG))) {
|
||||
/* At least, it's a GSM modem */
|
||||
*result = g_variant_new_uint32 (MM_MODEM_CAPABILITY_GSM_UMTS);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (strcasestr (response, "SIM PIN") ||
|
||||
strcasestr (response, "SIM PUK") ||
|
||||
|
Reference in New Issue
Block a user