Re: [PATCH 6/6] gemalto: fix sim reinsertion issue
Hi Gabriel, On 03/15/2018 07:49 AM, Gabriel Lucas wrote: When the SIM card is reinserted in the holder, the IRC +CIEV: simstatus,1 is emitted. The problem is that the SIM isn't ready when it is received. Hence, Ofono fails on CPIN? command and the modem cannot be used. This patch make ofono retry the CPIN? command until it succeeds. --- plugins/gemalto.c | 29 - 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/plugins/gemalto.c b/plugins/gemalto.c index c7fb783..caa5912 100644 --- a/plugins/gemalto.c +++ b/plugins/gemalto.c @@ -497,6 +497,33 @@ static void gemalto_set_online(struct ofono_modem *modem, ofono_bool_t online, g_free(cbd); } +static void sim_pin_query_cb(const struct ofono_error *error, + enum ofono_sim_password_type pin_type, + void *data); + +static void gemalto_wait_after_plug(struct ofono_sim *sim) { + ofono_sim_get_driver(sim)->query_passwd_state(sim, sim_pin_query_cb, sim); +} + +static gboolean cpin_timeout(gpointer sim) { + gemalto_wait_after_plug(sim); + + return FALSE; +} + +static void sim_pin_query_cb(const struct ofono_error *error, + enum ofono_sim_password_type pin_type, + void *data) { + struct ofono_sim *sim = data; + + if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { + g_timeout_add(50, cpin_timeout, sim); + } + else { + ofono_sim_inserted_notify(sim, TRUE); + } +} + static void gemalto_ciev_notify(GAtResult *result, gpointer user_data) { struct ofono_sim *sim = user_data; @@ -523,7 +550,7 @@ static void gemalto_ciev_notify(GAtResult *result, gpointer user_data) if (status == 0) { ofono_sim_inserted_notify(sim, FALSE); } else if(status == 1) { - ofono_sim_inserted_notify(sim, TRUE); + gemalto_wait_after_plug(sim); Why don't you just use at_util_sim_state_query_new here? } } Regards, -Denis ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
Re: [PATCH 5/6] sim: give access to the driver
Hi Gabriel, +const struct ofono_sim_driver* ofono_sim_get_driver(struct ofono_sim *sim); No, please don't do this. The driver should just issue the relevant command directly. Regards, -Denis ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
Re: [PATCH 4/6] gemalto: handle sim is inserted or removed URCs
Hi Gabriel, On 03/15/2018 07:49 AM, Gabriel Lucas wrote: From: Mariem Cherif--- plugins/gemalto.c | 37 + 1 file changed, 37 insertions(+) diff --git a/plugins/gemalto.c b/plugins/gemalto.c index 16ca463..c7fb783 100644 --- a/plugins/gemalto.c +++ b/plugins/gemalto.c @@ -497,6 +497,36 @@ static void gemalto_set_online(struct ofono_modem *modem, ofono_bool_t online, g_free(cbd); } +static void gemalto_ciev_notify(GAtResult *result, gpointer user_data) +{ + struct ofono_sim *sim = user_data; + const char *sim_status = "simstatus"; + const char *ind_str; + int status; + GAtResultIter iter; + + g_at_result_iter_init(, result); + + if (!g_at_result_iter_next(, "+CIEV:")) + return; + So generally +CIEV indication is an , syntax. + if (!g_at_result_iter_next_unquoted_string(, _str)) + return; Does Gemalto use some other syntax here? If so, you might want to document a simple example above. + + if (!g_str_equal(sim_status, ind_str)) + return; + + if (!g_at_result_iter_next_number(, )) + return; + + DBG("sim status %d", status); + if (status == 0) { + ofono_sim_inserted_notify(sim, FALSE); + } else if(status == 1) { + ofono_sim_inserted_notify(sim, TRUE); + } Okay, but simpler written as ofono_sim_inserted_notify(sim, status); +} + static void gemalto_pre_sim(struct ofono_modem *modem) { struct gemalto_data *data = ofono_modem_get_data(modem); @@ -509,6 +539,13 @@ static void gemalto_pre_sim(struct ofono_modem *modem) sim = ofono_sim_create(modem, OFONO_VENDOR_CINTERION, "atmodem", data->app); + /* Register for specific sim status reports */ + g_at_chat_register(data->app, "+CIEV:", + gemalto_ciev_notify, FALSE, sim, NULL); + + g_at_chat_send(data->app, "AT^SIND=\"simstatus\",1", none_prefix, + NULL, NULL, NULL); + if (sim && data->have_sim == TRUE) ofono_sim_inserted_notify(sim, TRUE); } Regards, -Denis ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
Re: [PATCH 1/6] gemalto: add detection of ALS3 modem
Hi Gabriel, On 03/15/2018 07:49 AM, Gabriel Lucas wrote: The product ID is added to the list of modems to be detected by Ofono. The gemalto plugin is used to handle the ALS3 modem. --- plugins/udevng.c | 18 ++ 1 file changed, 18 insertions(+) Patch applied, thanks. Regards, -Denis ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
[PATCH 5/6] sim: give access to the driver
--- include/sim.h | 2 ++ src/sim.c | 5 + 2 files changed, 7 insertions(+) diff --git a/include/sim.h b/include/sim.h index fad4c0d..cf679db 100644 --- a/include/sim.h +++ b/include/sim.h @@ -217,6 +217,8 @@ struct ofono_sim *ofono_sim_create(struct ofono_modem *modem, void ofono_sim_register(struct ofono_sim *sim); void ofono_sim_remove(struct ofono_sim *sim); +const struct ofono_sim_driver* ofono_sim_get_driver(struct ofono_sim *sim); + void ofono_sim_set_data(struct ofono_sim *sim, void *data); void *ofono_sim_get_data(struct ofono_sim *sim); diff --git a/src/sim.c b/src/sim.c index eb9f56a..f56706f 100644 --- a/src/sim.c +++ b/src/sim.c @@ -3305,6 +3305,11 @@ void ofono_sim_remove(struct ofono_sim *sim) __ofono_atom_free(sim->atom); } +const struct ofono_sim_driver* ofono_sim_get_driver(struct ofono_sim *sim) +{ + return sim->driver; +} + void ofono_sim_set_data(struct ofono_sim *sim, void *data) { sim->driver_data = data; -- 1.9.1 ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
[PATCH 3/6] gemalto: acquire the network technology
From: Mariem Cherif--- drivers/atmodem/network-registration.c | 45 ++ 1 file changed, 45 insertions(+) diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c index a5e2af3..aec9c2d 100644 --- a/drivers/atmodem/network-registration.c +++ b/drivers/atmodem/network-registration.c @@ -48,6 +48,7 @@ static const char *cops_prefix[] = { "+COPS:", NULL }; static const char *csq_prefix[] = { "+CSQ:", NULL }; static const char *cind_prefix[] = { "+CIND:", NULL }; static const char *cmer_prefix[] = { "+CMER:", NULL }; +static const char *smoni_prefix[] = { "^SMONI:", "", NULL }; static const char *zpas_prefix[] = { "+ZPAS:", NULL }; static const char *option_tech_prefix[] = { "_OCTI:", "_OUWCTI:", NULL }; @@ -178,6 +179,32 @@ static int option_parse_tech(GAtResult *result) return tech; } +static int cinterion_parse_tech(GAtResult *result) +{ + int tech = -1; + GAtResultIter iter; + GSList *l; + g_at_result_iter_init(, result); + l = result->lines; + if (strstr(l->data, "^SMONI: ") != NULL) { + gchar **body = g_strsplit(l->data, "^SMONI: ", 2); + if (*body != NULL) { + gchar **data = g_strsplit(body[1], ",", 20); + if (*data != NULL) { + if (g_strcmp0(data[0], "2G") == 0) { + tech = ACCESS_TECHNOLOGY_GSM; + } else if (g_strcmp0 (data[0], "3G") == 0) { + tech = ACCESS_TECHNOLOGY_UTRAN; + } else if (g_strcmp0 (data[0], "4G") == 0) { + tech = ACCESS_TECHNOLOGY_EUTRAN; + } + } + g_strfreev(body); + } + } + return tech; +} + static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct cb_data *cbd = user_data; @@ -205,6 +232,18 @@ static void at_creg_cb(gboolean ok, GAtResult *result, gpointer user_data) cb(, status, lac, ci, tech, cbd->data); } +static void cinterion_query_tech_cb(gboolean ok, GAtResult *result, + gpointer user_data) +{ + struct tech_query *tq = user_data; + int tech; + + tech = cinterion_parse_tech(result); + + ofono_netreg_status_notify(tq->netreg, + tq->status, tq->lac, tq->ci, tech); +} + static void zte_tech_cb(gboolean ok, GAtResult *result, gpointer user_data) { struct cb_data *cbd = user_data; @@ -1518,6 +1557,12 @@ static void creg_notify(GAtResult *result, gpointer user_data) option_query_tech_cb, tq, g_free) > 0) return; break; +case OFONO_VENDOR_CINTERION: + if (g_at_chat_send(nd->chat, "AT^SMONI", + smoni_prefix, + cinterion_query_tech_cb, tq, g_free) > 0) + return; + break; } g_free(tq); -- 1.9.1 ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
[PATCH 0/6] gemalto's ALS3 and PHS8P support
This patch serie bring further support to PHS8P modem and the same level of support for ALS3 modem. Here are the lists on enhancements: - ALS3 is detected by Ofono and uses the gemalto plugin - SIM removing and insertion is supported - The optional Technology property on NetworkRegistration is supported - We ensure that the modem is ready to work before initializing it Some of the enhancements are brought by workarounds because of AT command interface limitations Gabriel Lucas (4): gemalto: add detection of ALS3 modem gemalto: support ALS3 in gemalto's plugin sim: give access to the driver gemalto: fix sim reinsertion issue Mariem Cherif (2): gemalto: acquire the network technology gemalto: handle sim is inserted or removed URCs drivers/atmodem/network-registration.c | 45 + include/sim.h | 2 + plugins/gemalto.c | 169 +++-- plugins/udevng.c | 18 src/sim.c | 5 + 5 files changed, 233 insertions(+), 6 deletions(-) -- 1.9.1 ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono
[PATCH 1/6] gemalto: add detection of ALS3 modem
The product ID is added to the list of modems to be detected by Ofono. The gemalto plugin is used to handle the ALS3 modem. --- plugins/udevng.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/plugins/udevng.c b/plugins/udevng.c index 3c7d99e..d398c6e 100644 --- a/plugins/udevng.c +++ b/plugins/udevng.c @@ -1132,6 +1132,7 @@ static gboolean setup_gemalto(struct modem_info* modem) DBG("%s %s %s %s %s", info->devnode, info->interface, info->number, info->label, info->subsystem); + // PHS8-P if (g_strcmp0(info->interface, "255/255/255") == 0) { if (g_strcmp0(info->number, "01") == 0) gps = info->devnode; @@ -1144,6 +1145,20 @@ static gboolean setup_gemalto(struct modem_info* modem) else if (g_strcmp0(info->subsystem, "usbmisc") == 0) qmi = info->devnode; } + + // ALS3 + if (g_strcmp0(info->interface, "2/2/1") == 0) { + if (g_strcmp0(info->number, "00") == 0) + mdm = info->devnode; + else if (g_strcmp0(info->number, "02") == 0) + app = info->devnode; + else if (g_strcmp0(info->number, "04") == 0) + gps = info->devnode; + } + if (g_strcmp0(info->interface, "2/6/0") == 0) { + if (g_strcmp0(info->subsystem, "net") == 0) + net = info->devnode; + } } DBG("application=%s gps=%s modem=%s network=%s qmi=%s", @@ -1156,6 +1171,7 @@ static gboolean setup_gemalto(struct modem_info* modem) ofono_modem_set_string(modem->modem, "GPS", gps); ofono_modem_set_string(modem->modem, "Modem", mdm); ofono_modem_set_string(modem->modem, "Device", qmi); + ofono_modem_set_string(modem->modem, "Model", modem->model); ofono_modem_set_string(modem->modem, "NetworkInterface", net); return TRUE; @@ -1601,6 +1617,8 @@ static struct { { "gemalto","option", "1e2d", "0053" }, { "gemalto","cdc_wdm", "1e2d", "0053" }, { "gemalto","qmi_wwan", "1e2d", "0053" }, + { "gemalto","cdc_acm", "1e2d", "0061" }, + { "gemalto","cdc_ether","1e2d", "0061" }, { "telit", "cdc_ncm", "1bc7", "0036" }, { "telit", "cdc_acm", "1bc7", "0036" }, { "xmm7xxx","cdc_acm", "8087", "0930" }, -- 1.9.1 ___ ofono mailing list ofono@ofono.org https://lists.ofono.org/mailman/listinfo/ofono