Skip to contentSkip to conversation

handsfree profile plugins and driver framework

PATCH In review Zhang 2 participants 4 messages Oct 14, 2009 – Oct 17, 2009 Kbuild

lore
Share & tools
lore

Zhang

#0 lore raw

PATCH 1/1 handsfree profile plugins and driver framework

Hi,

Attached patch is the Bluetooth handsfree profile (HFP) support for oFono. It includes hfp plugin and the basic driver backend framework. The plugin use 'AT+BRSF=118' to inform AG supported features and perform serivce level connection in modem's power on stage. The voicecall driver for HFP is planed to add later. Handsfree profile actually need BlueZ support for SCO connection for routing audio which is not in this patch.

You may need to create /dev/rfcomm0 through 'rfcomm bind <port> <bdaddr> <channel>' and then specify device in modem.conf. For example,

    rfcomm bind 0 00:22:A9:8C:AF:34 2

The channel number of HFP audio gateway could be found though 'sdptool browse' result.

Regards,
Zhenhua

From ec789ba3155cd90decd252633d71535d93ae0262 Mon Sep 17 00:00:00 2001
From: Zhenhua Zhang <[email protected]>
Date: Tue, 13 Oct 2009 23:40:04 +0800
Subject: [PATCH] handsfree profile plugin and driver framework

The implementation is according to the Bluetooth HFP spec 1.5. It requires you create a HFP Audio Gateway TTY device(e.g. /dev/rfcomm0) via 'rfcomm bind <port> <bdaddr> <channel>'.

---
 Makefile.am            |    8 +
 drivers/hfpmodem/hfp.c |  347 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/hfpmodem/hfp.h |   93 +++++++++++++
 plugins/hfp.c          |  224 +++++++++++++++++++++++++++++++
 plugins/modemconf.c    |    3 +-
 5 files changed, 674 insertions(+), 1 deletions(-)
 create mode 100644 drivers/hfpmodem/hfp.c
 create mode 100644 drivers/hfpmodem/hfp.h
 create mode 100644 plugins/hfp.c
Makefile.am +8 -0
index cf84bf7..94b48dd 100644
@@ -116,6 +116,11 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/calypsomodem/calypsomodem.c \
 			drivers/calypsomodem/voicecall.c
 
+builtin_modules += hfpmodem
+builtin_sources += drivers/atmodem/atutil.h \
+			drivers/hfpmodem/hfp.h \
+			drivers/hfpmodem/hfp.c
+
 builtin_modules += modemconf
 builtin_sources += plugins/modemconf.c
 
@@ -146,6 +151,9 @@ builtin_sources += plugins/huawei.c
 
 builtin_modules += novatel
 builtin_sources += plugins/novatel.c
+
+builtin_modules += hfp
+builtin_sources += plugins/hfp.c
 endif
 
 if MAINTAINER_MODE
drivers/hfpmodem/hfp.c new file +347 -0

347 lines not on this page · raw message

drivers/hfpmodem/hfp.h new file +93 -0

93 lines not on this page · raw message

plugins/hfp.c new file +224 -0

224 lines not on this page · raw message

plugins/modemconf.c +2 -1
index 4795749..192faa6 100644
@@ -100,7 +100,8 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
 		set_address(modem, keyfile, group);
 
 	if (!g_strcmp0(driver, "atgen") || !g_strcmp0(driver, "g1") ||
-						!g_strcmp0(driver, "calypso"))
+						!g_strcmp0(driver, "calypso") ||
+						!g_strcmp0(driver, "hfp"))
 		set_device(modem, keyfile, group);
 
 	g_free(driver);
Signature · 1 line
1.6.1.3
#1 lore raw

fix handsfree profile patch

Hi Zhenhua,

This patch fix compiler warnings into your HFP patch. I didn't looked to the code and what it does yet.

Regards,

Gustavo

#2 lore raw

PATCH 1/1 fix handsfree profile to compile with --enable-maintainer-mode

this is all about compile-warnings.

---
 drivers/hfpmodem/hfp.c |    2 +-
 drivers/hfpmodem/hfp.h |    2 +-
 plugins/hfp.c          |    4 ----
 3 files changed, 2 insertions(+), 6 deletions(-)
drivers/hfpmodem/hfp.c +1 -1
index 941e7b1..69e2f64 100644
@@ -40,7 +40,6 @@
 
 #include "hfp.h"
 
-static const char *none_prefix[] = { NULL };
 static const char *brsf_prefix[] = { "+BRSF:", NULL };
 static const char *cind_prefix[] = { "+CIND:", NULL };
 static const char *cmer_prefix[] = { "+CMER:", NULL };
@@ -337,6 +336,7 @@ GAtChat *hfp_get_chat(gpointer user_data)
 
 static int hfpmodem_init(void)
 {
+    return 0;
 }
 
 static void hfpmodem_exit(void)
drivers/hfpmodem/hfp.h +1 -1
index fa5641f..5a98c3d 100644
@@ -71,7 +71,7 @@ struct gateway {
 	HfpConnectFunc conn_cb;
 	gpointer cb_data;
 
-	unsigned int ag_features;
+	int ag_features;
 	unsigned int mpty_features;
 	GSList *indies;
 };
plugins/hfp.c +0 -4
index c73a032..1a7f064 100644
@@ -187,15 +187,11 @@ static int hfp_disable(struct ofono_modem *modem)
 
 static void hfp_pre_sim(struct ofono_modem *modem)
 {
-	struct hfp_data *hfp_data = ofono_modem_get_data(modem);
-
 	DBG("%p", modem);
 }
 
 static void hfp_post_sim(struct ofono_modem *modem)
 {
-	struct hfp_data *hfp_data = ofono_modem_get_data(modem);
-
 	DBG("%p", modem);
 }
 
Signature · 1 line
1.6.4.4
#3 lore raw

RE: fix handsfree profile patch

In reply to Gustavo F. Padovan

Hi Padovan,

Quoted 5 lines · Gustavo F. Padovan

Hi Zhenhua,

This patch fix compiler warnings into your HFP patch. I didn't looked to the code and what it does yet.

Thanks for your patch. I will turn on the maintainer mode from now on.

Quoted 3 lines

Regards,

Gustavo

Regards,
Zhenhua