Friday, December 30, 2011

Bluetooth link key types

From http://lxr.linux.no/#linux+v3.1.6/include/net/bluetooth/hci.h#L254 :


/* Link Key types */
#define HCI_LK_COMBINATION        0x00
#define HCI_LK_LOCAL_UNIT        0x01
#define HCI_LK_REMOTE_UNIT        0x02
#define HCI_LK_DEBUG_COMBINATION    0x03
#define HCI_LK_UNAUTH_COMBINATION    0x04
#define HCI_LK_AUTH_COMBINATION        0x05
#define HCI_LK_CHANGED_COMBINATION    0x06

Pairing Bluetooth devices from command line

Following appear to be commands required to trigger pairing process from the command line:

hcitool cc <bdaddr>; hcitool auth <bdaddr>

Commands must be on the same line, separated by the semicolon, as described in previous post.

At this point, Bluez auth agent should kick in, asking for a code, if you have GUI one.

I found a page which suggests that only "hcitool cc" was enough for the author to trigger pairing, this could be explained by the fact that prior to 2.1, Bluetooth supported security modes which could protect either entire device access or just some of its profiles.