1

I'm trying to connect to a device using gatttool on Linux. I run hcitool lescan to get the device MAC address, and then gatttool -i hci1 -b <macaddr> -t random -I. Then I type connect. I see [CON] as expected, but the problem is that it disappears automatically after about 1s, with no error messages. I have been searching for hours, but I don't see why that is so?

Note: I have run hcitool lecc before running gatttool one time just to try it, but it seems to me that since then, gatttool connection is not working properly anymore (unexpected disconnection as explained above). Is it because I have used hcitool lecc? If yes, is there a way to "undo" it?

Richard
  • 8,961
  • 3
  • 38
  • 47
watiss
  • 111
  • 1
  • 6

1 Answers1

2

Not sure if this helps you because I'm seeing this behavior on my Raspberry Pi (an up-to-date wheezy version) and bluez 5.18 (released April 2014.)

  1. I can connect to my BLE peripheral from the command line after doing an lecc without any problems. I don't think you need to reset after an lecc. Regardless, if you do want to reset your BT dongle because it is in some funky state, look at this excellent step-by-step guide to reset the BT dongle. I have followed these steps with consistent results.

  2. I can connect and query say primary but more often than not, the connection drops before I can manually type in primary. See the results below. If I use the up/down arrows after connecting to quickly scroll to primary, I am able to see primary services offered by this peripheral without any problems.

~ $ sudo gatttool -I -i hci0 -m 48 -b 20:CD:39:A8:11:AF

[20:CD:39:A8:11:AF][LE]> connect

Attempting to connect to 20:CD:39:A8:11:AF

Connection successful

[20:CD:39:A8:11:AF][LE]> primary

Command Failed: Disconnected

Community
  • 1
  • 1
Sai Ramachandran
  • 393
  • 4
  • 12
  • Finally I changed my board because I aboslutely didn't see where the porblem came from... The same set of commands runs perfectly on my new board, so I guess it was more of a hardware bug with the faulty board which made it disconnect for no reason after some seconds.. – watiss May 24 '14 at 18:40