CreatorDev / openwrt

Linux distribution for embedded devices
https://openwrt.org
GNU General Public License v2.0
3 stars 15 forks source link

BLE connect sometimes does not work #256

Closed mtusnio closed 7 years ago

mtusnio commented 7 years ago

Running this command: gatttool -b -I

And then typing "connect" usually gives: Attempting to connect to D0:B5:C2:B1:A6:77 Error: connect: Connection refused (146)

However, in some cases flashing a brand new image makes it work and BLE has no issues connecting.

Shpinkso commented 7 years ago

@tjobanpu please update with the latest information

tjobanpu commented 7 years ago

There was a race condition between the driver and the initialisation scripts, when the driver was enumerating the controller, the bt initialize script pulled the interface down using the "hciconfig hci0 reset" command, the bluetoothd daemon application is not able to find any controller. The solution is to first ensure that the driver has been loaded then initialize the BT controller , then enable the bluetoothd bluez daemon and then configure the interface