All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking
@ 2013-02-20 22:26 Claudio Takahasi
  2013-02-20 22:26 ` [PATCH v0 2/2] hfp_hf_bluez5: Send HFP version when registering the profile Claudio Takahasi
  2013-02-21  3:40 ` [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking Denis Kenzior
  0 siblings, 2 replies; 3+ messages in thread
From: Claudio Takahasi @ 2013-02-20 22:26 UTC (permalink / raw)
  To: ofono

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

Fallback to HFP 1.5 if defer setup is not supported since it is not
possible to proceed with codec negotiation.
---
 plugins/hfp_hf_bluez5.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 5de6188..cc4e0a2 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -65,6 +65,7 @@ struct hfp {
 
 static GDBusClient *bluez = NULL;
 static guint sco_watch = 0;
+static uint16_t local_hfp_version = HFP_VERSION_1_6;
 
 static void hfp_debug(const char *str, void *user_data)
 {
@@ -502,9 +503,11 @@ static int sco_init(void)
 	}
 
 	if (setsockopt(sk, SOL_BLUETOOTH, BT_DEFER_SETUP,
-				&defer_setup, sizeof(defer_setup)) < 0)
+				&defer_setup, sizeof(defer_setup)) < 0) {
 		ofono_warn("Can't enable deferred setup: %s (%d)",
 						strerror(errno), errno);
+		local_hfp_version = HFP_VERSION_1_5;
+	}
 
 	if (listen(sk, 5) < 0) {
 		close(sk);
-- 
1.7.11.7


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

* [PATCH v0 2/2] hfp_hf_bluez5: Send HFP version when registering the profile
  2013-02-20 22:26 [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking Claudio Takahasi
@ 2013-02-20 22:26 ` Claudio Takahasi
  2013-02-21  3:40 ` [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Claudio Takahasi @ 2013-02-20 22:26 UTC (permalink / raw)
  To: ofono

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

This patch adds the supported HFP version in the RegisterProfile method
arguments since the default in BlueZ is 1.5. The version is required
to create the service record containing the correct profile version.
---
 plugins/bluez5.c        | 4 +++-
 plugins/bluez5.h        | 3 ++-
 plugins/hfp_ag_bluez5.c | 8 ++++++--
 plugins/hfp_hf_bluez5.c | 2 +-
 4 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/plugins/bluez5.c b/plugins/bluez5.c
index f2cd4bb..9233a2b 100644
--- a/plugins/bluez5.c
+++ b/plugins/bluez5.c
@@ -108,7 +108,8 @@ done:
 }
 
 int bt_register_profile(DBusConnection *conn, const char *uuid,
-					const char *name, const char *object)
+					uint16_t version, const char *name,
+					const char *object)
 {
 	DBusMessageIter iter, dict;
 	DBusPendingCall *c;
@@ -125,6 +126,7 @@ int bt_register_profile(DBusConnection *conn, const char *uuid,
 
 	dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &dict);
 	ofono_dbus_dict_append(&dict, "Name", DBUS_TYPE_STRING, &name);
+	ofono_dbus_dict_append(&dict, "Version", DBUS_TYPE_UINT16, &version);
 
 	dbus_message_iter_close_container(&iter, &dict);
 
diff --git a/plugins/bluez5.h b/plugins/bluez5.h
index 3155901..1432068 100644
--- a/plugins/bluez5.h
+++ b/plugins/bluez5.h
@@ -70,7 +70,8 @@ int bt_ba2str(const bdaddr_t *ba, char *str);
 int bt_bacmp(const bdaddr_t *ba1, const bdaddr_t *ba2);
 
 int bt_register_profile(DBusConnection *conn, const char *uuid,
-					const char *name, const char *object);
+					uint16_t version, const char *name,
+					const char *object);
 
 void bt_unregister_profile(DBusConnection *conn, const char *object);
 
diff --git a/plugins/hfp_ag_bluez5.c b/plugins/hfp_ag_bluez5.c
index 03a46fb..a81adfd 100644
--- a/plugins/hfp_ag_bluez5.c
+++ b/plugins/hfp_ag_bluez5.c
@@ -30,11 +30,15 @@
 #include <glib.h>
 #include <ofono.h>
 
+#include <gdbus.h>
+#include <gatchat.h>
+
 #define OFONO_API_SUBJECT_TO_CHANGE
 #include <ofono/plugin.h>
 #include <ofono/log.h>
 #include <ofono/modem.h>
-#include <gdbus.h>
+
+#include <drivers/hfpmodem/slc.h>
 
 #include "bluez5.h"
 
@@ -176,7 +180,7 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *data)
 	if (modems->next != NULL)
 		return;
 
-	bt_register_profile(conn, HFP_AG_UUID, "hfp_ag",
+	bt_register_profile(conn, HFP_AG_UUID, HFP_VERSION_1_5, "hfp_ag",
 						HFP_AG_EXT_PROFILE_PATH);
 }
 
diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index cc4e0a2..7057d71 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -528,7 +528,7 @@ static void connect_handler(DBusConnection *conn, void *user_data)
 {
 	DBG("Registering External Profile handler ...");
 
-	bt_register_profile(conn, HFP_HS_UUID, "hfp_hf",
+	bt_register_profile(conn, HFP_HS_UUID, local_hfp_version, "hfp_hf",
 						HFP_EXT_PROFILE_PATH);
 }
 
-- 
1.7.11.7


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

* Re: [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking
  2013-02-20 22:26 [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking Claudio Takahasi
  2013-02-20 22:26 ` [PATCH v0 2/2] hfp_hf_bluez5: Send HFP version when registering the profile Claudio Takahasi
@ 2013-02-21  3:40 ` Denis Kenzior
  1 sibling, 0 replies; 3+ messages in thread
From: Denis Kenzior @ 2013-02-21  3:40 UTC (permalink / raw)
  To: ofono

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

Hi Claudio,

On 02/20/2013 04:26 PM, Claudio Takahasi wrote:
> Fallback to HFP 1.5 if defer setup is not supported since it is not
> possible to proceed with codec negotiation.
> ---
>   plugins/hfp_hf_bluez5.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
>

Both patches have been applied, however I broke the second one into three.

Regards,
-Denis


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

end of thread, other threads:[~2013-02-21  3:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-20 22:26 [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking Claudio Takahasi
2013-02-20 22:26 ` [PATCH v0 2/2] hfp_hf_bluez5: Send HFP version when registering the profile Claudio Takahasi
2013-02-21  3:40 ` [PATCH v0 1/2] hfp_hf_bluez5: Add local HFP version tracking 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.