This patch adds a utility Bluetooth function to convert Bluetooth
address from string to bdaddr_t.
---
 src/bluetooth.h       | 8 ++++++++
 src/handsfree-audio.c | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/bluetooth.h b/src/bluetooth.h
index 1584109..af6f02c 100644
--- a/src/bluetooth.h
+++ b/src/bluetooth.h
@@ -69,3 +69,11 @@ static inline int bt_bacmp(const bdaddr_t *ba1, const 
bdaddr_t *ba2)
 {
        return memcmp(ba1, ba2, sizeof(bdaddr_t));
 }
+
+static inline void bt_str2ba(const char *str, bdaddr_t *ba)
+{
+       int i;
+
+       for (i = 5; i >= 0; i--, str += 3)
+               ba->b[i] = strtol(str, NULL, 16);
+}
diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
index 1e636cc..c11c325 100644
--- a/src/handsfree-audio.c
+++ b/src/handsfree-audio.c
@@ -26,6 +26,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdint.h>
+#include <stdlib.h>
 #include <string.h>
 #include <fcntl.h>
 #include <unistd.h>
-- 
1.7.11.7

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

Reply via email to