Use AT+CPIN? in case AT+CRSM=242 is not supported.
---
plugins/mbm.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 9193539..bef8783 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -49,6 +49,7 @@
static const char *cfun_prefix[] = { "+CFUN:", NULL };
static const char *crsm_prefix[] = { "+CRSM:", NULL };
+static const char *cpin_prefix[] = { "+CPIN:", NULL };
static const char *none_prefix[] = { NULL };
struct mbm_data {
@@ -92,6 +93,18 @@ static void mbm_debug(const char *str, void *user_data)
ofono_info("%s %s", prefix, str);
}
+static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct mbm_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ data->have_sim = ok;
+
+ ofono_modem_set_powered(modem, TRUE);
+}
+
static void status_check(gboolean ok, GAtResult *result, gpointer user_data)
{
struct ofono_modem *modem = user_data;
@@ -101,8 +114,12 @@ static void status_check(gboolean ok, GAtResult *result,
gpointer user_data)
DBG("");
- if (!ok)
- goto poweron;
+ if (!ok) {
+ /* If mbm does not support at+crsm=242, try at+cpin? */
+ g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix,
+ simpin_check, modem, NULL);
+ return;
+ }
/* Modem fakes a 94 04 response from card (File Id not found /
* Pattern not found) when there's no card in the slot.
--
1.6.3.3
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono