Bluetooth LE on Raspbian

I installed bluez-5.15 from the source with the following configuration:

$ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc \
--localstatedir=/var --libexecdir=/lib --disable-systemd

Then I had to manually copy gatttool to the / usr / local / bin directory

$ sudo cp attrib/gatttool /usr/local/bin/

I rebooted the Raspberry Pi and tried the following to connect to my BLE device:

$ sudo hciconfig hci0 up

$ sudo hcitool lescan
LE Scan ...  
EA:FB:B5:CE:B0:13 DfuTarg

$ sudo hcitool lewladd EA:FB:B5:CE:B0:13

$ sudo hcitool lecc EA:FB:B5:CE:B0:13
Could not create connection: Input/output error

So, I tried connecting to gatttool:

$ gatttool -b EA:FB:B5:CE:B0:13 --interactive
[EA:FB:B5:CE:B0:13][LE]> connect
Attempting to connect to EA:FB:B5:CE:B0:13
Error: connect error: Device or resource busy (16)
[EA:FB:B5:CE:B0:13][LE]>

What am I missing here - is this a configuration issue? What do the errors mean?

+4
source share
2 answers

First, I talked with a colleague about my configuration, and for Raspbian (or, more specifically, Debian), he recommended the following settings:

./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-library --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd

, , . , , ( BLE NRF), , LE "random". . :

gatttool -t random -b EA:FB:B5:CE:B0:13 -I

:

[EA:FB:B5:CE:B0:13][LE]> connect
Attempting to connect to EA:FB:B5:CE:B0:13
Connection successful
[EA:FB:B5:CE:B0:13][LE]> characteristics
handle: 0x0002, char properties: 0x0a, char value handle: 0x0003, uuid: 00002a00
-0000-1000-8000-00805f9b34fb

! , - , :

[EA:FB:B5:CE:B0:13][LE]> sec-level medium
+11

Bluez 5.15

  • , BLE ( hcitool con).
  • hcitool lecc.
  • gatttool, .
  • gatttool run connect. , ( SensorTag).

, Bluez hcitool lecc step, .

+5

Source: https://habr.com/ru/post/1530353/


All Articles