Cannot connect to BLE device on Raspberry Pi
Fixed the connection refused (111) issue in my raspberry pi 3B running raspbian buster by Updating/installing BlueZ via apt-get
> sudo apt-get install --no-install-recommends bluetooth
and re running
> sudo gatttool -t random -b E9:1C:89:B7:16:F9 -I
I was able to connect via Bluetooth
from Raspberry
to my Android
device using gatttool
after setting the LE address type
to random
with the -t random
argument, i.e. :
sudo gatttool -t random -b DD:9D:0B:43:A1:77 -I
connect
From gatttool
man
--t, ---addr-type=[public | random]
# Set LE address type. Default: public
USAGE gatttool [OPTION...]
Help Options:
-h, --help Show help options
-h, --help Show help options
--help-all Show all help options
--help-gatt Show all GATT commands
--help-params Show all Primary Services/Characteristics
arguments
--help-char-read-write Show all Characteristics Value/Descriptor
Read/Write arguments
Application Options:
--i, ---adapter=hciX Specify local adapter interface
--b, ---device=MAC Specify remote Bluetooth address
--t, ---addr-type=[public | random] Set LE address type. Default: public
--m, ---mtu=MTU Specify the MTU size
--p, ---psm=PSM Specify the PSM for GATT/ATT over BR/EDR
--l, ---sec-level=[low | medium | high] Set security level. Default: low
--I, ---interactive Use interactive mode
I got it running with:
btmgmt le on
By default GATT is not enable. Add the below lines to /etc/bluetooth/main.conf
EnableLE = true // Enable Low Energy support. Default is false.
AttributeServer = true // Enable the GATT attribute server. Default is false.