I cannot get Bluetooth working consistently on a Raspberry Pi. Installing bluez with "apt-get install bluez" renders gatttool useless. I always get the error "host is down". This has been addressed in another post: BLE gatttool cannot connect even though device is discoverable with hcitool lescan
Their solution was to install bluez v5.30 by compiling the source. This causes the Pi to not automatically power up the bluetooth device (a USB dongle). I have to enable the dongle with "sudo hcitool device up". It is extremely inconvenient to type in the command line with root permissions every time my Pi is turned on or has its dongle removed.
Does anyone have a solution where both gatttool works and bluetooth devices are automatically recognized and enabled?
ACTION=="add", KERNEL=="hci*", RUN+="/bin/hciconfig %k up"
– kaylum/etc/udev/rules.d/90-hci.rules
. That rule will bring up any bluetooth adapter that is inserted. – kaylum