summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@codecoup.pl>2016-09-19 20:25:54 +0200
committerMarcel Holtmann <marcel@holtmann.org>2016-09-19 20:33:27 +0200
commit6a9e90bff9cfb33d5939c29e5bf2674c9176365d (patch)
tree0409b06e690dd0f877c06c1535fb6969570d847b /net/bluetooth
parentcde7a863d36a4a629c111f37edc2297d6b822a82 (diff)
downloadlinux-stable-6a9e90bff9cfb33d5939c29e5bf2674c9176365d.tar.gz
linux-stable-6a9e90bff9cfb33d5939c29e5bf2674c9176365d.tar.bz2
linux-stable-6a9e90bff9cfb33d5939c29e5bf2674c9176365d.zip
Bluetooth: Add appearance to Read Ext Controller Info command
If LE is enabled appearance is added to EIR data. Signed-off-by: MichaƂ Narajowski <michal.narajowski@codecoup.pl> Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 2b6fe10256b9..d3837e0633af 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -878,6 +878,16 @@ static inline u16 eir_append_data(u8 *eir, u16 eir_len, u8 type, u8 *data,
return eir_len;
}
+static inline u16 eir_append_le16(u8 *eir, u16 eir_len, u8 type, u16 data)
+{
+ eir[eir_len++] = sizeof(type) + sizeof(data);
+ eir[eir_len++] = type;
+ put_unaligned_le16(data, &eir[eir_len]);
+ eir_len += sizeof(data);
+
+ return eir_len;
+}
+
static u16 append_eir_data_to_buf(struct hci_dev *hdev, u8 *eir)
{
u16 eir_len = 0;
@@ -887,6 +897,10 @@ static u16 append_eir_data_to_buf(struct hci_dev *hdev, u8 *eir)
eir_len = eir_append_data(eir, eir_len, EIR_CLASS_OF_DEV,
hdev->dev_class, 3);
+ if (hci_dev_test_flag(hdev, HCI_LE_ENABLED))
+ eir_len = eir_append_le16(eir, eir_len, EIR_APPEARANCE,
+ hdev->appearance);
+
name_len = strlen(hdev->dev_name);
eir_len = eir_append_data(eir, eir_len, EIR_NAME_COMPLETE,
hdev->dev_name, name_len);