How to set bluez mode?

2019-08-08 02:34发布

问题:

There are some threads for how to apply bluez as ibeacon or BLE peripheral.

But when I use ble scanner (a BLE central application on Android), that reveal the bluz peripheral as dual mode.

How should I do to disable the classic mode in bluez?

回答1:

Since you are referring to that thread, you probably use hcitool to set the advertisement data and options.

You need to set change the Flag for BR/EDR support to 0. Thats Bit 2 of the Flags field (See Part A Supplement of the Bluetooth Core Spezification, p.12).

So the original 0x1A changes to 0x16:

Change

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 1a 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00

to

sudo hcitool -i hci0 cmd 0x08 0x0008 1e 02 01 16 1a ff 4c 00 02 15 e2 c5 6d b5 df fb 48 d2 b0 60 d0 f5 a7 10 96 e0 00 00 00 00 c5 00 00 00 00 00 00 00 00 00 00 00 00 00

Running btmon on another shell while executing the commands allows you to observe whats going on exactly.