I would like to connect to a Bluetooth Low Energy (BTLE, Bluetooth Smart) device using a linux box with bluez and a bluetooth dongle. I have Orico BTA-402 dongle with CSR chipset; Ubuntu 14.04. I figured out how to make it the dongle appear as a device to a phone (hciconfig hci0 leadv 3).

What I would like is the opposite, for the dongle/linux box to scan for devices, connect to a device, enumerate characteristics, and read/write them. How do I do that?


The hcitool lescan answer is incomplete. it will loop. You want a timeout, but a timeout that will not cause issue to hcitool (the default signal would)

For 5 seconds:

timeout -s SIGINT 5s hcitool -i hci0 lescan --passive

Then you can use gatttool:

sudo gatttool -i hci1 -b BC:6A:29:AC:2E:B4 -I

For more details on what to do after the connect: http://joost.damad.be/2013/08/experiments-with-bluetooth-low-energy.html


Was demonstrated by jaredwolff you can use hcitool

hcitool lescan

Your device should show up like that: F4:C7:F8:0A:BF:C9 TWI. If don't show up, maybe it (the device that you are searching) isn't advertising itself.

To connect to a device you can use gatttool interative mode:

$ gatttool -I
[                 ][LE]> connect <BLE ADDRESS>

Inside gatttool you can use char-desc to obtain the available handles, char-read-hnd to read and char-write-req to write, see help to more details.

hciconfig hci0 up piscan  

(assuming that 'hci0' is the device name for your bluetooth dongle)

The switch 'piscan' enables both 'pscan' and 'iscan'.

Excerpt from manpage:

piscan Enable page and inquiry scan.

noscan Disable page and inquiry scan.

iscan Enable inquiry scan, disable page scan.

pscan Enable page scan, disable inquiry scan.

  • 1
    That's for BlueTooth classic, no? The question was about BlueTooth LE (also called BlueTooth Smart). – jch Jul 29 '16 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.