Skip to content

Instantly share code, notes, and snippets.

@waitman
Created March 19, 2015 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waitman/d77440b82dcb2463e5c3 to your computer and use it in GitHub Desktop.
Save waitman/d77440b82dcb2463e5c3 to your computer and use it in GitHub Desktop.
First scan for available bt devices. This will report the BD_ADDR of each advertised interface on the network.
# hccontrol -n ubt0hci inquiry
Inquiry result, num_responses=1
Inquiry result #0
BD_ADDR: 00:1b:dc:06:94:d3
Page Scan Rep. Mode: 0x1
Page Scan Period Mode: 0x2
Page Scan Mode: 00
Class: ff:01:0c
Clock offset: 0x241a
Inquiry complete. Status: No error [00]
Next use sdpcontrol to scan each BD_ADDR for the availability of "Human Interface Device (0x1124)" in it's "Service Class ID List".
# sdpcontrol -a 00:1b:dc:06:94:d3 browse
Record Handle: 00000000
Service Class ID List:
Service Discovery Server (0x1000)
Protocol Descriptor List:
L2CAP (0x0100)
SDP (0x0001)
Bluetooth Profile Descriptor List:
Service Discovery Server (0x1000) ver. 1.0
Record Handle: 0x00000001
Service Class ID List:
Browse Group Descriptor (0x1001)
Record Handle: 0x00000002
Service Class ID List:
Human Interface Device (0x1124)
Protocol Descriptor List:
L2CAP (0x0100)
Protocol specific parameter #1: u/int/uuid16 17
HIDP (0x0011)
Bluetooth Profile Descriptor List:
Human Interface Device (0x1124) ver. 1.0
When you find the BD_ADDR with an HID device you wish to connect to your client, test with bthidcontrol.
# bthidcontrol -a 00:1b:dc:06:94:d3 query
device {
bdaddr 00:1b:dc:06:94:d3;
control_psm 0x11;
interrupt_psm 0x13;
reconnect_initiate false;
battery_power false;
normally_connectable false;
hid_descriptor {
0x05 0x01 0x09 0x06 0xa1 0x01 0x85 0x01
0x05 0x07 0x19 0xe0 0x29 0xe7 0x15 0x00
0x25 0x01 0x75 0x01 0x95 0x08 0x81 0x02
0x75 0x08 0x95 0x01 0x81 0x01 0x75 0x01
0x95 0x05 0x05 0x08 0x19 0x01 0x29 0x05
0x91 0x02 0x75 0x03 0x95 0x01 0x91 0x01
0x75 0x08 0x95 0x06 0x15 0x00 0x26 0xff
0x00 0x05 0x07 0x19 0x00 0x2a 0xff 0x00
0x81 0x00 0x75 0x01 0x95 0x01 0x15 0x00
0x25 0x01 0x05 0x0c 0x09 0xb8 0x81 0x06
0x09 0xe2 0x81 0x06 0x09 0xe9 0x81 0x02
0x09 0xea 0x81 0x02 0x75 0x01 0x95 0x04
0x81 0x01 0xc0
};
}
Finally add the HID device to /etc/bluetooth/bthidd.conf
# bthidcontrol -a 00:1b:dc:06:94:d3 query >> /etc/bluetooth/bthidd.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment