diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-01-26 17:31:35 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-02-01 12:50:17 -0500 |
commit | c00d575bd550d3d57aeec2522defa0cea589560c (patch) | |
tree | 6cbdce4e127a7fb1d395eb12561a693b935187bb /net/bluetooth | |
parent | cdf1963f7ba075772b4b5f91f395ed8fb84d0e70 (diff) |
Bluetooth: Add support for 128-bit UUIDs in EIR data
This patch adds the necessary code for encoding a list of 128-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/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0110a75661ef..fbc8edf7dc1f 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -510,6 +510,39 @@ static u8 *create_uuid32_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) | |||
510 | return ptr; | 510 | return ptr; |
511 | } | 511 | } |
512 | 512 | ||
513 | static u8 *create_uuid128_list(struct hci_dev *hdev, u8 *data, ptrdiff_t len) | ||
514 | { | ||
515 | u8 *ptr = data, *uuids_start = NULL; | ||
516 | struct bt_uuid *uuid; | ||
517 | |||
518 | if (len < 18) | ||
519 | return ptr; | ||
520 | |||
521 | list_for_each_entry(uuid, &hdev->uuids, list) { | ||
522 | if (uuid->size != 128) | ||
523 | continue; | ||
524 | |||
525 | if (!uuids_start) { | ||
526 | uuids_start = ptr; | ||
527 | uuids_start[0] = 1; | ||
528 | uuids_start[1] = EIR_UUID128_ALL; | ||
529 | ptr += 2; | ||
530 | } | ||
531 | |||
532 | /* Stop if not enough space to put next UUID */ | ||
533 | if ((ptr - data) + 16 > len) { | ||
534 | uuids_start[1] = EIR_UUID128_SOME; | ||
535 | break; | ||
536 | } | ||
537 | |||
538 | memcpy(ptr, uuid->uuid, 16); | ||
539 | ptr += 16; | ||
540 | uuids_start[0] += 16; | ||
541 | } | ||
542 | |||
543 | return ptr; | ||
544 | } | ||
545 | |||
513 | static void create_eir(struct hci_dev *hdev, u8 *data) | 546 | static void create_eir(struct hci_dev *hdev, u8 *data) |
514 | { | 547 | { |
515 | u8 *ptr = data; | 548 | u8 *ptr = data; |
@@ -555,6 +588,7 @@ static void create_eir(struct hci_dev *hdev, u8 *data) | |||
555 | 588 | ||
556 | ptr = create_uuid16_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); | 589 | 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)); | 590 | ptr = create_uuid32_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); |
591 | ptr = create_uuid128_list(hdev, ptr, HCI_MAX_EIR_LENGTH - (ptr - data)); | ||
558 | } | 592 | } |
559 | 593 | ||
560 | static int update_eir(struct hci_dev *hdev) | 594 | static int update_eir(struct hci_dev *hdev) |