Skip to content

Instantly share code, notes, and snippets.

@noahp
Last active April 11, 2019 14:23
Show Gist options
  • Save noahp/85566fc8e04624785f8321022b05ecf1 to your computer and use it in GitHub Desktop.
Save noahp/85566fc8e04624785f8321022b05ecf1 to your computer and use it in GitHub Desktop.
Crummy script for ble read on linux
#/bin/bash
BTMGMT=btmgmt
BTADDR=$1
# hard reset the local HCI device, this helps ensure it's in a usable state
sudo $BTMGMT -i hci0 power off
sudo $BTMGMT -i hci0 le on
sudo $BTMGMT -i hci0 name "bt_adapter"
sudo $BTMGMT -i hci0 bredr off
sudo $BTMGMT -i hci0 sc off
sudo $BTMGMT -i hci0 bondable on
sudo $BTMGMT -i hci0 power on
# forever read characteristic handle 0x41 as fast as we can
while true;
do sudo gatttool -t random -b $BTADDR --char-read -a 0x41
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment