This patch registers the Handsfree Audio Card driver for devices
compliant with HFP 1.5.
---
 plugins/hfp_hf_bluez5.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/plugins/hfp_hf_bluez5.c b/plugins/hfp_hf_bluez5.c
index 381a541..2020e63 100644
--- a/plugins/hfp_hf_bluez5.c
+++ b/plugins/hfp_hf_bluez5.c
@@ -311,6 +311,26 @@ static struct ofono_modem_driver hfp_driver = {
        .post_sim       = hfp_post_sim,
 };
 
+static int card_probe(struct ofono_handsfree_card *card, void *data)
+{
+       return 0;
+}
+
+static void card_remove(struct ofono_handsfree_card *card)
+{
+}
+
+static int card_audio_connect15(const char *remote, const char *local)
+{
+       return 0;
+}
+
+static struct ofono_handsfree_card_driver card_driver15 = {
+       .probe          = card_probe,
+       .remove         = card_remove,
+       .audio_connect  = card_audio_connect15,
+};
+
 static ofono_bool_t device_path_compare(struct ofono_modem *modem,
                                        void *userdata)
 {
@@ -615,8 +635,16 @@ static int hfp_init(void)
                return -EIO;
        }
 
+       err = ofono_handsfree_card_driver_register(&card_driver15);
+       if (err < 0) {
+               g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
+                                               BLUEZ_PROFILE_INTERFACE);
+               return err;
+       }
+
        err = ofono_modem_driver_register(&hfp_driver);
        if (err < 0) {
+               ofono_handsfree_card_driver_unregister(&card_driver15);
                g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
                                                BLUEZ_PROFILE_INTERFACE);
                return err;
@@ -647,6 +675,7 @@ static void hfp_exit(void)
        g_dbus_unregister_interface(conn, HFP_EXT_PROFILE_PATH,
                                                BLUEZ_PROFILE_INTERFACE);
        ofono_modem_driver_unregister(&hfp_driver);
+       ofono_handsfree_card_driver_unregister(&card_driver15);
        g_dbus_client_unref(bluez);
 
        ofono_handsfree_audio_unref();
-- 
1.7.11.7

_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to