mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-12 21:44:12 +08:00
android: Register DeviceID record when adapter is initialized
Register DeviceID SDP record and update local UUIDs after DeviceID information is passed to kernel.
This commit is contained in:
parent
8612cbc529
commit
51ac375db0
@ -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 */
|
||||
@ -1196,20 +1200,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,
|
||||
|
Loading…
Reference in New Issue
Block a user