Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blescan

Scan for nearby BLE (Bluetooth Low Energy) devices and explore their GATT profiles from the command line.

Requirements

  • Linux with BlueZ 5.x (bluetoothd running)
  • A Bluetooth adapter (hciconfig shows it up and running)
  • Rust toolchain

Build

make

The first build downloads dependencies and compiles them, which may take several minutes on slower hardware such as a Raspberry Pi 4. Subsequent builds are much faster.

Install

sudo make install

Installs the binary to /usr/local/bin/blescan and the man page to /usr/local/share/man/man1/blescan.1.gz.

Debian package

To build a .deb package (requires dpkg-deb, standard on Debian/Ubuntu/Raspberry Pi OS):

make deb

This produces blescan_1.0.0_arm64.deb (architecture is detected automatically). Install it with:

sudo dpkg -i blescan_1.0.0_arm64.deb

Usage

Scan for nearby BLE devices:

$ blescan
Scanning for BLE devices... (5s)
Found 2 device(s):
  AA:BB:CC:DD:EE:FF - My Sensor (-72 dBm)
  11:22:33:44:55:66 - Unknown (-85 dBm)

To explore a device's GATT profile:
  blescan <address>

Enumerate a device's GATT profile:

$ blescan AA:BB:CC:DD:EE:FF
Connecting to AA:BB:CC:DD:EE:FF...
Waiting for GATT services...

GATT profile for AA:BB:CC:DD:EE:FF:

Service: 0x1800 - Generic Access
  Characteristic: 0x2A00 - Device Name [read]
    Value: "My Sensor"
  Characteristic: 0x2A01 - Appearance [read]
    Value: 00 00

Service: 0x180A - Device Information
  Characteristic: 0x2A29 - Manufacturer Name String [read]
    Value: "ACME Corp"
  Characteristic: 0x2A26 - Firmware Revision String [read]
    Value: "1.2.3"

Service: 0x180F - Battery Service
  Characteristic: 0x2A19 - Battery Level [read, notify]
    Value: 64

Permissions

By default blescan needs root to access Bluetooth. To run without sudo, add yourself to the bluetooth group and re-login:

sudo adduser $USER bluetooth

Tested on

  • Raspberry Pi 4 (Raspberry Pi OS, arm64)
  • BlueZ 5.82

About

A Linux Bluetooth BLE scanner to show GATT structure.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages