[PATCH 2/2] Fix update hfp_hangup to release active call

2009-12-08 Thread Zhenhua Zhang
In HFP, AT+CHUP is intended to release the current active call.
---
 drivers/hfpmodem/voicecall.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 6693280..17811d6 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -393,8 +393,8 @@ static void hfp_answer(struct ofono_voicecall *vc,
 static void hfp_hangup(struct ofono_voicecall *vc,
ofono_voicecall_cb_t cb, void *data)
 {
-   /* Hangup all calls */
-   hfp_template(AT+CHUP, vc, generic_cb, 0x3f, cb, data);
+   /* Hangup current active call */
+   hfp_template(AT+CHUP, vc, generic_cb, 0x1, cb, data);
 }
 
 static void hfp_hold_all_active(struct ofono_voicecall *vc,
-- 
1.6.5.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 1/2] Fix remove all atoms in ofono_modem_set_powered

2009-12-08 Thread Zhang, Zhenhua
Hi,

Zhang, Zhenhua wrote:
 We should remove all atoms when we disable the modem. In
 function set_powered, we remove all atoms if modem is powered down by
 dbus call. ---
 src/modem.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 

Let me explain more about this fix. In atmodem world, we use dbus call to 
power on/off modem and then it calls set_powered() to remove all atoms.

However, in hfpmodem, the plugin may receive signal from BlueZ that remote
has closed the service level connection with us. So we must power off the modem
through ofono_modem_set_powered(modem, FALSE).

I also tried phonesim and don't find problem. Let me know if any questions or
issues. Thanks.

Regards,
Zhenhua

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 4/4] Fix schedule clcc poll in the ring notify

2009-12-08 Thread Zhenhua Zhang
Similar to atmodem, We need schedule CLCC poll in the ring notify in
case AG doesn't send CLIP notification to us. If CLIP comes right
after RING, we cancel the CLCC poll.
---
 drivers/hfpmodem/voicecall.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 6b73e7c..dc9359a 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -40,6 +40,7 @@
 #include hfpmodem.h
 
 #define POLL_CLCC_INTERVAL 2000
+#define CLIP_INTERVAL 200
 
 static const char *none_prefix[] = { NULL };
 static const char *clcc_prefix[] = { +CLCC:, NULL };
@@ -717,6 +718,12 @@ static void ring_notify(GAtResult *result, gpointer 
user_data)
 
if (!call)
ofono_error(Couldn't create call, call management is fubar!);
+
+   /* We don't know the number must wait for CLIP to arrive before
+* announcing the call. So we schedule the clcc call. If the CLIP
+* arrives earlier, we annouce the call there
+*/
+   vd-clcc_source = g_timeout_add(CLIP_INTERVAL, poll_clcc, vc);
 }
 
 static void clip_notify(GAtResult *result, gpointer user_data)
@@ -773,6 +780,14 @@ static void clip_notify(GAtResult *result, gpointer 
user_data)
call-clip_validity = validity;
 
ofono_voicecall_notify(vc, call);
+
+   /* We started a CLCC, but the CLIP arrived and the call number
+* is known so we cancel the GSource
+*/
+   if (vd-clcc_source) {
+   g_source_remove(vd-clcc_source);
+   vd-clcc_source = 0;
+   }
 }
 
 static void ciev_call_notify(struct ofono_voicecall *vc,
-- 
1.6.5.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 3/4] Add poll_clcc if we are in multiparty call

2009-12-08 Thread Zhenhua Zhang
If we are in multiparty call, remote AG won't update indicator
if any call in multiparty call is released by CHLD=1x. So we
have to poll it periodically.
---
 drivers/hfpmodem/voicecall.c |   37 +
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 1d2188a..6b73e7c 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -39,6 +39,8 @@
 
 #include hfpmodem.h
 
+#define POLL_CLCC_INTERVAL 2000
+
 static const char *none_prefix[] = { NULL };
 static const char *clcc_prefix[] = { +CLCC:, NULL };
 
