All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers.
@ 2010-08-09 21:18 Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-09 21:18 ` [PATCH resend 2/3] voicecall: Add support for function hangup_all Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-11 23:03 ` [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers Denis Kenzior
  0 siblings, 2 replies; 4+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-09 21:18 UTC (permalink / raw)
  To: ofono

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

From: Sjur Brændeland <sjur.brandeland@stericsson.com>

---
 drivers/atmodem/voicecall.c      |    4 ++--
 drivers/calypsomodem/voicecall.c |    2 +-
 drivers/hfpmodem/voicecall.c     |    2 +-
 drivers/isimodem/voicecall.c     |    2 +-
 drivers/stemodem/voicecall.c     |    2 +-
 include/voicecall.h              |    2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index fce9144..2578779 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -409,7 +409,7 @@ static void at_answer(struct ofono_voicecall *vc,
 static void at_hangup(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data)
 {
-	/* Hangup all calls */
+	/* Hangup active call */
 	at_template("AT+CHUP", vc, generic_cb, 0x3f, cb, data);
 }
 
@@ -874,7 +874,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= at_voicecall_remove,
 	.dial			= at_dial,
 	.answer			= at_answer,
-	.hangup			= at_hangup,
+	.hangup_active		= at_hangup,
 	.hold_all_active	= at_hold_all_active,
 	.release_all_held	= at_release_all_held,
 	.set_udub		= at_set_udub,
diff --git a/drivers/calypsomodem/voicecall.c b/drivers/calypsomodem/voicecall.c
index 511d533..56ec5a9 100644
--- a/drivers/calypsomodem/voicecall.c
+++ b/drivers/calypsomodem/voicecall.c
@@ -407,7 +407,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= calypso_voicecall_remove,
 	.dial			= calypso_dial,
 	.answer			= calypso_answer,
-	.hangup			= calypso_hangup,
+	.hangup_active		= calypso_hangup,
 	.hold_all_active	= calypso_hold_all_active,
 	.release_all_held	= calypso_release_all_held,
 	.set_udub		= calypso_set_udub,
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index f83f26a..69923cc 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -1166,7 +1166,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= hfp_voicecall_remove,
 	.dial			= hfp_dial,
 	.answer			= hfp_answer,
-	.hangup			= hfp_hangup,
+	.hangup_active		= hfp_hangup,
 	.hold_all_active	= hfp_hold_all_active,
 	.release_all_held	= hfp_release_all_held,
 	.set_udub		= hfp_set_udub,
diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 3e28dae..4b720be 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -1318,7 +1318,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= isi_voicecall_remove,
 	.dial			= isi_dial,
 	.answer			= isi_answer,
-	.hangup			= isi_hangup,
+	.hangup_active		= isi_hangup,
 	.hold_all_active	= isi_hold_all_active,
 	.release_all_held	= isi_release_all_held,
 	.set_udub		= isi_set_udub,
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index a56709a..daadf54 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -569,7 +569,7 @@ static struct ofono_voicecall_driver driver = {
 	.remove			= ste_voicecall_remove,
 	.dial			= ste_dial,
 	.answer			= ste_answer,
-	.hangup			= ste_hangup,
+	.hangup_active		= ste_hangup,
 	.hold_all_active	= ste_hold_all_active,
 	.release_all_held	= ste_release_all_held,
 	.set_udub		= ste_set_udub,
diff --git a/include/voicecall.h b/include/voicecall.h
index 6ceb3d8..998c02d 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -67,7 +67,7 @@ struct ofono_voicecall_driver {
 			ofono_voicecall_cb_t cb, void *data);
 	void (*answer)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
-	void (*hangup)(struct ofono_voicecall *vc,
+	void (*hangup_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
 	void (*hold_all_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
-- 
1.6.3.3


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

* [PATCH resend 2/3] voicecall: Add support for function hangup_all
  2010-08-09 21:18 [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-09 21:18 ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-09 21:18   ` [PATCH resend 3/3] voicecall: manager_hangup_all should not terminate waiting calls Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-11 23:03 ` [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers Denis Kenzior
  1 sibling, 1 reply; 4+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-09 21:18 UTC (permalink / raw)
  To: ofono

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

From: Sjur Brændeland <sjur.brandeland@stericsson.com>

This patch fixes problem for modems that cannot terminate DIALING/ALERTING
calls with CHUP=1X. The main change is that voicecall-callback function
hangup is split into the functions hangup_all and hangup_active.

Changes:
o In cases where hangup previously was used, hangup_all is used if implemented
  otherwise hangup_active is used.
o Call in state DIALING/ALERTING is released with hangup_active if implemented.
o manager_hangup_all will simply call hangup_all if implemented.
o manager_hangup_all will release calls in state ALERTING/DIALING/INCOMING
  using hangup_active otherwise release_specific.
---
 include/voicecall.h |    2 +
 src/voicecall.c     |   56 +++++++++++++++++++++++++++++++++++++++-----------
 2 files changed, 45 insertions(+), 13 deletions(-)

diff --git a/include/voicecall.h b/include/voicecall.h
index 998c02d..2356fcf 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -69,6 +69,8 @@ struct ofono_voicecall_driver {
 			ofono_voicecall_cb_t cb, void *data);
 	void (*hangup_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
+	void (*hangup_all)(struct ofono_voicecall *vc,
+			ofono_voicecall_cb_t cb, void *data);
 	void (*hold_all_active)(struct ofono_voicecall *vc,
 			ofono_voicecall_cb_t cb, void *data);
 	void (*release_all_held)(struct ofono_voicecall *vc,
diff --git a/src/voicecall.c b/src/voicecall.c
index a30aaa5..49b9c79 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -261,15 +261,18 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
 	if (vc->pending)
 		return __ofono_error_busy(msg);
 
-	/* According to various specs, other than 27.007, +CHUP is used
-	 * to reject an incoming call
-	 */
 	if (call->status == CALL_STATUS_INCOMING) {
-		if (vc->driver->hangup == NULL)
+
+		if (vc->driver->hangup_all == NULL &&
+				vc->driver->hangup_active == NULL)
 			return __ofono_error_not_implemented(msg);
 
 		vc->pending = dbus_message_ref(msg);
-		vc->driver->hangup(vc, generic_callback, vc);
+
+		if (vc->driver->hangup_all)
+			vc->driver->hangup_all(vc, generic_callback, vc);
+		else
+			vc->driver->hangup_active(vc, generic_callback, vc);
 
 		return NULL;
 	}
@@ -286,12 +289,18 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
 
 	num_calls = g_slist_length(vc->call_list);
 
-	if (num_calls == 1 && vc->driver->hangup &&
+	if (num_calls == 1 &&
 			(call->status == CALL_STATUS_ACTIVE ||
 				call->status == CALL_STATUS_DIALING ||
-				call->status == CALL_STATUS_ALERTING)) {
+				call->status == CALL_STATUS_ALERTING) &&
+				(vc->driver->hangup_all != NULL ||
+					vc->driver->hangup_active != NULL)) {
 		vc->pending = dbus_message_ref(msg);
-		vc->driver->hangup(vc, generic_callback, vc);
+
+		if (vc->driver->hangup_all)
+			vc->driver->hangup_all(vc, generic_callback, vc);
+		else
+			vc->driver->hangup_active(vc, generic_callback, vc);
 
 		return NULL;
 	}
@@ -304,6 +313,15 @@ static DBusMessage *voicecall_hangup(DBusConnection *conn,
 		return NULL;
 	}
 
+	if (vc->driver->hangup_active != NULL &&
+		(call->status == CALL_STATUS_ALERTING ||
+			call->status == CALL_STATUS_DIALING)) {
+		vc->pending = dbus_message_ref(msg);
+		vc->driver->hangup_active(vc, generic_callback, vc);
+
+		return NULL;
+	}
+
 	if (vc->driver->release_specific == NULL)
 		return __ofono_error_not_implemented(msg);
 
@@ -762,7 +780,14 @@ static void voicecalls_release_next(struct ofono_voicecall *vc)
 
 	vc->release_list = g_slist_remove(vc->release_list, call);
 
-	vc->driver->release_specific(vc, call->call->id,
+	if (vc->driver->hangup_active != NULL &&
+			(call->call->status == CALL_STATUS_ALERTING ||
+				call->call->status == CALL_STATUS_DIALING ||
+				call->call->status == CALL_STATUS_INCOMING))
+
+		vc->driver->hangup_active(vc, multirelease_callback, vc);
+	else
+		vc->driver->release_specific(vc, call->call->id,
 						multirelease_callback, vc);
 }
 
@@ -1119,7 +1144,9 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,
 	if (vc->pending)
 		return __ofono_error_busy(msg);
 
-	if (!vc->driver->release_specific)
+	if (vc->driver->hangup_all == NULL &&
+		(vc->driver->release_specific == NULL ||
+			vc->driver->hangup_active == NULL))
 		return __ofono_error_not_implemented(msg);
 
 	if (vc->call_list == NULL) {
@@ -1131,9 +1158,12 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
-	voicecalls_release_queue(vc, vc->call_list);
-	voicecalls_release_next(vc);
-
+	if (vc->driver->hangup_all != NULL)
+		vc->driver->hangup_all(vc, generic_callback, vc);
+	else {
+		voicecalls_release_queue(vc, vc->call_list);
+		voicecalls_release_next(vc);
+	}
 	return NULL;
 }
 
-- 
1.6.3.3


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

* [PATCH resend 3/3] voicecall: manager_hangup_all should not terminate waiting calls.
  2010-08-09 21:18 ` [PATCH resend 2/3] voicecall: Add support for function hangup_all Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-09 21:18   ` Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  0 siblings, 0 replies; 4+ messages in thread
From: Sjur =?unknown-8bit?q?Br=C3=A6ndeland?= @ 2010-08-09 21:18 UTC (permalink / raw)
  To: ofono

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

From: Sjur Brændeland <sjur.brandeland@stericsson.com>

---
 src/voicecall.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 49b9c79..4341d29 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -758,15 +758,21 @@ static void emit_multiparty_call_list_changed(struct ofono_voicecall *vc)
 				real_emit_multiparty_call_list_changed, vc);
 }
 
-static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls)
+static void voicecalls_release_queue(struct ofono_voicecall *vc, GSList *calls,
+					gboolean skip_waiting)
 {
 	GSList *l;
+	struct ofono_call *call;
 
 	g_slist_free(vc->release_list);
 	vc->release_list = NULL;
 
-	for (l = calls; l; l = l->next)
-		vc->release_list = g_slist_prepend(vc->release_list, l->data);
+	for (l = calls; l; l = l->next) {
+		call = l->data;
+		if (!skip_waiting || call->status != CALL_STATUS_WAITING)
+			vc->release_list =
+				g_slist_prepend(vc->release_list,call);
+	 }
 }
 
 static void voicecalls_release_next(struct ofono_voicecall *vc)
@@ -1161,7 +1167,7 @@ static DBusMessage *manager_hangup_all(DBusConnection *conn,
 	if (vc->driver->hangup_all != NULL)
 		vc->driver->hangup_all(vc, generic_callback, vc);
 	else {
-		voicecalls_release_queue(vc, vc->call_list);
+		voicecalls_release_queue(vc, vc->call_list, TRUE);
 		voicecalls_release_next(vc);
 	}
 	return NULL;
@@ -1400,7 +1406,7 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
 
 	/* Fall back to the old-fashioned way */
 	vc->flags |= VOICECALLS_FLAG_MULTI_RELEASE;
-	voicecalls_release_queue(vc, vc->multiparty_list);
+	voicecalls_release_queue(vc, vc->multiparty_list,FALSE);
 	voicecalls_release_next(vc);
 
 out:
-- 
1.6.3.3


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

* Re: [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers.
  2010-08-09 21:18 [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
  2010-08-09 21:18 ` [PATCH resend 2/3] voicecall: Add support for function hangup_all Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
@ 2010-08-11 23:03 ` Denis Kenzior
  1 sibling, 0 replies; 4+ messages in thread
From: Denis Kenzior @ 2010-08-11 23:03 UTC (permalink / raw)
  To: ofono

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

Hi Sjur,

On 08/09/2010 04:18 PM, Sjur Brændeland wrote:
> From: Sjur Brændeland <sjur.brandeland@stericsson.com>
> 
> ---
>  drivers/atmodem/voicecall.c      |    4 ++--
>  drivers/calypsomodem/voicecall.c |    2 +-
>  drivers/hfpmodem/voicecall.c     |    2 +-
>  drivers/isimodem/voicecall.c     |    2 +-
>  drivers/stemodem/voicecall.c     |    2 +-
>  include/voicecall.h              |    2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)

I applied patch 1 and 2.  For patch 3 I changed my mind and fixed it
slightly differently (e.g. just always skipping WAITING calls).

Regards,
-Denis

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

end of thread, other threads:[~2010-08-11 23:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-09 21:18 [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-09 21:18 ` [PATCH resend 2/3] voicecall: Add support for function hangup_all Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-09 21:18   ` [PATCH resend 3/3] voicecall: manager_hangup_all should not terminate waiting calls Sjur =?unknown-8bit?q?Br=C3=A6ndeland?=
2010-08-11 23:03 ` [PATCH resend 1/3] voicecall: Rename cb-function hangup to hangup_active in core and drivers 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.