0

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?

Community
  • 1
  • 1
peteey
  • 420
  • 4
  • 14
  • Does RPi use udev? If so you can write a udev rule to bring up the hci interface whenever the kernel sees a new one. Something like: `ACTION=="add", KERNEL=="hci*", RUN+="/bin/hciconfig %k up"` – kaylum May 28 '15 at 06:51
  • Could you explain this? I do not know what udev is or where this rule should be written – peteey Jun 04 '15 at 15:11
  • [udev](https://www.kernel.org/pub/linux/utils/kernel/hotplug/udev/udev.html) is a Linux device management system. Of relevance here is that it can do user level device event notification. So you can run a script whenever a device is detected or removed. So place the above command into a udev rule file. Naming is similar to the rc files in that the name determines the order of processing. In your case it probably doesn't matter so place the above command into something like `/etc/udev/rules.d/90-hci.rules`. That rule will bring up any bluetooth adapter that is inserted. – kaylum Jun 05 '15 at 00:27

1 Answers1

-1

I hope this will work sudo cp attrib/gatttool /usr/bin/

Jagdish
  • 160
  • 3
  • 13
  • I can find the gatttool and run it. gatttool is the program that gives the error "host is down" – peteey Jun 04 '15 at 15:10
  • I was compiling 5.30 from source. This creates a permissions problem. I forgot to mention in my original post (edited now). Is there a way to install v5.30 using "apt-get install" instead of the default older version? – peteey Jun 11 '15 at 16:09