This patch extends the Handsfree Audio Card driver adding the Handsfree
Profile version to allow switching different drivers to manage SCO
connections or any other specific action related to a given profile
version.
---
 include/handsfree-audio.h | 4 +++-
 src/handsfree-audio.c     | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/handsfree-audio.h b/include/handsfree-audio.h
index 69f5a8e..e99a2dd 100644
--- a/include/handsfree-audio.h
+++ b/include/handsfree-audio.h
@@ -26,11 +26,13 @@
 extern "C" {
 #endif
 
+#include <stdint.h>
 #include <ofono/types.h>
 
 struct ofono_handsfree_card;
 
 struct ofono_handsfree_card_driver {
+       uint16_t version;
        int (*probe) (struct ofono_handsfree_card *card, void *data);
        void (*remove) (struct ofono_handsfree_card *card);
        int (*audio_connect) (const char *remote, const char *local);
@@ -42,7 +44,7 @@ void ofono_handsfree_card_driver_unregister(
                        const struct ofono_handsfree_card_driver *d);
 
 struct ofono_handsfree_card *ofono_handsfree_card_create(const char *remote,
-                                                       const char *local);
+                                       const char *local, uint16_t version);
 int ofono_handsfree_card_register(struct ofono_handsfree_card *card);
 void ofono_handsfree_card_remove(struct ofono_handsfree_card *card);
 
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index ffae47b..1e636cc 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -254,7 +254,7 @@ static const GDBusSignalTable card_signals[] = {
 };
 
 struct ofono_handsfree_card *ofono_handsfree_card_create(const char *remote,
-                                                       const char *local)
+                                       const char *local, uint16_t version)
 {
        struct ofono_handsfree_card *card;
        GSList *l;
@@ -269,6 +269,9 @@ struct ofono_handsfree_card 
*ofono_handsfree_card_create(const char *remote,
        for (l = g_drivers; l; l = g_slist_next(l)) {
                const struct ofono_handsfree_card_driver *drv = l->data;
 
+               if (drv->version != version)
+                       continue;
+
                if (drv->probe(card, NULL) < 0)
                        continue;
 
-- 
1.7.11.7

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to