Apple Wireless Keyboard And Ubuntu 9.1
Today, I got my shiny new Apple Wireless Keyboard. I just completed the setup, and it went fairly smoothly. There are plenty of tutorials on the net about pairing this keyboard with Ubuntu, but none (that I could find) on specifically pairing the keyboard with version 9.1. If you follow this tutorial in 9.1 you will run into a few problems, as you will be missing a few files. The Bluetooth file structure is a little bit different in Karmic, and there are a few configuration files you might want to edit, but will be unable to find. This includes the “hcid.conf” file and the “default bluetooth” file as well. Okay, the first step to paring your keyboard is to install “bluez-compat” and “bluez” (these are separate packages). Both packages can be found in Synaptic, or by typing:
sudo apt-get install bluez-compat bluez
Now type:
hcitool scan
to make sure that your Bluetooth dongle does, indeed detect your keyboard. It should be called “Apple Wireless Keyboard”. At this point you should make sure you have both packages installed, or this will not work. Now, simply go to your terminal and type:
sudo hidd --search
The “sudo” part is VERY important because if you do not use sudo, you will get a “permission denied” error. Of course you could login as root if you really wanted, but we all know how dangerous that is!
After it connects, you should be paired automatically. Some people have directly used the GUI package “Blueman” to configure their keyboard, but that did not work for me. The default Bluetooth manager in Ubuntu seemed to work even worse. And that’s all there is to it! Now that you have successfully paired the keyboard, the next step is to write a simple shell script to connect the keyboard without typing the full “sudo hidd –search” command. Simply open up your favorite text editor (Nano of course!) and write the following:
#!/bin/sh
sudo hidd --search
Give the script whatever name you want, just make sure it is saved “.sh”. I called mine “keyboard.sh”. Make the script executable, then edit your sudoers file to add an exception to the “hidd” command, so you can run the script as root without a password. Whenever you wish to connect the keyboard you can simply double click the script and pair your keyboard! I have included an some pictures below, as well as an image of my keyboard script. If you ran into any issues leave a comment below. Happy Typing!