[PATCH BlueZ 3/3] shared: Return real address of master dev in hciemu

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Exports master btdev address in hciemu.
---
 src/shared/hciemu.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/shared/hciemu.c b/src/shared/hciemu.c
index 8cd6548..133f16f 100644
--- a/src/shared/hciemu.c
+++ b/src/shared/hciemu.c
@@ -25,6 +25,7 @@
 #include <config.h>
 #endif
 
+#include <stdio.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <stdlib.h>
@@ -49,6 +50,7 @@ struct hciemu {
 	guint master_source;
 	guint client_source;
 	GList *post_command_hooks;
+	char bdaddr_str[18];
 };
 
 struct hciemu_command_hook {
@@ -331,10 +333,15 @@ void hciemu_unref(struct hciemu *hciemu)
 
 const char *hciemu_get_address(struct hciemu *hciemu)
 {
-	if (!hciemu)
+	const uint8_t *addr;
+
+	if (!hciemu || !hciemu->master_dev)
 		return NULL;
 
-	return "00:FA:CE:1E:55:00";
+	addr = btdev_get_bdaddr(hciemu->master_dev);
+	sprintf(hciemu->bdaddr_str, "%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X",
+			addr[5], addr[4], addr[3], addr[2], addr[1], addr[0]);
+	return hciemu->bdaddr_str;
 }
 
 bool hciemu_add_master_post_command_hook(struct hciemu *hciemu,
-- 
1.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux