Difference between revisions of "Bluetooth mouse"

From ArchWiki
Jump to: navigation, search
(Installation)
(31 intermediate revisions by 17 users not shown)
Line 1: Line 1:
[[Category:Input devices (English)]]
+
[[Category:Mice]]
{{i18n_links_start}}
+
[[Category:Bluetooth]]
{{i18n_entry|English|Bluetooth Mouse}}
+
[[cs:Bluetooth Mouse]]
{{i18n_entry|Czech|Bluetooth myš}}
+
[[ru:Bluetooth Mouse]]
{{i18n_entry|Русский|Bluetooth-мышь}}
+
This article describes how to set up a [[Bluetooth]] mouse manually with no desktop assistance for Bluetooth. For example, a minimalist XFCE installation.  
{{i18n_links_end}}This article describes how to set up a bluetooth mouse with Arch Linux. I used a Logitech v270 with a Trendnet TBW-101UB USB Bluetooth dongle, but the general process should be the same for any model.
+
  
 +
== Installation ==
  
 +
You need the {{Pkg|bluez}} package and optionally the {{Pkg|bluez-utils}} package from the extra repository.
  
== Required software ==
+
Note: The following instructions only work for the {{Pkg|bluez4}} package.
  
You need the '''bluez-utils''' and '''bluez-libs''' packages from the extra repository. Looks like you also need '''D-Bus''' for automating things, otherwise hcid reports errors such as:  "hcid[14851]: Unable to get on D-Bus". Enabling D-Bus also solved problems for local bluetooth device recognition.
+
== Start Bluetooth service ==
  
== Configuration ==
 
 
The pertinent options in /etc/conf.d/bluetooth are  
 
The pertinent options in /etc/conf.d/bluetooth are  
 
  HIDD_ENABLE=true
 
  HIDD_ENABLE=true
 +
 
after that, start bluetooth services with
 
after that, start bluetooth services with
  /etc/rc.d/bluetooth start
+
  # systemctl enable bluetooth.service
 +
# systemctl start bluetooth.service
  
== Finding out your mouse's bdaddr ==
+
=== kernel modules ===
 +
No additional actions are necessary if the bluetooth service is started using systemd. If it does not work try following.
  
It is of the form ''12:34:56:78:9A:BC''. Either find it in the documentation of your mouse, on the mouse itself or with the '''hcitool scan''' command.
+
The command
 +
# modprobe -v btusb bluetooth hidp l2cap
 +
loads the kernel modules you need, if they were not loaded automatically.
  
== kernel modules ==
+
=== Test ===
 +
The following command should show your bluetooth adapter:
  
The command
+
{{hc|# hciconfig|
  # modprobe -v hci_usb bluetooth hidp l2cap
+
hci0: Type: BR/EDR  Bus: USB
loads the kernel modules you need, if they weren't loaded automatically.
+
      BD Address: 00:22:43:E1:82:E0  ACL MTU: 1021:8  SCO MTU: 64:1
 +
      UP RUNNING PSCAN
 +
      RX bytes:1062273 acl:62061 sco:0 events:778 errors:0
 +
      TX bytes:1825 acl:11 sco:0 commands:39 errors:0
 +
}}
  
