Bluetooth mouse

From Gentoo Linux Wiki
Jump to: navigation, search

This article describes how to setup a bluetooth mouse.

Under Linux, bluetooth is managed by the BlueZ daemon (net-wireless/bluez).

This howto documents usage of >=bluez-4, which has been in the stable portage tree for a while now.

Contents

[edit] Kernel

The kernel configuration needs to be updated to enable the drivers for your bluetooth hardware, and the associated protocols.

Enable HIDP protocol in the kernel:

Linux Kernel Configuration: HIDP config
Networking  ---> 
  Bluetooth subsystem support  ---> 
    <*> L2CAP protocol support 
    <*> HIDP protocol support
          Special HID drivers  --->
                <*> ELECOM BM084 bluetooth mouse

You will also need a driver for your bluetooth device:

Linux Kernel Configuration: bluetooth device
Networking ---> 
  Bluetooth subsystem support ---> 
    Bluetooth device drivers

[edit] BlueZ

emerge bluez

The default configuration is fine and needs not be modified

Start the bluetooth service with:

/etc/init.d/bluetooth start

To make it permanent:

rc-update add bluetooth default

[edit] GUI configuration

There are many GUIs to configure bluetooth devices : blueman, gnome-bluetooth, kbluetooth bluedevil, and probably a few more.
Install one and it should not be difficult to add your mouse.

[edit] CLI Configuration

Configuration can either be performed using the BlueZ test programs (available if you enable the test-programs USE flag for bluez, or by using the D-Bus API. The first way is described here.

The first thing to do is to retrieve the address of the mouse. Most of the devices need you to press a special button, possibly for several seconds, to render them discoverable.

hcitool scan

The address looks like 11:22:33:44:55:66.

Then we need to pair the device:

simple-agent hci0 11:22:33:44:55:66

A PIN might be requested, if you don't know the PIN, then it is probably 0000.

Now we mark the device a trusted so it can connect automatically:

bluez-test-device trusted 11:22:33:44:55:66 yes

And finally we connect the device (this only needs to be done once, it will be done automatically after that):

bluez-test-input connect 11:22:33:44:55:66

And that's it, the mouse should work immediately for your current session, and automatically after a reboot.

[edit] Troubleshooting

[edit] Bluetooth working (ie. `hcitool dev` lists the device and `hcitool scan` does find devices) but the bluetooth tray icon (from gnome-bluetooth or gnome-shell) just don't show up.

Your user needs access to bluetooth and rfkill. Add the user to the `plugdev` group.

[edit] External links

Gentoo Bluetooth Guide
Archlinux bluetooth mouse howto (D-Bus is used there)
D-Bus API for bluetoothd

Personal tools
In other languages