diff options
author | Aleksander Morgado <aleksander@aleksander.es> | 2017-11-07 19:13:19 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@aleksander.es> | 2017-12-05 19:10:14 +0100 |
commit | 66dce6dacc440d8bfe4270562ef5a840c87e5a04 (patch) | |
tree | ecebfa4d5f88631414d352ed3f40fefb9fc77528 | |
parent | ce8c7035746e21e09cf491be1fa1186714abd4b2 (diff) |
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.
-rw-r--r-- | src/mm-broadband-modem.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mm-broadband-modem.c b/src/mm-broadband-modem.c index 3d96372a..c97afc13 100644 --- a/src/mm-broadband-modem.c +++ b/src/mm-broadband-modem.c @@ -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") || |