[PATCH v3 5/5] android: Register DeviceID record when adapter is initialized

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

 



Register DeviceID SDP record and update local UUIDs after DeviceID
information is passed to kernel.
---
 android/adapter.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/android/adapter.c b/android/adapter.c
index 2c95e54..2fd6aeb 100644
--- a/android/adapter.c
+++ b/android/adapter.c
@@ -46,6 +46,10 @@
 #include "utils.h"
 #include "adapter.h"
 
+#define DEVICE_ID_SOURCE	0x0002	/* USB */
+#define DEVICE_ID_VENDOR	0x1d6b	/* Linux Foundation */
+#define DEVICE_ID_PRODUCT	0x0247	/* BlueZ for Android */
+
 /* Default to DisplayYesNo */
 #define DEFAULT_IO_CAPABILITY 0x01
 /* Default discoverable timeout 120sec as in Android */
@@ -1197,20 +1201,28 @@ static void set_device_id(void)
 {
 	struct mgmt_cp_set_device_id cp;
 	uint8_t major, minor;
+	uint16_t version;
 
 	if (sscanf(VERSION, "%hhu.%hhu", &major, &minor) != 2)
 		return;
 
+	version = major << 8 | minor;
+
 	memset(&cp, 0, sizeof(cp));
-	cp.source = htobs(0x0002);		/* USB */
-	cp.vendor = htobs(0x1d6b);		/* Linux Foundation */
-	cp.product = htobs(0x0247);		/* BlueZ for Android */
-	cp.version = htobs(major << 8 | minor);
+	cp.source = htobs(DEVICE_ID_SOURCE);
+	cp.vendor = htobs(DEVICE_ID_VENDOR);
+	cp.product = htobs(DEVICE_ID_PRODUCT);
+	cp.version = htobs(version);
 
 	if (mgmt_send(adapter->mgmt, MGMT_OP_SET_DEVICE_ID,
 				adapter->index, sizeof(cp), &cp,
 				NULL, NULL, NULL) == 0)
 		error("Failed to set device id");
+
+	register_device_id(DEVICE_ID_SOURCE, DEVICE_ID_VENDOR,
+						DEVICE_ID_PRODUCT, version);
+
+	bt_adapter_add_record(sdp_record_find(0x10000), 0x00);
 }
 
 static void set_adapter_name_complete(uint8_t status, uint16_t length,
-- 
1.8.4.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