All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHv3 1/3] hfpmodem: Retry AT+CLCC request after outgoing callsetup
@ 2013-02-13  8:36 Timo Mueller
  2013-02-13  8:36 ` [PATCHv3 2/3] hfp_hf: Add generic hfp modem vendor Timo Mueller
  2013-03-27  5:05 ` [PATCHv3 1/3] hfpmodem: Retry AT+CLCC request after outgoing callsetup Denis Kenzior
  0 siblings, 2 replies; 7+ messages in thread
From: Timo Mueller @ 2013-02-13  8:36 UTC (permalink / raw)
  To: ofono

[-- Attachment #1: Type: text/plain, Size: 3086 bytes --]

From: Timo Mueller <timo.mueller@bmw-carit.de>

Currently the list of current calls is requested right after an
outgoing callsetup has been reported by the AG device. If the AG
device updates the list after reporting the callsetup the +CLCC
response may not contain the new call and it is not registered
with oFono.

In this case AT+CLCC should be requested again once after a small
delay.

AT sequence that exhibited the failure (AG device was a Nokia N9
placing an outgoing call)

< \r\n+CIEV: 5,2\r\n
> AT+CLCC\r
< \r\nOK\r\n
< \r\n+VGS=7\r\n
< \r\n+VGM=7\r\n
< \r\n+CIEV: 5,3\r\n
< \r\n+CIEV: 4,1\r\n
< \r\n+CIEV: 5,0\r\n
---
v3: Splitted clcc_poll_cb to avoid parsing of the clcc result twice
when a dialing call was found in the response.

 drivers/hfpmodem/voicecall.c | 45 +++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 40 insertions(+), 5 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 33dd05e..9b05dbc 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -203,11 +203,10 @@ static void release_with_status(struct ofono_voicecall *vc, int status)
 	}
 }
 
-static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
+static void handle_clcc_response(gboolean ok, GSList *calls, gpointer user_data)
 {
 	struct ofono_voicecall *vc = user_data;
 	struct voicecall_data *vd = ofono_voicecall_get_data(vc);
-	GSList *calls;
 	GSList *n, *o;
 	struct ofono_call *nc, *oc;
 	unsigned int num_active = 0;
@@ -217,8 +216,6 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	if (!ok)
 		return;
 
-	calls = at_util_parse_clcc(result);
-
 	n = calls;
 	o = vd->calls;
 
@@ -295,6 +292,43 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
 							vc);
 }
 
+static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
+{
+	GSList *calls;
+
+	if (!ok)
+		return;
+
+	calls = at_util_parse_clcc(result);
+
+	handle_clcc_response(ok, calls, user_data);
+}
+
+static void clcc_poll_dialing_cb(gboolean ok, GAtResult *result,
+			gpointer user_data)
+{
+	struct ofono_voicecall *vc = user_data;
+	struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+	GSList *calls, *dialing;
+
+	if (!ok)
+		return;
+
+	calls = at_util_parse_clcc(result);
+	dialing = find_dialing(calls);
+
+	if (dialing == NULL) {
+		if (vd->clcc_source)
+			g_source_remove(vd->clcc_source);
+
+		vd->clcc_source = g_timeout_add(POLL_CLCC_DELAY,
+												poll_clcc, vc);
+		return;
+	}
+
+	handle_clcc_response(ok, calls, user_data);
+}
+
 static gboolean poll_clcc(gpointer user_data)
 {
 	struct ofono_voicecall *vc = user_data;
@@ -977,7 +1011,8 @@ static void ciev_callsetup_notify(struct ofono_voicecall *vc,
 		 * from AG: query and create call.
 		 */
 		g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
-				clcc_poll_cb, vc, NULL);
+				clcc_poll_dialing_cb, vc, NULL);
+
 		break;
 
 	case 3:
-- 
1.7.11.7


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-03-27  5:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13  8:36 [PATCHv3 1/3] hfpmodem: Retry AT+CLCC request after outgoing callsetup Timo Mueller
2013-02-13  8:36 ` [PATCHv3 2/3] hfp_hf: Add generic hfp modem vendor Timo Mueller
2013-02-13  8:36   ` [PATCHv3 3/3] hfpmodem: Add N9 quirk to run CLCC after callheld=<2 or 3> Timo Mueller
2013-03-26  9:25     ` Timo =?unknown-8bit?q?M=C3=BCller?=
2013-03-27  5:13     ` Denis Kenzior
2013-03-27  5:09   ` [PATCHv3 2/3] hfp_hf: Add generic hfp modem vendor Denis Kenzior
2013-03-27  5:05 ` [PATCHv3 1/3] hfpmodem: Retry AT+CLCC request after outgoing callsetup 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.