* [PATCH v3 00/26] Escape Sequence Dectection implementation
@ 2011-04-01 8:56 Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
` (25 more replies)
0 siblings, 26 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2719 bytes --]
Hi,
This set of patches is an update of the previous one.
The main diff are:
- Rework Escape Sequence detection mechanism:
* we don't need a timeout to detect the 3 '+'
GUARD_TIMEOUTS only is enough.
* Be sure g_source timeout is deleted at hdlc_unref().
- GAtIO: add API to drain write buffer when hdlc is suspended
because we can't acces to GAtIO ring buffer externally.
- ppp_net: add API to suspend/resume GIOCHannel read watch
of TUN/TAP interface.
- GAtChat: add API to send <pause> +++ <pause> escape sequence
- gsmdial controls only the time interval between escape sequence
and ATO0/ATHO.
- emulator: rework ATH0 and ATO0 callbacks, add switch on emulator
type to register AT callbacks.
Kind regards,
Guillaume
Guillaume Zajac (26):
gat: add GAtSuspendFunc CB typedef
gatio: add prototype to drain GAtIO read buffer
gatio: add g_at_io_drain_ring_buffer() definition
gathdlc: add g_at_hdlc_set_suspend_function() prototype
gathdlc: add mechansim to detect '+++' escape sequence
gatppp: add g_at_ppp_set_suspend_function() prototype
gatppp: add g_at_ppp_set_suspend_function() definition
gathdlc: add g_at_hdlc_suspend() prototype
gathdlc: add g_at_hdlc_suspend() definition
ppp: add ppp_net_suspend_interface() prototype
ppp_net: add ppp_net_suspend_interface() definition
gatppp: add g_at_ppp_suspend() prototype
gatppp: add g_at_ppp_suspend() definition
emulator: add ppp_suspend() CB and register it
emulator: add dun_ath_cb() and register it
gathdlc: add g_at_hdlc_resume() prototype
gathdlc: add g_at_hdlc_resume() definition
ppp: add ppp_net_resume_interface() prototype
ppp_net: add ppp_net_resume_interface() definition
gatppp: add g_at_ppp_resume() prototype
gatppp: add g_at_ppp_resume() definition.
emulator: add dun_ato_cb() and register it
gsmdial: add new option to test sending escape sequence
gatchat: add g_at_chat_send_escape_sequence() prototype
gatchat: add g_at_chat_send_escape_sequence() definition
gsmdial: implement test sequence +++-ATO0-+++-ATH0
gatchat/gat.h | 1 +
gatchat/gatchat.c | 32 +++++++++++++
gatchat/gatchat.h | 2 +
gatchat/gathdlc.c | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++
gatchat/gathdlc.h | 6 +++
gatchat/gatio.c | 5 ++
gatchat/gatio.h | 2 +
gatchat/gatppp.c | 34 ++++++++++++++
gatchat/gatppp.h | 4 ++
gatchat/gsmdial.c | 81 ++++++++++++++++++++++++++++++++++
gatchat/ppp.h | 2 +
gatchat/ppp_net.c | 19 ++++++++
src/emulator.c | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++-
13 files changed, 437 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 36+ messages in thread
* [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:08 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer Guillaume Zajac
` (24 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 541 bytes --]
---
gatchat/gat.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/gat.h b/gatchat/gat.h
index ddf8695..f067389 100644
--- a/gatchat/gat.h
+++ b/gatchat/gat.h
@@ -32,6 +32,7 @@ typedef void (*GAtDisconnectFunc)(gpointer user_data);
typedef void (*GAtReceiveFunc)(const unsigned char *data, gsize size,
gpointer user_data);
typedef void (*GAtDebugFunc)(const char *str, gpointer user_data);
+typedef void (*GAtSuspendFunc)(gpointer user_data);
#ifdef __cplusplus
}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:08 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition Guillaume Zajac
` (23 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 597 bytes --]
---
gatchat/gatio.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatio.h b/gatchat/gatio.h
index ca9618f..16dd621 100644
--- a/gatchat/gatio.h
+++ b/gatchat/gatio.h
@@ -52,6 +52,8 @@ gboolean g_at_io_set_write_handler(GAtIO *io, GAtIOWriteFunc write_handler,
void g_at_io_set_write_done(GAtIO *io, GAtDisconnectFunc func,
gpointer user_data);
+void g_at_io_drain_ring_buffer(GAtIO *io, guint len);
+
gsize g_at_io_write(GAtIO *io, const gchar *data, gsize count);
gboolean g_at_io_set_disconnect_function(GAtIO *io,
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:09 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 04/26] gathdlc: add g_at_hdlc_set_suspend_function() prototype Guillaume Zajac
` (22 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
---
gatchat/gatio.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatio.c b/gatchat/gatio.c
index 2778260..f679cd0 100644
--- a/gatchat/gatio.c
+++ b/gatchat/gatio.c
@@ -387,3 +387,8 @@ void g_at_io_set_write_done(GAtIO *io, GAtDisconnectFunc func,
io->write_done_func = func;
io->write_done_data = user_data;
}
+
+void g_at_io_drain_ring_buffer(GAtIO *io, guint len)
+{
+ ring_buffer_drain(io->buf, len);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 04/26] gathdlc: add g_at_hdlc_set_suspend_function() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (2 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence Guillaume Zajac
` (21 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 514 bytes --]
---
gatchat/gathdlc.h | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.h b/gatchat/gathdlc.h
index 95c389e..158f27f 100644
--- a/gatchat/gathdlc.h
+++ b/gatchat/gathdlc.h
@@ -57,6 +57,9 @@ GAtIO *g_at_hdlc_get_io(GAtHDLC *hdlc);
void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect);
+void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,
+ gpointer user_data);
+
#ifdef __cplusplus
}
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (3 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 04/26] gathdlc: add g_at_hdlc_set_suspend_function() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:22 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 06/26] gatppp: add g_at_ppp_set_suspend_function() prototype Guillaume Zajac
` (20 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4043 bytes --]
---
gatchat/gathdlc.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 92 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index 7c45454..db4ad5a 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -50,6 +50,8 @@
#define HDLC_FCS(fcs, c) crc_ccitt_byte(fcs, c)
+#define GUARD_TIMEOUTS 1000 /* Pause time before and after '+++' sequence */
+
struct _GAtHDLC {
gint ref_count;
GAtIO *io;
@@ -68,6 +70,11 @@ struct _GAtHDLC {
gboolean in_read_handler;
gboolean destroyed;
gboolean no_carrier_detect;
+ GAtSuspendFunc suspend_func;
+ gpointer suspend_data;
+ guint cmpt;
+ guint pause_timeout;
+ gboolean paused;
};
static void hdlc_record(int fd, gboolean in, guint8 *data, guint16 length)
@@ -130,6 +137,37 @@ guint32 g_at_hdlc_get_recv_accm(GAtHDLC *hdlc)
return hdlc->recv_accm;
}
+void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,
+ gpointer user_data)
+{
+ if (hdlc == NULL)
+ return;
+
+ hdlc->suspend_func = func;
+ hdlc->suspend_data = user_data;
+}
+
+static gboolean paused_timeout_cb(gpointer user_data)
+{
+ GAtHDLC *hdlc = user_data;
+
+ hdlc->paused = TRUE;
+
+ return FALSE;
+}
+
+static gboolean hdlc_suspend(gpointer user_data)
+{
+ GAtHDLC *hdlc = user_data;
+
+ g_at_io_drain_ring_buffer(hdlc->io, 3);
+
+ if (hdlc->suspend_func)
+ hdlc->suspend_func(hdlc->suspend_data);
+
+ return FALSE;
+}
+
static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
{
GAtHDLC *hdlc = user_data;
@@ -142,6 +180,13 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
hdlc->in_read_handler = TRUE;
+ /*
+ * We delete the the paused_timeout_cb or hdlc_suspend as soons as
+ * we read a data.
+ */
+ if (hdlc->pause_timeout > 0)
+ g_source_remove(hdlc->pause_timeout);
+
while (pos < len) {
/*
* We try to detect NO CARRIER conditions here. We
@@ -153,6 +198,18 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
hdlc->decode_offset == 0 && *buf == '\r')
break;
+ /*
+ * If there was no character for 1 second we try to detect
+ * the '+' character to suspend data call if 3 '+' are
+ * detected.
+ */
+ if (*buf == '+' && hdlc->paused) {
+ hdlc->cmpt++;
+ } else {
+ hdlc->cmpt = 0;
+ hdlc->paused = FALSE;
+ }
+
if (hdlc->decode_escape == TRUE) {
unsigned char val = *buf ^ HDLC_TRANS;
@@ -190,6 +247,9 @@ static void new_bytes(struct ring_buffer *rbuf, gpointer user_data)
}
}
+ if (hdlc->cmpt == 3)
+ goto suspend;
+
out:
ring_buffer_drain(rbuf, pos);
@@ -197,6 +257,29 @@ out:
if (hdlc->destroyed)
g_free(hdlc);
+
+ /*
+ * If there were no data pause for GUARD_TIMEOUTS ms,
+ * we try again to check it.
+ */
+ if (!hdlc->paused)
+ hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
+ paused_timeout_cb,
+ hdlc);
+
+ return;
+
+suspend:
+ /*
+ * Restart the counter and reset the ring buffer.
+ */
+ hdlc->cmpt = 0;
+
+ /*
+ * Wait for another pause of GUARD_TIMEOUTS ms before returning to command mode.
+ */
+ hdlc->paused = FALSE;
+ hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS, hdlc_suspend, hdlc);
}
GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
@@ -245,6 +328,11 @@ GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
hdlc->io = g_at_io_ref(io);
g_at_io_set_read_handler(hdlc->io, new_bytes, hdlc);
+ /* We can try to check the pause as soon as read handler is set */
+ hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
+ paused_timeout_cb,
+ hdlc);
+
return hdlc;
error:
@@ -305,6 +393,10 @@ void g_at_hdlc_unref(GAtHDLC *hdlc)
g_at_io_set_write_handler(hdlc->io, NULL, NULL);
g_at_io_set_read_handler(hdlc->io, NULL, NULL);
+ if (hdlc->pause_timeout > 0)
+ g_source_remove(hdlc->pause_timeout);
+
+
g_at_io_unref(hdlc->io);
hdlc->io = NULL;
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 06/26] gatppp: add g_at_ppp_set_suspend_function() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (4 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 07/26] gatppp: add g_at_ppp_set_suspend_function() definition Guillaume Zajac
` (19 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
---
gatchat/gatppp.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h
index fb5de4c..7835d1f 100644
--- a/gatchat/gatppp.h
+++ b/gatchat/gatppp.h
@@ -61,6 +61,8 @@ void g_at_ppp_set_connect_function(GAtPPP *ppp, GAtPPPConnectFunc callback,
void g_at_ppp_set_disconnect_function(GAtPPP *ppp, GAtPPPDisconnectFunc func,
gpointer user_data);
void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
+void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
+ gpointer user_data);
void g_at_ppp_shutdown(GAtPPP *ppp);
void g_at_ppp_ref(GAtPPP *ppp);
void g_at_ppp_unref(GAtPPP *ppp);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 07/26] gatppp: add g_at_ppp_set_suspend_function() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (5 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 06/26] gatppp: add g_at_ppp_set_suspend_function() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 08/26] gathdlc: add g_at_hdlc_suspend() prototype Guillaume Zajac
` (18 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 691 bytes --]
---
gatchat/gatppp.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 993b5ea..9df6b8e 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -467,6 +467,14 @@ void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data)
ppp->debug_data = user_data;
}
+void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func, gpointer user_data)
+{
+ if (ppp == NULL)
+ return;
+
+ g_at_hdlc_set_suspend_function(ppp->hdlc, func, user_data);
+}
+
void g_at_ppp_shutdown(GAtPPP *ppp)
{
if (ppp->phase == PPP_PHASE_DEAD || ppp->phase == PPP_PHASE_TERMINATION)
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 08/26] gathdlc: add g_at_hdlc_suspend() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (6 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 07/26] gatppp: add g_at_ppp_set_suspend_function() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition Guillaume Zajac
` (17 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 509 bytes --]
---
gatchat/gathdlc.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.h b/gatchat/gathdlc.h
index 158f27f..556e383 100644
--- a/gatchat/gathdlc.h
+++ b/gatchat/gathdlc.h
@@ -60,6 +60,8 @@ void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect);
void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,
gpointer user_data);
+void g_at_hdlc_suspend(GAtHDLC *hdlc);
+
#ifdef __cplusplus
}
#endif
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (7 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 08/26] gathdlc: add g_at_hdlc_suspend() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:24 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 10/26] ppp: add ppp_net_suspend_interface() prototype Guillaume Zajac
` (16 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 567 bytes --]
---
gatchat/gathdlc.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index db4ad5a..37f2539 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -595,3 +595,12 @@ void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect)
hdlc->no_carrier_detect = detect;
}
+
+void g_at_hdlc_suspend(GAtHDLC *hdlc)
+{
+ if (hdlc == NULL)
+ return;
+
+ g_at_io_set_write_handler(hdlc->io, NULL, NULL);
+ g_at_io_set_read_handler(hdlc->io, NULL, NULL);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 10/26] ppp: add ppp_net_suspend_interface() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (8 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 11/26] ppp_net: add ppp_net_suspend_interface() definition Guillaume Zajac
` (15 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 627 bytes --]
---
gatchat/ppp.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/ppp.h b/gatchat/ppp.h
index d2786d7..22809d8 100644
--- a/gatchat/ppp.h
+++ b/gatchat/ppp.h
@@ -107,6 +107,7 @@ const char *ppp_net_get_interface(struct ppp_net *net);
void ppp_net_process_packet(struct ppp_net *net, const guint8 *packet);
void ppp_net_free(struct ppp_net *net);
gboolean ppp_net_set_mtu(struct ppp_net *net, guint16 mtu);
+void ppp_net_suspend_interface(struct ppp_net *net);
/* PPP functions related to main GAtPPP object */
void ppp_debug(GAtPPP *ppp, const char *str);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 11/26] ppp_net: add ppp_net_suspend_interface() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (9 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 10/26] ppp: add ppp_net_suspend_interface() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 12/26] gatppp: add g_at_ppp_suspend() prototype Guillaume Zajac
` (14 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 524 bytes --]
---
gatchat/ppp_net.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 1a6cdf7..9abf590 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -196,3 +196,12 @@ void ppp_net_free(struct ppp_net *net)
g_free(net->if_name);
g_free(net);
}
+
+void ppp_net_suspend_interface(struct ppp_net *net)
+{
+ if (net == NULL || net->channel == NULL)
+ return;
+
+ if (net->watch)
+ g_source_remove(net->watch);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 12/26] gatppp: add g_at_ppp_suspend() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (10 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 11/26] ppp_net: add ppp_net_suspend_interface() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition Guillaume Zajac
` (13 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 574 bytes --]
---
gatchat/gatppp.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h
index 7835d1f..e4e9f5f 100644
--- a/gatchat/gatppp.h
+++ b/gatchat/gatppp.h
@@ -64,6 +64,7 @@ void g_at_ppp_set_debug(GAtPPP *ppp, GAtDebugFunc func, gpointer user_data);
void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
gpointer user_data);
void g_at_ppp_shutdown(GAtPPP *ppp);
+void g_at_ppp_suspend(GAtPPP *ppp);
void g_at_ppp_ref(GAtPPP *ppp);
void g_at_ppp_unref(GAtPPP *ppp);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (11 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 12/26] gatppp: add g_at_ppp_suspend() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-05-02 12:26 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 14/26] emulator: add ppp_suspend() CB and register it Guillaume Zajac
` (12 subsequent siblings)
25 siblings, 1 reply; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 566 bytes --]
---
gatchat/gatppp.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 9df6b8e..5f005fe 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -484,6 +484,15 @@ void g_at_ppp_shutdown(GAtPPP *ppp)
pppcp_signal_close(ppp->lcp);
}
+void g_at_ppp_suspend(GAtPPP *ppp)
+{
+ if (ppp == NULL)
+ return;
+
+ ppp_net_suspend_interface(ppp->net);
+ g_at_hdlc_suspend(ppp->hdlc);
+}
+
void g_at_ppp_ref(GAtPPP *ppp)
{
g_atomic_int_inc(&ppp->ref_count);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 14/26] emulator: add ppp_suspend() CB and register it
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (12 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 15/26] emulator: add dun_ath_cb() " Guillaume Zajac
` (11 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 926 bytes --]
---
src/emulator.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index c84f0a9..ededf9d 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -99,6 +99,16 @@ static void ppp_disconnect(GAtPPPDisconnectReason reason, gpointer user_data)
g_at_server_resume(em->server);
}
+static void ppp_suspend(gpointer user_data)
+{
+ struct ofono_emulator *em = user_data;
+
+ DBG("");
+
+ g_at_ppp_suspend(em->ppp);
+ g_at_server_resume(em->server);
+}
+
static gboolean setup_ppp(gpointer user_data)
{
struct ofono_emulator *em = user_data;
@@ -126,6 +136,7 @@ static gboolean setup_ppp(gpointer user_data)
g_at_ppp_set_connect_function(em->ppp, ppp_connect, em);
g_at_ppp_set_disconnect_function(em->ppp, ppp_disconnect, em);
+ g_at_ppp_set_suspend_function(em->ppp, ppp_suspend, em);
return FALSE;
}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 15/26] emulator: add dun_ath_cb() and register it
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (13 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 14/26] emulator: add ppp_suspend() CB and register it Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 16/26] gathdlc: add g_at_hdlc_resume() prototype Guillaume Zajac
` (10 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2110 bytes --]
---
src/emulator.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 58 insertions(+), 2 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index ededf9d..f375c9e 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -188,6 +188,53 @@ error:
g_at_server_send_final(em->server, G_AT_SERVER_RESULT_ERROR);
}
+static void dun_ath_cb(GAtServer *server, GAtServerRequestType type,
+ GAtResult *result, gpointer user_data)
+{
+ struct ofono_emulator *em = user_data;
+ GAtResultIter iter;
+ int val;
+
+ DBG("");
+
+ if (em->ppp == NULL) {
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+ return;
+ }
+
+ switch (type) {
+ case G_AT_SERVER_REQUEST_TYPE_SET:
+ g_at_result_iter_init(&iter, result);
+ g_at_result_iter_next(&iter, "");
+
+ if (g_at_result_iter_next_number(&iter, &val) == FALSE)
+ goto error;
+
+ if (val != 0)
+ goto error;
+
+ g_at_ppp_unref(em->ppp);
+ em->ppp = NULL;
+
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+ break;
+
+ case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+ g_at_ppp_unref(em->ppp);
+ em->ppp = NULL;
+
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_OK);
+ break;
+
+ default:
+error:
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+ break;
+ }
+
+ return;
+}
+
static void brsf_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data)
{
@@ -477,10 +524,19 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
__ofono_atom_register(em->atom, emulator_unregister);
- if (em->type == OFONO_EMULATOR_TYPE_DUN)
+ switch (em->type) {
+ case OFONO_EMULATOR_TYPE_DUN:
g_at_server_register(em->server, "D", dial_cb, em, NULL);
- else if (em->type == OFONO_EMULATOR_TYPE_HFP)
+ g_at_server_register(em->server, "H", dun_ath_cb, em, NULL);
+ break;
+
+ case OFONO_EMULATOR_TYPE_HFP:
g_at_server_set_echo(em->server, FALSE);
+ break;
+
+ default:
+ break;
+ }
}
static void emulator_remove(struct ofono_atom *atom)
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 16/26] gathdlc: add g_at_hdlc_resume() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (14 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 15/26] emulator: add dun_ath_cb() " Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 17/26] gathdlc: add g_at_hdlc_resume() definition Guillaume Zajac
` (9 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 467 bytes --]
---
gatchat/gathdlc.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.h b/gatchat/gathdlc.h
index 556e383..e82b33e 100644
--- a/gatchat/gathdlc.h
+++ b/gatchat/gathdlc.h
@@ -61,6 +61,7 @@ void g_at_hdlc_set_suspend_function(GAtHDLC *hdlc, GAtSuspendFunc func,
gpointer user_data);
void g_at_hdlc_suspend(GAtHDLC *hdlc);
+void g_at_hdlc_resume(GAtHDLC *hdlc);
#ifdef __cplusplus
}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 17/26] gathdlc: add g_at_hdlc_resume() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (15 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 16/26] gathdlc: add g_at_hdlc_resume() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 18/26] ppp: add ppp_net_resume_interface() prototype Guillaume Zajac
` (8 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 997 bytes --]
---
gatchat/gathdlc.c | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index 37f2539..816da34 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -604,3 +604,28 @@ void g_at_hdlc_suspend(GAtHDLC *hdlc)
g_at_io_set_write_handler(hdlc->io, NULL, NULL);
g_at_io_set_read_handler(hdlc->io, NULL, NULL);
}
+
+static void hdlc_wakeup_writer(GAtHDLC *hdlc)
+{
+ g_at_io_set_write_handler(hdlc->io, can_write_data, hdlc);
+}
+
+void g_at_hdlc_resume(GAtHDLC *hdlc)
+{
+ if (hdlc == NULL)
+ return;
+
+ g_at_io_set_read_handler(hdlc->io, new_bytes, hdlc);
+
+ if (g_queue_get_length(hdlc->write_queue) > 0)
+ hdlc_wakeup_writer(hdlc);
+
+ /*
+ * As soon as we resume HDLC we can start checking for
+ * guard timeouts pause.
+ */
+ if (!hdlc->paused)
+ hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
+ paused_timeout_cb,
+ hdlc);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 18/26] ppp: add ppp_net_resume_interface() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (16 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 17/26] gathdlc: add g_at_hdlc_resume() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 19/26] ppp_net: add ppp_net_resume_interface() definition Guillaume Zajac
` (7 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
---
gatchat/ppp.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/ppp.h b/gatchat/ppp.h
index 22809d8..ae96e42 100644
--- a/gatchat/ppp.h
+++ b/gatchat/ppp.h
@@ -108,6 +108,7 @@ void ppp_net_process_packet(struct ppp_net *net, const guint8 *packet);
void ppp_net_free(struct ppp_net *net);
gboolean ppp_net_set_mtu(struct ppp_net *net, guint16 mtu);
void ppp_net_suspend_interface(struct ppp_net *net);
+void ppp_net_resume_interface(struct ppp_net *net);
/* PPP functions related to main GAtPPP object */
void ppp_debug(GAtPPP *ppp, const char *str);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 19/26] ppp_net: add ppp_net_resume_interface() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (17 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 18/26] ppp: add ppp_net_resume_interface() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 20/26] gatppp: add g_at_ppp_resume() prototype Guillaume Zajac
` (6 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
---
gatchat/ppp_net.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c
index 9abf590..6ace16b 100644
--- a/gatchat/ppp_net.c
+++ b/gatchat/ppp_net.c
@@ -205,3 +205,13 @@ void ppp_net_suspend_interface(struct ppp_net *net)
if (net->watch)
g_source_remove(net->watch);
}
+
+void ppp_net_resume_interface(struct ppp_net *net)
+{
+ if (net == NULL || net->channel == NULL)
+ return;
+
+ net->watch = g_io_add_watch(net->channel,
+ G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
+ ppp_net_callback, net);
+}
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 20/26] gatppp: add g_at_ppp_resume() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (18 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 19/26] ppp_net: add ppp_net_resume_interface() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 21/26] gatppp: add g_at_ppp_resume() definition Guillaume Zajac
` (5 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
---
gatchat/gatppp.h | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.h b/gatchat/gatppp.h
index e4e9f5f..fbf55b9 100644
--- a/gatchat/gatppp.h
+++ b/gatchat/gatppp.h
@@ -65,6 +65,7 @@ void g_at_ppp_set_suspend_function(GAtPPP *ppp, GAtSuspendFunc func,
gpointer user_data);
void g_at_ppp_shutdown(GAtPPP *ppp);
void g_at_ppp_suspend(GAtPPP *ppp);
+void g_at_ppp_resume(GAtPPP *ppp);
void g_at_ppp_ref(GAtPPP *ppp);
void g_at_ppp_unref(GAtPPP *ppp);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 21/26] gatppp: add g_at_ppp_resume() definition.
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (19 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 20/26] gatppp: add g_at_ppp_resume() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 22/26] emulator: add dun_ato_cb() and register it Guillaume Zajac
` (4 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
---
gatchat/gatppp.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 5f005fe..6dfd965 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -493,6 +493,23 @@ void g_at_ppp_suspend(GAtPPP *ppp)
g_at_hdlc_suspend(ppp->hdlc);
}
+void g_at_ppp_resume(GAtPPP *ppp)
+{
+ if (ppp == NULL)
+ return;
+
+ if (g_at_hdlc_get_io(ppp->hdlc) == NULL) {
+ io_disconnect(ppp);
+ return;
+ }
+
+ g_at_io_set_disconnect_function(g_at_hdlc_get_io(ppp->hdlc),
+ io_disconnect, ppp);
+
+ g_at_hdlc_resume(ppp->hdlc);
+ ppp_net_resume_interface(ppp->net);
+}
+
void g_at_ppp_ref(GAtPPP *ppp)
{
g_atomic_int_inc(&ppp->ref_count);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 22/26] emulator: add dun_ato_cb() and register it
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (20 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 21/26] gatppp: add g_at_ppp_resume() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 23/26] gsmdial: add new option to test sending escape sequence Guillaume Zajac
` (3 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1969 bytes --]
---
src/emulator.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/src/emulator.c b/src/emulator.c
index f375c9e..7280030 100644
--- a/src/emulator.c
+++ b/src/emulator.c
@@ -235,6 +235,59 @@ error:
return;
}
+static gboolean resume_ppp(gpointer user_data)
+{
+ struct ofono_emulator *em = user_data;
+
+ g_at_server_suspend(em->server);
+ g_at_ppp_resume(em->ppp);
+
+ return FALSE;
+}
+
+static void dun_ato_cb(GAtServer *server, GAtServerRequestType type,
+ GAtResult *result, gpointer user_data)
+{
+ struct ofono_emulator *em = user_data;
+ GAtResultIter iter;
+ int val;
+
+ DBG("");
+
+ if (em->ppp == NULL) {
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_NO_CARRIER);
+ return;
+ }
+
+ switch (type) {
+ case G_AT_SERVER_REQUEST_TYPE_SET:
+ g_at_result_iter_init(&iter, result);
+ g_at_result_iter_next(&iter, "");
+
+ if (g_at_result_iter_next_number(&iter, &val) == FALSE)
+ goto error;
+
+ if (val != 0)
+ goto error;
+
+ g_at_server_send_intermediate(em->server, "CONNECT");
+ em->source = g_idle_add(resume_ppp, em);
+ break;
+
+ case G_AT_SERVER_REQUEST_TYPE_COMMAND_ONLY:
+ g_at_server_send_intermediate(em->server, "CONNECT");
+ em->source = g_idle_add(resume_ppp, em);
+ break;
+
+ default:
+error:
+ g_at_server_send_final(server, G_AT_SERVER_RESULT_ERROR);
+ break;
+ }
+
+ return;
+}
+
static void brsf_cb(GAtServer *server, GAtServerRequestType type,
GAtResult *result, gpointer user_data)
{
@@ -528,6 +581,7 @@ void ofono_emulator_register(struct ofono_emulator *em, int fd)
case OFONO_EMULATOR_TYPE_DUN:
g_at_server_register(em->server, "D", dial_cb, em, NULL);
g_at_server_register(em->server, "H", dun_ath_cb, em, NULL);
+ g_at_server_register(em->server, "O", dun_ato_cb, em, NULL);
break;
case OFONO_EMULATOR_TYPE_HFP:
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 23/26] gsmdial: add new option to test sending escape sequence
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (21 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 22/26] emulator: add dun_ato_cb() and register it Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 24/26] gatchat: add g_at_chat_send_escape_sequence() prototype Guillaume Zajac
` (2 subsequent siblings)
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 936 bytes --]
---
gatchat/gsmdial.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index a10e7cb..92a7ff2 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -57,6 +57,7 @@ static gchar *option_username = NULL;
static gchar *option_password = NULL;
static gchar *option_pppdump = NULL;
static gboolean option_bluetooth = FALSE;
+static gboolean option_esc = FALSE;
static GAtPPP *ppp;
static GAtChat *control;
@@ -624,6 +625,8 @@ static GOptionEntry options[] = {
"Use ATD*99***<cid>#" },
{ "bluetooth", 'b', 0, G_OPTION_ARG_NONE, &option_bluetooth,
"Use only ATD*99" },
+ { "esc_seq", 'e', 0, G_OPTION_ARG_NONE, &option_esc,
+ "Send escape sequence test" },
{ "username", 'u', 0, G_OPTION_ARG_STRING, &option_username,
"Specify PPP username" },
{ "password", 'w', 0, G_OPTION_ARG_STRING, &option_password,
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 24/26] gatchat: add g_at_chat_send_escape_sequence() prototype
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (22 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 23/26] gsmdial: add new option to test sending escape sequence Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 25/26] gatchat: add g_at_chat_send_escape_sequence() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 26/26] gsmdial: implement test sequence +++-ATO0-+++-ATH0 Guillaume Zajac
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 599 bytes --]
---
gatchat/gatchat.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatchat.h b/gatchat/gatchat.h
index eb82daa..326ebe2 100644
--- a/gatchat/gatchat.h
+++ b/gatchat/gatchat.h
@@ -132,6 +132,8 @@ guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd,
const char **valid_resp, GAtResultFunc func,
gpointer user_data, GDestroyNotify notify);
+void g_at_chat_send_escape_sequence(GAtChat *chat);
+
gboolean g_at_chat_cancel(GAtChat *chat, guint id);
gboolean g_at_chat_cancel_all(GAtChat *chat);
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 25/26] gatchat: add g_at_chat_send_escape_sequence() definition
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (23 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 24/26] gatchat: add g_at_chat_send_escape_sequence() prototype Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 26/26] gsmdial: implement test sequence +++-ATO0-+++-ATH0 Guillaume Zajac
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]
---
gatchat/gatchat.c | 32 ++++++++++++++++++++++++++++++++
1 files changed, 32 insertions(+), 0 deletions(-)
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 546bd68..ae276eb 100644
--- a/gatchat/gatchat.c
+++ b/gatchat/gatchat.c
@@ -41,6 +41,9 @@
#define COMMAND_FLAG_EXPECT_PDU 0x1
#define COMMAND_FLAG_EXPECT_SHORT_PROMPT 0x2
+/* Time to wait before and after +++ sequence */
+#define GUARD_TIMEOUTS 1500
+
struct at_chat;
static void chat_wakeup_writer(struct at_chat *chat);
@@ -102,6 +105,7 @@ struct at_chat {
gboolean in_read_handler; /* Re-entrancy guard */
gboolean in_notify;
GSList *terminator_list; /* Non-standard terminator */
+ guint guard_timeout; /* guard_timeout CB id */
};
struct _GAtChat {
@@ -958,6 +962,9 @@ static void at_chat_unref(struct at_chat *chat)
chat_cleanup(chat);
}
+ if (chat->guard_timeout)
+ g_source_remove(chat->guard_timeout);
+
if (chat->in_read_handler)
chat->destroyed = TRUE;
else
@@ -1495,6 +1502,31 @@ guint g_at_chat_send_and_expect_short_prompt(GAtChat *chat, const char *cmd,
NULL, func, user_data, notify);
}
+static gboolean resume_chat(gpointer user_data)
+{
+ struct at_chat *chat = user_data;
+
+ at_chat_resume(chat);
+
+ return FALSE;
+}
+
+static gboolean at_send_escape_sequence(gpointer user_data)
+{
+ struct at_chat *chat = user_data;
+
+ g_at_io_write(chat->io, "+++", 3);
+
+ chat->guard_timeout = g_timeout_add(GUARD_TIMEOUTS, resume_chat, chat);
+
+ return FALSE;
+}
+
+void g_at_chat_send_escape_sequence(GAtChat *chat)
+{
+ chat->parent->guard_timeout = g_timeout_add(GUARD_TIMEOUTS, at_send_escape_sequence, chat->parent);
+}
+
gboolean g_at_chat_cancel(GAtChat *chat, guint id)
{
/* We use id 0 for wakeup commands */
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* [PATCH v3 26/26] gsmdial: implement test sequence +++-ATO0-+++-ATH0
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
` (24 preceding siblings ...)
2011-04-01 8:56 ` [PATCH v3 25/26] gatchat: add g_at_chat_send_escape_sequence() definition Guillaume Zajac
@ 2011-04-01 8:56 ` Guillaume Zajac
25 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-04-01 8:56 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 2626 bytes --]
---
gatchat/gsmdial.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 92a7ff2..7e6eec9 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -238,6 +238,76 @@ static gboolean execute(const char *cmd)
return TRUE;
}
+static void ppp_suspend(void)
+{
+ /* Delete the write done CB */
+ g_at_io_set_write_done(g_at_chat_get_io(modem), NULL, NULL);
+
+ /*
+ * We are sure there are no more PPP packets to be written,
+ * we can suspend PPP client
+ */
+ g_at_ppp_suspend(ppp);
+ g_at_chat_send_escape_sequence(modem);
+}
+
+static void power_down_ppp(gboolean ok, GAtResult *result, gpointer user_data)
+{
+ if (!ok)
+ return;
+
+ g_at_ppp_unref(ppp);
+ ppp = NULL;
+}
+
+static gboolean send_ATH0(gpointer user_data)
+{
+ /* Resume AT chat to send ATH0 */
+ g_at_chat_resume(modem);
+ g_at_chat_send(modem, "ATH0", none_prefix, power_down_ppp, NULL, NULL);
+
+ return FALSE;
+}
+
+static void continue_test_sequence(gpointer data)
+{
+ ppp_suspend();
+ g_timeout_add_seconds(5, send_ATH0, NULL);
+}
+
+static void suspend_gat_chat(gboolean ok, GAtResult *result,
+ gpointer user_data)
+{
+ /*
+ * As soon as the command is treated by AT server
+ * we can suspend AT chat and resume PPP client
+ */
+ g_at_chat_suspend(modem);
+ g_at_ppp_resume(ppp);
+
+ /*
+ * As soon as a PPP packet is written by the client, we continue
+ * test sequence.
+ */
+ g_at_io_set_write_done(g_at_chat_get_io(modem),
+ continue_test_sequence, NULL);
+}
+
+static gboolean send_ATO0(gpointer user_data)
+{
+ g_at_chat_resume(modem);
+ g_at_chat_send(modem, "ATO0", none_prefix,
+ suspend_gat_chat, NULL, NULL);
+
+ return FALSE;
+}
+
+static void start_test_sequence(gpointer data)
+{
+ ppp_suspend();
+ g_timeout_add_seconds(5, send_ATO0, NULL);
+}
+
static void ppp_connect(const char *iface, const char *local, const char *peer,
const char *dns1, const char *dns2,
gpointer user_data)
@@ -262,6 +332,14 @@ static void ppp_connect(const char *iface, const char *local, const char *peer,
snprintf(buf, sizeof(buf), "%s %s %s pointopoint %s", IFCONFIG_PATH,
iface, local, peer);
execute(buf);
+
+ /*
+ * As soon as a PPP packet is written by the client, we start
+ * test sequence.
+ */
+ if (option_esc)
+ g_at_io_set_write_done(g_at_chat_get_io(modem),
+ start_test_sequence, NULL);
}
static void no_carrier_notify(GAtResult *result, gpointer user_data)
--
1.7.1
^ permalink raw reply related [flat|nested] 36+ messages in thread
* Re: [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef
2011-04-01 8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
@ 2011-05-02 12:08 ` Denis Kenzior
0 siblings, 0 replies; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:08 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 211 bytes --]
Hi Guillaume,
On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
> ---
> gatchat/gat.h | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer
2011-04-01 8:56 ` [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer Guillaume Zajac
@ 2011-05-02 12:08 ` Denis Kenzior
0 siblings, 0 replies; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:08 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 214 bytes --]
Hi Guillaume,
On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
> ---
> gatchat/gatio.h | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition
2011-04-01 8:56 ` [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition Guillaume Zajac
@ 2011-05-02 12:09 ` Denis Kenzior
0 siblings, 0 replies; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:09 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 335 bytes --]
Hi Guillaume,
On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
> ---
> gatchat/gatio.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
Patch has been applied, however I went ahead and squished this commit
and the previous one together since they logically belong to the same
commit.
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence
2011-04-01 8:56 ` [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence Guillaume Zajac
@ 2011-05-02 12:22 ` Denis Kenzior
2011-05-04 9:14 ` Guillaume Zajac
0 siblings, 1 reply; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:22 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1320 bytes --]
Hi Guillaume,
> @@ -197,6 +257,29 @@ out:
>
> if (hdlc->destroyed)
> g_free(hdlc);
> +
> + /*
> + * If there were no data pause for GUARD_TIMEOUTS ms,
> + * we try again to check it.
> + */
> + if (!hdlc->paused)
> + hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
> + paused_timeout_cb,
> + hdlc);
So you just caused a crash here...
> +
> + return;
> +
> +suspend:
> + /*
> + * Restart the counter and reset the ring buffer.
> + */
> + hdlc->cmpt = 0;
> +
> + /*
> + * Wait for another pause of GUARD_TIMEOUTS ms before returning to command mode.
> + */
> + hdlc->paused = FALSE;
> + hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS, hdlc_suspend, hdlc);
> }
>
> GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
Some general comments:
Your implementation assumes too much about the contents of the read
buffer. You have to make sure that it works even in different timings
of the received information. You should also not try to process the
escape sequence through the main HDLC parser...
I've pushed my own version, which I have not tested at all. The
relevant commits are 94d6d505eeda4db0a28aea99bf3ab23a62a65f2c and
dc86e864463a61d3f99a21c948c11ba274c6ef84. Please review and let me know
how well it works.
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition
2011-04-01 8:56 ` [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition Guillaume Zajac
@ 2011-05-02 12:24 ` Denis Kenzior
2011-05-04 9:23 ` Guillaume Zajac
0 siblings, 1 reply; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:24 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 781 bytes --]
Hi Guillaume,
On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
> ---
> gatchat/gathdlc.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
> index db4ad5a..37f2539 100644
> --- a/gatchat/gathdlc.c
> +++ b/gatchat/gathdlc.c
> @@ -595,3 +595,12 @@ void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect)
>
> hdlc->no_carrier_detect = detect;
> }
> +
> +void g_at_hdlc_suspend(GAtHDLC *hdlc)
> +{
> + if (hdlc == NULL)
> + return;
> +
> + g_at_io_set_write_handler(hdlc->io, NULL, NULL);
> + g_at_io_set_read_handler(hdlc->io, NULL, NULL);
> +}
What do you think of simply putting this into the function that calls
the HDLC suspend callback?
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition
2011-04-01 8:56 ` [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition Guillaume Zajac
@ 2011-05-02 12:26 ` Denis Kenzior
2011-05-04 9:25 ` Guillaume Zajac
0 siblings, 1 reply; 36+ messages in thread
From: Denis Kenzior @ 2011-05-02 12:26 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 868 bytes --]
Hi Guillaume,
On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
> ---
> gatchat/gatppp.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
>
> diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
> index 9df6b8e..5f005fe 100644
> --- a/gatchat/gatppp.c
> +++ b/gatchat/gatppp.c
> @@ -484,6 +484,15 @@ void g_at_ppp_shutdown(GAtPPP *ppp)
> pppcp_signal_close(ppp->lcp);
> }
>
> +void g_at_ppp_suspend(GAtPPP *ppp)
> +{
> + if (ppp == NULL)
> + return;
> +
> + ppp_net_suspend_interface(ppp->net);
> + g_at_hdlc_suspend(ppp->hdlc);
> +}
> +
What do you think of automatically calling ppp_net_suspend_interface
when the ppp suspend callback is triggered? e.g. using a proxy function
in g_at_ppp_set_suspend_function.
> void g_at_ppp_ref(GAtPPP *ppp)
> {
> g_atomic_int_inc(&ppp->ref_count);
Regards,
-Denis
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence
2011-05-02 12:22 ` Denis Kenzior
@ 2011-05-04 9:14 ` Guillaume Zajac
0 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-05-04 9:14 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
Hi Denis,
On 02/05/2011 14:22, Denis Kenzior wrote:
> Hi Guillaume,
>
>> @@ -197,6 +257,29 @@ out:
>>
>> if (hdlc->destroyed)
>> g_free(hdlc);
>> +
>> + /*
>> + * If there were no data pause for GUARD_TIMEOUTS ms,
>> + * we try again to check it.
>> + */
>> + if (!hdlc->paused)
>> + hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS,
>> + paused_timeout_cb,
>> + hdlc);
> So you just caused a crash here...
Yes big one, I may have sent you not the right version because I made it
working.
Abyway, I will work on your version now :)
>> +
>> + return;
>> +
>> +suspend:
>> + /*
>> + * Restart the counter and reset the ring buffer.
>> + */
>> + hdlc->cmpt = 0;
>> +
>> + /*
>> + * Wait for another pause of GUARD_TIMEOUTS ms before returning to command mode.
>> + */
>> + hdlc->paused = FALSE;
>> + hdlc->pause_timeout = g_timeout_add (GUARD_TIMEOUTS, hdlc_suspend, hdlc);
>> }
>>
>> GAtHDLC *g_at_hdlc_new_from_io(GAtIO *io)
> Some general comments:
>
> Your implementation assumes too much about the contents of the read
> buffer. You have to make sure that it works even in different timings
> of the received information. You should also not try to process the
> escape sequence through the main HDLC parser...
>
> I've pushed my own version, which I have not tested at all. The
> relevant commits are 94d6d505eeda4db0a28aea99bf3ab23a62a65f2c and
> dc86e864463a61d3f99a21c948c11ba274c6ef84. Please review and let me know
> how well it works.
>
At first sight, it sounds ok, I will test it now.
Kind regards,
Guillaume
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition
2011-05-02 12:24 ` Denis Kenzior
@ 2011-05-04 9:23 ` Guillaume Zajac
0 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-05-04 9:23 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 990 bytes --]
Hi Denis,
On 02/05/2011 14:24, Denis Kenzior wrote:
> Hi Guillaume,
>
> On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
>> ---
>> gatchat/gathdlc.c | 9 +++++++++
>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
>> index db4ad5a..37f2539 100644
>> --- a/gatchat/gathdlc.c
>> +++ b/gatchat/gathdlc.c
>> @@ -595,3 +595,12 @@ void g_at_hdlc_set_no_carrier_detect(GAtHDLC *hdlc, gboolean detect)
>>
>> hdlc->no_carrier_detect = detect;
>> }
>> +
>> +void g_at_hdlc_suspend(GAtHDLC *hdlc)
>> +{
>> + if (hdlc == NULL)
>> + return;
>> +
>> + g_at_io_set_write_handler(hdlc->io, NULL, NULL);
>> + g_at_io_set_read_handler(hdlc->io, NULL, NULL);
>> +}
> What do you think of simply putting this into the function that calls
> the HDLC suspend callback?
>
Yes it would avoid some round-trips.
However we might need this function for gsmdial to make some tests.
Kind regards,
Guillaume
^ permalink raw reply [flat|nested] 36+ messages in thread
* Re: [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition
2011-05-02 12:26 ` Denis Kenzior
@ 2011-05-04 9:25 ` Guillaume Zajac
0 siblings, 0 replies; 36+ messages in thread
From: Guillaume Zajac @ 2011-05-04 9:25 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1196 bytes --]
Hi Denis,
On 02/05/2011 14:26, Denis Kenzior wrote:
> Hi Guillaume,
>
> On 04/01/2011 03:56 AM, Guillaume Zajac wrote:
>> ---
>> gatchat/gatppp.c | 9 +++++++++
>> 1 files changed, 9 insertions(+), 0 deletions(-)
>>
>> diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
>> index 9df6b8e..5f005fe 100644
>> --- a/gatchat/gatppp.c
>> +++ b/gatchat/gatppp.c
>> @@ -484,6 +484,15 @@ void g_at_ppp_shutdown(GAtPPP *ppp)
>> pppcp_signal_close(ppp->lcp);
>> }
>>
>> +void g_at_ppp_suspend(GAtPPP *ppp)
>> +{
>> + if (ppp == NULL)
>> + return;
>> +
>> + ppp_net_suspend_interface(ppp->net);
>> + g_at_hdlc_suspend(ppp->hdlc);
>> +}
>> +
> What do you think of automatically calling ppp_net_suspend_interface
> when the ppp suspend callback is triggered? e.g. using a proxy function
> in g_at_ppp_set_suspend_function.
Good idea, thus we only need to resume GAtServer into ppp_suspend() into
emulator.c
However, like for g_at_hdlc_suspend(), we might need to call this
function from gsmdial to make some tests.
>> void g_at_ppp_ref(GAtPPP *ppp)
>> {
>> g_atomic_int_inc(&ppp->ref_count);
> Regards,
> -Denis
>
Kind regards,
Guillaume
^ permalink raw reply [flat|nested] 36+ messages in thread
end of thread, other threads:[~2011-05-04 9:25 UTC | newest]
Thread overview: 36+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-01 8:56 [PATCH v3 00/26] Escape Sequence Dectection implementation Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 01/26] gat: add GAtSuspendFunc CB typedef Guillaume Zajac
2011-05-02 12:08 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 02/26] gatio: add prototype to drain GAtIO read buffer Guillaume Zajac
2011-05-02 12:08 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 03/26] gatio: add g_at_io_drain_ring_buffer() definition Guillaume Zajac
2011-05-02 12:09 ` Denis Kenzior
2011-04-01 8:56 ` [PATCH v3 04/26] gathdlc: add g_at_hdlc_set_suspend_function() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 05/26] gathdlc: add mechansim to detect '+++' escape sequence Guillaume Zajac
2011-05-02 12:22 ` Denis Kenzior
2011-05-04 9:14 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 06/26] gatppp: add g_at_ppp_set_suspend_function() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 07/26] gatppp: add g_at_ppp_set_suspend_function() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 08/26] gathdlc: add g_at_hdlc_suspend() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 09/26] gathdlc: add g_at_hdlc_suspend() definition Guillaume Zajac
2011-05-02 12:24 ` Denis Kenzior
2011-05-04 9:23 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 10/26] ppp: add ppp_net_suspend_interface() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 11/26] ppp_net: add ppp_net_suspend_interface() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 12/26] gatppp: add g_at_ppp_suspend() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 13/26] gatppp: add g_at_ppp_suspend() definition Guillaume Zajac
2011-05-02 12:26 ` Denis Kenzior
2011-05-04 9:25 ` Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 14/26] emulator: add ppp_suspend() CB and register it Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 15/26] emulator: add dun_ath_cb() " Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 16/26] gathdlc: add g_at_hdlc_resume() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 17/26] gathdlc: add g_at_hdlc_resume() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 18/26] ppp: add ppp_net_resume_interface() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 19/26] ppp_net: add ppp_net_resume_interface() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 20/26] gatppp: add g_at_ppp_resume() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 21/26] gatppp: add g_at_ppp_resume() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 22/26] emulator: add dun_ato_cb() and register it Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 23/26] gsmdial: add new option to test sending escape sequence Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 24/26] gatchat: add g_at_chat_send_escape_sequence() prototype Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 25/26] gatchat: add g_at_chat_send_escape_sequence() definition Guillaume Zajac
2011-04-01 8:56 ` [PATCH v3 26/26] gsmdial: implement test sequence +++-ATO0-+++-ATH0 Guillaume Zajac
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.