I installed bluez-5.15 from source with the following configuration:
$ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc \
--localstatedir=/var --libexecdir=/lib --disable-systemd
Then I had to copy gatttool manually into the /usr/local/bin dir
$ 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 then I tried to connect with 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?
First off, I spoke with a colleague about my configuration and for Raspbian (or more specifically, Debian) he recommended the following configuration settings:
Afterward, upon further inspection, here is how I was able to successfully connect. So what was happening was that the device I was trying to connect to (an NRF-based BLE device) required the LE address flag to be set to 'random'. See below:
Then the result:
Huzzah! Also, there may be a need to set the security level to something lower than high:
From my experience with Bluez 5.15
I believe earlier versions of Bluez required hcitool lecc step, but it is not the case anymore.