All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver
@ 2011-08-05  7:19 Dmitriy Paliy
  2011-08-05  7:19 ` [PATCH 2/2] Fix cancel pending D-Bus call to ohmd Dmitriy Paliy
  2011-08-05  9:42 ` [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Johan Hedberg
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitriy Paliy @ 2011-08-05  7:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Dmitriy Paliy

If ringtone is loud enough, it may leak to microphone when call is
answered via Bluetooth headset. As result, it can be heard on remote
end. Therefore, playing ringtone shall be stopped as fast as possible
before answering a call.
---
 audio/telephony-maemo6.c |   34 +++++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 4430cc1..94feda2 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -113,6 +113,11 @@ enum net_registration_status {
 #define CSD_SIMPB_TYPE_EN			"EN"
 #define CSD_SIMPB_TYPE_MSISDN			"MSISDN"
 
+/* OHM plugin D-Bus definitions */
+#define OHM_BUS_NAME		"com.nokia.NonGraphicFeedback1"
+#define OHM_INTERFACE		"com.nokia.NonGraphicFeedback1"
+#define OHM_PATH		"/com/nokia/NonGraphicFeedback1"
+
 struct csd_call {
 	char *object_path;
 	int status;
@@ -143,6 +148,11 @@ struct pending_req {
 };
 
 static int get_property(const char *iface, const char *prop);
+static int send_method_call(const char *dest, const char *path,
+				const char *interface, const char *method,
+				DBusPendingCallNotifyFunction cb,
+				void *user_data, int type, ...);
+static void remove_pending(DBusPendingCall *call);
 
 static DBusConnection *connection = NULL;
 
@@ -320,6 +330,28 @@ static int answer_call(struct csd_call *call)
 	return 0;
 }
 
+static void stop_ringtone_reply(DBusPendingCall *call, void *user_data)
+{
+	struct csd_call *coming = user_data;
+
+	remove_pending(call);
+	answer_call(coming);
+}
+
+static int stop_ringtone_and_answer(struct csd_call *call)
+{
+	int ret;
+
+	ret = send_method_call(OHM_BUS_NAME, OHM_PATH,
+				OHM_INTERFACE, "StopRingtone",
+				stop_ringtone_reply, call,
+				DBUS_TYPE_INVALID);
+	if (ret < 0)
+		return answer_call(call);
+
+	return 0;
+}
+
 static int split_call(struct csd_call *call)
 {
 	DBusMessage *msg;
@@ -545,7 +577,7 @@ void telephony_answer_call_req(void *telephony_device)
 		return;
 	}
 
-	if (answer_call(call) < 0)
+	if (stop_ringtone_and_answer(call) < 0)
 		telephony_answer_call_rsp(telephony_device,
 						CME_ERROR_AG_FAILURE);
 	else
-- 
1.7.4.1


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

* [PATCH 2/2] Fix cancel pending D-Bus call to ohmd
  2011-08-05  7:19 [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Dmitriy Paliy
@ 2011-08-05  7:19 ` Dmitriy Paliy
  2011-08-05  9:42 ` [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Johan Hedberg
  1 sibling, 0 replies; 4+ messages in thread
From: Dmitriy Paliy @ 2011-08-05  7:19 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Dmitriy Paliy

Pending D-Bus call to ohmd daemon is canceled if telephony driver is
unloaded before reply comes.
---
 audio/telephony-maemo6.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
index 94feda2..86a045f 100644
--- a/audio/telephony-maemo6.c
+++ b/audio/telephony-maemo6.c
@@ -1533,6 +1533,8 @@ static void csd_call_free(void *data)
 	g_free(call->object_path);
 	g_free(call->number);
 
+	g_slist_foreach(pending, remove_pending_by_data, call);
+
 	g_free(call);
 }
 
-- 
1.7.4.1


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

* Re: [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver
  2011-08-05  7:19 [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Dmitriy Paliy
  2011-08-05  7:19 ` [PATCH 2/2] Fix cancel pending D-Bus call to ohmd Dmitriy Paliy
@ 2011-08-05  9:42 ` Johan Hedberg
  2011-08-05  9:54   ` Dmitriy Paliy
  1 sibling, 1 reply; 4+ messages in thread
From: Johan Hedberg @ 2011-08-05  9:42 UTC (permalink / raw)
  To: Dmitriy Paliy; +Cc: linux-bluetooth

Hi Dmitriy,

On Fri, Aug 05, 2011, Dmitriy Paliy wrote:
> If ringtone is loud enough, it may leak to microphone when call is
> answered via Bluetooth headset. As result, it can be heard on remote
> end. Therefore, playing ringtone shall be stopped as fast as possible
> before answering a call.
> ---
>  audio/telephony-maemo6.c |   34 +++++++++++++++++++++++++++++++++-
>  1 files changed, 33 insertions(+), 1 deletions(-)

Both patches have been applied. Thanks. I also pushed a patch which
moves around the static functions so that forward-declarations of them
are not needed.

Johan

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

* Re: [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver
  2011-08-05  9:42 ` [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Johan Hedberg
@ 2011-08-05  9:54   ` Dmitriy Paliy
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitriy Paliy @ 2011-08-05  9:54 UTC (permalink / raw)
  To: linux-bluetooth, johan.hedberg

Hi Johan,

On Fri, Aug 5, 2011 at 12:42 PM, Johan Hedberg <johan.hedberg@gmail.com> wrote:
> Hi Dmitriy,
>
> On Fri, Aug 05, 2011, Dmitriy Paliy wrote:
>> If ringtone is loud enough, it may leak to microphone when call is
>> answered via Bluetooth headset. As result, it can be heard on remote
>> end. Therefore, playing ringtone shall be stopped as fast as possible
>> before answering a call.
>> ---
>>  audio/telephony-maemo6.c |   34 +++++++++++++++++++++++++++++++++-
>>  1 files changed, 33 insertions(+), 1 deletions(-)
>
> Both patches have been applied. Thanks. I also pushed a patch which
> moves around the static functions so that forward-declarations of them
> are not needed.

Thanks. Actually I have added forward declaration on purpose in order
not to move functions anymore.

Dmitriy

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

end of thread, other threads:[~2011-08-05  9:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-05  7:19 [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Dmitriy Paliy
2011-08-05  7:19 ` [PATCH 2/2] Fix cancel pending D-Bus call to ohmd Dmitriy Paliy
2011-08-05  9:42 ` [PATCH 1/2] Add stop playing ringtone to maemo6 telephony driver Johan Hedberg
2011-08-05  9:54   ` Dmitriy Paliy

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.