summaryrefslogtreecommitdiffstats
path: root/drivers/hfpmodem/voicecall.c
diff options
context:
space:
mode:
authorFrédéric Danis <frederic.danis@linux.intel.com>2011-07-25 16:42:19 +0200
committerDenis Kenzior <denkenz@gmail.com>2011-07-25 23:06:16 -0500
commit3b00f5aad75688ec2ad34e88f797da9cd85ae94b (patch)
tree23349f504781602edb757eafb593221b1f60fa3d /drivers/hfpmodem/voicecall.c
parent968efe08ba377571ca4bfc46555c17b1a611c509 (diff)
downloadofono-3b00f5aad75688ec2ad34e88f797da9cd85ae94b.tar.bz2
hfpmodem: fix callheld indicator
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.
Diffstat (limited to 'drivers/hfpmodem/voicecall.c')
-rw-r--r--drivers/hfpmodem/voicecall.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 126c1e31..3c498706 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);
}
}