summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch')
-rw-r--r--meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch76
1 files changed, 0 insertions, 76 deletions
diff --git a/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch b/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch
deleted file mode 100644
index 51d50b917b..0000000000
--- a/meta/recipes-connectivity/gsm/files/0002-Flush-all-pending-commands-before-restarting-the-mod.patch
+++ /dev/null
@@ -1,76 +0,0 @@
1Upstream-Status: Inappropriate [not used]
2
3From 1078f7aced63c6216bffe649930b97c9ccf9a16e Mon Sep 17 00:00:00 2001
4From: Andrzej Zaborowski <balrog@zabor.org>
5Date: Wed, 19 Sep 2007 14:04:50 +0200
6Subject: [PATCH] Flush all pending commands before restarting the modem initialisation.
7
8---
9 include/gsmd/gsmd.h | 1 +
10 src/gsmd/atcmd.c | 21 +++++++++++++++++++++
11 src/gsmd/timer.c | 8 ++++++++
12 3 files changed, 30 insertions(+), 0 deletions(-)
13
14diff --git a/include/gsmd/gsmd.h b/include/gsmd/gsmd.h
15index 4afdf66..6ac9d8e 100644
16--- a/include/gsmd/gsmd.h
17+++ b/include/gsmd/gsmd.h
18@@ -131,6 +131,7 @@ struct gsmd_timer {
19
20 int gsmd_timer_init(void);
21 void gmsd_timer_check_n_run(void);
22+void gsmd_timer_reset(void);
23
24 struct gsmd_timer *gsmd_timer_alloc(void);
25 int gsmd_timer_register(struct gsmd_timer *timer);
26diff --git a/src/gsmd/atcmd.c b/src/gsmd/atcmd.c
27index 27dfa41..2f6cee2 100644
28--- a/src/gsmd/atcmd.c
29+++ b/src/gsmd/atcmd.c
30@@ -264,6 +264,27 @@ static int ml_parse(const char *buf, int len, void *ctx)
31 if (strlen(buf) == 0 ||
32 !strcmp(buf, "AT-Command Interpreter ready")) {
33 g->interpreter_ready = 1;
34+ g->clear_to_send = 1;
35+
36+ /* Flush current queue and reinitialise */
37+ while (!llist_empty(&g->busy_atcmds)) {
38+ cmd = llist_entry(g->busy_atcmds.next,
39+ struct gsmd_atcmd, list);
40+ gsmd_log(GSMD_NOTICE, "discarding busy cmd %s\n",
41+ cmd->buf);
42+ llist_del(&cmd->list);
43+ talloc_free(cmd);
44+ }
45+ while (!llist_empty(&g->pending_atcmds)) {
46+ cmd = llist_entry(g->pending_atcmds.next,
47+ struct gsmd_atcmd, list);
48+ gsmd_log(GSMD_NOTICE, "discarding pending cmd %s\n",
49+ cmd->buf);
50+ llist_del(&cmd->list);
51+ talloc_free(cmd);
52+ }
53+
54+ gsmd_timer_reset();
55 gsmd_initsettings(g);
56 gmsd_alive_start(g);
57 atcmd_wake_queue(g);
58diff --git a/src/gsmd/timer.c b/src/gsmd/timer.c
59index 5200690..8877275 100644
60--- a/src/gsmd/timer.c
61+++ b/src/gsmd/timer.c
62@@ -215,3 +215,11 @@ void gsmd_timer_unregister(struct gsmd_timer *timer)
63 /* re-calculate next expiration */
64 calc_next_expiration();
65 }
66+
67+void gsmd_timer_reset(void)
68+{
69+ while (!llist_empty(&gsmd_timers))
70+ /* TODO: free associated resources (e.g timer->cancel_cb()) */
71+ llist_del(&llist_entry(gsmd_timers.next,
72+ struct gsmd_timer, list)->list);
73+}
74--
751.5.2.1
76