Trying to continuously list all bluetooth devices in range on a Raspberry Pi. I don't need to monitor any traffic, just list the devices. My hope is that I can get that information from the advertisement packets (frames?).

I did some experiments on Ubuntu 18.04 and was able to see those packets in Wireshark, but not until I had the system actively scan for bluetooth devices. Is there a way to just passively receive those advertisements, or to have the system continuously scan? I'd like to be able to trigger it from a shell script.

Ideally I'd have a shell script run tshark with the appropriate filters and get output including any devices advertising their presence. If there's some reason that won't work, I am game to write a custom program to do this.

I'm not really clear why the system is not receiving anything from bluetooth until I scan for devices, and if there's a way to enter this mode from a script. From there I guess the question is whether tshark can do what I need or if it will have to be a program.

All the bluetooth instructions I've found so far would have me using a GUI to start scanning. I haven't seen anything that tells me how to control this more directly.


2 Answers 2


Well this is what I came up with that seems to work:

bluetoothctl scan on

sudo tshark -i bluetooth1 -Y "bthci_evt.le_meta_subevent == 0x2" -T fields -e bthci_evt.bd_addr -e bthci_evt.rssi

This gives me the MAC address and signal strength. However I found that when using the in-built bluetooth on the pi it would stop working after a short while. I could restart the service and get it to go for a little while again, but it would shortly quit each time.

However with a cheap USB bluetooth dongle it seems to just run forever. That's why I'm sniffing on bluetooth1 instead of bluetooth0. Time will tell if this is a good permanent solution but so far it seems to work.


I tried fuzzboil's solution on a Raspberry Pi 4B but listened on bluetooth0 and had no issues with reliability so the built-in bluetooth module worked fine for me and I didn't need to get an external USB bluetooth module.

However, with the filter specified in their answer, I couldn't get a list of all Bluetooth devices and only BLE devices showed up.

With this command, you can get a list of all (BLE and non-BLE) devices to show up with their MAC address, RSSI and name.

sudo tshark -i bluetooth0 -Y "(bthci_evt.code == 0x2f) || (bthci_evt.le_meta_subevent == 0x2 && btcommon.eir_ad.entry.device_name != '')" -T fields -e bthci_evt.bd_addr -e bthci_evt.rssi -e btcommon.eir_ad.entry.device_name

The output looks like this:

d1:6e:XX:XX:XX:XX   -65 Mi Smart Band 4
8c:5a:XX:XX:XX:XX   -43 Mi Soundbar
c5:9d:XX:XX:XX:XX   -69 ENDURE
d1:6e:XX:XX:XX:XX   -61 Mi Smart Band 4
8c:5a:XX:XX:XX:XX   -47 Mi Soundbar

Add -e btcommon.cod.class_of_device -e btcommon.cod.minor_device_class to the end of the command to show additional information for non-BLE devices.

Additional resources:

  1. Wireshark - Bluetooth HCI Event
  2. HCI Interface
  3. Installing Wireshark on Raspberry Pi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .