aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/simtech/mm-broadband-modem-simtech.c
diff options
context:
space:
mode:
authorDan Williams <dan@ioncontrol.co>2025-05-23 14:11:58 -0500
committerDan Williams <dan@ioncontrol.co>2025-05-23 14:11:58 -0500
commit9cc5582bf28ba6cc30bc000f1f759fe530b6be55 (patch)
tree7df1d08d24db68b12b202d7bf2f658e0c8787b69 /src/plugins/simtech/mm-broadband-modem-simtech.c
parentc5a2cd3157854b9f368717f72ebc852d6d8de954 (diff)
parent5c1fcbfe4a6ee9e89f8b859e26d7d0f74106178d (diff)
Merge request !1355 from 'mtk-unlock-required'
mtk-legacy: read IMSI if CPIN response is an error https://gitlab.freedesktop.org/mobile-broadband/ModemManager/-/merge_requests/1355 Closes #980
Diffstat (limited to 'src/plugins/simtech/mm-broadband-modem-simtech.c')
-rw-r--r--src/plugins/simtech/mm-broadband-modem-simtech.c39
1 files changed, 2 insertions, 37 deletions
diff --git a/src/plugins/simtech/mm-broadband-modem-simtech.c b/src/plugins/simtech/mm-broadband-modem-simtech.c
index cdc822d8..a390a88f 100644
--- a/src/plugins/simtech/mm-broadband-modem-simtech.c
+++ b/src/plugins/simtech/mm-broadband-modem-simtech.c
@@ -72,31 +72,6 @@ struct _MMBroadbandModemSimtechPrivate {
MMModemLock sim_lock;
};
-typedef struct {
- const gchar *result;
- MMModemLock code;
-} CPinResult;
-
-static CPinResult unlock_results[] = {
- { "READY", MM_MODEM_LOCK_NONE },
- { "SIM PIN2", MM_MODEM_LOCK_SIM_PIN2 },
- { "SIM PUK2", MM_MODEM_LOCK_SIM_PUK2 },
- { "SIM PIN", MM_MODEM_LOCK_SIM_PIN },
- { "SIM PUK", MM_MODEM_LOCK_SIM_PUK },
- { "PH-NETSUB PIN", MM_MODEM_LOCK_PH_NETSUB_PIN },
- { "PH-NETSUB PUK", MM_MODEM_LOCK_PH_NETSUB_PUK },
- { "PH-FSIM PIN", MM_MODEM_LOCK_PH_FSIM_PIN },
- { "PH-FSIM PUK", MM_MODEM_LOCK_PH_FSIM_PUK },
- { "PH-CORP PIN", MM_MODEM_LOCK_PH_CORP_PIN },
- { "PH-CORP PUK", MM_MODEM_LOCK_PH_CORP_PUK },
- { "PH-SIM PIN", MM_MODEM_LOCK_PH_SIM_PIN },
- { "PH-NET PIN", MM_MODEM_LOCK_PH_NET_PIN },
- { "PH-NET PUK", MM_MODEM_LOCK_PH_NET_PUK },
- { "PH-SP PIN", MM_MODEM_LOCK_PH_SP_PIN },
- { "PH-SP PUK", MM_MODEM_LOCK_PH_SP_PUK },
- { NULL }
-};
-
/*****************************************************************************/
/* Setup/Cleanup unsolicited events (3GPP interface) */
@@ -158,20 +133,10 @@ simtech_cpin_changed (MMPortSerialAt *port,
MMBroadbandModemSimtech *self)
{
g_autofree gchar *str = NULL;
- CPinResult *iter;
str = mm_get_string_unquoted_from_match_info (match_info, 1);
- if (str) {
- iter = &unlock_results[0];
- /* Translate the reply */
- while (iter->result) {
- if (g_str_has_prefix (str, iter->result)) {
- self->priv->sim_lock = iter->code;
- return;
- }
- iter++;
- }
- }
+ if (str)
+ self->priv->sim_lock = mm_parse_cpin_response (str, FALSE);
}
static void