HCI Tools & Bluez



About


Playing around with your bluetooth devices using bluez and the HCI (Human Computer Interaction) tools on linux.


Bluez

Websitehttp://leddartech.com/


HCI Tools

Installation
sudo apt-get install bluez python-gobject python-dbus


Find Devices
$ hcitool dev
    Devices:
        hci0    00:01:95:25:76:34
$ hciconfig -a hci0 
hci0:   Type: BR/EDR  Bus: USB
        BD Address: 00:01:95:25:76:34  ACL MTU: 310:10  SCO MTU: 64:8
        UP RUNNING PSCAN 
        RX bytes:1013 acl:0 sco:0 events:57 errors:0
        TX bytes:2463 acl:0 sco:0 commands:54 errors:0
        Features: 0xff 0xff 0x8f 0xfe 0xdb 0xff 0x5b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
        Link policy: RSWITCH HOLD SNIFF PARK 
        Link mode: SLAVE ACCEPT 
        Name: 'snorriwork-0'
        Class: 0x740100
        Service Classes: Rendering, Object Transfer, Audio, Telephony
        Device Class: Computer, Uncategorized
        HCI Version: 4.0 (0x6)  Revision: 0x2031
        LMP Version: 4.0 (0x6)  Subversion: 0x2031
        Manufacturer: Cambridge Silicon Radio (10)
$ hcitool scan
Scanning ...
        24:DF:6A:63:4E:A7       Nexus 6P


Low Energy Commands
$ sudo hciconfig hci0 lestates
Supported link layer states:
        YES Non-connectable Advertising State
        YES Scannable Advertising State
        YES Connectable Advertising State
        YES Directed Advertising State
        ....
$ sudo hcitool lescan
LE Scan ...
 
# To enable advertising
$ sudo hciconfig hci0 leadv
# Scan on another bluetooth device
$ sudo hcitool lescan
# To disable advertising
$ sudo hciconfig hci0 noleadv


Gattool

Other