August 18, 2007 · General · Email This Post

Sponsored Link
If you have a Bluetooth Keyboard and Mouse here is the procedure to follow 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).

Sponsored Link

Incoming search terms:

Related posts

50 Comments to “Howto Setup Bluetooth Keyboard and Mouse in Ubuntu”

  1. Jason says:

    I’m using ubuntu 8.1. Got it working thanks to the guide, bluetooth keyboard and mouse would work at boot. But had a power failure, then it stopped working automatically. I’ve been through the files etc. I log on using a PS2 keyboard and mouse then try to restart bluetooth etc. It just doesn’t seem to start them up. If I unplug bluetooth adaptor and re plug it back in again all starts up. Once they are running I can stop bluetooth services and they still continue to work.

    Any ideas.

    Also sometimes I get the first key I press on a line will be a double character ie jason@jason-desktop:~$ lls

    I’ve only type ls, but it comes out double. Gets a little annoying sometimes as I have to go back and delete.

    [Reply]

  2. DrFunn says:

    I am running Ubuntu 8.04 Hardy Heron and pairing my Microsoft Bluetooth Mouse to my Dell Latitude D800 was this simple:

    1) Press “make connection” button on the bottom of the mouse
    2) open a terminal window from the Applications > Accesories > Terminal
    3) type “sudo hidd –search” and your admin password when sudo asks for authority to mess with the system

    hidd identified the MAC address of the mouse AA:BB:CC:DD:EE:FF and immediately connects.

    1) To make it permanent type “sudo gedit /etc/default/bluetooth” to launch a text editor with the bluetooth config file
    2) midway down enable the hidd server and point it to your bluetooth device:
    # HID daemon

    HIDD_ENABLED=1
    HIDD_OPTIONS=”-i AA:BB:CC:DD:EE:FF –server”

    where you should edit in your actual Mouse MAC address (example 00:0d:3a:a2:75:bf) in place of AA:BB:CC:DD:EE:FF

    3) save the file and exit

    That worked quite well for me!

    – Dr Funn -

    [Reply]

  3. Murphy says:

    I’m on Debian Lenny.

    “man hidd” shows that “-i” sets the _LOCAL_HCI_DEVICE_OR_BD_ADDRESS_ rather than the remote device address…

    HIDD_ENABLED=1
    HIDD-OPTIONS=”-i AA:BB:CC:DD:EE:FF --server”

    changed to

    HIDD_ENABLED=0
    HIDD_OPTIONS=”--connect AA:BB:CC:DD:EE:FF --server”

    Now it works for me beautifully~

    Debian based distros should try “--connect” than “-i”.

    [Reply]

  4. Stoffe says:

    I also have that double keypress thing in 8.10 with the bluetooth keyboard, wierd. :) It didn’t do that earlier? Guess I’ll have to see if there’s a bug for this.

    [Reply]

  5. mjkal says:

    got through stage 1 scaning and found address but once i enter sudo gedit it asks for the password but disables the keyboard i receive aflashing black cursor which will not accepet any input from keyboard i use laptop samsung x22 any ideas

    [Reply]

  6. Bill Salyers says:

    Hi, all;
    This was very helpful. I have my Microsoft Bluetooth Notebook Mouse 5000 connecting to my Ubuntu 8.10 Asus laptop without issue. However, I have partial functionality. The two main buttons work, but the scroll wheel and additional buttons do not. I’ve tried reinstalling bluez to no avail. Anyone with a similar experience or suggestions?
    Thanks in advance.

    [Reply]

  7. Ben says:

    mjkal, It is accepting input from your keyboard, but it turns of the echo for security purposes. Just type your password, even if you do not see it showing up.

    [Reply]

  8. Bill Salyers says:

    Just thought I’d try one more time. I’m booting into Vista more and more and my Ubuntu Jaunty (I upgraded) less and less, simply because my mouse won’t function completely in Jaunty. It’s a real pain when trying to scroll through a document or trying to play a round of Scorched 3D.

    Thanks.

    [Reply]

  9. I purchased a Razr ProClick Bluetooth Mobile Notebook Mouse about a month ago and have had a hell of a time trying to get it to work with my HP Mini 110 with MIE Ubuntu Hardy. I have read through this guide as well as many others and just cannot get the computer to locate the device…

    I have tried hcitool scan, it returns :No Such Device.
    I have tried hidd –search, it says Searching…and then goes to the next line and never finds anything. Both of these commands are issued after pressing the Connect button on the mouse.

    Does anyone have any advice for me? It would be greatly appreciated, thank you.

    [Reply]

  10. Dave T says:

    I too have a bluetooth mouse (kensington) and cannot get it to pair or sync.

    The above directions is exactly why Linux will never be accepted as a Mainstreem OS.

    I find it hard to believe that it is almost 2010 and we still have to deal with cryptic command line commands to get a mouse to work.

    My 2 cents.

    Dave

    [Reply]

  11. NorViking says:

    just wanted to say in the new Linux Mint version and probably in ubuntu, its much easier now!

    1. Turn on your mouse and push the “connection” button on the mouse so its flashing red and green.

    2. Click on the bluetooth logo on the desktop.

    3. Choose “set up new device”

    4. Locate the mouse and press forward.

    Now the mouse should work. If not do the guide above.

    [Reply]

  12. Dow H says:

    Laptop Dell XPS M1530 w/native Ubuntu 8.04
    has bluetooth enabled.

    Above procedure worked perfectly with MS Bluetooth Mouse 5000 OEM version.

    [Reply]

  13. Dow H says:

    Laptop Dell XPS M1530 w/native Ubuntu 8.04

    Found that reconnection after turning mouse off and then on, did not automagically happen. So, I added the lines described above to /etc/init.d/bluetooth and that worked. Now if bluetooth on the laptop is enabled, then turning on the mouse and clicking a button causes the mouse to get reconnected.

    [Reply]

  14. GS says:

    Dell mini 9 with ubuntu 8.04 pairs with the razer proclick mouse but then it won’t connect to the device using the blutooth manager. i tried manually adding mac address to config file and still can’t get it to connect.

    [Reply]

  15. bronskiy says:

    i have microsoft mouse 5000 and acer aspire one with ubuntu 10.04
    mouse work, but sometimes it has restarted. charge of battery is lowing faster, than in winxp.

    ps. sorry, for my English :)

    [Reply]

  16. sera says:

    ok i have a mini mac and my keyboard and mouse are wireless and my sisters smart phone asked to sync with my internet and i thought it was her laptop and i said yes, well after it took the sync off to the mouse and keyboard… and i tried going to settings to re sync the bluetooth but the option is not there anymore….. what do i do?

    [Reply]

  17. Jim Mears says:

    Also, I second what Dave said.

    [Reply]

  18. dnz says:

    dave, you are a fuckhead, go back to windows, these commands make perfect sense.

    [Reply]

  19. Mike Potapoff says:

    I found the easiest solution was to simply uninstall & purge the bluetooth libraries and let the iMac hardware take care the mouse and keyboard. The only problem with this is it won’t allow you any other bluetooth devices, but it will allow you to use the mouse and keyboard. The only thing you have to do to get them to connect is to click the mouse, and to tap a key on the keyboard and they will connect without the need to pair or anything.

    [Reply]

  20. Sridhar says:

    Useful information. Its worked for me.
    Thank you…

    [Reply]

Leave a Reply