Howto: Setup and Install Bluetooth Keyboard and mouse in Ubuntu Fiesty, Gibbon, and Hardy Heron



If you love technology like me, you got a few bluetooth things controlling your cyberlife.

If you have a Bluetooth Keyboard and Mouse here is the howto setup in Ubuntu.


We need the MAC address (e.g. 00:00:00:00:00) of the mouse and keyboard.You can use KEYBOARD_ADDR and MOUSE_ADDR where you should find the addresses for the keyboard and mouse respectively. Press the button on the mouse that makes it visible to be found by the computer. Do the same for the keyboard. Now open a terminal window and run the following command

hcitool scan

Scanning …
KEYBOARD_ADDR Microsoft Wireless Keyboard
MOUSE_ADDR Microsoft Mouse

Adding the Keyboard and Mouse

Now we need to add the keyboard and mouse to the bluetooth configuration files. Run the following command to pop up GEdit

sudo gedit /etc/bluetooth/hcid.conf

You may be asked for your password, this is because we used sudo.

At the end of the file, add the following (replacing KEYBOARD_ADDR and MOUSE_ADDR for the keyboard and mouse MAC addresses as found earlier)

device KEYBOARD_ADDR {
name “Microsoft Wireless Keyboard”;
auth enable;
encrypt enable;
}

device MOUSE_ADDR {
name “Microsoft Mouse”;
}

Now you need to restart the bluetooth subsystem so that it refreshes it’s configuration file.

sudo /etc/init.d/bluez-utils restart

* Restarting Bluetooth services… [ ok ]

Pairing the Devices

You now need to pair the devices with the computer. Do not press any buttons on the keyboard as we’ll need to use it to enter a passcode so we can pair. Run the following command

sudo hidd --search

Searching …
Connecting to device MOUSE_ADDR
Connecting to device KEYBOARD_ADDR

They could pair with the computer in any order, you will need to remember which one is the keyboard. As soon as Connecting to device KEYBOARD_ADDR appears you must enter a PIN code into the keyboard. It must consist of numbers not using the numpad, somewhere between 4 and 8 should be fine. Type this number in to the keyboard and press Return.

A window should pop up on your computer asking you for the number you just entered on the keyboard.

You should now be set up. The devices should automatically reconnect when they go to sleep and when your computer boots up.

Troubleshooting

If you have followed all the steps above and you find your mouse or keyboard don’t automatically reconnect, we can fix it. Run the following command in a terminal

sudo gedit /etc/default/bluez-utils

Find the following lines

HIDD_ENABLED=0
HIDD_OPTIONS=”…”

Change them to

HIDD_ENABLED=1
HIDD_OPTIONS=”--master --connect KEYBOARD_ADDR --connect MOUSE_ADDR --server”

Now reboot and hopefully they’ll automatically connect (give them a few seconds to connect after you move the mouse/press a key).

Clicky Web Analytics