All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 00/15] Bluetooth HFP-specific extensions
@ 2011-10-20 16:38 Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes Mikel Astiz
                   ` (14 more replies)
  0 siblings, 15 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

This patch series mainly includes the modified patches from the previous proposal. Additionally, some fixes are proposed to avoid potential crashes during hfpmodem powering.

More significantly, hfpmodem now exposes the BT address through the Serial property in org.ofono.Modem. This is achieved by a simple devinfo driver ATOM.

Mikel Astiz (15):
  hfpmodem: Support for +BSIR unsol. result codes
  doc: Voice recognition function added in Handsfree
  include: Voice recognition in handsfree public api
  handsfree: Implement voice recognition function
  hfpmodem: Support for AT+BVRA
  doc: Handsfree exposes supported AG features
  include: AG features added to handsfree public api
  handsfree: Supported AG features exposed in D-Bus
  hfpmodem: Report features supported by AG
  hfpmodem: Avoid segfault in network-registration
  hfpmodem: Avoid segfault in call-volume
  hfpmodem: Avoid segfault in handsfree
  hfpmodem: devinfo atom added to export BT address
  hfp_hf: BT address exposed through Serial property
  hfpmodem: minor whitespace fix

 Makefile.am                             |    1 +
 doc/handsfree-api.txt                   |   16 ++++-
 drivers/hfpmodem/call-volume.c          |    9 ++-
 drivers/hfpmodem/devinfo.c              |  133 +++++++++++++++++++++++++++++++
 drivers/hfpmodem/handsfree.c            |   81 ++++++++++++++++++-
 drivers/hfpmodem/hfpmodem.c             |    2 +
 drivers/hfpmodem/hfpmodem.h             |    7 ++
 drivers/hfpmodem/network-registration.c |    9 ++-
 include/handsfree.h                     |    9 ++
 plugins/hfp_hf.c                        |    7 ++
 src/handsfree.c                         |  130 ++++++++++++++++++++++++++++++
 11 files changed, 399 insertions(+), 5 deletions(-)
 create mode 100644 drivers/hfpmodem/devinfo.c

-- 
1.7.6.4


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

* [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 17:58   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 02/15] doc: Voice recognition function added in Handsfree Mikel Astiz
                   ` (13 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 drivers/hfpmodem/handsfree.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c
index 05bf2c8..54a5fba 100644
--- a/drivers/hfpmodem/handsfree.c
+++ b/drivers/hfpmodem/handsfree.c
@@ -49,11 +49,30 @@ struct hf_data {
 	unsigned int ag_features;
 };
 
+static void bsir_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_handsfree *hf = user_data;
+	GAtResultIter iter;
+	int value;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+BSIR:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &value))
+		return;
+
+	ofono_handsfree_set_inband_ringing(hf, (ofono_bool_t) value);
+}
+
 static gboolean hfp_handsfree_register(gpointer user_data)
 {
 	struct ofono_handsfree *hf = user_data;
 	struct hf_data *hd = ofono_handsfree_get_data(hf);
 
+	g_at_chat_register(hd->chat, "+BSIR:", bsir_notify, FALSE, hf, NULL);
+
 	if (hd->ag_features & HFP_AG_FEATURE_IN_BAND_RING_TONE)
 		ofono_handsfree_set_inband_ringing(hf, TRUE);
 
-- 
1.7.6.4


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

* [PATCH v3 02/15] doc: Voice recognition function added in Handsfree
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:33   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 03/15] include: Voice recognition in handsfree public api Mikel Astiz
                   ` (12 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 doc/handsfree-api.txt |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/doc/handsfree-api.txt b/doc/handsfree-api.txt
index 023233c..9355946 100644
--- a/doc/handsfree-api.txt
+++ b/doc/handsfree-api.txt
@@ -41,3 +41,10 @@ Signals		PropertyChanged(string property, variant value)
 Properties	boolean InbandRinging [readonly]
 
 			Boolean representing whether inband ringing is enabled.
+
+		boolean VoiceRecognition [readwrite]
+
+			Boolean representing whether voice recognition is
+			currently active in the AG. This property may be written
+			to activate or deactivate the function from the HF, or
+			the AG could autonomously initiate it.
-- 
1.7.6.4


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

* [PATCH v3 03/15] include: Voice recognition in handsfree public api
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 02/15] doc: Voice recognition function added in Handsfree Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:27   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 04/15] handsfree: Implement voice recognition function Mikel Astiz
                   ` (11 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 include/handsfree.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/include/handsfree.h b/include/handsfree.h
index a4aa177..4ffd673 100644
--- a/include/handsfree.h
+++ b/include/handsfree.h
@@ -31,6 +31,8 @@ extern "C" {
 
 struct ofono_handsfree;
 
+typedef void (*ofono_handsfree_cb_t)(const struct ofono_error *error,
+					void *data);
 typedef void (*ofono_handsfree_phone_cb_t)(const struct ofono_error *error,
 					const struct ofono_phone_number *number,
 					void *data);
@@ -43,10 +45,15 @@ struct ofono_handsfree_driver {
 	void (*request_phone_number) (struct ofono_handsfree *hf,
 					ofono_handsfree_phone_cb_t cb,
 					void *data);
+	void (*voice_recognition)(struct ofono_handsfree *cv,
+					ofono_bool_t enabled,
+					ofono_handsfree_cb_t cb, void *data);
 };
 
 void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
 						ofono_bool_t enabled);
+void ofono_handsfree_set_voice_recognition(struct ofono_handsfree *hf,
+						ofono_bool_t enabled);
 
 int ofono_handsfree_driver_register(const struct ofono_handsfree_driver *d);
 void ofono_handsfree_driver_unregister(
-- 
1.7.6.4


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

* [PATCH v3 04/15] handsfree: Implement voice recognition function
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (2 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 03/15] include: Voice recognition in handsfree public api Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:32   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 05/15] hfpmodem: Support for AT+BVRA Mikel Astiz
                   ` (10 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 src/handsfree.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)

diff --git a/src/handsfree.c b/src/handsfree.c
index efebcc0..7f3882f 100644
--- a/src/handsfree.c
+++ b/src/handsfree.c
@@ -45,6 +45,9 @@ static GSList *g_drivers = NULL;
 
 struct ofono_handsfree {
 	ofono_bool_t inband_ringing;
+	ofono_bool_t voicerec_state;
+	ofono_bool_t pending_voicerec_state;
+
 	const struct ofono_handsfree_driver *driver;
 	void *driver_data;
 	struct ofono_atom *atom;
@@ -72,6 +75,24 @@ void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
 					&dbus_enabled);
 }
 
+void ofono_handsfree_set_voice_recognition(struct ofono_handsfree *hf,
+						ofono_bool_t enabled)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+	const char *path = __ofono_atom_get_path(hf->atom);
+	dbus_bool_t dbus_enabled = enabled;
+
+	if (hf->voicerec_state == enabled)
+		return;
+
+	hf->voicerec_state = enabled;
+
+	ofono_dbus_signal_property_changed(conn, path,
+					OFONO_HANDSFREE_INTERFACE,
+					"VoiceRecognition", DBUS_TYPE_BOOLEAN,
+					&dbus_enabled);
+}
+
 static DBusMessage *handsfree_get_properties(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
@@ -80,6 +101,7 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
 	DBusMessageIter iter;
 	DBusMessageIter dict;
 	dbus_bool_t inband_ringing;
+	dbus_bool_t voicerec_state;
 
 	reply = dbus_message_new_method_return(msg);
 	if (reply == NULL)
@@ -95,17 +117,49 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
 	ofono_dbus_dict_append(&dict, "InbandRinging", DBUS_TYPE_BOOLEAN,
 				&inband_ringing);
 
+	voicerec_state = hf->voicerec_state;
+	ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
+				&voicerec_state);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
 }
 
+static void voicerec_set_cb(const struct ofono_error *error, void *data)
+{
+	struct ofono_handsfree *hf = data;
+	DBusConnection *conn = ofono_dbus_get_connection();
+	const char *path = __ofono_atom_get_path(hf->atom);
+
+	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
+		__ofono_dbus_pending_reply(&hf->pending,
+					__ofono_error_failed(hf->pending));
+		return;
+	}
+
+	hf->voicerec_state = hf->pending_voicerec_state;
+
+	__ofono_dbus_pending_reply(&hf->pending,
+				dbus_message_new_method_return(hf->pending));
+
+	ofono_dbus_signal_property_changed(conn, path,
+					OFONO_HANDSFREE_INTERFACE,
+					"VoiceRecognition",
+					DBUS_TYPE_BOOLEAN,
+					&hf->voicerec_state);
+}
+
 static DBusMessage *handsfree_set_property(DBusConnection *conn,
 						DBusMessage *msg, void *data)
 {
+	struct ofono_handsfree *hf = data;
 	DBusMessageIter iter, var;
 	const char *name;
 
+	if (hf->pending)
+		return __ofono_error_busy(msg);
+
 	if (dbus_message_iter_init(msg, &iter) == FALSE)
 		return __ofono_error_invalid_args(msg);
 
@@ -120,6 +174,24 @@ static DBusMessage *handsfree_set_property(DBusConnection *conn,
 
 	dbus_message_iter_recurse(&iter, &var);
 
+	if (g_str_equal(name, "VoiceRecognition") == TRUE) {
+		ofono_bool_t enabled;
+
+		if (!hf->driver->voice_recognition)
+			return __ofono_error_not_implemented(msg);
+
+		if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
+			return __ofono_error_invalid_args(msg);
+
+		dbus_message_iter_get_basic(&var, &enabled);
+
+		hf->pending_voicerec_state = enabled;
+		hf->pending = dbus_message_ref(msg);
+		hf->driver->voice_recognition(hf, enabled, voicerec_set_cb, hf);
+
+		return NULL;
+	}
+
 	return __ofono_error_invalid_args(msg);
 }
 
-- 
1.7.6.4


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

* [PATCH v3 05/15] hfpmodem: Support for AT+BVRA
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (3 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 04/15] handsfree: Implement voice recognition function Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 06/15] doc: Handsfree exposes supported AG features Mikel Astiz
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 drivers/hfpmodem/handsfree.c |   53 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 53 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c
index 54a5fba..2daff94 100644
--- a/drivers/hfpmodem/handsfree.c
+++ b/drivers/hfpmodem/handsfree.c
@@ -43,12 +43,25 @@
 #include "slc.h"
 
 static const char *binp_prefix[] = { "+BINP:", NULL };
+static const char *bvra_prefix[] = { "+BVRA:", NULL };
 
 struct hf_data {
 	GAtChat *chat;
 	unsigned int ag_features;
 };
 
+static void hf_generic_set_cb(gboolean ok, GAtResult *result,
+				gpointer user_data)
+{
+	struct cb_data *cbd = user_data;
+	ofono_handsfree_cb_t cb = cbd->cb;
+	struct ofono_error error;
+
+	decode_at_error(&error, g_at_result_final_response(result));
+
+	cb(&error, cbd->data);
+}
+
 static void bsir_notify(GAtResult *result, gpointer user_data)
 {
 	struct ofono_handsfree *hf = user_data;
@@ -66,12 +79,30 @@ static void bsir_notify(GAtResult *result, gpointer user_data)
 	ofono_handsfree_set_inband_ringing(hf, (ofono_bool_t) value);
 }
 
+static void bvra_notify(GAtResult *result, gpointer user_data)
+{
+	struct ofono_handsfree *hf = user_data;
+	GAtResultIter iter;
+	int value;
+
+	g_at_result_iter_init(&iter, result);
+
+	if (!g_at_result_iter_next(&iter, "+BVRA:"))
+		return;
+
+	if (!g_at_result_iter_next_number(&iter, &value))
+		return;
+
+	ofono_handsfree_set_voice_recognition(hf, (ofono_bool_t) value);
+}
+
 static gboolean hfp_handsfree_register(gpointer user_data)
 {
 	struct ofono_handsfree *hf = user_data;
 	struct hf_data *hd = ofono_handsfree_get_data(hf);
 
 	g_at_chat_register(hd->chat, "+BSIR:", bsir_notify, FALSE, hf, NULL);
+	g_at_chat_register(hd->chat, "+BVRA:", bvra_notify, FALSE, hf, NULL);
 
 	if (hd->ag_features & HFP_AG_FEATURE_IN_BAND_RING_TONE)
 		ofono_handsfree_set_inband_ringing(hf, TRUE);
@@ -169,11 +200,33 @@ static void hfp_request_phone_number(struct ofono_handsfree *hf,
 	CALLBACK_WITH_FAILURE(cb, NULL, data);
 }
 
+static void hfp_voice_recognition(struct ofono_handsfree *hf,
+					ofono_bool_t enabled,
+					ofono_handsfree_cb_t cb, void *data)
+{
+	struct hf_data *hd = ofono_handsfree_get_data(hf);
+	struct cb_data *cbd = cb_data_new(cb, data);
+	char buf[64];
+
+	snprintf(buf, sizeof(buf), "AT+BVRA=%d",
+				(int)(enabled));
+
+	if (g_at_chat_send(hd->chat, buf, bvra_prefix,
+				hf_generic_set_cb,
+				cbd, g_free) > 0)
+		return;
+
+	g_free(cbd);
+
+	CALLBACK_WITH_FAILURE(cb, data);
+}
+
 static struct ofono_handsfree_driver driver = {
 	.name			= "hfpmodem",
 	.probe			= hfp_handsfree_probe,
 	.remove			= hfp_handsfree_remove,
 	.request_phone_number	= hfp_request_phone_number,
+	.voice_recognition	= hfp_voice_recognition,
 };
 
 void hfp_handsfree_init(void)
-- 
1.7.6.4


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

* [PATCH v3 06/15] doc: Handsfree exposes supported AG features
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (4 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 05/15] hfpmodem: Support for AT+BVRA Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:36   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 07/15] include: AG features added to handsfree public api Mikel Astiz
                   ` (8 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 doc/handsfree-api.txt |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/doc/handsfree-api.txt b/doc/handsfree-api.txt
index 9355946..12cfe62 100644
--- a/doc/handsfree-api.txt
+++ b/doc/handsfree-api.txt
@@ -38,7 +38,14 @@ Signals		PropertyChanged(string property, variant value)
 			Signal is emitted whenever a property has changed.
 			The new value is passed as the signal argument.
 
-Properties	boolean InbandRinging [readonly]
+Properties	array{string} Features [readonly]
+
+			List of features supported by the AG. The currently
+			supported values are:
+				"VoiceRecognition"
+				"AttachVoiceTag"
+
+		boolean InbandRinging [readonly]
 
 			Boolean representing whether inband ringing is enabled.
 
-- 
1.7.6.4


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

* [PATCH v3 07/15] include: AG features added to handsfree public api
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (5 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 06/15] doc: Handsfree exposes supported AG features Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:38   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 08/15] handsfree: Supported AG features exposed in D-Bus Mikel Astiz
                   ` (7 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 include/handsfree.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/handsfree.h b/include/handsfree.h
index 4ffd673..4f6cbc0 100644
--- a/include/handsfree.h
+++ b/include/handsfree.h
@@ -50,6 +50,8 @@ struct ofono_handsfree_driver {
 					ofono_handsfree_cb_t cb, void *data);
 };
 
+void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
+					unsigned int ag_features);
 void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
 						ofono_bool_t enabled);
 void ofono_handsfree_set_voice_recognition(struct ofono_handsfree *hf,
-- 
1.7.6.4


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

* [PATCH v3 08/15] handsfree: Supported AG features exposed in D-Bus
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (6 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 07/15] include: AG features added to handsfree public api Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 09/15] hfpmodem: Report features supported by AG Mikel Astiz
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 src/handsfree.c |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 58 insertions(+), 0 deletions(-)

diff --git a/src/handsfree.c b/src/handsfree.c
index 7f3882f..d3acb8b 100644
--- a/src/handsfree.c
+++ b/src/handsfree.c
@@ -41,9 +41,12 @@
 #include "ofono.h"
 #include "common.h"
 
+#define MAX_AG_FEATURE_COUNT 32
+
 static GSList *g_drivers = NULL;
 
 struct ofono_handsfree {
+	unsigned int ag_features;
 	ofono_bool_t inband_ringing;
 	ofono_bool_t voicerec_state;
 	ofono_bool_t pending_voicerec_state;
@@ -54,6 +57,54 @@ struct ofono_handsfree {
 	DBusMessage *pending;
 };
 
+static void append_ag_features(struct ofono_handsfree *hf, char **features)
+{
+	unsigned int bit;
+	int feature_count = 0;
+
+	for (bit = 1; bit != 0; bit <<= 1) {
+		if (hf->ag_features & bit) {
+			char *name = NULL;
+
+			switch ((enum hfp_ag_feature) bit) {
+			case HFP_AG_FEATURE_VOICE_RECOG:
+				name = "VoiceRecognition";
+				break;
+			case HFP_AG_FEATURE_ATTACH_VOICE_TAG:
+				name = "AttachVoiceTag";
+				break;
+			default:
+				continue;
+			}
+
+			features[feature_count++] = name;
+		}
+	}
+
+	features[feature_count] = NULL;
+}
+
+void ofono_handsfree_set_ag_features(struct ofono_handsfree *hf,
+					unsigned int ag_features)
+{
+	DBusConnection *conn = ofono_dbus_get_connection();
+	const char *path = __ofono_atom_get_path(hf->atom);
+	char **features;
+
+	if (hf->ag_features == ag_features)
+		return;
+
+	hf->ag_features = ag_features;
+
+	features = g_new0(char *, MAX_AG_FEATURE_COUNT + 1);
+	append_ag_features(hf, features);
+	ofono_dbus_signal_array_property_changed(conn, path,
+						OFONO_HANDSFREE_INTERFACE,
+						"Features", DBUS_TYPE_STRING,
+						&features);
+	g_free(features);
+}
+
 void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
 						ofono_bool_t enabled)
 {
@@ -102,6 +153,7 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
 	DBusMessageIter dict;
 	dbus_bool_t inband_ringing;
 	dbus_bool_t voicerec_state;
+	char **features;
 
 	reply = dbus_message_new_method_return(msg);
 	if (reply == NULL)
@@ -121,6 +173,12 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
 	ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
 				&voicerec_state);
 
+	features = g_new0(char *, MAX_AG_FEATURE_COUNT + 1);
+	append_ag_features(hf, features);
+	ofono_dbus_dict_append_array(&dict, "Features", DBUS_TYPE_STRING,
+					&features);
+	g_free(features);
+
 	dbus_message_iter_close_container(&iter, &dict);
 
 	return reply;
-- 
1.7.6.4


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

* [PATCH v3 09/15] hfpmodem: Report features supported by AG
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (7 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 08/15] handsfree: Supported AG features exposed in D-Bus Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration Mikel Astiz
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 drivers/hfpmodem/handsfree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c
index 2daff94..7526b40 100644
--- a/drivers/hfpmodem/handsfree.c
+++ b/drivers/hfpmodem/handsfree.c
@@ -107,6 +107,7 @@ static gboolean hfp_handsfree_register(gpointer user_data)
 	if (hd->ag_features & HFP_AG_FEATURE_IN_BAND_RING_TONE)
 		ofono_handsfree_set_inband_ringing(hf, TRUE);
 
+	ofono_handsfree_set_ag_features(hf, hd->ag_features);
 	ofono_handsfree_register(hf);
 
 	return FALSE;
-- 
1.7.6.4


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

* [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (8 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 09/15] hfpmodem: Report features supported by AG Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 17:59   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 11/15] hfpmodem: Avoid segfault in call-volume Mikel Astiz
                   ` (4 subsequent siblings)
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

The use of g_idle_add can cause a segmentation fault if the object is
destroyed in the meantime.
---
 drivers/hfpmodem/network-registration.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/hfpmodem/network-registration.c b/drivers/hfpmodem/network-registration.c
index da7d8eb..6c27a23 100644
--- a/drivers/hfpmodem/network-registration.c
+++ b/drivers/hfpmodem/network-registration.c
@@ -51,6 +51,7 @@ struct netreg_data {
 	GAtChat *chat;
 	unsigned char cind_pos[HFP_INDICATOR_LAST];
 	int cind_val[HFP_INDICATOR_LAST];
+	guint registration_event_id;
 };
 
 static void cops_cb(gboolean ok, GAtResult *result, gpointer user_data)
@@ -297,6 +298,9 @@ static void hfp_signal_strength(struct ofono_netreg *netreg,
 static gboolean hfp_netreg_register(gpointer user_data)
 {
 	struct ofono_netreg *netreg = user_data;
+	struct netreg_data *nd = ofono_netreg_get_data(netreg);
+
+	nd->registration_event_id = 0;
 
 	ofono_netreg_register(netreg);
 
@@ -320,7 +324,7 @@ static int hfp_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
 	g_at_chat_register(nd->chat, "+CIEV:", ciev_notify, FALSE,
 				netreg, NULL);
 
-	g_idle_add(hfp_netreg_register, netreg);
+	nd->registration_event_id = g_idle_add(hfp_netreg_register, netreg);
 
 	return 0;
 }
@@ -329,6 +333,9 @@ static void hfp_netreg_remove(struct ofono_netreg *netreg)
 {
 	struct netreg_data *nd = ofono_netreg_get_data(netreg);
 
+	if (nd->registration_event_id != 0)
+		g_source_remove(nd->registration_event_id);
+
 	ofono_netreg_set_data(netreg, NULL);
 
 	g_at_chat_unref(nd->chat);
-- 
1.7.6.4


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

* [PATCH v3 11/15] hfpmodem: Avoid segfault in call-volume
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (9 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 12/15] hfpmodem: Avoid segfault in handsfree Mikel Astiz
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

The use of g_idle_add can cause a segmentation fault if the object is
destroyed in the meantime.
---
 drivers/hfpmodem/call-volume.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index 804d9e2..e91d34b 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -50,6 +50,7 @@ struct cv_data {
 	GAtChat *chat;
 	unsigned char sp_volume;
 	unsigned char mic_volume;
+	guint registration_event_id;
 };
 
 static void cv_generic_set_cb(gboolean ok, GAtResult *result,
@@ -173,6 +174,8 @@ static gboolean hfp_call_volume_register(gpointer user_data)
 
 	DBG("");
 
+	vd->registration_event_id = 0;
+
 	g_at_chat_register(vd->chat, "+VGS:", vgs_notify, FALSE, cv, NULL);
 	g_at_chat_register(vd->chat, "+VGM:", vgm_notify, FALSE, cv, NULL);
 
@@ -197,7 +200,7 @@ static int hfp_call_volume_probe(struct ofono_call_volume *cv,
 
 	ofono_call_volume_set_data(cv, vd);
 
-	g_idle_add(hfp_call_volume_register, cv);
+	vd->registration_event_id = g_idle_add(hfp_call_volume_register, cv);
 
 	return 0;
 }
@@ -206,6 +209,9 @@ static void hfp_call_volume_remove(struct ofono_call_volume *cv)
 {
 	struct cv_data *vd = ofono_call_volume_get_data(cv);
 
+	if (vd->registration_event_id != 0)
+		g_source_remove(vd->registration_event_id);
+
 	ofono_call_volume_set_data(cv, NULL);
 
 	g_at_chat_unref(vd->chat);
-- 
1.7.6.4


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

* [PATCH v3 12/15] hfpmodem: Avoid segfault in handsfree
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (10 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 11/15] hfpmodem: Avoid segfault in call-volume Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address Mikel Astiz
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

The use of g_idle_add can cause a segmentation fault if the object is
destroyed in the meantime.
---
 drivers/hfpmodem/handsfree.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c
index 7526b40..c278a0d 100644
--- a/drivers/hfpmodem/handsfree.c
+++ b/drivers/hfpmodem/handsfree.c
@@ -48,6 +48,7 @@ static const char *bvra_prefix[] = { "+BVRA:", NULL };
 struct hf_data {
 	GAtChat *chat;
 	unsigned int ag_features;
+	guint registration_event_id;
 };
 
 static void hf_generic_set_cb(gboolean ok, GAtResult *result,
@@ -101,6 +102,8 @@ static gboolean hfp_handsfree_register(gpointer user_data)
 	struct ofono_handsfree *hf = user_data;
 	struct hf_data *hd = ofono_handsfree_get_data(hf);
 
+	hd->registration_event_id = 0;
+
 	g_at_chat_register(hd->chat, "+BSIR:", bsir_notify, FALSE, hf, NULL);
 	g_at_chat_register(hd->chat, "+BVRA:", bvra_notify, FALSE, hf, NULL);
 
@@ -126,7 +129,7 @@ static int hfp_handsfree_probe(struct ofono_handsfree *hf,
 
 	ofono_handsfree_set_data(hf, hd);
 
-	g_idle_add(hfp_handsfree_register, hf);
+	hd->registration_event_id = g_idle_add(hfp_handsfree_register, hf);
 
 	return 0;
 }
@@ -135,6 +138,9 @@ static void hfp_handsfree_remove(struct ofono_handsfree *hf)
 {
 	struct hf_data *hd = ofono_handsfree_get_data(hf);
 
+	if (hd->registration_event_id != 0)
+		g_source_remove(hd->registration_event_id);
+
 	ofono_handsfree_set_data(hf, NULL);
 
 	g_at_chat_unref(hd->chat);
-- 
1.7.6.4


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

* [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (11 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 12/15] hfpmodem: Avoid segfault in handsfree Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:40   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property Mikel Astiz
  2011-10-20 16:38 ` [PATCH v3 15/15] hfpmodem: minor whitespace fix Mikel Astiz
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 Makefile.am                 |    1 +
 drivers/hfpmodem/devinfo.c  |  133 +++++++++++++++++++++++++++++++++++++++++++
 drivers/hfpmodem/hfpmodem.c |    2 +
 drivers/hfpmodem/hfpmodem.h |    7 ++
 4 files changed, 143 insertions(+), 0 deletions(-)
 create mode 100644 drivers/hfpmodem/devinfo.c

diff --git a/Makefile.am b/Makefile.am
index 8771cb2..83b7737 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -255,6 +255,7 @@ builtin_sources += drivers/atmodem/atutil.h \
 			drivers/hfpmodem/voicecall.c \
 			drivers/hfpmodem/network-registration.c \
 			drivers/hfpmodem/call-volume.c \
+			drivers/hfpmodem/devinfo.c \
 			drivers/hfpmodem/handsfree.c
 
 if PHONESIM
diff --git a/drivers/hfpmodem/devinfo.c b/drivers/hfpmodem/devinfo.c
new file mode 100644
index 0000000..021a8b7
--- /dev/null
+++ b/drivers/hfpmodem/devinfo.c
@@ -0,0 +1,133 @@
+/*
+ *
+ *  oFono - Open Source Telephony
+ *
+ *  Copyright (C) 2008-2011  Intel Corporation. All rights reserved.
+ *  Copyright (C) 2011  BMW Car IT GmbH. All rights reserved.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <gatchat.h>
+#include <gatresult.h>
+
+#include <ofono/log.h>
+#include <ofono/modem.h>
+#include <ofono/devinfo.h>
+
+#include "hfpmodem.h"
+
+struct devinfo_data {
+	char *device_address;
+	guint register_event_id;
+};
+
+static void hfp_query_manufacturer(struct ofono_devinfo *info,
+					ofono_devinfo_query_cb_t cb,
+					void *data)
+{
+	CALLBACK_WITH_FAILURE(cb, "", data);
+}
+
+static void hfp_query_model(struct ofono_devinfo *info,
+				ofono_devinfo_query_cb_t cb,
+				void *data)
+{
+	CALLBACK_WITH_FAILURE(cb, "", data);
+}
+
+static void hfp_query_revision(struct ofono_devinfo *info,
+				ofono_devinfo_query_cb_t cb,
+				void *data)
+{
+	CALLBACK_WITH_FAILURE(cb, "", data);
+}
+
+static void hfp_query_serial(struct ofono_devinfo *info,
+				ofono_devinfo_query_cb_t cb,
+				void *data)
+{
+	struct devinfo_data *dev = ofono_devinfo_get_data(info);
+	CALLBACK_WITH_SUCCESS(cb, dev->device_address, data);
+}
+
+static gboolean hfp_devinfo_register(gpointer user_data)
+{
+	struct ofono_devinfo *info = user_data;
+	struct devinfo_data *dd = ofono_devinfo_get_data(info);
+
+	dd->register_event_id = 0;
+
+	ofono_devinfo_register(info);
+
+	return FALSE;
+}
+
+static int hfp_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
+				void *user)
+{
+	struct hfp_devinfo_params *devinfo_params = user;
+	struct devinfo_data *dd;
+
+	dd = g_new0(struct devinfo_data, 1);
+	dd->device_address = g_strdup(devinfo_params->device_address);
+
+	ofono_devinfo_set_data(info, dd);
+
+	dd->register_event_id = g_idle_add(hfp_devinfo_register, info);
+	return 0;
+}
+
+static void hfp_devinfo_remove(struct ofono_devinfo *info)
+{
+	struct devinfo_data *dd = ofono_devinfo_get_data(info);
+
+	ofono_devinfo_set_data(info, NULL);
+	if (dd == NULL)
+		return;
+
+	if (dd->register_event_id != 0)
+		g_source_remove(dd->register_event_id);
+
+	g_free(dd->device_address);
+	g_free(dd);
+}
+
+static struct ofono_devinfo_driver driver = {
+	.name			= "hfpmodem",
+	.probe			= hfp_devinfo_probe,
+	.remove			= hfp_devinfo_remove,
+	.query_manufacturer	= hfp_query_manufacturer,
+	.query_model		= hfp_query_model,
+	.query_revision		= hfp_query_revision,
+	.query_serial		= hfp_query_serial
+};
+
+void hfp_devinfo_init(void)
+{
+	ofono_devinfo_driver_register(&driver);
+}
+
+void hfp_devinfo_exit(void)
+{
+	ofono_devinfo_driver_unregister(&driver);
+}
diff --git a/drivers/hfpmodem/hfpmodem.c b/drivers/hfpmodem/hfpmodem.c
index 13d7766..1348beb 100644
--- a/drivers/hfpmodem/hfpmodem.c
+++ b/drivers/hfpmodem/hfpmodem.c
@@ -35,6 +35,7 @@
 static int hfpmodem_init(void)
 {
 	hfp_voicecall_init();
+	hfp_devinfo_init();
 	hfp_netreg_init();
 	hfp_call_volume_init();
 	hfp_handsfree_init();
@@ -45,6 +46,7 @@ static int hfpmodem_init(void)
 static void hfpmodem_exit(void)
 {
 	hfp_voicecall_exit();
+	hfp_devinfo_exit();
 	hfp_netreg_exit();
 	hfp_call_volume_exit();
 	hfp_handsfree_exit();
diff --git a/drivers/hfpmodem/hfpmodem.h b/drivers/hfpmodem/hfpmodem.h
index 4a996cf..ff7af6f 100644
--- a/drivers/hfpmodem/hfpmodem.h
+++ b/drivers/hfpmodem/hfpmodem.h
@@ -22,6 +22,10 @@
 #include <drivers/atmodem/atutil.h>
 #include <ofono/dbus.h>
 
+struct hfp_devinfo_params {
+	const char *device_address;
+};
+
 extern void hfp_netreg_init(void);
 extern void hfp_netreg_exit(void);
 
@@ -33,3 +37,6 @@ extern void hfp_voicecall_exit(void);
 
 extern void hfp_handsfree_init(void);
 extern void hfp_handsfree_exit(void);
+
+extern void hfp_devinfo_init(void);
+extern void hfp_devinfo_exit(void);
-- 
1.7.6.4


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

* [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (12 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-21  1:42   ` Denis Kenzior
  2011-10-20 16:38 ` [PATCH v3 15/15] hfpmodem: minor whitespace fix Mikel Astiz
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

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

diff --git a/plugins/hfp_hf.c b/plugins/hfp_hf.c
index ba06434..bceae55 100644
--- a/plugins/hfp_hf.c
+++ b/plugins/hfp_hf.c
@@ -38,12 +38,14 @@
 #include <ofono/plugin.h>
 #include <ofono/log.h>
 #include <ofono/modem.h>
+#include <ofono/devinfo.h>
 #include <ofono/netreg.h>
 #include <ofono/voicecall.h>
 #include <ofono/call-volume.h>
 #include <ofono/handsfree.h>
 
 #include <drivers/hfpmodem/slc.h>
+#include <drivers/hfpmodem/hfpmodem.h>
 
 #include "bluetooth.h"
 
@@ -207,6 +209,7 @@ static int hfp_hf_probe(const char *device, const char *dev_addr,
 	struct ofono_modem *modem;
 	struct hfp_data *data;
 	char buf[256];
+	struct hfp_devinfo_params devinfo_params;
 
 	/* We already have this device in our hash, ignore */
 	if (g_hash_table_lookup(modem_hash, device) != NULL)
@@ -232,6 +235,10 @@ static int hfp_hf_probe(const char *device, const char *dev_addr,
 
 	ofono_modem_set_data(modem, data);
 	ofono_modem_set_name(modem, alias);
+
+	devinfo_params.device_address = dev_addr;
+	ofono_devinfo_create(modem, 0, "hfpmodem", &devinfo_params);
+
 	ofono_modem_register(modem);
 
 	g_hash_table_insert(modem_hash, g_strdup(device), modem);
-- 
1.7.6.4


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

* [PATCH v3 15/15] hfpmodem: minor whitespace fix
  2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
                   ` (13 preceding siblings ...)
  2011-10-20 16:38 ` [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property Mikel Astiz
@ 2011-10-20 16:38 ` Mikel Astiz
  2011-10-20 17:58   ` Denis Kenzior
  14 siblings, 1 reply; 26+ messages in thread
From: Mikel Astiz @ 2011-10-20 16:38 UTC (permalink / raw)
  To: ofono

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

---
 drivers/hfpmodem/call-volume.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index e91d34b..638d362 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -236,4 +236,3 @@ void hfp_call_volume_exit(void)
 {
 	ofono_call_volume_driver_unregister(&driver);
 }
-
-- 
1.7.6.4


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

* Re: [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes
  2011-10-20 16:38 ` [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes Mikel Astiz
@ 2011-10-20 17:58   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:58 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  drivers/hfpmodem/handsfree.c |   19 +++++++++++++++++++
>  1 files changed, 19 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH v3 15/15] hfpmodem: minor whitespace fix
  2011-10-20 16:38 ` [PATCH v3 15/15] hfpmodem: minor whitespace fix Mikel Astiz
@ 2011-10-20 17:58   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:58 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  drivers/hfpmodem/call-volume.c |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration
  2011-10-20 16:38 ` [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration Mikel Astiz
@ 2011-10-20 17:59   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-20 17:59 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> The use of g_idle_add can cause a segmentation fault if the object is
> destroyed in the meantime.
> ---
>  drivers/hfpmodem/network-registration.c |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 

Looks good to me, but please...

> diff --git a/drivers/hfpmodem/network-registration.c b/drivers/hfpmodem/network-registration.c
> index da7d8eb..6c27a23 100644
> --- a/drivers/hfpmodem/network-registration.c
> +++ b/drivers/hfpmodem/network-registration.c
> @@ -51,6 +51,7 @@ struct netreg_data {
>  	GAtChat *chat;
>  	unsigned char cind_pos[HFP_INDICATOR_LAST];
>  	int cind_val[HFP_INDICATOR_LAST];
> +	guint registration_event_id;

...name this 'register_source' to be more consistent with how oFono
names variables that store GSource ids.

Same comment applies to patch 11 and 12.

Regards,
-Denis

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

* Re: [PATCH v3 03/15] include: Voice recognition in handsfree public api
  2011-10-20 16:38 ` [PATCH v3 03/15] include: Voice recognition in handsfree public api Mikel Astiz
@ 2011-10-21  1:27   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:27 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  include/handsfree.h |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 

OK, nitpicking time ;)

> diff --git a/include/handsfree.h b/include/handsfree.h
> index a4aa177..4ffd673 100644
> --- a/include/handsfree.h
> +++ b/include/handsfree.h
> @@ -31,6 +31,8 @@ extern "C" {
>  
>  struct ofono_handsfree;
>  
> +typedef void (*ofono_handsfree_cb_t)(const struct ofono_error *error,
> +					void *data);
>  typedef void (*ofono_handsfree_phone_cb_t)(const struct ofono_error *error,
>  					const struct ofono_phone_number *number,
>  					void *data);
> @@ -43,10 +45,15 @@ struct ofono_handsfree_driver {
>  	void (*request_phone_number) (struct ofono_handsfree *hf,
>  					ofono_handsfree_phone_cb_t cb,
>  					void *data);
> +	void (*voice_recognition)(struct ofono_handsfree *cv,

And this should be *hf not *cv.

> +					ofono_bool_t enabled,
> +					ofono_handsfree_cb_t cb, void *data);
>  };
>  
>  void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
>  						ofono_bool_t enabled);
> +void ofono_handsfree_set_voice_recognition(struct ofono_handsfree *hf,
> +						ofono_bool_t enabled);

Please rename this to ofono_handsfree_voice_recognition_notify.

>  
>  int ofono_handsfree_driver_register(const struct ofono_handsfree_driver *d);
>  void ofono_handsfree_driver_unregister(

Regards,
-Denis

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

* Re: [PATCH v3 04/15] handsfree: Implement voice recognition function
  2011-10-20 16:38 ` [PATCH v3 04/15] handsfree: Implement voice recognition function Mikel Astiz
@ 2011-10-21  1:32   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:32 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  src/handsfree.c |   72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 72 insertions(+), 0 deletions(-)
> 
> diff --git a/src/handsfree.c b/src/handsfree.c
> index efebcc0..7f3882f 100644
> --- a/src/handsfree.c
> +++ b/src/handsfree.c
> @@ -45,6 +45,9 @@ static GSList *g_drivers = NULL;
>  
>  struct ofono_handsfree {
>  	ofono_bool_t inband_ringing;
> +	ofono_bool_t voicerec_state;
> +	ofono_bool_t pending_voicerec_state;

Please name these voice_recognition and voice_recognition_pending.

> +
>  	const struct ofono_handsfree_driver *driver;
>  	void *driver_data;
>  	struct ofono_atom *atom;
> @@ -72,6 +75,24 @@ void ofono_handsfree_set_inband_ringing(struct ofono_handsfree *hf,
>  					&dbus_enabled);
>  }
>  
> +void ofono_handsfree_set_voice_recognition(struct ofono_handsfree *hf,
> +						ofono_bool_t enabled)
> +{
> +	DBusConnection *conn = ofono_dbus_get_connection();
> +	const char *path = __ofono_atom_get_path(hf->atom);
> +	dbus_bool_t dbus_enabled = enabled;
> +
> +	if (hf->voicerec_state == enabled)
> +		return;
> +
> +	hf->voicerec_state = enabled;
> +
> +	ofono_dbus_signal_property_changed(conn, path,
> +					OFONO_HANDSFREE_INTERFACE,
> +					"VoiceRecognition", DBUS_TYPE_BOOLEAN,
> +					&dbus_enabled);
> +}
> +
>  static DBusMessage *handsfree_get_properties(DBusConnection *conn,
>  						DBusMessage *msg, void *data)
>  {
> @@ -80,6 +101,7 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
>  	DBusMessageIter iter;
>  	DBusMessageIter dict;
>  	dbus_bool_t inband_ringing;
> +	dbus_bool_t voicerec_state;
>  
>  	reply = dbus_message_new_method_return(msg);
>  	if (reply == NULL)
> @@ -95,17 +117,49 @@ static DBusMessage *handsfree_get_properties(DBusConnection *conn,
>  	ofono_dbus_dict_append(&dict, "InbandRinging", DBUS_TYPE_BOOLEAN,
>  				&inband_ringing);
>  
> +	voicerec_state = hf->voicerec_state;
> +	ofono_dbus_dict_append(&dict, "VoiceRecognition", DBUS_TYPE_BOOLEAN,
> +				&voicerec_state);
> +
>  	dbus_message_iter_close_container(&iter, &dict);
>  
>  	return reply;
>  }
>  
> +static void voicerec_set_cb(const struct ofono_error *error, void *data)
> +{
> +	struct ofono_handsfree *hf = data;
> +	DBusConnection *conn = ofono_dbus_get_connection();
> +	const char *path = __ofono_atom_get_path(hf->atom);
> +
> +	if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
> +		__ofono_dbus_pending_reply(&hf->pending,
> +					__ofono_error_failed(hf->pending));
> +		return;
> +	}
> +
> +	hf->voicerec_state = hf->pending_voicerec_state;
> +
> +	__ofono_dbus_pending_reply(&hf->pending,
> +				dbus_message_new_method_return(hf->pending));
> +
> +	ofono_dbus_signal_property_changed(conn, path,
> +					OFONO_HANDSFREE_INTERFACE,
> +					"VoiceRecognition",
> +					DBUS_TYPE_BOOLEAN,
> +					&hf->voicerec_state);
> +}
> +
>  static DBusMessage *handsfree_set_property(DBusConnection *conn,
>  						DBusMessage *msg, void *data)
>  {
> +	struct ofono_handsfree *hf = data;
>  	DBusMessageIter iter, var;
>  	const char *name;
>  
> +	if (hf->pending)
> +		return __ofono_error_busy(msg);
> +
>  	if (dbus_message_iter_init(msg, &iter) == FALSE)
>  		return __ofono_error_invalid_args(msg);
>  
> @@ -120,6 +174,24 @@ static DBusMessage *handsfree_set_property(DBusConnection *conn,
>  
>  	dbus_message_iter_recurse(&iter, &var);
>  
> +	if (g_str_equal(name, "VoiceRecognition") == TRUE) {
> +		ofono_bool_t enabled;
> +
> +		if (!hf->driver->voice_recognition)
> +			return __ofono_error_not_implemented(msg);
> +
> +		if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
> +			return __ofono_error_invalid_args(msg);
> +
> +		dbus_message_iter_get_basic(&var, &enabled);
> +
> +		hf->pending_voicerec_state = enabled;
> +		hf->pending = dbus_message_ref(msg);
> +		hf->driver->voice_recognition(hf, enabled, voicerec_set_cb, hf);
> +

You might want to think about whether we need to be a bit smarter here.
 For example, AG indicated BVRA is active, and us trying to set (and
potentially signal PropertyChanged) again might be bad.

Same goes for setting the property to the already set value.

> +		return NULL;
> +	}
> +
>  	return __ofono_error_invalid_args(msg);
>  }
>  

Regards,
-Denis

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

* Re: [PATCH v3 02/15] doc: Voice recognition function added in Handsfree
  2011-10-20 16:38 ` [PATCH v3 02/15] doc: Voice recognition function added in Handsfree Mikel Astiz
@ 2011-10-21  1:33   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:33 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  doc/handsfree-api.txt |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH v3 06/15] doc: Handsfree exposes supported AG features
  2011-10-20 16:38 ` [PATCH v3 06/15] doc: Handsfree exposes supported AG features Mikel Astiz
@ 2011-10-21  1:36   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:36 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  doc/handsfree-api.txt |    9 ++++++++-
>  1 files changed, 8 insertions(+), 1 deletions(-)
> 
> diff --git a/doc/handsfree-api.txt b/doc/handsfree-api.txt
> index 9355946..12cfe62 100644
> --- a/doc/handsfree-api.txt
> +++ b/doc/handsfree-api.txt
> @@ -38,7 +38,14 @@ Signals		PropertyChanged(string property, variant value)
>  			Signal is emitted whenever a property has changed.
>  			The new value is passed as the signal argument.
>  
> -Properties	boolean InbandRinging [readonly]
> +Properties	array{string} Features [readonly]
> +
> +			List of features supported by the AG. The currently
> +			supported values are:
> +				"VoiceRecognition"
> +				"AttachVoiceTag"
> +

Please use small caps and hyphens for values, e.g. 'voice-recognition',
'attach-voice-tag', etc.  See other BlueZ/oFono/ConnMan style APIs for
details.  Only properties and functions are CamelCased.

> +		boolean InbandRinging [readonly]
>  
>  			Boolean representing whether inband ringing is enabled.
>  

Regards,
-Denis

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

* Re: [PATCH v3 07/15] include: AG features added to handsfree public api
  2011-10-20 16:38 ` [PATCH v3 07/15] include: AG features added to handsfree public api Mikel Astiz
@ 2011-10-21  1:38   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:38 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  include/handsfree.h |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 

Patch has been applied, thanks.

Regards,
-Denis

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

* Re: [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address
  2011-10-20 16:38 ` [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address Mikel Astiz
@ 2011-10-21  1:40   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:40 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

<snip>

> +
> +struct devinfo_data {
> +	char *device_address;
> +	guint register_event_id;

Please use register_source here

> +};
> +
> +static void hfp_query_manufacturer(struct ofono_devinfo *info,
> +					ofono_devinfo_query_cb_t cb,
> +					void *data)
> +{
> +	CALLBACK_WITH_FAILURE(cb, "", data);
> +}
> +
> +static void hfp_query_model(struct ofono_devinfo *info,
> +				ofono_devinfo_query_cb_t cb,
> +				void *data)
> +{
> +	CALLBACK_WITH_FAILURE(cb, "", data);
> +}
> +
> +static void hfp_query_revision(struct ofono_devinfo *info,
> +				ofono_devinfo_query_cb_t cb,
> +				void *data)
> +{
> +	CALLBACK_WITH_FAILURE(cb, "", data);
> +}
> +

Please omit these functions, the devinfo atom should handle the absence
of these gracefully.

> +static void hfp_query_serial(struct ofono_devinfo *info,
> +				ofono_devinfo_query_cb_t cb,
> +				void *data)
> +{
> +	struct devinfo_data *dev = ofono_devinfo_get_data(info);
> +	CALLBACK_WITH_SUCCESS(cb, dev->device_address, data);
> +}
> +
> +static gboolean hfp_devinfo_register(gpointer user_data)
> +{
> +	struct ofono_devinfo *info = user_data;
> +	struct devinfo_data *dd = ofono_devinfo_get_data(info);
> +
> +	dd->register_event_id = 0;
> +
> +	ofono_devinfo_register(info);
> +
> +	return FALSE;
> +}
> +
> +static int hfp_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
> +				void *user)
> +{
> +	struct hfp_devinfo_params *devinfo_params = user;
> +	struct devinfo_data *dd;
> +
> +	dd = g_new0(struct devinfo_data, 1);
> +	dd->device_address = g_strdup(devinfo_params->device_address);
> +
> +	ofono_devinfo_set_data(info, dd);
> +
> +	dd->register_event_id = g_idle_add(hfp_devinfo_register, info);
> +	return 0;
> +}
> +
> +static void hfp_devinfo_remove(struct ofono_devinfo *info)
> +{
> +	struct devinfo_data *dd = ofono_devinfo_get_data(info);
> +
> +	ofono_devinfo_set_data(info, NULL);
> +	if (dd == NULL)
> +		return;
> +
> +	if (dd->register_event_id != 0)
> +		g_source_remove(dd->register_event_id);
> +
> +	g_free(dd->device_address);
> +	g_free(dd);
> +}
> +
> +static struct ofono_devinfo_driver driver = {
> +	.name			= "hfpmodem",
> +	.probe			= hfp_devinfo_probe,
> +	.remove			= hfp_devinfo_remove,
> +	.query_manufacturer	= hfp_query_manufacturer,
> +	.query_model		= hfp_query_model,
> +	.query_revision		= hfp_query_revision,
> +	.query_serial		= hfp_query_serial
> +};
> +
> +void hfp_devinfo_init(void)
> +{
> +	ofono_devinfo_driver_register(&driver);
> +}
> +
> +void hfp_devinfo_exit(void)
> +{
> +	ofono_devinfo_driver_unregister(&driver);
> +}

<snip>

Regards,
-Denis

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

* Re: [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property
  2011-10-20 16:38 ` [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property Mikel Astiz
@ 2011-10-21  1:42   ` Denis Kenzior
  0 siblings, 0 replies; 26+ messages in thread
From: Denis Kenzior @ 2011-10-21  1:42 UTC (permalink / raw)
  To: ofono

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

Hi Mikel,

On 10/20/2011 11:38 AM, Mikel Astiz wrote:
> ---
>  plugins/hfp_hf.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 
> diff --git a/plugins/hfp_hf.c b/plugins/hfp_hf.c
> index ba06434..bceae55 100644
> --- a/plugins/hfp_hf.c
> +++ b/plugins/hfp_hf.c
> @@ -38,12 +38,14 @@
>  #include <ofono/plugin.h>
>  #include <ofono/log.h>
>  #include <ofono/modem.h>
> +#include <ofono/devinfo.h>
>  #include <ofono/netreg.h>
>  #include <ofono/voicecall.h>
>  #include <ofono/call-volume.h>
>  #include <ofono/handsfree.h>
>  
>  #include <drivers/hfpmodem/slc.h>
> +#include <drivers/hfpmodem/hfpmodem.h>
>  
>  #include "bluetooth.h"
>  
> @@ -207,6 +209,7 @@ static int hfp_hf_probe(const char *device, const char *dev_addr,
>  	struct ofono_modem *modem;
>  	struct hfp_data *data;
>  	char buf[256];
> +	struct hfp_devinfo_params devinfo_params;
>  
>  	/* We already have this device in our hash, ignore */
>  	if (g_hash_table_lookup(modem_hash, device) != NULL)
> @@ -232,6 +235,10 @@ static int hfp_hf_probe(const char *device, const char *dev_addr,
>  
>  	ofono_modem_set_data(modem, data);
>  	ofono_modem_set_name(modem, alias);
> +
> +	devinfo_params.device_address = dev_addr;
> +	ofono_devinfo_create(modem, 0, "hfpmodem", &devinfo_params);
> +

This looks way too complicated, why don't you just pass the const char
*dev_addr to ofono_devinfo_create?

>  	ofono_modem_register(modem);
>  
>  	g_hash_table_insert(modem_hash, g_strdup(device), modem);

Regards,
-Denis

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

end of thread, other threads:[~2011-10-21  1:42 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-20 16:38 [PATCH v3 00/15] Bluetooth HFP-specific extensions Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 01/15] hfpmodem: Support for +BSIR unsol. result codes Mikel Astiz
2011-10-20 17:58   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 02/15] doc: Voice recognition function added in Handsfree Mikel Astiz
2011-10-21  1:33   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 03/15] include: Voice recognition in handsfree public api Mikel Astiz
2011-10-21  1:27   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 04/15] handsfree: Implement voice recognition function Mikel Astiz
2011-10-21  1:32   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 05/15] hfpmodem: Support for AT+BVRA Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 06/15] doc: Handsfree exposes supported AG features Mikel Astiz
2011-10-21  1:36   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 07/15] include: AG features added to handsfree public api Mikel Astiz
2011-10-21  1:38   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 08/15] handsfree: Supported AG features exposed in D-Bus Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 09/15] hfpmodem: Report features supported by AG Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 10/15] hfpmodem: Avoid segfault in network-registration Mikel Astiz
2011-10-20 17:59   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 11/15] hfpmodem: Avoid segfault in call-volume Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 12/15] hfpmodem: Avoid segfault in handsfree Mikel Astiz
2011-10-20 16:38 ` [PATCH v3 13/15] hfpmodem: devinfo atom added to export BT address Mikel Astiz
2011-10-21  1:40   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 14/15] hfp_hf: BT address exposed through Serial property Mikel Astiz
2011-10-21  1:42   ` Denis Kenzior
2011-10-20 16:38 ` [PATCH v3 15/15] hfpmodem: minor whitespace fix Mikel Astiz
2011-10-20 17:58   ` 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.