Re: [PATCH 1/2] linktop: reimplemented with minimum features.
Hi Denis, On Mon, Jun 27, 2011 at 9:04 PM, Denis Kenzior wrote: > Hi Amit, > > On 06/27/2011 01:22 AM, Amit Mendapara wrote: > > The device supports subset of ST-Ericsson AT command > > extensions but nither STE nor the MBM plugin works with > > these devices. > > > > Fixes MeeGo bug #14784 > > --- > > plugins/linktop.c | 120 > +++-- > > 1 files changed, 52 insertions(+), 68 deletions(-) > > > > I applied this patch with some amendments: > Thanks... > > > diff --git a/plugins/linktop.c b/plugins/linktop.c > > index 953f634..2eb1c55 100644 > > --- a/plugins/linktop.c > > +++ b/plugins/linktop.c > > @@ -26,6 +26,7 @@ > > #include > > #include > > #include > > +#include > > > > This header doesn't seem necessary > > > #include > > #include > > @@ -45,22 +42,20 @@ > > #include > > #include > > #include > > -#include > > -#include > > #include > > #include > > #include > > #include > > #include > > > > -#include > > #include > > +#include > > > > Since you're not using any VENDOR defines, this header is not necessary. > However I actually question whether signal strength updates work right > now without using the CIND based signal strength updates that MBM uses. > Yes, signal strength is being updated correctly using unsolicited CIEV messages. > > static const char *none_prefix[] = { NULL }; > > > > struct linktop_data { > > GAtChat *modem; > > - GAtChat *control; > > + GAtChat *aux; > > struct ofono_gprs *gprs; > > struct ofono_gprs_context *gc; > > }; > > > > > @@ -138,10 +133,9 @@ static void linktop_disconnect(gpointer user_data) > > struct ofono_modem *modem = user_data; > > struct linktop_data *data = ofono_modem_get_data(modem); > > > > - DBG(""); > > + DBG("%p, data->gc %p", modem, data->gc); > > > > - if (data->gc) > > - ofono_gprs_context_remove(data->gc); > > + ofono_gprs_context_remove(data->gc); > > > > g_at_chat_unref(data->modem); > > data->modem = NULL; > > @@ -151,7 +145,7 @@ static void linktop_disconnect(gpointer user_data) > > return; > > > > g_at_chat_set_disconnect_function(data->modem, > > - linktop_disconnect, modem); > > + linktop_disconnect, modem); > > The original formatting was correct > > > > > ofono_info("Reopened GPRS context channel"); > > > > @@ -232,13 +223,12 @@ static int linktop_disable(struct ofono_modem > *modem) > > data->modem = NULL; > > } > > > > It is not necessary to cancel_all on the modem channel, unref it and set > it to zero, cancel_all is already called automatically from unref. Not > to mention you do the same thing in cfun_disable. > Thanks for correcting this... > > > - if (data->control == NULL) > > + if (data->aux == NULL) > > return 0; > > > > - g_at_chat_cancel_all(data->control); > > - g_at_chat_unregister_all(data->control); > > - g_at_chat_send(data->control, "AT+CFUN=4", none_prefix, > > - cfun_disable, modem, NULL); > > + g_at_chat_cancel_all(data->aux); > > + g_at_chat_unregister_all(data->aux); > > + g_at_chat_send(data->aux, "AT+CFUN=4", NULL, cfun_disable, modem, > NULL); > > > > return -EINPROGRESS; > > } > > @@ -247,22 +237,25 @@ static void set_online_cb(gboolean ok, GAtResult > *result, gpointer user_data) > > { > > struct cb_data *cbd = user_data; > > ofono_modem_online_cb_t cb = cbd->cb; > > - struct ofono_error error; > > > > - decode_at_error(&error, g_at_result_final_response(result)); > > - cb(&error, cbd->data); > > + if (ok) > > + CALLBACK_WITH_SUCCESS(cb, cbd->data); > > + else > > + CALLBACK_WITH_FAILURE(cb, cbd->data); > > The original was actually correct and I updated the mbm plugin to do the > same. > > > } > > > > Please test my changes and make sure I didn't break anything > > I just tested and everything works fine :). Thank you again... Regards -- Amit Mendapara ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/2] udev: changed linktop device strings
--- plugins/udev.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/udev.c b/plugins/udev.c index 99303e9..1580b02 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -577,10 +577,10 @@ static void add_linktop(struct ofono_modem *modem, if (g_strcmp0(intfnum, "01") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Modem", devnode); + ofono_modem_set_string(modem, "Aux", devnode); } else if (g_strcmp0(intfnum, "03") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Control", devnode); + ofono_modem_set_string(modem, "Modem", devnode); ofono_modem_set_integer(modem, "Registered", 1); ofono_modem_register(modem); -- 1.7.4.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] linktop: reimplemented with minimum features.
The device supports subset of ST-Ericsson AT command extensions but nither STE nor the MBM plugin works with these devices. Fixes MeeGo bug #14784 --- plugins/linktop.c | 120 +++-- 1 files changed, 52 insertions(+), 68 deletions(-) diff --git a/plugins/linktop.c b/plugins/linktop.c index 953f634..2eb1c55 100644 --- a/plugins/linktop.c +++ b/plugins/linktop.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -34,10 +35,6 @@ #define OFONO_API_SUBJECT_TO_CHANGE #include #include -#include -#include -#include -#include #include #include #include @@ -45,22 +42,20 @@ #include #include #include -#include -#include #include #include #include #include #include -#include #include +#include static const char *none_prefix[] = { NULL }; struct linktop_data { GAtChat *modem; - GAtChat *control; + GAtChat *aux; struct ofono_gprs *gprs; struct ofono_gprs_context *gc; }; @@ -89,16 +84,16 @@ static void linktop_remove(struct ofono_modem *modem) ofono_modem_set_data(modem, NULL); g_at_chat_unref(data->modem); - g_at_chat_unref(data->control); + g_at_chat_unref(data->aux); g_free(data); } static void linktop_debug(const char *str, void *user_data) { -const char *prefix = user_data; + const char *prefix = user_data; -ofono_info("%s%s", prefix, str); + ofono_info("%s%s", prefix, str); } static GAtChat *open_device(struct ofono_modem *modem, @@ -138,10 +133,9 @@ static void linktop_disconnect(gpointer user_data) struct ofono_modem *modem = user_data; struct linktop_data *data = ofono_modem_get_data(modem); - DBG(""); + DBG("%p, data->gc %p", modem, data->gc); - if (data->gc) - ofono_gprs_context_remove(data->gc); + ofono_gprs_context_remove(data->gc); g_at_chat_unref(data->modem); data->modem = NULL; @@ -151,7 +145,7 @@ static void linktop_disconnect(gpointer user_data) return; g_at_chat_set_disconnect_function(data->modem, - linktop_disconnect, modem); + linktop_disconnect, modem); ofono_info("Reopened GPRS context channel"); @@ -176,31 +170,25 @@ static int linktop_enable(struct ofono_modem *modem) DBG("%p", modem); - data->modem = open_device(modem, "Modem", "Modem: "); - if (data->modem == NULL) - return -EINVAL; + data->aux = open_device(modem, "Aux", "Aux: "); + if (data->aux == NULL) + return -EIO; - g_at_chat_set_disconnect_function(data->modem, - linktop_disconnect, modem); + data->modem = open_device(modem, "Modem", "Modem: "); + if (data->modem == NULL) { + g_at_chat_unref(data->aux); + data->aux = NULL; - data->control = open_device(modem, "Control", "Control: "); - if (data->control == NULL) { - g_at_chat_unref(data->modem); - data->modem = NULL; return -EIO; } - g_at_chat_send(data->control, "ATE0 +CMEE=1", none_prefix, - NULL, NULL, NULL); - - g_at_chat_send(data->modem, "AT", none_prefix, - NULL, NULL, NULL); - - g_at_chat_send(data->modem, "AT &F", none_prefix, - NULL, NULL, NULL); + g_at_chat_set_disconnect_function(data->modem, + linktop_disconnect, modem); - g_at_chat_send(data->control, "AT+CFUN=4", none_prefix, - cfun_enable, modem, NULL); + g_at_chat_send(data->aux, "ATE0 +CMEE=1", none_prefix, + NULL, NULL, NULL); + g_at_chat_send(data->aux, "AT+CFUN=4", none_prefix, + cfun_enable, modem, NULL); return -EINPROGRESS; } @@ -212,8 +200,11 @@ static void cfun_disable(gboolean ok, GAtResult *result, gpointer user_data) DBG(""); - g_at_chat_unref(data->control); - data->control = NULL; + g_at_chat_unref(data->aux); + data->aux = NULL; + + g_at_chat_unref(data->modem); + data->modem = NULL; if (ok) ofono_modem_set_powered(modem, FALSE); @@ -232,13 +223,12 @@ static int linktop_disable(struct ofono_modem *modem) data->modem = NULL; } - if (data->control == NULL) + if (data->aux == NULL) return 0; - g_at_chat_cancel_all(data->control); - g_at_chat_unregister_all(data->control); - g_at_chat_send(data->control, "AT+CFUN=4", none_prefix, - cfun_di
[PATCH 1/2] linktop: reimplemented linktop plugin with minimum features.
The device supports subset of ST-Ericsson AT command extensions but nither STE nor the MBM plugin works with these devices. - Supports voice call and has builtin soundcard but unable to hear any sound. - Supports sim toolkit commands but I am unable to test this feature. Fixes MeeGo bug #14784 --- plugins/linktop.c | 234 + 1 files changed, 112 insertions(+), 122 deletions(-) diff --git a/plugins/linktop.c b/plugins/linktop.c index 953f634..bd8aa3e 100644 --- a/plugins/linktop.c +++ b/plugins/linktop.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -34,33 +35,30 @@ #define OFONO_API_SUBJECT_TO_CHANGE #include #include -#include -#include -#include -#include #include #include #include #include -#include #include #include -#include -#include #include #include #include #include #include -#include #include +#include +static const char *cpin_prefix[] = { "+CPIN:", NULL }; static const char *none_prefix[] = { NULL }; struct linktop_data { - GAtChat *modem; - GAtChat *control; + GAtChat *modem_port; + GAtChat *data_port; + guint cpin_poll_source; + guint cpin_poll_count; + gboolean have_sim; struct ofono_gprs *gprs; struct ofono_gprs_context *gc; }; @@ -88,25 +86,79 @@ static void linktop_remove(struct ofono_modem *modem) ofono_modem_set_data(modem, NULL); - g_at_chat_unref(data->modem); - g_at_chat_unref(data->control); + g_at_chat_unref(data->data_port); + g_at_chat_unref(data->modem_port); + + if (data->cpin_poll_source > 0) + g_source_remove(data->cpin_poll_source); g_free(data); } static void linktop_debug(const char *str, void *user_data) { -const char *prefix = user_data; + const char *prefix = user_data; + + ofono_info("%s%s", prefix, str); +} + +static gboolean init_simpin_check(gpointer user_data); + +static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); + + DBG(""); + + /* Modem returns an error if SIM is not ready. */ + if (!ok && data->cpin_poll_count++ < 5) { + data->cpin_poll_source = + g_timeout_add_seconds(1, init_simpin_check, modem); + return; + } + + data->cpin_poll_count = 0; + + /* There is probably no SIM if SIM is not ready after 5 seconds. */ + data->have_sim = ok; + + ofono_modem_set_powered(modem, TRUE); +} + +static gboolean init_simpin_check(gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); + + data->cpin_poll_source = 0; -ofono_info("%s%s", prefix, str); + g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix, + simpin_check, modem, NULL); + + return FALSE; +} + +static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + + DBG(""); + + if (!ok) { + ofono_modem_set_powered(modem, FALSE); + return; + } + + init_simpin_check(modem); } static GAtChat *open_device(struct ofono_modem *modem, const char *key, char *debug) { - const char *device; GAtSyntax *syntax; GIOChannel *channel; + const char *device; GAtChat *chat; device = ofono_modem_get_string(modem, key); @@ -126,94 +178,53 @@ static GAtChat *open_device(struct ofono_modem *modem, if (chat == NULL) return NULL; - + if (getenv("OFONO_AT_DEBUG")) g_at_chat_set_debug(chat, linktop_debug, debug); return chat; } -static void linktop_disconnect(gpointer user_data) -{ - struct ofono_modem *modem = user_data; - struct linktop_data *data = ofono_modem_get_data(modem); - - DBG(""); - - if (data->gc) - ofono_gprs_context_remove(data->gc); - - g_at_chat_unref(data->modem); - data->modem = NULL; - - data->modem = open_device(modem, "Modem", "Modem: "); - if (data->modem == NULL) - return; - - g_at_chat_set_disconnect_function(data->modem, - linktop_disconnect, modem); - - ofono_info("Reopened GPRS context channel"); - - data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem); - - if (data->gprs && data->gc) - ofono_gprs_add_context(data->gprs, data->gc); -} - -static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) -{ - struct ofono_modem *modem = user_data; - - DBG(""); - - ofono_modem_set_powered(
[PATCH 2/2] udev: changed linktop device strings
--- plugins/udev.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/udev.c b/plugins/udev.c index 0234fc0..4f4e6d8 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -577,10 +577,10 @@ static void add_linktop(struct ofono_modem *modem, if (g_strcmp0(intfnum, "01") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Modem", devnode); + ofono_modem_set_string(modem, "ModemDevice", devnode); } else if (g_strcmp0(intfnum, "03") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Control", devnode); + ofono_modem_set_string(modem, "DataDevice", devnode); ofono_modem_set_integer(modem, "Registered", 1); ofono_modem_register(modem); -- 1.7.4.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/2] udev: changed linktop device strings
--- plugins/udev.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/udev.c b/plugins/udev.c index 0234fc0..4f4e6d8 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -577,10 +577,10 @@ static void add_linktop(struct ofono_modem *modem, if (g_strcmp0(intfnum, "01") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Modem", devnode); + ofono_modem_set_string(modem, "ModemDevice", devnode); } else if (g_strcmp0(intfnum, "03") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Control", devnode); + ofono_modem_set_string(modem, "DataDevice", devnode); ofono_modem_set_integer(modem, "Registered", 1); ofono_modem_register(modem); -- 1.7.4.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] linktop: reimplemented linktop plugin based on mbm with minimum features
The AT commands listed with AT+CLAC matches with MBM supported devices. However, the mbm plugin doesn't work for this devices and the specification is also quite different. I have also adopted some fixes from huawei plugin to fix MeeGo bug #14784 The device supports voice call but I am unable to hear any sound after making calls even though the soundcard is detected by the kernel. The device also supports sim toolkit commands but I am unable to test this feature. All these untested features will be added later. --- plugins/linktop.c | 299 +++-- 1 files changed, 199 insertions(+), 100 deletions(-) diff --git a/plugins/linktop.c b/plugins/linktop.c index 953f634..4083f17 100644 --- a/plugins/linktop.c +++ b/plugins/linktop.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -34,10 +35,6 @@ #define OFONO_API_SUBJECT_TO_CHANGE #include #include -#include -#include -#include -#include #include #include #include @@ -45,24 +42,27 @@ #include #include #include -#include -#include #include #include #include #include #include -#include #include +#include +static const char *cpin_prefix[] = { "+CPIN:", NULL }; static const char *none_prefix[] = { NULL }; struct linktop_data { - GAtChat *modem; - GAtChat *control; + GAtChat *modem_port; + GAtChat *data_port; + guint cpin_poll_source; + guint cpin_poll_count; + gboolean have_sim; struct ofono_gprs *gprs; struct ofono_gprs_context *gc; + guint reopen_source; }; static int linktop_probe(struct ofono_modem *modem) @@ -86,35 +86,86 @@ static void linktop_remove(struct ofono_modem *modem) DBG("%p", modem); + if (data->reopen_source > 0) { + g_source_remove(data->reopen_source); + data->reopen_source = 0; + } + ofono_modem_set_data(modem, NULL); - g_at_chat_unref(data->modem); - g_at_chat_unref(data->control); + g_at_chat_unref(data->data_port); + g_at_chat_unref(data->modem_port); + + if (data->cpin_poll_source > 0) + g_source_remove(data->cpin_poll_source); g_free(data); } static void linktop_debug(const char *str, void *user_data) { -const char *prefix = user_data; + const char *prefix = user_data; + + ofono_info("%s%s", prefix, str); +} + +static gboolean init_simpin_check(gpointer user_data); + +static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); + + DBG(""); + + /* Modem returns an error if SIM is not ready. */ + if (!ok && data->cpin_poll_count++ < 5) { + data->cpin_poll_source = + g_timeout_add_seconds(1, init_simpin_check, modem); + return; + } + + data->cpin_poll_count = 0; + + /* There is probably no SIM if SIM is not ready after 5 seconds. */ + data->have_sim = ok; + + ofono_modem_set_powered(modem, TRUE); +} + +static gboolean init_simpin_check(gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); + + data->cpin_poll_source = 0; -ofono_info("%s%s", prefix, str); + g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix, + simpin_check, modem, NULL); + + return FALSE; } -static GAtChat *open_device(struct ofono_modem *modem, - const char *key, char *debug) +static void cfun_enable_cb(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + + DBG(""); + + if (!ok) { + ofono_modem_set_powered(modem, FALSE); + return; + } + + init_simpin_check(modem); +} + +static GAtChat *create_port(const char *device) { - const char *device; GAtSyntax *syntax; GIOChannel *channel; GAtChat *chat; - device = ofono_modem_get_string(modem, key); - if (device == NULL) - return NULL; - - DBG("%s %s", key, device); - channel = g_at_tty_open(device, NULL); if (channel == NULL) return NULL; @@ -127,93 +178,130 @@ static GAtChat *open_device(struct ofono_modem *modem, if (chat == NULL) return NULL; - if (getenv("OFONO_AT_DEBUG")) - g_at_chat_set_debug(chat, linktop_debug, debug); - return chat; } -static void linktop_disconnect(gpointer user_data) +static void linktop_disconnect(gpointer user_data); + +static gboolean reopen_callback(gpointer user_data) { struct ofono_modem *modem = user_data; struct linktop_data *data = ofono_modem_get_data(modem); + const char *data_dev; + +
Patches not accepted :(
Hi, I have sent few patches couple of days ago on this list but it seems no one is looking after it. These patches has fixed few issues related to ofono crash with Linktop devices. Here is the link to the archived mailing list thread: http://lists.ofono.org/pipermail/ofono/2011-June/010537.html Would you please consider the patches for review? Do I need to resubmit the patches? Regards -- Amit Mendapara ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 2/2] udev: changed linktop device strings
Signed-off-by: Amit Mendapara --- plugins/udev.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/udev.c b/plugins/udev.c index 0234fc0..4f4e6d8 100644 --- a/plugins/udev.c +++ b/plugins/udev.c @@ -577,10 +577,10 @@ static void add_linktop(struct ofono_modem *modem, if (g_strcmp0(intfnum, "01") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Modem", devnode); + ofono_modem_set_string(modem, "ModemDevice", devnode); } else if (g_strcmp0(intfnum, "03") == 0) { devnode = udev_device_get_devnode(udev_device); - ofono_modem_set_string(modem, "Control", devnode); + ofono_modem_set_string(modem, "DataDevice", devnode); ofono_modem_set_integer(modem, "Registered", 1); ofono_modem_register(modem); -- 1.7.4.1 ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
[PATCH 1/2] linktop: reimplemented linktop plugin based on mbm
The AT commands listed with AT+CLAC matches with MBM supported devices. However, the mbm plugin doesn't work for this devices and the specification is also quite different. I have also adopted some fixes from huawei plugin to fix MeeGo bug #14784 Signed-off-by: Amit Mendapara --- plugins/linktop.c | 301 1 files changed, 208 insertions(+), 93 deletions(-) diff --git a/plugins/linktop.c b/plugins/linktop.c index 953f634..26536d8 100644 --- a/plugins/linktop.c +++ b/plugins/linktop.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -42,6 +43,7 @@ #include #include #include +#include #include #include #include @@ -53,16 +55,21 @@ #include #include -#include #include +#include +static const char *cpin_prefix[] = { "+CPIN:", NULL }; static const char *none_prefix[] = { NULL }; struct linktop_data { - GAtChat *modem; - GAtChat *control; + GAtChat *modem_port; + GAtChat *data_port; + guint cpin_poll_source; + guint cpin_poll_count; + gboolean have_sim; struct ofono_gprs *gprs; struct ofono_gprs_context *gc; + guint reopen_source; }; static int linktop_probe(struct ofono_modem *modem) @@ -86,35 +93,86 @@ static void linktop_remove(struct ofono_modem *modem) DBG("%p", modem); + if (data->reopen_source > 0) { + g_source_remove(data->reopen_source); + data->reopen_source = 0; + } + ofono_modem_set_data(modem, NULL); - g_at_chat_unref(data->modem); - g_at_chat_unref(data->control); + g_at_chat_unref(data->data_port); + g_at_chat_unref(data->modem_port); + + if (data->cpin_poll_source > 0) + g_source_remove(data->cpin_poll_source); g_free(data); } static void linktop_debug(const char *str, void *user_data) { -const char *prefix = user_data; + const char *prefix = user_data; + + ofono_info("%s%s", prefix, str); +} + +static gboolean init_simpin_check(gpointer user_data); + +static void simpin_check(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); -ofono_info("%s%s", prefix, str); + DBG(""); + + /* Modem returns an error if SIM is not ready. */ + if (!ok && data->cpin_poll_count++ < 5) { + data->cpin_poll_source = + g_timeout_add_seconds(1, init_simpin_check, modem); + return; + } + + data->cpin_poll_count = 0; + + /* There is probably no SIM if SIM is not ready after 5 seconds. */ + data->have_sim = ok; + + ofono_modem_set_powered(modem, TRUE); } -static GAtChat *open_device(struct ofono_modem *modem, - const char *key, char *debug) +static gboolean init_simpin_check(gpointer user_data) +{ + struct ofono_modem *modem = user_data; + struct linktop_data *data = ofono_modem_get_data(modem); + + data->cpin_poll_source = 0; + + g_at_chat_send(data->modem_port, "AT+CPIN?", cpin_prefix, + simpin_check, modem, NULL); + + return FALSE; +} + +static void cfun_enable(gboolean ok, GAtResult *result, gpointer user_data) +{ + struct ofono_modem *modem = user_data; + + DBG(""); + + if (!ok) { + ofono_modem_set_powered(modem, FALSE); + return; + } + + init_simpin_check(modem); +} + +static GAtChat *create_port(const char *device) { - const char *device; GAtSyntax *syntax; GIOChannel *channel; GAtChat *chat; - device = ofono_modem_get_string(modem, key); - if (device == NULL) - return NULL; - - DBG("%s %s", key, device); - channel = g_at_tty_open(device, NULL); if (channel == NULL) return NULL; @@ -127,81 +185,116 @@ static GAtChat *open_device(struct ofono_modem *modem, if (chat == NULL) return NULL; - if (getenv("OFONO_AT_DEBUG")) - g_at_chat_set_debug(chat, linktop_debug, debug); - return chat; } -static void linktop_disconnect(gpointer user_data) +static void linktop_disconnect(gpointer user_data); + +static gboolean reopen_callback(gpointer user_data) { struct ofono_modem *modem = user_data; struct linktop_data *data = ofono_modem_get_data(modem); + const char *data_dev; + + data_dev = ofono_modem_get_string(modem, "DataDevice"); + data->data_port = create_port(data_dev); + /* retry once if failed */ + if (data->data_port == NULL) { + if (data->
Re: ofono crash (setting offline while connected)
Hi Denis, I tried several things but no luck. Here I am attaching the backtrace as you suggested. What I found is, ofono crashes on `ofono_gprs_context_remove(data->gc)` call when `linktop_disconnect` was called second time. I am still not sure why `linktop_disconnect` is being called twice in this case. Regards -- Amit Mendapara On Thu, Feb 24, 2011 at 11:01 PM, Denis Kenzior wrote: > Hi Amit, > > On 02/23/2011 11:07 PM, Amit Mendapara wrote: > > Hi, > > > > While testing the Linktop driver I observed that ofono is crashing if I > > try to set modem offline while it is connected (using > > test/offline-modem.py script). After some debugging, I found that > > `linktop_disconnect` function is being called twice (see the attached > > debug log). > > > > What could be the reason here? I have seen some hack in mbm driver (in > > mbm_disconnect) having `reopen_callback`. I have tried this but then > > having another crash (this time when creating gprs context). Anyone, > > please clarify how to deal with the issue properly? > > Some of these modems HUP the tty for x seconds. So if you try to open > them too fast, they will be HUPed again, leading to various issues. > > When posting backtraces, please give them directly from gdb, or use the > backtrace script to 'prettify' them. e.g.: > > test/backtrace src/ofonod your_log > > Regards, > -Denis > backtrace [0]: __ofono_atom_free() [modem.c:336] [1]: linktop_disconnect() [linktop.c:147] [2]: main() [main.c:245] [3]: _start() [location-reporting.c:0] --- ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
ofono crash (setting offline while connected)
Hi, While testing the Linktop driver I observed that ofono is crashing if I try to set modem offline while it is connected (using test/offline-modem.py script). After some debugging, I found that `linktop_disconnect` function is being called twice (see the attached debug log). What could be the reason here? I have seen some hack in mbm driver (in mbm_disconnect) having `reopen_callback`. I have tried this but then having another crash (this time when creating gprs context). Anyone, please clarify how to deal with the issue properly? Regards -- Amit Mendapara ... ofonod[16892]: Control: < \r\nOK\r\n\r\n+CIEV: 5,1\r\n\r\n+CIEV: 9,0\r\n ofonod[16892]: Control: > AT+COPS?\r ofonod[16892]: Control: < \r\n+COPS: 0,2,"40457",2 \r\n\r\nOK\r\n ofonod[16892]: Control: > AT+CIND?\r ofonod[16892]: Control: < \r\n+CIND: 1,3,1,0,1,0,0,0,0,0,0,0\r\n\r\nOK\r\n ofonod[16892]: Control: > AT+COPS=3,0\r ofonod[16892]: Control: < \r\nOK\r\n ofonod[16892]: Control: > AT+COPS?\r ofonod[16892]: Control: < \r\n+COPS: 0,0,"",2 \r\n\r\nOK\r\n\r\n+CIEV: 2,2\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,2\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Modem: > AT+CGDCONT=1,"IP","bsnlnet"\r ofonod[16892]: Modem: < AT+CGDCONT=1,"IP","bsnlnet"\r ofonod[16892]: Modem: < \r\nOK\r\n ofonod[16892]: Modem: > AT+CGDATA="PPP",1\r ofonod[16892]: Modem: < AT+CGDATA="PPP",1\r ofonod[16892]: Modem: < \r\nCONNECT\r\n Entering new phase: 1 Entering new phase: 2 Entering new phase: 3 ofonod[16892]: Control: < \r\n*EPSB: 3\r\n ofonod[16892]: Control: < \r\n*EPSB: 5\r\n\r\n*EPSB: 6\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,2\r\n Received IPCP NAK Setting suggested ip addr Setting suggested dns1 Setting suggested dns2 Entering new phase: 4 ofonod[16892]: IP: 10.163.90.180 ofonod[16892]: DNS: 218.248.240.134, 218.248.240.23 ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,2\r\n ofonod[16892]: Control: < \r\n*EPSB: 0\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Control: < \r\n*EPSB: 3\r\n ofonod[16892]: Control: < \r\n*EPSB: 5\r\n\r\n*EPSB: 6\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,2\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,2\r\n ofonod[16892]: Control: < \r\n+CIEV: 2,3\r\n ofonod[16892]: Control: < \r\n*EPSB: 0\r\n ofonod[16892]: Control: < \r\n*EPSB: 3\r\n ofonod[16892]: Control: < \r\n*EPSB: 5\r\n\r\n*EPSB: 6\r\n ofonod[16892]: Control: < \r\n*EPSB: 0\r\n ofonod[16892]: plugins/linktop.c:linktop_set_online() modem 0xbf4ff0 offline ofonod[16892]: Control: > AT+CFUN=4\r Entering new phase: 5 ofonod[16892]: plugins/udev.c:remove_modem() /devices/virtual/net/ppp0 Entering new phase: 0 ofonod[16892]: plugins/linktop.c:linktop_disconnect() ofonod[16892]: plugins/linktop.c:open_device() Modem /dev/ttyACM0 ofonod[16892]: Reopened GPRS context channel ofonod[16892]: Control: < \r\nOK\r\n\r\n+CGEV: NW DEACT "IP", "10.163.90.180", 1\r\n\r\n+CGEV: NW DEACT "IP", "10.163.90.180", 1\r\n ofonod[16892]: Unregistered handle for channel 1: 0x10005 ofonod[16892]: plugins/linktop.c:linktop_disconnect() ofonod[16892]: Aborting (signal 11) ofonod[16892]: backtrace ofonod[16892]: [0]: /lib/libpthread.so.0(+0xfb40) [0x7f0843a44b40] ofonod[16892]: [1]: ./src/ofonod() [0x46ccce] ofonod[16892]: [2]: ./src/ofonod() [0x46342c] ofonod[16892]: [3]: /lib/libglib-2.0.so.0(+0x3f8fe) [0x7f0843ed38fe] ofonod[16892]: [4]: /lib/libglib-2.0.so.0(+0x3ff35) [0x7f0843ed3f35] ofonod[16892]: [5]: /lib/libglib-2.0.so.0(g_main_context_dispatch+0x263) [0x7f0843ed43b3] ofonod[16892]: [6]: /lib/libglib-2.0.so.0(+0x442a8) [0x7f0843ed82a8] ofonod[16892]: [7]: /lib/libglib-2.0.so.0(g_main_loop_run+0x195) [0x7f0843ed87b5] ofonod[16892]: [8]: ./src/ofonod() [0x46b6c4] ofonod[16892]: [9]: /lib/libc.so.6(__libc_start_main+0xfe) [0x7f08430bfd8e] ofonod[16892]: [10]: ./src/ofonod() [0x40cb89] ofonod[16892]: +++ ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] plugin: add plugin for Linktop/Teracom LW273 data card
I have have sent the patches again this morning (with cc to Denis). Would you please tell me what could be the reason here? I am sending the patches with git-send-email like this: git send-email --to ofono@ofono.org origin I have configured `msmtp-mta` to send email through my GMail account. Regards -- Amit Mendapara On Thu, Feb 10, 2011 at 1:32 PM, wrote: > Hi Amit, > > ofono-boun...@ofono.org wrote: > > Hi Amit, > > > > On 02/09/2011 10:56 AM, Amit Mendapara wrote: > >> Hi Danis, > >> > >> I have submitted three patches as you suggested but no one has > >> reviewed it. Would you tell me what else I can do to ensure it's > >> been integrated in ofono? > >> > > > > So it looks like GMail is losing patches again. Your patches > > do show up on the mailing list archives but not in my > > mailbox. Can you resend them again, and CC my private Email as well: > > denk...@gmail.com. > > Your patches neither showed up in my GMail nor in my company outlook. > Only place it can be seen is in ofono mail archives. :( > > Regards, > Jeevaka > > > > Please note: This e-mail may contain confidential information > intended solely for the addressee. If you have received this > e-mail in error, please do not disclose it to anyone, notify > the sender promptly, and delete the message from your system. > Thank you. > > ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] plugin: add plugin for Linktop/Teracom LW273 data card
Hi Danis, I have submitted three patches as you suggested but no one has reviewed it. Would you tell me what else I can do to ensure it's been integrated in ofono? Regards -- Amit Mendapara On Mon, Feb 7, 2011 at 8:51 AM, Amit Mendapara wrote: > Hi Denis, > > Thanks you for your kind attention. I will resubmit as suggested. > > Regards > -- > Amit Mendapara > > > On Fri, Feb 4, 2011 at 10:07 PM, Denis Kenzior wrote: > >> Hi Amit, >> >> On 02/03/2011 10:34 AM, Amit Mendapara wrote: >> > The LW273 and LW272 devices are being distributed by BSNL in India >> > with Teracom >> > brand name. Both the devices have similar specs except data speed and >> > having same >> > usb id (230d:0001). >> > >> > Links: >> > >> > http://www.bsnl.in/service/3G/3G_files/3g.htm >> > http://www.teracom.in/htmls/3G.html >> > http://www.linktop.com.cn/en/Products.asp?FID=1&LID=302 >> > <http://www.linktop.com.cn/en/Products.asp?FID=1&LID=302> >> > http://amit-mendapara.blogspot.com/2010/11/amazing-bsnl-3g.html >> > >> > Regards >> > -- >> > Amit Mendapara >> > >> >> Thanks for your patch, but please resubmit it in a proper format for >> review. The easiest way to do that is git-send-email. Also, please >> have a look at the 'Submitting patches' section in the HACKING file of >> oFono. Ideally this should be a 3 patch series, one adding the linktop >> driver, one modifying udev and one modifying ofono.rules. >> >> Regards, >> -Denis >> > > ___ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono
Re: [PATCH] plugin: add plugin for Linktop/Teracom LW273 data card
The LW273 and LW272 devices are being distributed by BSNL in India with Teracom brand name. Both the devices have similar specs except data speed and having same usb id (230d:0001). Links: http://www.bsnl.in/service/3G/3G_files/3g.htm http://www.teracom.in/htmls/3G.html http://www.linktop.com.cn/en/Products.asp?FID=1&LID=302 http://amit-mendapara.blogspot.com/2010/11/amazing-bsnl-3g.html Regards -- Amit Mendapara On Thu, Feb 3, 2011 at 8:33 PM, Amit Mendapara wrote: > Signed-off-by: Amit Mendapara > --- > Makefile.am |3 + > plugins/linktop.c | 357 > +++ > plugins/ofono.rules |3 + > plugins/udev.c | 32 + > 4 files changed, 395 insertions(+), 0 deletions(-) > create mode 100644 plugins/linktop.c > > diff --git a/Makefile.am b/Makefile.am > index 758fb10..2fb8962 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -314,6 +314,9 @@ builtin_sources += plugins/nokia.c > builtin_modules += nokiacdma > builtin_sources += plugins/nokiacdma.c > > +builtin_modules += linktop > +builtin_sources += plugins/linktop.c > + > if BLUETOOTH > builtin_modules += bluetooth > builtin_sources += plugins/bluetooth.c plugins/bluetooth.h > diff --git a/plugins/linktop.c b/plugins/linktop.c > new file mode 100644 > index 000..7f552b5 > --- /dev/null > +++ b/plugins/linktop.c > @@ -0,0 +1,357 @@ > +/* > + * > + * oFono - Open Source Telephony > + * > + * Copyright (C) 2008-2010 Intel Corporation. All rights reserved. > + * > + * 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 > +#endif > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > +#define OFONO_API_SUBJECT_TO_CHANGE > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +static const char *none_prefix[] = { NULL }; > + > +struct linktop_data { > + GAtChat *modem; > + GAtChat *control; > + struct ofono_gprs *gprs; > + struct ofono_gprs_context *gc; > +}; > + > +static int linktop_probe(struct ofono_modem *modem) > +{ > + struct linktop_data *data; > + > + DBG("%p", modem); > + > + data = g_try_new0(struct linktop_data, 1); > + if (data == NULL) > + return -ENOMEM; > + > + ofono_modem_set_data(modem, data); > + > + return 0; > +} > + > +static void linktop_remove(struct ofono_modem *modem) > +{ > + struct linktop_data *data = ofono_modem_get_data(modem); > + > + DBG("%p", modem); > + > + ofono_modem_set_data(modem, NULL); > + > + g_at_chat_unref(data->modem); > + g_at_chat_unref(data->control); > + > + g_free(data); > +} > + > +static void linktop_debug(const char *str, void *user_data) > +{ > +const char *prefix = user_data; > + > +ofono_info("%s%s", prefix, str); > +} > + > +static GAtChat *open_device(struct ofono_modem *modem, > + const char *key, char *debug) > +{ > + const char *device; > + GAtSyntax *syntax; > + GIOChannel *channel; > + GAtChat *chat; > + > + device = ofono_modem_get_string(modem, key); > + if (device == NULL) > + return NULL; > + > + DBG("%s %s", key, device); > + > + channel = g_at_tty_open(device, NULL); > + if (channel == NULL) > + return NULL; > + > + syntax = g_at_syntax_new_gsm_permissive(); > + chat = g_at_chat_new(channel, syntax); > + g_at_syntax_unref(syntax); > + g_io_channel_unref(channel); > + >