From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3680217226125103594==" MIME-Version: 1.0 From: Alexey Mednyy Subject: GPRS provisioning is broken for old (non-USIM) SIM cards Date: Mon, 01 Dec 2014 14:39:50 +0300 Message-ID: <547C5386.3090400@gmail.com> List-Id: To: ofono@ofono.org --===============3680217226125103594== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable year old patch from ubuntu's ofono flavor. commit d9b8a16f0878868396bbecb61941d0325f07e662 Author: Alfonso Sanchez-Beato Date: Wed Oct 2 09:49:46 2013 +0200 Fix for LP #1231320: GPRS provisioning is broken for old (non-USIM) SIM cards in Ubuntu diff --git a/include/sim.h b/include/sim.h index ed850f9..f63324a 100644 --- a/include/sim.h +++ b/include/sim.h @@ -191,6 +191,7 @@ void *ofono_sim_get_data(struct ofono_sim *sim); const char *ofono_sim_get_imsi(struct ofono_sim *sim); const char *ofono_sim_get_mcc(struct ofono_sim *sim); const char *ofono_sim_get_mnc(struct ofono_sim *sim); +unsigned ofono_sim_get_mnc_length(struct ofono_sim *sim); const char *ofono_sim_get_spn(struct ofono_sim *sim); enum ofono_sim_phase ofono_sim_get_phase(struct ofono_sim *sim); = diff --git a/plugins/provision.c b/plugins/provision.c index 4e9e2a7..78f4f5b 100644 --- a/plugins/provision.c +++ b/plugins/provision.c @@ -48,7 +48,7 @@ static int provision_get_settings(const char *mcc, const char *mnc, int ap_count; int i; = - DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn); + ofono_info("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn); = /* * TODO: review with upstream. Default behavior was to diff --git a/src/gprs.c b/src/gprs.c index e379f7b..0218696 100644 --- a/src/gprs.c +++ b/src/gprs.c @@ -2967,7 +2967,7 @@ static void provision_context(const struct ofono_gprs_provision_data *ap, gprs->contexts =3D g_slist_append(gprs->contexts, context); } = -static void provision_contexts(struct ofono_gprs *gprs, const char *mcc, +static int provision_contexts(struct ofono_gprs *gprs, const char *mcc, const char *mnc, const char *spn) { struct ofono_gprs_provision_data *settings; @@ -2977,13 +2977,15 @@ static void provision_contexts(struct ofono_gprs *gprs, const char *mcc, if (__ofono_gprs_provision_get_settings(mcc, mnc, spn, &settings, &count) =3D=3D FALSE) { ofono_warn("Provisioning failed"); - return; + return -EINVAL; } = for (i =3D 0; i < count; i++) provision_context(&settings[i], gprs); = __ofono_gprs_provision_free_settings(settings, count); + + return 0; + ofono_dbus_signal_property_changed(conn, path, + ofono_dbus_signal_property_changed(conn, path, + OFONO_SIM_MANAGER_INTERFACE, + "MobileNetworkCode", + DBUS_TYPE_STRING, &str); = sim_set_ready(sim); = @@ -1772,8 +1783,12 @@ static void sim_ad_read_cb(int ok, int length, int record, if (!ok) return; = + if (length < 3) { + ofono_error("EFad should contain at least three bytes"); + return; + } if (length < 4) { - ofono_error("EFad should contain@least four bytes"); + ofono_info("EFad does not contain MNC length"); return; } = @@ -2234,6 +2249,14 @@ const char *ofono_sim_get_mnc(struct ofono_sim *sim) return sim->mnc; } = +unsigned ofono_sim_get_mnc_length(struct ofono_sim *sim) +{ + if (sim =3D=3D NULL) + return 0; + + return sim->mnc_length; +} + const char *ofono_sim_get_spn(struct ofono_sim *sim) { if (sim =3D=3D NULL) -- = _________________________________ Best regards, Mednyy Alexey. --===============3680217226125103594==--