(See below for some tips if you're stuck at this point)
+
== Configure Bluetooth Mouse ==
 +
The method described here is based in three steps, in this order:
 +
 
 +
# Make the PC learn about the bluetooth mouse.
 +
# Grant the mouse permissions to connect.
 +
# Make the mouse learn about the PC.
 +
 
 +
=== Search your mouse ===
 +
First make your mouse discoverable. For example some mouse need to press a button. Then issue the following command as root:
 +
 
 +
{{hc|# hcitool scan|
 +
Scanning ...
 +
        00:07:61:F5:5C:3D      Logitech Bluetooth Mouse M555b
 +
}}
 +
 
 +
Your mouse bluetooth address will be similar to {{ic|12:34:56:78:9A:BC}}. You may also find it in the documentation or on the mouse itself.
  
 
== Connecting the mouse ==
 
== Connecting the mouse ==
 
  hidd --search
 
  hidd --search
 
  hcitool inq
 
  hcitool inq
are good for device scanning.
+
are good for device scanning (I needed to use sudo for 'hidd --search' to automatically connect mouse, searching worked even without sudo).
 
  hidd --connect <bdaddr>
 
  hidd --connect <bdaddr>
 
to actually connect.
 
to actually connect.
 
  hidd --show
 
  hidd --show
will show your currently connected devices. The mouse should show up in this list. If it doesn't, press the reset button to make it discoverable.
+
will show your currently connected devices. The mouse should show up in this list. If it does not, press the reset button to make it discoverable.
  
 
Note: If you have the ipw3945 module loaded (wifi on HP computer) the bluetooth wont work.
 
Note: If you have the ipw3945 module loaded (wifi on HP computer) the bluetooth wont work.
Line 51: Line 76:
 
  /etc/rc.d/bluetooth start
 
  /etc/rc.d/bluetooth start
  
Note: The above instructions to start the mouse at startup don't work with the now outdated 3.11 bluetooth packages. New versions such as the current (3.32) packages are not affected. If you are using an older version, then to start the mouse at startup, add:
+
Note: The above instructions to start the mouse at startup do not work with the now outdated 3.11 bluetooth packages. New versions such as the current (3.32) packages are not affected. If you are using an older version, then to start the mouse at startup, add:
 
  hidd --connect <enter here your bluetooth mouse address (No capitals!!!)>
 
  hidd --connect <enter here your bluetooth mouse address (No capitals!!!)>
 
to your /etc/rc.local file.
 
to your /etc/rc.local file.
  
 
Note #2: You can connect any bluetooth mouse and/or keyboard without any further configuration and without knowing the device address. You can do it by adding the --master and/or --server option in HIDD_OPTIONS depending on your device.
 
Note #2: You can connect any bluetooth mouse and/or keyboard without any further configuration and without knowing the device address. You can do it by adding the --master and/or --server option in HIDD_OPTIONS depending on your device.
 +
 +
== Configuring through bluetoothctl ==
 +
Since `bluez>=5` there is bluetoothctl util, that provide simple interface to configuring bluetooth devices.
 +
 +
For example, configuring autoconnect bluetooth mouse can be done as described above:
 +
  # bluetoothctl
 +
  [bluetooth]# list
 +
  Controller <cmac> BlueZ 5.5 [default]
 +
  [bluetooth]# select <cmac>
 +
  [bluetooth]# power on
 +
  [bluetooth]# scan on
 +
  /// enable scanning mode on your mouse
 +
  [bluetooth]# devices
 +
  Device <mmac> Name: Bluetooth Mouse
 +
  [bluetooth]# trust <mmac>
 +
  [bluetooth]# pairable on
 +
  [bluetooth]# pair <mmac>
 +
  [bluetooth]# connect <mmac>
  
 
== Troubleshooting tips ==
 
== Troubleshooting tips ==
 +
=== Mouse lag ===
 +
If you experience mouse lag you can try to increase the polling rate. There is a wiki article describing the procedure: [[Mouse Polling Rate]].
  
 +
=== Problems with the USB dongle ===
 
If you have trouble with your USB dongle, you may also want to try
 
If you have trouble with your USB dongle, you may also want to try
 
  # modprobe -v rfcomm
 
  # modprobe -v rfcomm

Revision as of 00:52, 21 July 2013

This article describes how to set up a Bluetooth mouse manually with no desktop assistance for Bluetooth. For example, a minimalist XFCE installation.

Installation

You need the bluez package and optionally the bluez-utils package from the extra repository.

Note: The following instructions only work for the bluez4 package.

Start Bluetooth service

The pertinent options in /etc/conf.d/bluetooth are

HIDD_ENABLE=true

after that, start bluetooth services with

# systemctl enable bluetooth.service
# systemctl start bluetooth.service

kernel modules

No additional actions are necessary if the bluetooth service is started using systemd. If it does not work try following.

The command

# modprobe -v btusb bluetooth hidp l2cap

loads the kernel modules you need, if they were not loaded automatically.

Test

The following command should show your bluetooth adapter:

# hciconfig
hci0:  Type: BR/EDR  Bus: USB
       BD Address: 00:22:43:E1:82:E0  ACL MTU: 1021:8  SCO MTU: 64:1
       UP RUNNING PSCAN 
       RX bytes:1062273 acl:62061 sco:0 events:778 errors:0
       TX bytes:1825 acl:11 sco:0 commands:39 errors:0

Configure Bluetooth Mouse

The method described here is based in three steps, in this order:

  1. Make the PC learn about the bluetooth mouse.
  2. Grant the mouse permissions to connect.
  3. Make the mouse learn about the PC.

Search your mouse

First make your mouse discoverable. For example some mouse need to press a button. Then issue the following command as root:

# hcitool scan
Scanning ...
        00:07:61:F5:5C:3D       Logitech Bluetooth Mouse M555b

Your mouse bluetooth address will be similar to 12:34:56:78:9A:BC. You may also find it in the documentation or on the mouse itself.

Connecting the mouse

hidd --search
hcitool inq

are good for device scanning (I needed to use sudo for 'hidd --search' to automatically connect mouse, searching worked even without sudo).

hidd --connect <bdaddr>

to actually connect.

hidd --show

will show your currently connected devices. The mouse should show up in this list. If it does not, press the reset button to make it discoverable.

Note: If you have the ipw3945 module loaded (wifi on HP computer) the bluetooth wont work.

Connecting the mouse at startup

Edit /etc/conf.d/bluetooth:

# Arguments to hidd
HIDD_OPTIONS="--connect <enter here your bluetooth mouse address>"

and test the new settings:

/etc/rc.d/bluetooth stop
hidd --killall (drop mouse connection)
/etc/rc.d/bluetooth start

Note: The above instructions to start the mouse at startup do not work with the now outdated 3.11 bluetooth packages. New versions such as the current (3.32) packages are not affected. If you are using an older version, then to start the mouse at startup, add:

hidd --connect <enter here your bluetooth mouse address (No capitals!!!)>

to your /etc/rc.local file.

Note #2: You can connect any bluetooth mouse and/or keyboard without any further configuration and without knowing the device address. You can do it by adding the --master and/or --server option in HIDD_OPTIONS depending on your device.

Configuring through bluetoothctl

Since `bluez>=5` there is bluetoothctl util, that provide simple interface to configuring bluetooth devices.

For example, configuring autoconnect bluetooth mouse can be done as described above:

 # bluetoothctl
 [bluetooth]# list
 Controller <cmac> BlueZ 5.5 [default]
 [bluetooth]# select <cmac>
 [bluetooth]# power on
 [bluetooth]# scan on
 /// enable scanning mode on your mouse
 [bluetooth]# devices
 Device <mmac> Name: Bluetooth Mouse
 [bluetooth]# trust <mmac>
 [bluetooth]# pairable on
 [bluetooth]# pair <mmac>
 [bluetooth]# connect <mmac>

Troubleshooting tips

Mouse lag

If you experience mouse lag you can try to increase the polling rate. There is a wiki article describing the procedure: Mouse Polling Rate.

Problems with the USB dongle

If you have trouble with your USB dongle, you may also want to try

# modprobe -v rfcomm

At this point, you should get an hci0 device with

# hcitool dev

Sometimes the device is not active right away - try starting the interface with

# hciconfig hci0 up

and searching for devices as shown above.