* [PATCH 1/2] linktop: reimplemented with minimum features.
@ 2011-06-27 6:22 Amit Mendapara
2011-06-27 6:22 ` [PATCH 2/2] udev: changed linktop device strings Amit Mendapara
2011-06-27 15:34 ` [PATCH 1/2] linktop: reimplemented with minimum features Denis Kenzior
0 siblings, 2 replies; 5+ messages in thread
From: Amit Mendapara @ 2011-06-27 6:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 8336 bytes --]
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 <stdio.h>
#include <errno.h>
#include <stdlib.h>
+#include <string.h>
#include <glib.h>
#include <gatchat.h>
@@ -34,10 +35,6 @@
#define OFONO_API_SUBJECT_TO_CHANGE
#include <ofono/plugin.h>
#include <ofono/modem.h>
-#include <ofono/call-barring.h>
-#include <ofono/call-forwarding.h>
-#include <ofono/call-meter.h>
-#include <ofono/call-settings.h>
#include <ofono/devinfo.h>
#include <ofono/message-waiting.h>
#include <ofono/netreg.h>
@@ -45,22 +42,20 @@
#include <ofono/cbs.h>
#include <ofono/sms.h>
#include <ofono/ussd.h>
-#include <ofono/call-volume.h>
-#include <ofono/voicecall.h>
#include <ofono/gprs.h>
#include <ofono/gprs-context.h>
#include <ofono/phonebook.h>
#include <ofono/radio-settings.h>
#include <ofono/log.h>
-#include <drivers/atmodem/vendor.h>
#include <drivers/atmodem/atutil.h>
+#include <drivers/atmodem/vendor.h>
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_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);
}
static void linktop_set_online(struct ofono_modem *modem, ofono_bool_t online,
ofono_modem_online_cb_t cb, void *user_data)
{
struct linktop_data *data = ofono_modem_get_data(modem);
- GAtChat *chat = data->control;
+ GAtChat *chat = data->aux;
struct cb_data *cbd = cb_data_new(cb, user_data);
char const *command = online ? "AT+CFUN=1" : "AT+CFUN=4";
DBG("modem %p %s", modem, online ? "online" : "offline");
+ cbd->user = data;
+
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
return;
@@ -278,9 +271,8 @@ static void linktop_pre_sim(struct ofono_modem *modem)
DBG("%p", modem);
- ofono_devinfo_create(modem, 0, "atmodem", data->control);
- sim = ofono_sim_create(modem, 0, "atmodem", data->control);
- ofono_voicecall_create(modem, 0, "stemodem", data->control);
+ ofono_devinfo_create(modem, 0, "atmodem", data->aux);
+ sim = ofono_sim_create(modem, 0, "atmodem", data->aux);
if (sim)
ofono_sim_inserted_notify(sim, TRUE);
@@ -292,35 +284,27 @@ static void linktop_post_sim(struct ofono_modem *modem)
DBG("%p", modem);
- ofono_radio_settings_create(modem, 0, "stemodem", data->control);
- ofono_phonebook_create(modem, 0, "atmodem", data->control);
- ofono_sms_create(modem, 0, "atmodem", data->control);
+ ofono_radio_settings_create(modem, 0, "stemodem", data->aux);
+ ofono_phonebook_create(modem, 0, "atmodem", data->aux);
+ ofono_sms_create(modem, 0, "atmodem", data->aux);
}
static void linktop_post_online(struct ofono_modem *modem)
{
struct linktop_data *data = ofono_modem_get_data(modem);
struct ofono_message_waiting *mw;
- struct ofono_gprs *gprs;
- struct ofono_gprs_context *gc;
DBG("%p", modem);
- ofono_ussd_create(modem, 0, "atmodem", data->control);
- ofono_call_forwarding_create(modem, 0, "atmodem", data->control);
- ofono_call_settings_create(modem, 0, "atmodem", data->control);
- ofono_netreg_create(modem, OFONO_VENDOR_MBM, "atmodem", data->control);
- ofono_call_meter_create(modem, 0, "atmodem", data->control);
- ofono_call_barring_create(modem, 0, "atmodem", data->control);
- ofono_call_volume_create(modem, 0, "atmodem", data->control);
- ofono_cbs_create(modem, 0, "atmodem", data->control);
-
- gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
- "atmodem", data->control);
- gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
-
- if (gprs && gc)
- ofono_gprs_add_context(gprs, gc);
+ ofono_netreg_create(modem, 0, "atmodem", data->aux);
+ ofono_cbs_create(modem, 0, "atmodem", data->aux);
+ ofono_ussd_create(modem, 0, "atmodem", data->aux);
+
+ data->gprs = ofono_gprs_create(modem, 0, "atmodem", data->aux);
+ data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
+
+ if (data->gprs && data->gc)
+ ofono_gprs_add_context(data->gprs, data->gc);
mw = ofono_message_waiting_create(modem);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] udev: changed linktop device strings
2011-06-27 6:22 [PATCH 1/2] linktop: reimplemented with minimum features Amit Mendapara
@ 2011-06-27 6:22 ` Amit Mendapara
2011-06-27 15:35 ` Denis Kenzior
2011-06-27 15:34 ` [PATCH 1/2] linktop: reimplemented with minimum features Denis Kenzior
1 sibling, 1 reply; 5+ messages in thread
From: Amit Mendapara @ 2011-06-27 6:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 793 bytes --]
---
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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] linktop: reimplemented with minimum features.
2011-06-27 6:22 [PATCH 1/2] linktop: reimplemented with minimum features Amit Mendapara
2011-06-27 6:22 ` [PATCH 2/2] udev: changed linktop device strings Amit Mendapara
@ 2011-06-27 15:34 ` Denis Kenzior
2011-06-28 4:13 ` Amit Mendapara
1 sibling, 1 reply; 5+ messages in thread
From: Denis Kenzior @ 2011-06-27 15:34 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 3815 bytes --]
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:
> 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 <stdio.h>
> #include <errno.h>
> #include <stdlib.h>
> +#include <string.h>
>
This header doesn't seem necessary
> #include <glib.h>
> #include <gatchat.h>
> @@ -45,22 +42,20 @@
> #include <ofono/cbs.h>
> #include <ofono/sms.h>
> #include <ofono/ussd.h>
> -#include <ofono/call-volume.h>
> -#include <ofono/voicecall.h>
> #include <ofono/gprs.h>
> #include <ofono/gprs-context.h>
> #include <ofono/phonebook.h>
> #include <ofono/radio-settings.h>
> #include <ofono/log.h>
>
> -#include <drivers/atmodem/vendor.h>
> #include <drivers/atmodem/atutil.h>
> +#include <drivers/atmodem/vendor.h>
>
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.
> static const char *none_prefix[] = { NULL };
>
> struct linktop_data {
> GAtChat *modem;
> - GAtChat *control;
> + GAtChat *aux;
> struct ofono_gprs *gprs;
> struct ofono_gprs_context *gc;
> };
<snip>
> @@ -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.
> - 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
Regards,
-Denis
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 1/2] linktop: reimplemented with minimum features.
2011-06-27 15:34 ` [PATCH 1/2] linktop: reimplemented with minimum features Denis Kenzior
@ 2011-06-28 4:13 ` Amit Mendapara
0 siblings, 0 replies; 5+ messages in thread
From: Amit Mendapara @ 2011-06-28 4:13 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4649 bytes --]
Hi Denis,
On Mon, Jun 27, 2011 at 9:04 PM, Denis Kenzior <denkenz@gmail.com> 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 <stdio.h>
> > #include <errno.h>
> > #include <stdlib.h>
> > +#include <string.h>
> >
>
> This header doesn't seem necessary
>
> > #include <glib.h>
> > #include <gatchat.h>
> > @@ -45,22 +42,20 @@
> > #include <ofono/cbs.h>
> > #include <ofono/sms.h>
> > #include <ofono/ussd.h>
> > -#include <ofono/call-volume.h>
> > -#include <ofono/voicecall.h>
> > #include <ofono/gprs.h>
> > #include <ofono/gprs-context.h>
> > #include <ofono/phonebook.h>
> > #include <ofono/radio-settings.h>
> > #include <ofono/log.h>
> >
> > -#include <drivers/atmodem/vendor.h>
> > #include <drivers/atmodem/atutil.h>
> > +#include <drivers/atmodem/vendor.h>
> >
>
> 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;
> > };
>
> <snip>
>
> > @@ -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
[-- Attachment #2: attachment.html --]
[-- Type: text/html, Size: 6389 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-06-28 4:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-27 6:22 [PATCH 1/2] linktop: reimplemented with minimum features Amit Mendapara
2011-06-27 6:22 ` [PATCH 2/2] udev: changed linktop device strings Amit Mendapara
2011-06-27 15:35 ` Denis Kenzior
2011-06-27 15:34 ` [PATCH 1/2] linktop: reimplemented with minimum features Denis Kenzior
2011-06-28 4:13 ` Amit Mendapara
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.