Linux Bluetooth l2ping with signal strength (without connecting?)

Tom picture Tom · Oct 2, 2011 · Viewed 11.3k times · Source

For any Linux BlueZ/BT experts here:

I'm looking for a way to "ping" known BT devices (known BDADDR) and if they are in range I'd like to know the approximate signal strength.

I know that I could first run l2ping, then establish a connection to the device and finally check the rssi or link quality if the connection worked without pairing first.

However what I'm looking for is a way of getting the signal strength without connecting to the device first. Perfect would be a signal strength measurement from the l2ping reply packet, but I don't know if that info is available at all and passed along the stack.

Answer

TJD picture TJD · Oct 3, 2011

You can obtain RSSI during inquiry scan, without connecting to devices. Here's an example using pybluez. You could also do the same thing directly from C using Bluez on linux.

inquiry-with-rssi.py