* [PATCH] atmodem: add PIN retry count for Alcatel modems.
@ 2012-11-15 8:35 Cedric Jehasse
2012-11-15 18:32 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Cedric Jehasse @ 2012-11-15 8:35 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2280 bytes --]
From: Cedric Jehasse <cedric.jehasse@softathome.com>
---
drivers/atmodem/sim.c | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 9f05f4b..7e2b373 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -66,6 +66,7 @@ static const char *cpinr_prefixes[] = { "+CPINR:", "+CPINRE:", NULL };
static const char *epin_prefix[] = { "*EPIN:", NULL };
static const char *spic_prefix[] = { "+SPIC:", NULL };
static const char *pct_prefix[] = { "#PCT:", NULL };
+static const char *pnnm_prefix[] = { "+PNNM:", NULL };
static const char *none_prefix[] = { NULL };
static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -899,6 +900,43 @@ error:
CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
}
+static void at_pnnm_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ struct cb_data *cbd = user_data;
+ ofono_sim_pin_retries_cb_t cb = cbd->cb;
+ const char *final = g_at_result_final_response(result);
+ GAtResultIter iter;
+ struct ofono_error error;
+ int retries[OFONO_SIM_PASSWORD_INVALID];
+ size_t i;
+ static enum ofono_sim_password_type password_types[] = {
+ OFONO_SIM_PASSWORD_SIM_PIN,
+ OFONO_SIM_PASSWORD_SIM_PUK,
+ };
+
+ decode_at_error(&error, final);
+
+ if (!ok) {
+ cb(&error, NULL, cbd->data);
+ return;
+ }
+
+ g_at_result_iter_init(&iter, result);
+
+ if (!g_at_result_iter_next(&iter, "+PNNM:"))
+ goto error;
+
+ BUILD_PIN_RETRIES_ARRAY(password_types, ARRAY_SIZE(password_types),
+ retries);
+
+ cb(&error, retries, cbd->data);
+
+ return;
+
+error:
+ CALLBACK_WITH_FAILURE(cb, NULL, cbd->data);
+}
+
static void at_pin_retries_query(struct ofono_sim *sim,
ofono_sim_pin_retries_cb_t cb,
void *data)
@@ -955,6 +993,11 @@ static void at_pin_retries_query(struct ofono_sim *sim,
at_pct_cb, cbd, g_free) > 0)
return;
break;
+ case OFONO_VENDOR_ALCATEL:
+ if (g_at_chat_send(sd->chat, "AT+PNNM?", pnnm_prefix,
+ at_pnnm_cb, cbd, g_free) > 0)
+ return;
+ break;
default:
if (g_at_chat_send(sd->chat, "AT+CPINR", cpinr_prefixes,
at_cpinr_cb, cbd, g_free) > 0)
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] atmodem: add PIN retry count for Alcatel modems.
2012-11-15 8:35 [PATCH] atmodem: add PIN retry count for Alcatel modems Cedric Jehasse
@ 2012-11-15 18:32 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2012-11-15 18:32 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 316 bytes --]
Hi Cedric,
On 11/15/2012 02:35 AM, Cedric Jehasse wrote:
> From: Cedric Jehasse<cedric.jehasse@softathome.com>
>
> ---
> drivers/atmodem/sim.c | 43 +++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 43 insertions(+), 0 deletions(-)
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-15 8:35 [PATCH] atmodem: add PIN retry count for Alcatel modems Cedric Jehasse
2012-11-15 18:32 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.