Just before I continue, I am by no means a Linux guru; so if anyone sees something that is incorrect, or has a better understanding of what the issue is please let me know!
THE PROBLEM
When trying to use the default GUI Bluetooth connection program, gnome-control-center bluetooth, to connect my keyboard, it would always fail pairing the device even though I was entering the passkey correctly.
Part of me thought that perhaps it was a user privilege problem, so I also tried running it as su and sudo to no avail.
There were plenty of websites suggesting to select the 'do not pair' option, which would require me re-connecting the keyboard every time I restarted the computer; this was simply not an acceptable option for me. As the device I was trying to connect was my input device, it was imperative to have it setup before logging in to the desktop environment.
After a couple of hours of trying different methods with the GUI, I gave up and decided to try with the terminal instead, although I thought it would behave the same as the UI. Part of me was a little stumped as to why it is not the case??
A GLIMMER OF HOPE
After reading around numerous websites, I stumbled across this one http://devasive.blogspot.com.au/2012/11 ... iring.html which apparently would solve my problem, especially seeming this was the very keyboard I was trying to pair. Unfortunately for whatever reason, the steps on this page did not solve my problem either. In fact, in one way it actually made my problem worse, by simply giving me a time out error with no other indication of what was happening with my Bluetooth device.
Digging a little bit deeper, I started to look up the Linux Bluetooth protocol on http://www.bluez.org and learnt about a few other packages/tools that could assist with the main program. Using Synaptic I downloaded two packages that seemed like a good place to start; albeit I only ended up using one of the packages to find a fix. Maybe the other package may provide useful for people who cannot get their devices to work properly.
- bluez-tools
Bluez-tools provides command line tools to functions of Bluetooth.
They are Bluetooth adapter control, Bluetooth agent, sound, input, network
and other.
bluez-hcidump
The hcidump utility allows the monitoring of Bluetooth activity. It
provides a disassembly of the Bluetooth traffic and can display packets
from higher level protocols such as RFCOMM, SDP and BNEP.
SOLUTION
So after a little bit of reading to work out how 'bluez-hcidump' tool worked, I came up with the following solution to pair my Bluetooth device to my computer.
- Turn on PC Bluetooth and set to discoverable
- Turn on Bluetooth device, and set to discoverable
- In a new terminal type:
and copy mac address XX:XX:XX:XX:XX:XX of the device
Code: Select all
hcitool scan
- Now in another terminal type (switches are for ascii output, and date stamped):
Code: Select all
sudo hcidump -at
- You should get output similar to what is posted below (followed by a blinking cursor):
HCI sniffer - Bluetooth packet analyzer ver 2.4
device: hci0 snap_len: 1028 filter: 0xffffffffffffffff - Assuming the device is on 'hci0', switch back to your original terminal and type:
Code: Select all
sudo bluez-simple-agent hci0 XX:XX:XX:XX:XX:XX
- Now in the hcidump terminal you will see a few things scroll past until you get something that looks like:
2013-02-07 15:35:40.653393 > HCI Event: User Passkey Notification (0x3b) plen 10
bdaddr XX:XX:XX:XX:XX:XX passkey xxxxxx - Type the 'passkey' in and press ENTER
- In the original terminal, on success you should get "Release" and "New device (/org/bluez/..."
- Now set device as trusted:
Code: Select all
sudo bluez-test-device trusted XX:XX:XX:XX:XX:XX yes
- You might have a connection now, but still need to:
Code: Select all
sudo bluez-test-input connect XX:XX:XX:XX:XX:XX