@@ -50,6 +52,7 @@ struct voicecall_data {
unsigned char cind_pos[HFP_INDICATOR_LAST];
int cind_val[HFP_INDICATOR_LAST];
unsigned int local_release;
+   unsigned int clcc_source;
 };
 
 struct release_id_req {
@@ -66,6 +69,8 @@ struct change_state_req {
int affected_types;
 };
 
+static gboolean poll_clcc(gpointer user_data);
+
 static GSList *find_dialing(GSList *calls)
 {
GSList *c;
@@ -197,6 +202,8 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
GSList *calls;
GSList *n, *o;
struct ofono_call *nc, *oc;
+   unsigned int num_active = 0;
+   unsigned int num_held = 0;
 
dump_response(clcc_poll_cb, ok, result);
 
@@ -212,6 +219,14 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
nc = n ? n-data : NULL;
oc = o ? o-data : NULL;
 
+   if (nc) {
+   if (nc-status == CALL_STATUS_ACTIVE)
+   num_active++;
+
+   if (nc-status == CALL_STATUS_HELD)
+   num_held++;
+   }
+
if (oc  (!nc || (nc-id  oc-id))) {
enum ofono_disconnect_reason reason;
 
@@ -255,6 +270,25 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, 
gpointer user_data)
g_slist_free(vd-calls);
 
vd-calls = calls;
+
+   /* If either active/held call is more than 1, we are in mpty calls.
+* we won't get indicator update if any of them is released by CHLD=1x.
+* So we have to poll it.
+*/
+   if (num_active  1 || num_held  1)
+   vd-clcc_source = g_timeout_add(POLL_CLCC_INTERVAL, poll_clcc,
+   vc);
+}
+
+static gboolean poll_clcc(gpointer user_data)
+{
+   struct ofono_voicecall *vc = user_data;
+   struct voicecall_data *vd = ofono_voicecall_get_data(vc);
+
+   g_at_chat_send(vd-chat, AT+CLCC, clcc_prefix,
+   clcc_poll_cb, vc, NULL);
+
+   return FALSE;
 }
 
 static void generic_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -1090,6 +1124,9 @@ static void hfp_voicecall_remove(struct ofono_voicecall 
*vc)
 {
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
 
+   if (vd-clcc_source)
+   g_source_remove(vd-clcc_source);
+
g_slist_foreach(vd-calls, (GFunc) g_free, NULL);
g_slist_free(vd-calls);
 
-- 
1.6.5.2

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 1/4] Add hfp_release_specific to release specific call

2009-12-08 Thread Zhang, Zhenhua
Hi,

Zhang, Zhenhua wrote:
 Use AT+CHLD=1x to release a specific call if AG supports that. ---
 drivers/hfpmodem/voicecall.c |   51
 +-
 1 files changed, 50 insertions(+), 1 deletions(-)
 

Update the patch to initlize 'struct release_id_req *req' as NULL. 

Regards,
Zhenhua



0001-Add-hfp_release_specific-to-release-specific-call.patch
Description: 0001-Add-hfp_release_specific-to-release-specific-call.patch
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


RE: [PATCH 4/4] Fix schedule clcc poll in the ring notify

2009-12-08 Thread Zhang, Zhenhua
Hi,

Zhang, Zhenhua wrote:
 Similar to atmodem, We need schedule CLCC poll in the ring
 notify in case AG doesn't send CLIP notification to us. If
 CLIP comes right after RING, we cancel the CLCC poll. ---
 drivers/hfpmodem/voicecall.c |   15 +++
 1 files changed, 15 insertions(+), 0 deletions(-)
 

Changed to add clip_timeout to notify the call directly if CLIP
notification doesn't arrive. Please review it.

Regards,
Zhenhua



0004-Add-clip_timeout-for-notify-incoming-call.patch
Description: 0004-Add-clip_timeout-for-notify-incoming-call.patch
___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono


[PATCH 1/1] new modem desc for f3607g modem in Samos platform

2009-12-08 Thread Martin Xu
From: root r...@blutolan-desktop.localdomain

---
 plugins/udev.c |6 ++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/plugins/udev.c b/plugins/udev.c
index 243ce9b..8bb2d65 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -86,24 +86,30 @@ static void add_mbm(struct ofono_modem *modem,
if (desc == NULL)
return;
 
+   DBG(desc: %s, desc);
+
registered = ofono_modem_get_integer(modem, Registered);
if (registered != 0)
return;
 
if (g_str_has_suffix(desc, Minicard Modem) ||
+   g_str_has_suffix(desc, Mini-Card Modem) ||
g_str_has_suffix(desc, Broadband Modem) ||
g_str_has_suffix(desc, Broadband USB Modem)) {
devnode = udev_device_get_devnode(udev_device);
ofono_modem_set_string(modem, MODEM_DEVICE, devnode);
} else if (g_str_has_suffix(desc, Minicard Data Modem) ||
+   g_str_has_suffix(desc, Mini-Card Data Modem) ||
g_str_has_suffix(desc, Broadband Data Modem)) {
devnode = udev_device_get_devnode(udev_device);
ofono_modem_set_string(modem, DATA_DEVICE, devnode);
} else if (g_str_has_suffix(desc, Minicard GPS Port) ||
+   g_str_has_suffix(desc, Mini-Card GPRS Port) ||
g_str_has_suffix(desc, Broadband GPS Port)) {
devnode = udev_device_get_devnode(udev_device);
ofono_modem_set_string(modem, GPS_DEVICE, devnode);
} else if (g_str_has_suffix(desc, Minicard Network Adapter) ||
+   g_str_has_suffix(desc, Mini-Card Network Adapter) ||
g_str_has_suffix(desc, Broadband Network Adapter) ||
g_str_has_suffix(desc, Minicard NetworkAdapter)) {
devnode = udev_device_get_property_value(udev_device,
-- 
1.6.1.3

___
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono