[PATCH] qmimodem: Notify when SIM is initialized
by Nicolas Serafini
Since the commit that introduced the notification API of a SIM inserted
and initialized I can not unlock the SIM card on a WP7607 modem.
The previously mentioned commit: 54d56d763e40bc44c99a9b24aa0477bd373ea085
Signed-off-by: Nicolas Serafini <nicolas.serafini(a)sensefly.com>
---
drivers/qmimodem/sim-legacy.c | 1 +
drivers/qmimodem/sim.c | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/qmimodem/sim-legacy.c b/drivers/qmimodem/sim-legacy.c
index af857693..30eb4613 100644
--- a/drivers/qmimodem/sim-legacy.c
+++ b/drivers/qmimodem/sim-legacy.c
@@ -250,6 +250,7 @@ static void process_uim_state(struct ofono_sim *sim, uint8_t state)
switch (state) {
case QMI_DMS_UIM_STATE_INIT_COMPLETE:
ofono_sim_inserted_notify(sim, TRUE);
+ ofono_sim_initialized_notify(sim);
break;
case QMI_DMS_UIM_STATE_INIT_FAILED:
case QMI_DMS_UIM_STATE_NOT_PRESENT:
diff --git a/drivers/qmimodem/sim.c b/drivers/qmimodem/sim.c
index 8edabb80..e91c6578 100644
--- a/drivers/qmimodem/sim.c
+++ b/drivers/qmimodem/sim.c
@@ -791,6 +791,7 @@ static void get_card_status_cb(struct qmi_result *result, void *user_data)
break;
case 0x01: /* Present */
ofono_sim_inserted_notify(sim, TRUE);
+ ofono_sim_initialized_notify(sim);
break;
}
}
--
2.20.1
1 year, 11 months
ofono fails to compile on gcc-6.3
by Pavel Machek
Hi!
I'm getting this:
CC drivers/rilmodem/network-registration.o
drivers/rilmodem/network-registration.c:40:32: error: unknown option
after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas]
#pragma GCC diagnostic ignored "-Wrestrict"
cc1: error: unrecognized command line option ‘-Wno-format-truncation’
[-Werror]
cc1: all warnings being treated as errors
I commented out #pragma, and this allows compilation to
continue... until I hit same issue in
drivers/rilmodem/call-forwarding.c:41:32:
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
1 year, 11 months
[PATCH 2/2] xmm7modem: chnage to assign datapath for activated PDP context
by Antara Borwankar
Changed the handling of CGCONTRDP AT command reply in ifxmodem
modem driver for XMM7MODEM vendor for assigning network interface
to context settings and routing data over the selected path.
---
drivers/ifxmodem/gprs-context.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 7f3628b..6cadb47 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -271,6 +271,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
const char *gw = NULL;
const char *interface;
const char *dns[3];
+ const char *ctrlpath;
+ const char *datapath;
+ char buf[64];
DBG("ok %d", ok);
@@ -328,8 +331,9 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
DBG("Gateway: %s\n", gcd->gateway);
interface = ofono_modem_get_string(modem, "NetworkInterface");
+ ctrlpath = ofono_modem_get_string(modem, "CtrlPath");
+ datapath = ofono_modem_get_string(modem, "DataPath");
- ofono_gprs_context_set_interface(gc, interface);
ofono_gprs_context_set_ipv4_address(gc, gcd->address, TRUE);
if (gcd->netmask[0])
@@ -340,6 +344,15 @@ static void cgcontrdp_cb(gboolean ok, GAtResult *result, gpointer user_data)
ofono_gprs_context_set_ipv4_dns_servers(gc, dns);
+ sprintf(buf, "AT+XDATACHANNEL=1,1,\"%s\",\"%s%u\",2,%u", ctrlpath,
+ datapath, gcd->active_context, gcd->active_context);
+ g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+ sprintf(buf, "AT+CGDATA=\"M-RAW_IP\",%u", gcd->active_context);
+ g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
+
+ sprintf(buf, "%s\b%u", interface, gcd->active_context);
+ ofono_gprs_context_set_interface(gc, buf);
+
CALLBACK_WITH_SUCCESS(gcd->cb, gcd->cb_data);
}
--
1.9.1
1 year, 11 months
[PATCH 1/2] xmm7modem: Change in xmm7mode plugin for multi PDP handling
by Antara Borwankar
Made changes in xmm7modem plugin to allow mutiple PDP context
activation and to assign correct network interface to the
activated PDP context.
---
plugins/udevng.c | 2 ++
plugins/xmm7xxx.c | 12 ++++++++++++
2 files changed, 14 insertions(+)
diff --git a/plugins/udevng.c b/plugins/udevng.c
index ff6e1fc..353a7dd 100644
--- a/plugins/udevng.c
+++ b/plugins/udevng.c
@@ -1219,6 +1219,8 @@ static gboolean setup_xmm7xxx(struct modem_info *modem)
ofono_modem_set_string(modem->modem, "Modem", mdm);
ofono_modem_set_string(modem->modem, "NetworkInterface", net);
+ ofono_modem_set_string(modem->modem, "CtrlPath", "/USBCDC/0");
+ ofono_modem_set_string(modem->modem, "DataPath", "/USBHS/NCM/");
return TRUE;
}
diff --git a/plugins/xmm7xxx.c b/plugins/xmm7xxx.c
index 237c62c..8b775e0 100644
--- a/plugins/xmm7xxx.c
+++ b/plugins/xmm7xxx.c
@@ -1282,6 +1282,18 @@ static void xmm7xxx_post_online(struct ofono_modem *modem)
if (gprs && gc)
ofono_gprs_add_context(gprs, gc);
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
+ data->chat);
+
+ if (gprs && gc)
+ ofono_gprs_add_context(gprs, gc);
+
+ gc = ofono_gprs_context_create(modem, OFONO_VENDOR_XMM, "ifxmodem",
+ data->chat);
+
+ if (gprs && gc)
+ ofono_gprs_add_context(gprs, gc);
+
ofono_ims_create(modem, "xmm7modem", data->chat);
ofono_netmon_create(modem, 0, "xmm7modem", data->chat);
}
--
1.9.1
1 year, 11 months
[PATCH] mbim: add optional copy of TEMP_FAILURE_RETRY macro (fix musl compile)
by Nicolas Serafini
TEMP_FAILURE_RETRY is not available on musl.
Signed-off-by: Nicolas Serafini <nicolas.serafini(a)sensefly.com>
---
drivers/mbimmodem/mbim.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/mbimmodem/mbim.c b/drivers/mbimmodem/mbim.c
index 54b18acf..4b040528 100644
--- a/drivers/mbimmodem/mbim.c
+++ b/drivers/mbimmodem/mbim.c
@@ -37,6 +37,16 @@
#include "mbim-message.h"
#include "mbim-private.h"
+/* taken from glibc unistd.h for musl support */
+#ifndef TEMP_FAILURE_RETRY
+#define TEMP_FAILURE_RETRY(expression) \
+ (__extension__ \
+ ({ long int __result; \
+ do __result = (long int) (expression); \
+ while (__result == -1L && errno == EINTR); \
+ __result; }))
+#endif
+
#define MAX_CONTROL_TRANSFER 4096
#define HEADER_SIZE (sizeof(struct mbim_message_header) + \
sizeof(struct mbim_fragment_header))
--
2.20.1
1 year, 11 months
Re: Reason ofono flakeyness
by Pavel Machek
Hi!
> > > OK I think I found the reason fo ofono doing a variable
> > > number of commands on start-up with sudo test/enable-modem.
> > >
> > > There seems to be some kind of issue with handling of
> > > commands and results in ofono. See the logs below for
> > > test/enable-modem. The AT+SCRN=0 is sent and then AT+CFUN=1
> > > without waiting for results from the previous command :)
> > >
> > > Is there maybe a missing sync somewhere after writes?
> >
> > No idea. I just copied the code from other drivers and it seemed to
> > work for me.
>
> Yeah presumably that works for serial ports.
Still not sure what is going on there. Part of the problem seems to be
ofono expects serial protocol, and will happily split & batch things
together, but motmdm is really packet-based.
Few questions:
drivers/mfd/motorola-mdm.c:
/* Prepend Motorola custom packet numbering */
snprintf(cmd, cmdlen, "U%04i%s\r", mot_dlci->id, buf);
We already have \r or \n from the user. Will this add extra one?
I guess this will not work with embedded zero bytes...
Plus it seems kernel auto-splits stream from user into packets...
motmdm_cdev_write:
static ssize_t motmdm_cdev_write(struct file *file, const char __user
*buf,
...should it work byte-by-byte? This way if userland sends
AT+FOO=1\rAT+BAR=2\r, it will be sent as a single packet, which is
probably wrong thing to do.
...should it also treat ^Z as an end of packet? In case of SMS
sending, AT+GCGMS= should go in one packet and hex data in another
one, if I understand things correctly....
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
1 year, 12 months
[PATCH] modem: add support to clear cached pins.
by Nandini Rebello
Adding support to clear cached pins when modem is powered off.
---
src/modem.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/modem.c b/src/modem.c
index bc46275..baacdc8 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -1130,6 +1130,9 @@ static DBusMessage *modem_set_property(DBusConnection *conn,
if (modem->lockdown)
return __ofono_error_access_denied(msg);
+ if (!powered)
+ ofono_sim_clear_cached_pins(modem->sim);
+
err = set_powered(modem, powered);
if (err < 0) {
if (err != -EINPROGRESS)
--
2.7.4
1 year, 12 months
[PATCH] sim: Sim PIN1 cache upon modem reset/crash
by Nandini Rebello
Adding SIM PIN caching feature to oFono. oFono now caches the SIM PIN1 type
against the ICCID throughout its lifetime in a link list and enters
implicitly upon modem reset/crash.
Violates 3GPP spec 21.111, section 5.3 - User Data stored in ME. Helps
in user experience by not barring out cellular services unless pin is entered
manually.
Handles cases of incorrect pin and sim pin changed externally.
Clear cached PIN incase modem disabled manually and selectively when
sim is removed.
Seperate 'pin_cache_enter_cb' added without dbus calls to handle implict entering of
cached pin.
Adding to all modems by default.
---
src/sim.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 111 insertions(+)
diff --git a/src/sim.c b/src/sim.c
index 886f291..d5e6d40 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -143,6 +143,11 @@ struct ofono_sim {
bool wait_initialized : 1;
};
+struct cached_pin {
+ char *id;
+ char *pin;
+};
+
struct msisdn_set_request {
struct ofono_sim *sim;
int pending;
@@ -178,6 +183,8 @@ static void sim_own_numbers_update(struct ofono_sim *sim);
static GSList *g_drivers = NULL;
+static GSList *cached_pins = NULL;
+
static const char *sim_passwd_name(enum ofono_sim_password_type type)
{
return passwd_name[type];
@@ -475,6 +482,68 @@ done:
return reply;
}
+static struct cached_pin *pin_cache_lookup(const char *iccid)
+{
+ struct cached_pin *c;
+ GSList *l;
+
+ if (cached_pins == NULL)
+ return NULL;
+
+ for (l = cached_pins; l; l = l->next) {
+ c = l->data;
+
+ if (g_strcmp0(iccid, c->id) == 0)
+ return c;
+ }
+
+ return NULL;
+}
+
+static void pin_cache_update(const char *iccid, const char *pin)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+ struct cached_pin *cpins;
+
+ if (pin_cached != NULL) {
+ g_free(pin_cached->pin);
+ pin_cached->pin = g_strdup(pin);
+ return;
+ }
+
+ cpins = g_new0(struct cached_pin, 1);
+
+ cpins->id = g_strdup(iccid);
+ cpins->pin = g_strdup(pin);
+ cached_pins = g_slist_prepend(cached_pins, cpins);
+}
+
+static void pin_cache_remove(const char *iccid)
+{
+ struct cached_pin *pin_cached = pin_cache_lookup(iccid);
+
+ if (pin_cached == NULL)
+ return;
+
+ cached_pins = g_slist_remove(cached_pins, pin_cached);
+}
+
+static void pin_cache_enter_cb(const struct ofono_error *error, void *data)
+{
+ struct ofono_sim *sim = data;
+
+ if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+ pin_cache_remove(sim->iccid);
+
+ __ofono_sim_recheck_pin(sim);
+
+ return;
+ }
+
+ sim->wait_initialized = true;
+ DBG("Waiting for ofono_sim_initialized_notify");
+}
+
static void sim_pin_retries_query_cb(const struct ofono_error *error,
int retries[OFONO_SIM_PASSWORD_INVALID],
void *data)
@@ -683,6 +752,11 @@ static void sim_locked_cb(struct ofono_sim *sim, gboolean locked)
OFONO_SIM_MANAGER_INTERFACE,
"LockedPins", DBUS_TYPE_STRING,
&locked_pins);
+
+ /*Cache pin only for SIM PIN type*/
+ if (g_strcmp0(typestr, "pin") == 0)
+ pin_cache_update(sim->iccid, pin);
+
g_strfreev(locked_pins);
sim_pin_retries_check(sim);
@@ -778,6 +852,14 @@ static DBusMessage *sim_unlock_pin(DBusConnection *conn, DBusMessage *msg,
static void sim_change_pin_cb(const struct ofono_error *error, void *data)
{
struct ofono_sim *sim = data;
+ const char *typestr;
+ const char *old;
+ const char *new;
+
+ dbus_message_get_args(sim->pending, NULL, DBUS_TYPE_STRING, &typestr,
+ DBUS_TYPE_STRING, &old,
+ DBUS_TYPE_STRING, &new,
+ DBUS_TYPE_INVALID);
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
__ofono_dbus_pending_reply(&sim->pending,
@@ -788,6 +870,10 @@ static void sim_change_pin_cb(const struct ofono_error *error, void *data)
return;
}
+ /*Cache pin only for SIM PIN type*/
+ if (g_strcmp0(typestr, "pin") == 0)
+ pin_cache_update(sim->iccid, new);
+
__ofono_dbus_pending_reply(&sim->pending,
dbus_message_new_method_return(sim->pending));
@@ -839,8 +925,14 @@ static DBusMessage *sim_change_pin(DBusConnection *conn, DBusMessage *msg,
static void sim_enter_pin_cb(const struct ofono_error *error, void *data)
{
struct ofono_sim *sim = data;
+ const char *typestr;
+ const char *pin;
DBusMessage *reply;
+ dbus_message_get_args(sim->pending, NULL, DBUS_TYPE_STRING, &typestr,
+ DBUS_TYPE_STRING, &pin,
+ DBUS_TYPE_INVALID);
+
if (error->type != OFONO_ERROR_TYPE_NO_ERROR)
reply = __ofono_error_failed(sim->pending);
else
@@ -852,6 +944,10 @@ static void sim_enter_pin_cb(const struct ofono_error *error, void *data)
if (sim->initialized || error->type != OFONO_ERROR_TYPE_NO_ERROR)
goto recheck;
+ /*Cache pin only for SIM PIN type*/
+ if (g_strcmp0(typestr, "pin") == 0)
+ pin_cache_update(sim->iccid, pin);
+
if (sim->pin_type == OFONO_SIM_PASSWORD_SIM_PIN ||
sim->pin_type == OFONO_SIM_PASSWORD_SIM_PUK) {
sim->wait_initialized = true;
@@ -2751,6 +2847,8 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted)
sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PIN2] = -1;
sim->pin_retries[OFONO_SIM_PASSWORD_SIM_PUK2] = -1;
+ pin_cache_remove(sim->iccid);
+
sim_free_state(sim);
}
}
@@ -3024,6 +3122,7 @@ static void sim_pin_query_cb(const struct ofono_error *error,
struct ofono_sim *sim = data;
DBusConnection *conn = ofono_dbus_get_connection();
const char *path = __ofono_atom_get_path(sim->atom);
+ struct cached_pin *cpins = pin_cache_lookup(sim->iccid);
const char *pin_name;
char **locked_pins;
gboolean lock_changed;
@@ -3068,6 +3167,10 @@ static void sim_pin_query_cb(const struct ofono_error *error,
&pin_name);
}
+ if (g_strcmp0(pin_name, "pin") == 0 && cpins != NULL)
+ sim->driver->send_passwd(sim, cpins->pin,
+ pin_cache_enter_cb, sim);
+
switch (pin_type) {
case OFONO_SIM_PASSWORD_NONE:
case OFONO_SIM_PASSWORD_SIM_PIN2:
@@ -3301,6 +3404,14 @@ void ofono_sim_register(struct ofono_sim *sim)
__ofono_atom_register(sim->atom, sim_unregister);
}
+void ofono_sim_clear_cached_pins(struct ofono_sim *sim)
+{
+ if (cached_pins == NULL)
+ return;
+
+ pin_cache_remove(sim->iccid);
+}
+
void ofono_sim_remove(struct ofono_sim *sim)
{
__ofono_atom_free(sim->atom);
--
2.7.4
1 year, 12 months
[PATCH] sim: Add support to clear cached PINs
by Nandini Rebello
Adding function to clear cached pins in case modem is disabled.
---
include/sim.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/include/sim.h b/include/sim.h
index fad4c0d..e00e213 100644
--- a/include/sim.h
+++ b/include/sim.h
@@ -262,6 +262,8 @@ void ofono_sim_inserted_notify(struct ofono_sim *sim, ofono_bool_t inserted);
*/
void ofono_sim_initialized_notify(struct ofono_sim *sim);
+void ofono_sim_clear_cached_pins(struct ofono_sim *sim);
+
struct ofono_sim_context *ofono_sim_context_create(struct ofono_sim *sim);
struct ofono_sim_context *ofono_sim_context_create_isim(
--
2.7.4
2 years
[PATCH] ifxmodem: removing TAP/TUN support check for XMM vendor
by Antara Borwankar
skipping TAP/TUN support check from gprs-context probe for
xmm vendor. xmm modem does not require TAP/TUN support. Also
it is not enabled by default in enbedded yocto bsp.
---
drivers/ifxmodem/gprs-context.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 5d1da2d..7f3628b 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -616,9 +616,11 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
DBG("");
- if (stat(TUN_DEV, &st) < 0) {
- ofono_error("Missing support for TUN/TAP devices");
- return -ENODEV;
+ if (vendor != OFONO_VENDOR_XMM) {
+ if (stat(TUN_DEV, &st) < 0) {
+ ofono_error("Missing support for TUN/TAP devices");
+ return -ENODEV;
+ }
}
if (vendor != OFONO_VENDOR_XMM) {
--
1.9.1
2 years