aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-01-26 17:31:34 -0500
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-02-01 12:50:17 -0500
commitcdf1963f7ba075772b4b5f91f395ed8fb84d0e70 (patch)
treef0999ca227b528ca3bc94b6387741fff143dcee4 /net
parent213202edc9b5ae60eef2a915b83b4aa19b1c3617 (diff)
Bluetooth: Add support for 32-bit UUIDs in EIR data
This patch adds the necessary code for inserting a list of 32-bit UUIDs into the EIR data. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/mgmt.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 497928d2b257..0110a75661ef 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -477,6 +477,39 @@ static u8 *create_uuid16_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len)
477 return ptr; 477 return ptr;
478} 478}
479 479
480static u8 *create_uuid32_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len)
481{
482 u8 *ptr = data, *uuids_start = NULL;
483 struct bt_uuid *uuid;
484
485 if (len < 6)
486 return ptr;
487
488 list_for_each_entry(uuid, &hdev->uuids, list) {
489 if (uuid->size != 32)
490 continue;
491
492 if (!uuids_start) {
493 uuids_start = ptr;
494 uuids_start[0] = 1;
495 uuids_start[1] = EIR_UUID32_ALL;
496 ptr += 2;
497 }
498
499 /* Stop if not enough space to put next UUID */
500 if ((ptr - data) + sizeof(u32) > len) {
501 uuids_start[1] = EIR_UUID32_SOME;
502 break;
503 }
504
505 memcpy(ptr, &uuid->uuid[12], sizeof(u32));
506 ptr += sizeof(u32);
507 uuids_start[0] += sizeof(u32);
508 }
509
510 return ptr;
511}
512
480static void create_eir(struct hci_dev *hdev, u8 *data) 513static void create_eir(struct hci_dev *hdev, u8 *data)
481{ 514{
482 u8 *ptr = data; 515 u8 *ptr = data;
@@ -521,6 +554,7 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
521 } 554 }
522 555
523 ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); 556 ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
557 ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data));
524} 558}
525 559
526static int update_eir(struct hci_dev *hdev) 560static int update_eir(struct hci_dev *hdev)