* Re: [PATCH] sim900: Using AT+SPIC for obtaining times remains input SIM PIN/PUK
2012-02-22 12:18 [PATCH] sim900: Using AT+SPIC for obtaining times remains input SIM PIN/PUK r.r.zaripov
@ 2012-02-22 10:19 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2012-02-22 10:19 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 942 bytes --]
Hi Renat,
On 02/22/2012 06:18 AM, r.r.zaripov(a)gmail.com wrote:
> From: Renat Zaripov <r.r.zaripov@gmail.com>
>
> In SIMCOM SIM900 not implemented AT+CPINR, but possible use AT+SPIC
> instead this one.
>
> AT+SPIC Times Remained to Input SIM PIN/PUK
>
> +SPIC: <pin1>,<pin2>,<puk1>,<puk2>
>
> Parameters
> <pin1> Times remained to input chv1
> <pin2> Times remained to input chv2
> <puk1> Times remained to input puk1
> <puk2> Times remained to input puk2
> ---
> drivers/atmodem/sim.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
> plugins/sim900.c | 2 +-
> 2 files changed, 46 insertions(+), 1 deletions(-)
>
I broke this patch up into two, one for drivers/atmodem changes and one
for plugins/ changes. Please refer to item 3) in 'Submitting patches'
section of the HACKING document.
I also re-worded the commit message slightly and applied the patch.
Thanks!
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] sim900: Using AT+SPIC for obtaining times remains input SIM PIN/PUK
@ 2012-02-22 12:18 r.r.zaripov
2012-02-22 10:19 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: r.r.zaripov @ 2012-02-22 12:18 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3260 bytes --]
From: Renat Zaripov <r.r.zaripov@gmail.com>
In SIMCOM SIM900 not implemented AT+CPINR, but possible use AT+SPIC
instead this one.
AT+SPIC Times Remained to Input SIM PIN/PUK
+SPIC: <pin1>,<pin2>,<puk1>,<puk2>
Parameters
<pin1> Times remained to input chv1
<pin2> Times remained to input chv2
<puk1> Times remained to input puk1
<puk2> Times remained to input puk2
---
drivers/atmodem/sim.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
plugins/sim900.c | 2 +-
2 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 8edd582..8ee9822 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -62,6 +62,7 @@ static const char *zpinpuk_prefix[] = { "+ZPINPUK:", NULL };
static const char *oercn_prefix[] = { "_OERCN:", NULL };
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 *none_prefix[] = { NULL };
static void at_crsm_info_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -800,6 +801,45 @@ static void at_cpinr_cb(gboolean ok, GAtResult *result, gpointer user_data)
cb(&error, retries, cbd->data);
}
+static void at_spic_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,
+ OFONO_SIM_PASSWORD_SIM_PIN2,
+ OFONO_SIM_PASSWORD_SIM_PUK2,
+ };
+
+ 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, "+SPIC:"))
+ 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)
@@ -840,6 +880,11 @@ static void at_pin_retries_query(struct ofono_sim *sim,
at_epin_cb, cbd, g_free) > 0)
return;
break;
+ case OFONO_VENDOR_SIMCOM:
+ if (g_at_chat_send(sd->chat, "AT+SPIC", spic_prefix,
+ at_spic_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)
diff --git a/plugins/sim900.c b/plugins/sim900.c
index bc5f9c5..87d640f 100644
--- a/plugins/sim900.c
+++ b/plugins/sim900.c
@@ -210,7 +210,7 @@ static void sim900_pre_sim(struct ofono_modem *modem)
DBG("%p", modem);
ofono_devinfo_create(modem, 0, "atmodem", data->modem);
- sim = ofono_sim_create(modem, 0, "atmodem", data->modem);
+ sim = ofono_sim_create(modem, OFONO_VENDOR_SIMCOM, "atmodem", data->modem);
if (sim)
ofono_sim_inserted_notify(sim, TRUE);
--
1.7.7.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-02-22 12:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-22 12:18 [PATCH] sim900: Using AT+SPIC for obtaining times remains input SIM PIN/PUK r.r.zaripov
2012-02-22 10:19 ` 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.