All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Synchronize call status in case of Hangup error
@ 2015-08-04 16:00 Kuba Pawlak
  2015-08-05  4:34 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Kuba Pawlak @ 2015-08-04 16:00 UTC (permalink / raw)
  To: ofono

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

It is possible for the phone to accept Dial request
but not actually dial. This leaves a voicecall object
in state 'dialling' that cannot be removed.
Proposed workaround is to trigger AT+CLCC when an error
is returned for Hangup. As the call is not on the list,
this would remove this hanging object and signal CallRemoved.
---
 drivers/hfpmodem/voicecall.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index e3e6e0f5eccbbd61972c4b823c8093dd227e4bb9..06ad216b91bcbe99f9632f3c129a8f61756fd585 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -318,21 +318,31 @@ static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	struct change_state_req *req = user_data;
 	struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
 	struct ofono_error error;
+	unsigned int num_calls = 0;
 
 	decode_at_error(&error, g_at_result_final_response(result));
 
-	if (ok && req->affected_types) {
+	if (req->affected_types) {
 		GSList *l;
 		struct ofono_call *call;
 
 		for (l = vd->calls; l; l = l->next) {
 			call = l->data;
 
-			if (req->affected_types & (1 << call->status))
-				vd->local_release |= (1 << call->id);
+			if (req->affected_types & (1 << call->status)) {
+				if (ok)
+					vd->local_release |= (1 << call->id);
+				else
+					num_calls++;
+			}
 		}
 	}
 
+	/* AG returned an error, but some calls are present, resync*/
+	if (num_calls)
+		g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
+					clcc_poll_cb, req->vc, NULL);
+
 	req->cb(&error, req->data);
 }
 
-- 
1.7.11.7

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Prof. Dr. Hermann Eul
Chairperson of the Supervisory Board: Tiffany Doon Silva
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928


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

* Re: [PATCH] Synchronize call status in case of Hangup error
  2015-08-04 16:00 [PATCH] Synchronize call status in case of Hangup error Kuba Pawlak
@ 2015-08-05  4:34 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2015-08-05  4:34 UTC (permalink / raw)
  To: ofono

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

Hi Kuba,

On 08/04/2015 11:00 AM, Kuba Pawlak wrote:
> It is possible for the phone to accept Dial request
> but not actually dial. This leaves a voicecall object
> in state 'dialling' that cannot be removed.
> Proposed workaround is to trigger AT+CLCC when an error
> is returned for Hangup. As the call is not on the list,
> this would remove this hanging object and signal CallRemoved.
> ---
>   drivers/hfpmodem/voicecall.c | 16 +++++++++++++---
>   1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
> index e3e6e0f5eccbbd61972c4b823c8093dd227e4bb9..06ad216b91bcbe99f9632f3c129a8f61756fd585 100644
> --- a/drivers/hfpmodem/voicecall.c
> +++ b/drivers/hfpmodem/voicecall.c
> @@ -318,21 +318,31 @@ static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
>   	struct change_state_req *req = user_data;
>   	struct voicecall_data *vd = ofono_voicecall_get_data(req->vc);
>   	struct ofono_error error;
> +	unsigned int num_calls = 0;
>
>   	decode_at_error(&error, g_at_result_final_response(result));
>
> -	if (ok && req->affected_types) {
> +	if (req->affected_types) {

Would it not be far easier to simply add an if statement at the end. 
Something like:

if (!ok && vd->calls)
	g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
				clcc_poll_cb, req->vc, NULL);

>   		GSList *l;
>   		struct ofono_call *call;
>
>   		for (l = vd->calls; l; l = l->next) {
>   			call = l->data;
>
> -			if (req->affected_types & (1 << call->status))
> -				vd->local_release |= (1 << call->id);
> +			if (req->affected_types & (1 << call->status)) {
> +				if (ok)
> +					vd->local_release |= (1 << call->id);
> +				else
> +					num_calls++;
> +			}
>   		}
>   	}
>
> +	/* AG returned an error, but some calls are present, resync*/
> +	if (num_calls)
> +		g_at_chat_send(vd->chat, "AT+CLCC", clcc_prefix,
> +					clcc_poll_cb, req->vc, NULL);
> +
>   	req->cb(&error, req->data);
>   }
>
>

Regards,
-Denis

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

end of thread, other threads:[~2015-08-05  4:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 16:00 [PATCH] Synchronize call status in case of Hangup error Kuba Pawlak
2015-08-05  4:34 ` 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.