Difference between hcitool scan and inq

ChrisVollo picture ChrisVollo · Oct 20, 2014 · Viewed 11.8k times · Source

Looking at the hcitool command on linux, what is the technical difference between

hcitool scan 

and

hcitool inq

I understand in bluetooth the remote devices respond to an inquiry from the local device (Inquiry scan mode). What is a "scan" from the local device though, and how does it differ from an inquiry?

Answer

Jonathan Davies picture Jonathan Davies · Dec 18, 2014

First off - sorry this is a late answer, I am a new member here.

hcitool scan scans for any device and returns the name and the MAC address.

hcitool inq inquires about a device, and receives the MAC address, clock offset and class. The clock offset can be ignored as it's just a low-level value. Whereas the class tells you what type of device you are talking too, whether it be a bluetooth headset, phone or speakers etc.

However, if you are trying to scan for a Bluetooth Low Energy (BLE), none of the above commands will work. You can use the following command to do so:

hcitool lescan

And if you wish to connect to a BLE energy device, use:

hcitool lecc 00:11:22:33:44:55

OR gatttool works with any Bluetooth device:

sudo gatttool -b 00:11:22:33:44:55 –I

With gatttool, you can read, write and arithmetic with the device.

Update:

If you want to break it down to the lower level, view this code.

Line 435 for inq.

Line 521 for scan.