Hi Mikel,
On 10/12/2011 07:35 AM, Mikel Astiz wrote:
---
drivers/hfpmodem/handsfree.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c
index 12a23fc..be6b83c 100644
--- a/drivers/hfpmodem/handsfree.c
+++ b/drivers/hfpmodem/handsfree.c
@@ -45,11 +45,28 @@
struct hf_data {
GAtChat *chat;
unsigned int ag_features;
+ unsigned int vendor;
};
+static void bsir_notify(GAtResult *result, gpointer user_data)
+{
+ struct ofono_handsfree *hf = user_data;
+ struct hf_data *hd = ofono_handsfree_get_data(hf);
+ int value;
+
+ if (at_util_parse_reg_unsolicited(result, "+BSIR:", &value,
+ NULL, NULL, NULL, hd->vendor) == FALSE)
+ return;
Why exactly are you using parse_reg_unsolicited here? That one is meant
to parse +CREG/+CGREG unsolicited responses, probably not the right
thing for BSIR, just using g_at_result_iter_next_number would be enough
here.
+
+ 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);
ofono_handsfree_register(hf);
@@ -69,6 +86,7 @@ static int hfp_handsfree_probe(struct ofono_handsfree *hf,
hd = g_new0(struct hf_data, 1);
hd->chat = g_at_chat_clone(info->chat);
hd->ag_features = info->ag_features;
+ hd->vendor = vendor;
If you don't use the at_util_parse_reg_unsolicited then you don't need
the vendor information.
ofono_handsfree_set_data(hf, hd);
Regards,
-Denis