Voicecall while context is activate
by TengChou Yang
Hi,
I am able to create voicecalls, creating contexts by using Option module
GTM661W. Please see following for the issue,
if I activate the context,
/usr/lib/ofono/test/list-contexts
[ /hso_0 ]
[ /hso_0/context1 ]
Username = isp(a)cingulargprs.com
Protocol = ip
Name = Data Connect (old)
Settings = { }
IPv6.Settings = { }
Active = 0
AccessPointName = isp.cingular
Password = cingular1
Type = internet
/usr/lib/ofono/test/activate-context,
{ConnectionContext} [/hso_0/context1] Settings = { DomainNameServers =
209.183.35.23 209.183.33.23, Method = static, Netmask = 255.255.255.255,
Address = 166.204.XXX.XX, Interface = hso0, Gateway = 0.0.0.0 }
{ConnectionContext} [/hso_0/context1] Active = True
{ConnectionContext} [/hso_0/context1] Settings = {}
{ConnectionContext} [/hso_0/context1] Active = False
and than create the voicecall,
root@g2:~# /usr/lib/ofono/test/dial-number XXXXXXXXXX
Using modem /hso_0
/hso_0/voicecall01
the test case shows it had been created in voicecall01, but when I list the
phone call
root@g2:~# /usr/lib/ofono/test/list-calls
[ /hso_0 ]
[ /hso_0/voicecall02 ]
Name =
LineIdentification = 9496796229
Multiparty = 0
Emergency = 0
RemoteHeld = 0
State = alerting
RemoteMultiparty = 0
the voicecall which supposed to be at the first
interface(/hso_0/voicecall01) will be created at second
interface(/hso_0/voicecall02).
Does anyone have any clue for this problem?
Sincerely,
TengChou Yang
7 years, 3 months
huawei cdc_ncm devices
by Cedric Jehasse
Hi,
i'm trying to add support for the Huawei E3276 using a cdc_ncm interface.
To activate the pdp context for this device i need to send:
1. AT^NDISDUP=1,1
2. wait for an unsollicited reply ^NDISSTAT:
3. start a dhcp client on the wwanX interface
The huaweimodem gprs-context driver already implement AT^NDISDUP, but is
trying to get the ip address with AT^DHCP?. However this driver is not
being used.
Can i remove the code to send and handle AT^DHCP?, and replace with
^NDISSTAT?
Or should i keep it and add checks to see which at commands are supported?
thanks,
Cedric
7 years, 4 months
[PATCH 2/4] plugin: Interface for using plugins that find the MNC lenght from the IMSI
by Alfonso Sanchez-Beato
---
include/sim-mnclength.h | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 include/sim-mnclength.h
diff --git a/include/sim-mnclength.h b/include/sim-mnclength.h
new file mode 100644
index 0000000..67769f2
--- /dev/null
+++ b/include/sim-mnclength.h
@@ -0,0 +1,45 @@
+/*
+ *
+ * oFono - Open Telephony stack for Linux
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifndef OFONO_SIM_MNCLENGTH_H
+#define OFONO_SIM_MNCLENGTH_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+struct ofono_sim_mnclength_driver {
+ const char *name;
+ int (*get_mnclength)(const char *imsi);
+};
+
+int ofono_sim_mnclength_driver_register(
+ struct ofono_sim_mnclength_driver *driver);
+void ofono_sim_mnclength_driver_unregister(
+ const struct ofono_sim_mnclength_driver *driver);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* OFONO_SIM_MNCLENGTH_H */
--
1.8.3.2
7 years, 4 months
[PATCH 1/4] plugin: Plugin that finds correspondence between MCC and MNC length
by Alfonso Sanchez-Beato
The implementation searchs in two tables, one of them with some special cases
for some operators and the other with the MNC length for a given MCC, as
recommended by the ITU (http://www.itu.int/pub/T-SP-E.212B).
---
plugins/mnclength.c | 392 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 392 insertions(+)
create mode 100644 plugins/mnclength.c
diff --git a/plugins/mnclength.c b/plugins/mnclength.c
new file mode 100644
index 0000000..ee40857
--- /dev/null
+++ b/plugins/mnclength.c
@@ -0,0 +1,392 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2008-2011 Intel Corporation. All rights reserved.
+ * Copyright (C) 2013 Canonical Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <errno.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include <glib.h>
+
+#define OFONO_API_SUBJECT_TO_CHANGE
+#include <ofono/types.h>
+#include <ofono/log.h>
+#include <ofono/plugin.h>
+#include <ofono/sim-mnclength.h>
+
+
+struct mcc_mnclength {
+ int mcc;
+ int mnclength;
+};
+
+/*
+ * Database of MCC to MNC length correspondences based on "Mobile Network Codes
+ * (MNC) for the international identification plan for public networks and
+ * subscriptions (According to Recommendation ITU-T E.212 (05/2008))"
+ * Latest version of that document can be found in
+ * http://www.itu.int/pub/T-SP-E.212B.
+ */
+static struct mcc_mnclength mnclen_db[] = {
+ {202, 2},
+ {204, 2},
+ {206, 2},
+ {208, 2},
+ {212, 2},
+ {213, 2},
+ {214, 2},
+ {216, 2},
+ {218, 2},
+ {219, 2},
+ {220, 2},
+ {222, 2},
+ {225, 2},
+ {226, 2},
+ {228, 2},
+ {230, 2},
+ {231, 2},
+ {232, 2},
+ {234, 2},
+ {235, 2},
+ {238, 2},
+ {240, 2},
+ {242, 2},
+ {244, 2},
+ {246, 2},
+ {247, 2},
+ {248, 2},
+ {250, 2},
+ {255, 2},
+ {257, 2},
+ {259, 2},
+ {260, 2},
+ {262, 2},
+ {266, 2},
+ {268, 2},
+ {270, 2},
+ {272, 2},
+ {274, 2},
+ {276, 2},
+ {278, 2},
+ {280, 2},
+ {282, 2},
+ {283, 2},
+ {284, 2},
+ {286, 2},
+ {288, 2},
+ {289, 2},
+ {290, 2},
+ {292, 2},
+ {293, 2},
+ {294, 2},
+ {295, 2},
+ {297, 2},
+ {302, 3},
+ {308, 2},
+ {310, 3},
+ {311, 3},
+ {312, 3},
+ {313, 3},
+ {314, 3},
+ {315, 3},
+ {316, 3},
+ {330, 2},
+ {332, 2},
+ {334, 3},
+ {338, 3},
+ {340, 2},
+ {342, 3},
+ {344, 3},
+ {346, 3},
+ {348, 3},
+ {350, 2},
+ {352, 2},
+ {354, 2},
+ {356, 2},
+ {358, 2},
+ {360, 2},
+ {362, 2},
+ {363, 2},
+ {364, 2},
+ {365, 3},
+ {366, 2},
+ {368, 2},
+ {370, 2},
+ {372, 2},
+ {374, 2},
+ {376, 2},
+ {400, 2},
+ {401, 2},
+ {402, 2},
+ {404, 2},
+ {405, 2},
+ {410, 2},
+ {412, 2},
+ {413, 2},
+ {414, 2},
+ {415, 2},
+ {416, 2},
+ {417, 2},
+ {418, 2},
+ {419, 2},
+ {420, 2},
+ {421, 2},
+ {422, 2},
+ {423, 2},
+ {424, 2},
+ {425, 2},
+ {426, 2},
+ {427, 2},
+ {428, 2},
+ {429, 2},
+ {430, 2},
+ {431, 2},
+ {432, 2},
+ {434, 2},
+ {436, 2},
+ {437, 2},
+ {438, 2},
+ {440, 2},
+ {441, 2},
+ {450, 2},
+ {452, 2},
+ {454, 2},
+ {455, 2},
+ {456, 2},
+ {457, 2},
+ {460, 2},
+ {461, 2},
+ {466, 2},
+ {467, 2},
+ {470, 2},
+ {472, 2},
+ {502, 2},
+ {505, 2},
+ {510, 2},
+ {514, 2},
+ {515, 2},
+ {520, 2},
+ {525, 2},
+ {528, 2},
+ {530, 2},
+ {534, 2},
+ {535, 2},
+ {536, 2},
+ {537, 2},
+ {539, 2},
+ {540, 2},
+ {541, 2},
+ {542, 2},
+ {543, 2},
+ {544, 2},
+ {545, 2},
+ {546, 2},
+ {547, 2},
+ {548, 2},
+ {549, 2},
+ {550, 2},
+ {551, 2},
+ {552, 2},
+ {602, 2},
+ {603, 2},
+ {604, 2},
+ {605, 2},
+ {606, 2},
+ {607, 2},
+ {608, 2},
+ {609, 2},
+ {610, 2},
+ {611, 2},
+ {612, 2},
+ {613, 2},
+ {614, 2},
+ {615, 2},
+ {616, 2},
+ {617, 2},
+ {618, 2},
+ {619, 2},
+ {620, 2},
+ {621, 2},
+ {622, 2},
+ {623, 2},
+ {624, 2},
+ {625, 2},
+ {626, 2},
+ {627, 2},
+ {628, 2},
+ {629, 2},
+ {630, 2},
+ {631, 2},
+ {632, 2},
+ {633, 2},
+ {634, 2},
+ {635, 2},
+ {636, 2},
+ {637, 2},
+ {638, 2},
+ {639, 2},
+ {640, 2},
+ {641, 2},
+ {642, 2},
+ {643, 2},
+ {645, 2},
+ {646, 2},
+ {647, 2},
+ {648, 2},
+ {649, 2},
+ {650, 2},
+ {651, 2},
+ {652, 2},
+ {653, 2},
+ {654, 2},
+ {655, 2},
+ {657, 2},
+ {702, 2},
+ {704, 2},
+ {706, 2},
+ {708, 3},
+ {710, 2},
+ {712, 2},
+ {714, 2},
+ {716, 2},
+ {722, 3},
+ {724, 2},
+ {730, 2},
+ {732, 3},
+ {734, 2},
+ {736, 2},
+ {738, 2},
+ {740, 2},
+ {742, 2},
+ {744, 2},
+ {746, 2},
+ {748, 2},
+ {750, 2},
+};
+
+/*
+ * These MCC+MNC combinations have 3 digit MNC even though the default for
+ * the corresponing MCC in mnclen_db is length 2.
+ */
+static int codes_mnclen3_db[] = {
+ 405025, 405026, 405027, 405028, 405029, 405030, 405031, 405032,
+ 405033, 405034, 405035, 405036, 405037, 405038, 405039, 405040,
+ 405041, 405042, 405043, 405044, 405045, 405046, 405047, 405750,
+ 405751, 405752, 405753, 405754, 405755, 405756, 405799, 405800,
+ 405801, 405802, 405803, 405804, 405805, 405806, 405807, 405808,
+ 405809, 405810, 405811, 405812, 405813, 405814, 405815, 405816,
+ 405817, 405818, 405819, 405820, 405821, 405822, 405823, 405824,
+ 405825, 405826, 405827, 405828, 405829, 405830, 405831, 405832,
+ 405833, 405834, 405835, 405836, 405837, 405838, 405839, 405840,
+ 405841, 405842, 405843, 405844, 405845, 405846, 405847, 405848,
+ 405849, 405850, 405851, 405852, 405853, 405875, 405876, 405877,
+ 405878, 405879, 405880, 405881, 405882, 405883, 405884, 405885,
+ 405886, 405908, 405909, 405910, 405911, 405912, 405913, 405914,
+ 405915, 405916, 405917, 405918, 405919, 405920, 405921, 405922,
+ 405923, 405924, 405925, 405926, 405927, 405928, 405929, 405930,
+ 405931, 405932
+};
+
+static int comp_int(const void *key, const void *value)
+{
+ int mccmnckey = *(int *) key;
+ int mccmnccurr = *(int *) value;
+
+ return mccmnckey - mccmnccurr;
+}
+
+static int comp_mcc(const void *key, const void *value)
+{
+ int mcc = *(int *) key;
+ struct mcc_mnclength *mccmnc = (struct mcc_mnclength *) value;
+
+ return mcc - mccmnc->mcc;
+}
+
+static int mnclength_get_mnclength(const char *imsi)
+{
+ char mccmnc[OFONO_MAX_MCC_LENGTH + OFONO_MAX_MNC_LENGTH + 1];
+ size_t nelem_mnclen3 = sizeof(codes_mnclen3_db)
+ / sizeof(codes_mnclen3_db[0]);
+ size_t nelem_mccmnc = sizeof(mnclen_db)
+ / sizeof(mnclen_db[0]);
+ int mccmnc_num;
+ int *mccmnc3_res;
+ int mcc_num;
+ struct mcc_mnclength *mccmnc_res;
+
+ if (strlen(imsi) < 6)
+ return 0;
+
+ /* Special case for some operators */
+ strncpy(mccmnc, imsi, sizeof(mccmnc) - 1);
+ mccmnc[sizeof(mccmnc) - 1] = '\0';
+ errno = 0;
+ mccmnc_num = (int) strtol(mccmnc, NULL, 10);
+
+ if (errno == 0) {
+ mccmnc3_res =
+ bsearch(&mccmnc_num, codes_mnclen3_db, nelem_mnclen3,
+ sizeof(codes_mnclen3_db[0]), comp_int);
+
+ if (mccmnc3_res)
+ return 3;
+ }
+
+ /* General case */
+ mccmnc[OFONO_MAX_MCC_LENGTH] = '\0';
+ errno = 0;
+ mcc_num = (int) strtol(mccmnc, NULL, 10);
+
+ if (errno == 0) {
+ mccmnc_res =
+ bsearch(&mcc_num, mnclen_db, nelem_mccmnc,
+ sizeof(mnclen_db[0]), comp_mcc);
+
+ if (mccmnc_res)
+ return mccmnc_res->mnclength;
+ }
+
+ return 0;
+}
+
+static struct ofono_sim_mnclength_driver mnclength_driver = {
+ .name = "MNC length",
+ .get_mnclength = mnclength_get_mnclength
+};
+
+static int mnclength_init(void)
+{
+ return ofono_sim_mnclength_driver_register(&mnclength_driver);
+}
+
+static void mnclength_exit(void)
+{
+ ofono_sim_mnclength_driver_unregister(&mnclength_driver);
+}
+
+OFONO_PLUGIN_DEFINE(mnclength, "MNC length Plugin", VERSION,
+ OFONO_PLUGIN_PRIORITY_DEFAULT,
+ mnclength_init, mnclength_exit)
--
1.8.3.2
7 years, 4 months
[PATCH 4/4] sim: mnclength plugin is called in case no MNC lenght is found in the SIM
by Alfonso Sanchez-Beato
---
src/ofono.h | 4 ++++
src/sim.c | 18 +++++++++++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/src/ofono.h b/src/ofono.h
index 8abaf1e..b0d12d0 100644
--- a/src/ofono.h
+++ b/src/ofono.h
@@ -519,3 +519,7 @@ ofono_bool_t __ofono_cdma_provision_get_name(const char *sid, char **name);
void __ofono_private_network_release(int id);
ofono_bool_t __ofono_private_network_request(ofono_private_network_cb_t cb,
int *id, void *data);
+
+#include <ofono/sim-mnclength.h>
+
+int __ofono_sim_mnclength_get_mnclength(const char *imsi);
diff --git a/src/sim.c b/src/sim.c
index edae5eb..beec74e 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1435,6 +1435,18 @@ static void sim_imsi_obtained(struct ofono_sim *sim, const char *imsi)
"SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
+ /*
+ * sim->mnc_length = 0 means that EFad was not present or that EFad did
+ * not contain the MNC length field (MNC length is not mandatory for
+ * SIMs (non-USIM) - see TS 51.011).
+ *
+ * MNC can have either 2 or 3 digits depending on the MCC: we will try
+ * to find a correspondence in an MCC-MNC length database
+ */
+ if (sim->mnc_length == 0)
+ sim->mnc_length =
+ __ofono_sim_mnclength_get_mnclength(sim->imsi);
+
if (sim->mnc_length) {
const char *str;
@@ -1772,8 +1784,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 at least four bytes");
+ ofono_info("EFad does not contain MNC length");
return;
}
--
1.8.3.2
7 years, 4 months
[PATCH 3/4] sim: Glue for making mnclength plugin reachable
by Alfonso Sanchez-Beato
---
Makefile.am | 7 ++++--
src/sim-mnclength.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 2 deletions(-)
create mode 100644 src/sim-mnclength.c
diff --git a/Makefile.am b/Makefile.am
index 21e8b68..167a350 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,7 +21,7 @@ pkginclude_HEADERS = include/log.h include/plugin.h include/history.h \
include/cdma-connman.h include/gnss.h \
include/private-network.h include/cdma-netreg.h \
include/cdma-provision.h include/handsfree.h \
- include/handsfree-audio.h
+ include/handsfree-audio.h include/sim-mnclength.h
nodist_pkginclude_HEADERS = include/version.h
@@ -463,6 +463,9 @@ builtin_sources += plugins/provision.c
builtin_modules += cdma_provision
builtin_sources += plugins/cdma-provision.c
+
+builtin_modules += mnclength
+builtin_sources += plugins/mnclength.c
endif
if MAINTAINER_MODE
@@ -518,7 +521,7 @@ src_ofonod_SOURCES = $(builtin_sources) src/ofono.ver \
src/cdma-sms.c src/private-network.c src/cdma-netreg.c \
src/cdma-provision.c src/handsfree.c \
src/handsfree-audio.c src/bluetooth.h \
- src/hfp.h
+ src/hfp.h src/sim-mnclength.c
src_ofonod_LDADD = gdbus/libgdbus-internal.la $(builtin_libadd) \
@GLIB_LIBS@ @DBUS_LIBS@ -ldl
diff --git a/src/sim-mnclength.c b/src/sim-mnclength.c
new file mode 100644
index 0000000..9ff6409
--- /dev/null
+++ b/src/sim-mnclength.c
@@ -0,0 +1,70 @@
+/*
+ *
+ * oFono - Open Source Telephony
+ *
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib.h>
+#include "ofono.h"
+#include "sim-mnclength.h"
+
+static GSList *g_drivers = NULL;
+
+int __ofono_sim_mnclength_get_mnclength(const char *imsi)
+{
+ GSList *d;
+ int mnclen;
+
+ for (d = g_drivers; d != NULL; d = d->next) {
+ const struct ofono_sim_mnclength_driver *driver = d->data;
+
+ if (driver->get_mnclength == NULL)
+ continue;
+
+ DBG("Calling mnclength plugin '%s'", driver->name);
+
+ if ((mnclen = driver->get_mnclength(imsi)) <= 0)
+ continue;
+
+ return mnclen;
+ }
+
+ return 0;
+}
+
+int ofono_sim_mnclength_driver_register(
+ struct ofono_sim_mnclength_driver *driver)
+{
+ DBG("driver: %p name: %s", driver, driver->name);
+
+ g_drivers = g_slist_prepend(g_drivers, driver);
+ return 0;
+}
+
+void ofono_sim_mnclength_driver_unregister(
+ const struct ofono_sim_mnclength_driver *driver)
+{
+ DBG("driver: %p name: %s", driver, driver->name);
+
+ g_drivers = g_slist_remove(g_drivers, driver);
+}
--
1.8.3.2
7 years, 4 months
[PATCH] Fix gprs provisioning for some SIM (non-USIM) cards
by Alfonso Sanchez-Beato
In some cases the field MNC length in EFad is not present. MNC can
have either 2 or 3 digits depending on the MCC: we will try with
those 2 lengths when searching in the database for this corner case
(this situation can happen for SIMs (non-USIM), as MNC lenght field
is not mandatory for them - see 3gpp TS 51.011)
---
include/sim.h | 1 +
src/gprs.c | 26 +++++++++++++++++++++----
src/sim.c | 61 ++++++++++++++++++++++++++++++++++++++++-------------------
3 files changed, 65 insertions(+), 23 deletions(-)
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/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 = 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) == FALSE) {
ofono_warn("Provisioning failed");
- return;
+ return -EINVAL;
}
for (i = 0; i < count; i++)
provision_context(&settings[i], gprs);
__ofono_gprs_provision_free_settings(settings, count);
+
+ return 0;
}
static void ofono_gprs_finish_register(struct ofono_gprs *gprs)
@@ -3021,9 +3023,25 @@ static void spn_read_cb(const char *spn, const char *dc, void *data)
struct ofono_gprs *gprs = data;
struct ofono_modem *modem = __ofono_atom_get_modem(gprs->atom);
struct ofono_sim *sim = __ofono_atom_find(OFONO_ATOM_TYPE_SIM, modem);
+ const char *mnc = ofono_sim_get_mnc(sim);
+ const char *mcc = ofono_sim_get_mcc(sim);
+
+ if (ofono_sim_get_mnc_length(sim) == 0 && mnc != NULL) {
+ /* MNC length not found in EFad: we try with length 3 and 2 */
+ char aux_mnc[OFONO_MAX_MNC_LENGTH + 1];
- provision_contexts(gprs, ofono_sim_get_mcc(sim),
- ofono_sim_get_mnc(sim), spn);
+ strncpy(aux_mnc, mnc, OFONO_MAX_MNC_LENGTH);
+ aux_mnc[OFONO_MAX_MNC_LENGTH] = '\0';
+
+ if (provision_contexts(gprs, mcc, aux_mnc, spn) != 0) {
+ ofono_info("MNC length is not 3: trying length 2");
+ aux_mnc[OFONO_MAX_MNC_LENGTH - 1] = '\0';
+ provision_contexts(gprs, mcc, aux_mnc, spn);
+ }
+
+ } else {
+ provision_contexts(gprs, mcc, mnc, spn);
+ }
ofono_sim_remove_spn_watch(sim, &gprs->spn_watch);
diff --git a/src/sim.c b/src/sim.c
index edae5eb..3d31386 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -1427,6 +1427,8 @@ static void sim_imsi_obtained(struct ofono_sim *sim, const char *imsi)
{
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(sim->atom);
+ unsigned char aux_mnc_length;
+ const char *str;
sim->imsi = g_strdup(imsi);
@@ -1435,27 +1437,36 @@ static void sim_imsi_obtained(struct ofono_sim *sim, const char *imsi)
"SubscriberIdentity",
DBUS_TYPE_STRING, &sim->imsi);
- if (sim->mnc_length) {
- const char *str;
+ /*
+ * sim->mnc_length = 0 means that EFad did not contain the MNC length
+ * field. So we will copy 3 digits from the IMSI in the MNC. MNC can
+ * have either 2 or 3 digits depending on the MCC: we will try with
+ * those 2 lengths when searching in the database for this corner case
+ * (this situation can happen for SIMs (non-USIM), as MNC lenght field
+ * is not mandatory for them - see TS 51.011)
+ */
+ if (sim->mnc_length)
+ aux_mnc_length = sim->mnc_length;
+ else
+ aux_mnc_length = OFONO_MAX_MNC_LENGTH;
- strncpy(sim->mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
- sim->mcc[OFONO_MAX_MCC_LENGTH] = '\0';
- strncpy(sim->mnc, sim->imsi + OFONO_MAX_MCC_LENGTH,
- sim->mnc_length);
- sim->mnc[sim->mnc_length] = '\0';
+ strncpy(sim->mcc, sim->imsi, OFONO_MAX_MCC_LENGTH);
+ sim->mcc[OFONO_MAX_MCC_LENGTH] = '\0';
+ strncpy(sim->mnc, sim->imsi + OFONO_MAX_MCC_LENGTH,
+ aux_mnc_length);
+ sim->mnc[aux_mnc_length] = '\0';
- str = sim->mcc;
- ofono_dbus_signal_property_changed(conn, path,
- OFONO_SIM_MANAGER_INTERFACE,
- "MobileCountryCode",
- DBUS_TYPE_STRING, &str);
+ str = sim->mcc;
+ ofono_dbus_signal_property_changed(conn, path,
+ OFONO_SIM_MANAGER_INTERFACE,
+ "MobileCountryCode",
+ DBUS_TYPE_STRING, &str);
- str = sim->mnc;
- ofono_dbus_signal_property_changed(conn, path,
- OFONO_SIM_MANAGER_INTERFACE,
- "MobileNetworkCode",
- DBUS_TYPE_STRING, &str);
- }
+ str = sim->mnc;
+ 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 at 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 == NULL)
+ return 0;
+
+ return sim->mnc_length;
+}
+
const char *ofono_sim_get_spn(struct ofono_sim *sim)
{
if (sim == NULL)
--
1.8.1.2
7 years, 4 months
[PATCH] plugins, mbpi: make mbpi return only APNs of a given type. When provisioning for internect connection, only OFONO_GPRS_CONTEXT_TYPE_INTERNET APNs will be returned.
by Alfonso Sanchez-Beato
From: Alfonso Sanchez-Beato <alfonsosanchezbeato(a)yahoo.es>
---
plugins/mbpi.c | 7 ++++++-
plugins/mbpi.h | 1 +
plugins/provision.c | 3 ++-
tools/lookup-apn.c | 3 ++-
4 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index 309e1ed..b3e26fd 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -53,6 +53,7 @@ enum MBPI_ERROR {
struct gsm_data {
const char *match_mcc;
const char *match_mnc;
+ enum ofono_gprs_context_type match_type;
GSList *apns;
gboolean match_found;
gboolean allow_duplicates;
@@ -370,7 +371,9 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
}
}
- gsm->apns = g_slist_append(gsm->apns, ap);
+ if (gsm->match_type == OFONO_GPRS_CONTEXT_TYPE_ANY ||
+ gsm->match_type == ap->type)
+ gsm->apns = g_slist_append(gsm->apns, ap);
}
static const GMarkupParser gsm_parser = {
@@ -565,6 +568,7 @@ static gboolean mbpi_parse(const GMarkupParser *parser, gpointer userdata,
}
GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
+ enum ofono_gprs_context_type type,
gboolean allow_duplicates, GError **error)
{
struct gsm_data gsm;
@@ -573,6 +577,7 @@ GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
memset(&gsm, 0, sizeof(gsm));
gsm.match_mcc = mcc;
gsm.match_mnc = mnc;
+ gsm.match_type = type;
gsm.allow_duplicates = allow_duplicates;
if (mbpi_parse(&toplevel_gsm_parser, &gsm, error) == FALSE) {
diff --git a/plugins/mbpi.h b/plugins/mbpi.h
index 64b7ea5..36bbed6 100644
--- a/plugins/mbpi.h
+++ b/plugins/mbpi.h
@@ -24,6 +24,7 @@ const char *mbpi_ap_type(enum ofono_gprs_context_type type);
void mbpi_ap_free(struct ofono_gprs_provision_data *data);
GSList *mbpi_lookup_apn(const char *mcc, const char *mnc,
+ enum ofono_gprs_context_type type,
gboolean allow_duplicates, GError **error);
char *mbpi_lookup_cdma_provider_name(const char *sid, GError **error);
diff --git a/plugins/provision.c b/plugins/provision.c
index 99c299e..39e037b 100644
--- a/plugins/provision.c
+++ b/plugins/provision.c
@@ -50,7 +50,8 @@ static int provision_get_settings(const char *mcc, const char *mnc,
DBG("Provisioning for MCC %s, MNC %s, SPN '%s'", mcc, mnc, spn);
- apns = mbpi_lookup_apn(mcc, mnc, FALSE, &error);
+ apns = mbpi_lookup_apn(mcc, mnc, OFONO_GPRS_CONTEXT_TYPE_INTERNET,
+ FALSE, &error);
if (apns == NULL) {
if (error != NULL) {
ofono_error("%s", error->message);
diff --git a/tools/lookup-apn.c b/tools/lookup-apn.c
index 884b32a..4654b03 100644
--- a/tools/lookup-apn.c
+++ b/tools/lookup-apn.c
@@ -42,7 +42,8 @@ static void lookup_apn(const char *match_mcc, const char *match_mnc,
g_print("Searching for info for network: %s%s\n", match_mcc, match_mnc);
- apns = mbpi_lookup_apn(match_mcc, match_mnc, allow_duplicates, &error);
+ apns = mbpi_lookup_apn(match_mcc, match_mnc, OFONO_GPRS_CONTEXT_TYPE_ANY,
+ allow_duplicates, &error);
if (apns == NULL) {
if (error != NULL) {
--
1.8.1.2
7 years, 4 months
oFono upstream test results_20131004
by Nicolas Paccou
Hello all,
Please find the test report of oFono v1.12 commit 2158249.
During this testing, we ran 34 functional positive cases. 34 cases passed,
0 failed. No new issue has been found.
If you have any comment about this report, tell me please.
-----------------------------------------------
Test Objective
The aim of this session was to validate the
state of oFono upstream by testing only major tests of most important
features (voice call tests have been tested using HFP) over all material
we had (according to what feature was supported and by priority order:
PR3, Network Simulator, 3G dongle, phonesim). oFono has been installed and
tested on smartphone running Tizen 2.0 and Ubuntu 12.04 device.
-----------------------------------------------
Test Environment
For all Setup:
oFono: v1.12 (updated to commit 2158249)
- Smartphone Setup:
Image: Tizen 2.0 image
Operator & SIM Card: SFR SIM Card Phone number +33623312183
or
Network Simulator
- Laptop + 3G Dongle/Phonesim:
usb_modeswitch: v1.2.5
modeswitch data: 20130610
Hardware: Laptop
Ubuntu: v12.04
Modem: Huawei E173u-2 - Operator & SIM Card: SFR SIM Card Phone number
+33623312183
Phonesim: v1.19 (updated to commit c94e6c0)
- Laptop + HFP
HF:
Hardware: Laptop
Ubuntu: v12.04
Bluez 5.9 (updated to commit cad62a7)
AG: Android JB device
-----------------------------------------------
Issue Summary
New bug: 0
None
Known bug: 1
OF-162 - Going back from a select item list releases the session
https://01.org/jira/browse/OF-162
Closed bug: 0
None
-----------------------------------------------
Test Result
SUMMARY
Total Test Case 34
Passed 34
Failed 0
Blocked 0
TCs completed 100%
Run rate 100%
Pass rate total 100%
Blocked rate total 0%
Pass rate of executed 100%
FEATURES Total Pass Fail Blocked Pass %
Modem 5 5 0 0 100%
Tested on smartphone using a real SIM Card or on Laptop using 3G Dongle
SIM 4 4 0 0 100%
Tested on smartphone using a real SIM Card or on Laptop using 3G Dongle
Network 2 2 0 0 100%
Tested on smartphone using a real SIM
Connectivity 8 8 0 0 100%
Tested on smartphone using a real SIM Card or on Laptop using 3G Dongle
Voice Calls 12 12 0 0 100%
Tested on smartphone with appropriate SIM Card and Laptop + HFP connected
with a smartphone
Messaging 2 2 0 0 100%
Tested on smartphone using a real SIM
Message Waiting 1 1 0 0 100%
Tested on Laptop using Phonesim
Please find details in the attached file.
-----------------------------------------------
Notes
Please note that one oFono crash still occur on the following conditions:
- OF-163 - oFono crashes when doing a NAA Initialization+File Change
Notification after having done a NAA Initialization+Full File Change
Notification with Phonesim.
Best regards,
Nicolas
7 years, 4 months