2012-12-27 13:36:57

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH 1/2 v1] Bluetooth: Fix to update EIR for uuid16

If we register a uuid other than uuid16, especially custom 128 bit uuid
then EIR is not updating properly.

After registering a 16 bit uuid. ex: "sdptool add SP", we can see the
uuid16 in the EIR as shown below.
< 0000: 01 52 0c f1 00 08 09 52 65 64 77 6f 6f 64 15 03 .R.....Redwood..
0010: 01 11 32 11 2f 11 06 11 05 11 0a 11 0e 11 0c 11 ..2./...........
0020: 1f 11 12 11 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00f0: 00 00 00 00 00 .....
> 0000: 04 0e 04 01 52 0c 00 ....R..

But after register a user defined 128 bit uuid, EIR is not
updated.

< 0000: 01 52 0c f1 00 08 09 52 65 64 77 6f 6f 64 00 00 .R.....Redwood..
0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00f0: 00 00 00 00 00 .....
> 0000: 04 0e 04 01 52 0c 00 ....R..

With this fix, we can see the EIR is updated properly.

Signed-off-by: Syam Sidhardhan <[email protected]>
---
v1 -> Incorporated the comment mentioned by Johan.

net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f559b96..ab25edf 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -515,7 +515,7 @@ static void create_eir(struct hci_dev *hdev, u8 *data)

uuid16 = get_uuid16(uuid->uuid);
if (uuid16 == 0)
- return;
+ continue;

if (uuid16 < 0x1100)
continue;
--
1.7.9.5



2012-12-27 13:36:58

by Syam Sidhardhan

[permalink] [raw]
Subject: [PATCH 2/2] Bluetooth: Update management interface revision

This enable us to introduce a check in user space to know
whether it's safe to pass non-16bit UUID's to kernel or not.
Currently the kernel support only 16bit UUID's in the EIR.

Signed-off-by: Syam Sidhardhan <[email protected]>
---
net/bluetooth/mgmt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index ab25edf..ba7c38a 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -35,7 +35,7 @@
bool enable_hs;

#define MGMT_VERSION 1
-#define MGMT_REVISION 2
+#define MGMT_REVISION 3

static const u16 mgmt_commands[] = {
MGMT_OP_READ_INDEX_LIST,
--
1.7.9.5