* [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP
@ 2010-06-29 7:59 Kalle Valo
2010-06-29 7:59 ` [PATCH 2/2] PPP GPRS context is now done, update documentation Kalle Valo
2010-06-29 19:04 ` [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Denis Kenzior
0 siblings, 2 replies; 3+ messages in thread
From: Kalle Valo @ 2010-06-29 7:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4669 bytes --]
Huawei always closes the tty port after PPP disconnect. Handle this in
huawei plugin, similarly as done with novatel. Now there's no need
to unplug the modem after disconnection.
Tested with Huawei E1552.
Based on a patch by Marcel Holtmann:
commit 0329a6ceaf8f69857cb5f8437b9db86ca327ef1d
Author: Marcel Holtmann <marcel@holtmann.org>
Date: Mon Jun 7 02:36:12 2010 -0700
Reopen the GPRS context channel when the modem closes it after PPP
---
plugins/huawei.c | 86 +++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 62 insertions(+), 24 deletions(-)
diff --git a/plugins/huawei.c b/plugins/huawei.c
index e2dfd1e..ae0139a 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -56,6 +56,8 @@ struct huawei_data {
GAtChat *pcui;
struct ofono_sim *sim;
gint sim_state;
+ struct ofono_gprs *gprs;
+ struct ofono_gprs_context *gc;
};
static int huawei_probe(struct ofono_modem *modem)
@@ -196,42 +198,80 @@ static GAtChat *create_port(const char *device)
return chat;
}
-static int huawei_enable(struct ofono_modem *modem)
+static GAtChat *open_device(struct ofono_modem *modem,
+ const char *key, char *debug)
{
struct huawei_data *data = ofono_modem_get_data(modem);
- const char *modem_device, *pcui_device;
+ const char *device;
+ GAtChat *chat;
- DBG("%p", modem);
+ device = ofono_modem_get_string(modem, key);
+ if (device == NULL)
+ return NULL;
- modem_device = ofono_modem_get_string(modem, "Modem");
- pcui_device = ofono_modem_get_string(modem, "Pcui");
+ DBG("%s %s", key, device);
- if (modem_device == NULL || pcui_device == NULL)
- return -EINVAL;
+ chat = create_port(device);
+ if (chat == NULL)
+ return NULL;
+
+ g_at_chat_add_terminator(chat, "COMMAND NOT SUPPORT", -1, FALSE);
+
+ if (getenv("OFONO_AT_DEBUG"))
+ g_at_chat_set_debug(chat, huawei_debug, debug);
+
+ return chat;
+}
+
+static void huawei_disconnect(gpointer user_data)
+{
+ struct ofono_modem *modem = user_data;
+ struct huawei_data *data = ofono_modem_get_data(modem);
+
+ DBG("");
+
+ ofono_gprs_context_remove(data->gc);
- data->modem = create_port(modem_device);
+ g_at_chat_unref(data->modem);
+ data->modem = NULL;
+ data->modem = open_device(modem, "Modem", "Modem:");
if (data->modem == NULL)
- return -EIO;
+ return;
- g_at_chat_add_terminator(data->modem, "COMMAND NOT SUPPORT", -1, FALSE);
+ g_at_chat_set_disconnect_function(data->modem,
+ huawei_disconnect, modem);
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(data->modem, huawei_debug, "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 int huawei_enable(struct ofono_modem *modem)
+{
+ struct huawei_data *data = ofono_modem_get_data(modem);
+ const char *modem_device, *pcui_device;
+
+ DBG("%p", modem);
+
+ data->modem = open_device(modem, "Modem", "Modem:");
+ if (data->modem == NULL)
+ return -EINVAL;
- data->pcui = create_port(pcui_device);
+ g_at_chat_set_disconnect_function(data->modem,
+ huawei_disconnect, modem);
+ data->pcui = open_device(modem, "Pcui", "Pcui:");
if (data->pcui == NULL) {
g_at_chat_unref(data->modem);
data->modem = NULL;
return -EIO;
}
- g_at_chat_add_terminator(data->pcui, "COMMAND NOT SUPPORT", -1, FALSE);
-
- if (getenv("OFONO_AT_DEBUG"))
- g_at_chat_set_debug(data->pcui, huawei_debug, "Pcui:");
-
data->sim_state = 0;
g_at_chat_send(data->pcui, "ATE0", none_prefix, NULL, NULL, NULL);
@@ -293,9 +333,7 @@ static void huawei_pre_sim(struct ofono_modem *modem)
static void huawei_post_sim(struct ofono_modem *modem)
{
struct huawei_data *data = ofono_modem_get_data(modem);
- struct ofono_gprs_context *gc;
struct ofono_netreg *netreg;
- struct ofono_gprs *gprs;
DBG("%p", modem);
@@ -307,11 +345,11 @@ static void huawei_post_sim(struct ofono_modem *modem)
data->pcui);
ofono_ussd_create(modem, 0, "atmodem", data->pcui);
- gprs = ofono_gprs_create(modem, 0, "atmodem", data->pcui);
- gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
+ data->gprs = ofono_gprs_create(modem, 0, "atmodem", data->pcui);
+ data->gc = ofono_gprs_context_create(modem, 0, "atmodem", data->modem);
- if (gprs && gc)
- ofono_gprs_add_context(gprs, gc);
+ if (data->gprs && data->gc)
+ ofono_gprs_add_context(data->gprs, data->gc);
}
static struct ofono_modem_driver huawei_driver = {
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] PPP GPRS context is now done, update documentation
2010-06-29 7:59 [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Kalle Valo
@ 2010-06-29 7:59 ` Kalle Valo
2010-06-29 19:04 ` [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2010-06-29 7:59 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1168 bytes --]
---
TODO | 7 -------
doc/overview.txt | 6 ------
2 files changed, 0 insertions(+), 13 deletions(-)
diff --git a/TODO b/TODO
index a25394a..470d4a6 100644
--- a/TODO
+++ b/TODO
@@ -200,13 +200,6 @@ Flight Mode
GPRS
====
-- PPP gprs-context driver support. Add an implementation for 'atmodem' that
- will use the GAtPPP stack to drive a GPRS context interface. Nicely support
- existing PPP based modems like Huawei, Novatel and Sierra.
-
- Priority: High
- Complexity: C2
-
- PPP Server support. Extend GAtPPP to support PPP Server role, similarly to
how existing GSM modems support PPP GPRS contexts.
diff --git a/doc/overview.txt b/doc/overview.txt
index cda9f68..a18e620 100644
--- a/doc/overview.txt
+++ b/doc/overview.txt
@@ -130,12 +130,6 @@ Work in progress features:
User initiated USSD support is available, but not
network-initiated USSD support.
- PPP
-
- Modems that use PPP for data connections are currently not
- supported. This feature will be available once a functional
- userspace ppp stack is available.
-
Not implemented features:
SIM card storage
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP
2010-06-29 7:59 [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Kalle Valo
2010-06-29 7:59 ` [PATCH 2/2] PPP GPRS context is now done, update documentation Kalle Valo
@ 2010-06-29 19:04 ` Denis Kenzior
1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2010-06-29 19:04 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 556 bytes --]
Hi Kalle,
> Huawei always closes the tty port after PPP disconnect. Handle this in
> huawei plugin, similarly as done with novatel. Now there's no need
> to unplug the modem after disconnection.
>
> Tested with Huawei E1552.
>
> Based on a patch by Marcel Holtmann:
>
> commit 0329a6ceaf8f69857cb5f8437b9db86ca327ef1d
> Author: Marcel Holtmann <marcel@holtmann.org>
> Date: Mon Jun 7 02:36:12 2010 -0700
>
> Reopen the GPRS context channel when the modem closes it after PPP
Both have been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-06-29 19:04 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 7:59 [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Kalle Valo
2010-06-29 7:59 ` [PATCH 2/2] PPP GPRS context is now done, update documentation Kalle Valo
2010-06-29 19:04 ` [PATCH 1/2] huawei: reopen the GPRS context when the modem closes it after PPP Denis Kenzior
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.