Open Source Telephony
 help / color / mirror / Atom feed
From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis <frederic.danis@linux.intel.com>
To: ofono@ofono.org
Subject: [PATCH v2] hfpmodem: fix callheld indicator
Date: Mon, 25 Jul 2011 16:42:19 +0200	[thread overview]
Message-ID: <1311604939-10751-1-git-send-email-frederic.danis@linux.intel.com> (raw)

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

Callheld move from 1 (active and held calls) to 2 (all calls on hold) may
result of:
- active call has been dropped by remote,
- an intermediate state during a call swap which will be followed by a
  move back to 1.
So, wait a little before checking calls state.
---
 drivers/hfpmodem/voicecall.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 126c1e3..3c49870 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -42,6 +42,7 @@
 #include "slc.h"
 
 #define POLL_CLCC_INTERVAL 2000
+#define POLL_CLCC_DELAY 50
 #define CLIP_TIMEOUT 500
 
 static const char *none_prefix[] = { NULL };
@@ -1024,6 +1025,11 @@ static void ciev_callheld_notify(struct ofono_voicecall *vc,
 		break;
 
 	case 1:
+		if (vd->clcc_source) {
+			g_source_remove(vd->clcc_source);
+			vd->clcc_source = 0;
+		}
+
 		/* We have to poll here, we have no idea whether the call was
 		 * accepted by CHLD=1 or swapped by CHLD=2 or one call was
 		 * chosed for private chat by CHLD=2x
@@ -1043,7 +1049,15 @@ static void ciev_callheld_notify(struct ofono_voicecall *vc,
 				ofono_voicecall_notify(vc, call);
 			}
 		} else if (callheld == 1) {
-			release_with_status(vc, CALL_STATUS_ACTIVE);
+			if (vd->clcc_source)
+				g_source_remove(vd->clcc_source);
+
+			/* We have to schedule a poll here, we have no idea
+			 * whether active call was dropped by remote or if this
+			 * is an intermediate state during call swap
+			 */
+			vd->clcc_source = g_timeout_add(POLL_CLCC_DELAY,
+							poll_clcc, vc);
 		}
 	}
 
-- 
1.7.1


             reply	other threads:[~2011-07-25 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-25 14:42 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis [this message]
2011-07-26  4:06 ` [PATCH v2] hfpmodem: fix callheld indicator Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311604939-10751-1-git-send-email-frederic.danis@linux.intel.com \
    --to=frederic.danis@linux.intel.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox