Difference between revisions of "Bluetooth mouse"

From ArchWiki
Jump to: navigation, search
(Configuring through bluetoothctl: please don't write in 1st person, see Help:Style)
(Mouse always disconnect: fix broken section link (really))
 
(58 intermediate revisions by 19 users not shown)
Line 1: Line 1:
 
[[Category:Mice]]
 
[[Category:Mice]]
 
[[Category:Bluetooth]]
 
[[Category:Bluetooth]]
[[cs:Bluetooth Mouse]]
+
[[cs:Bluetooth mouse]]
[[ru:Bluetooth Mouse]]
+
[[ja:Bluetooth マウス]]
This article describes how to set up a [[Bluetooth]] mouse manually with no desktop assistance for Bluetooth. For example, a minimalist XFCE installation.
+
[[ru:Bluetooth mouse]]
 +
{{Related articles start}}
 +
{{Related|Bluetooth}}
 +
{{Related|Mouse polling rate}}
 +
{{Related articles end}}
  
== Installation ==
+
This article describes configuration & troubleshooting steps specific to Bluetooth mice. The information here builds on the main [[Bluetooth]] article, and assumes the user has already followed any installation, configuration, or troubleshooting from that article.
  
You need the {{Pkg|bluez}} package and optionally the {{Pkg|bluez-utils}} package from the extra repository.
+
== Configuration ==
 +
=== Apple Magic Mouse scroll speed ===
 +
If the scroll speed is too slow, you can try
 +
# rmmod hid_magicmouse
 +
# modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=55
  
Note: The following instructions only work for the {{Pkg|bluez4}} package. For Bluez 5(Current version) please see the bluetoothctl section.  
+
Scroll speed can be set from 0 to 63.
  
== Start Bluetooth service ==
+
If the speed suits you, you can make the change permanent in {{ic|/etc/modprobe.d/}}
 +
{{hc | /etc/modprobe.d/hid_magicmouse.conf |<nowiki>
 +
options hid_magicmouse scroll_acceleration=1 scroll_speed=55</nowiki>}}
  
The pertinent options in /etc/conf.d/bluetooth are
+
=== Apple Magic Mouse middle click ===
  HIDD_ENABLE=true
+
If you find the middle click to be too finicky, you can disable it
 +
# rmmod hid_magicmouse
 +
  # modprobe hid_magicmouse emulate_3button=0
  
after that, start bluetooth services with
+
If this setting suits you, you can make the change permantent in {{ic|/etc/modprobe.d/}}
# systemctl enable bluetooth.service
+
{{hc | /etc/modprobe.d/hid_magicmouse.conf |<nowiki>
# systemctl start bluetooth.service
+
options hid_magicmouse emulate_3button=0</nowiki>}}
  
=== kernel modules ===
+
=== Mouse pairing and dual boot ===
No additional actions are necessary if the bluetooth service is started using systemd. If it does not work try following.
 
  
The command
+
When dual booting Windows and Linux, you may find yourself having to repair your Bluetooth mouse again and again. This will happen every time you switch OS, because when you pair your device, your Bluetooth service generates a unique set of pairing keys.
# modprobe -v btusb bluetooth hidp l2cap
 
loads the kernel modules you need, if they were not loaded automatically.
 
  
=== Test ===
+
First, your computer stores the Bluetooth device's mac address and pairing key. Second, your Bluetooth device stores your computer's mac address and the matching key. This usually works fine, but the mac address for your Bluetooth port will be the same on both Linux and Windows (it is set on the hardware level). However, when you re-pair the device in Windows or Linux, it generates a new key. That key overwrites the previously stored key on the Bluetooth device. Windows overwrites the Linux key and vice versa.
The following command should show your bluetooth adapter:
 
  
{{hc|# hciconfig|
+
To fix the problem, follow the instructions on [https://unix.stackexchange.com/questions/255509/bluetooth-pairing-on-dual-boot-of-windows-linux-mint-ubuntu-stop-having-to-p this post at StackExchange].
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 ==
+
== Troubleshooting ==
The method described here is based in three steps, in this order:
 
  
# Make the PC learn about the bluetooth mouse.
+
=== Mouse lag ===
# Grant the mouse permissions to connect.
 
# Make the mouse learn about the PC.
 
  
=== Search your mouse ===
+
If you experience mouse lag you can try to increase the polling rate. See [[Mouse polling rate]] for more information.
First make your mouse discoverable. For example some mouse need to press a button. Then issue the following command as root:
 
  
{{hc|# hcitool scan|
+
=== Problems with the USB dongle ===
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.
+
If you have trouble with your USB dongle, you may also want to try:
  
== Connecting the mouse ==
+
  # modprobe -v rfcomm
  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.
+
At this point, you should get an hci0 device with:
  
== Connecting the mouse at startup ==
+
  # hcitool dev
Edit /etc/conf.d/bluetooth:
 
  # Arguments to hidd
 
HIDD_OPTIONS="--connect <enter here your bluetooth mouse address>"
 
  
and test the new settings:
+
Sometimes the device is not active right away. Try starting the interface with:
/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:
+
  # hciconfig hci0 up
  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.
+
and searching for devices as shown above.
  
== Configuring through bluetoothctl ==
+
=== Mouse always disconnect ===
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:
+
If the mouse stops working but works again after restarting bluetooth, you may need to [[Power_management#USB_autosuspend|disable USB autosuspend]] for the selected device.
  # 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>
 
  
In order for the device to start on boot you may have to create a [[udev]] rule as discussed in [https://bbs.archlinux.org/viewtopic.php?id=166362].
+
The issue may also lie in the device timeout and HID settings. See [[#Thinkpad Bluetooth Laser Mouse problems]].
  
== Troubleshooting tips ==
+
=== Thinkpad Bluetooth Laser Mouse problems ===
=== 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]].
+
If you are experiencing that your Thinkpad Bluetooth Laser Mouse rapidly connects and then (after a few milliseconds) disconnects again every few seconds (when you move the mouse or press a button), try pairing it with the code {{ic|0000}} instead pairing without a code.
  
=== Problems with the USB dongle ===
+
If the above is unhelpful, the issue may be in the device timeout settings. Edit/create the file {{ic|/etc/bluetooth/input.conf}} and apply the following changes:
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
+
# Configuration file for the input service
  # hcitool dev
+
# This section contains options which are not specific to any
 +
# particular interface
 +
[General]
 +
 +
  # Set idle timeout (in minutes) before the connection will
 +
# be disconnect (defaults to 0 for no timeout)
 +
IdleTimeout=0
 +
 +
#Enable HID protocol handling in userspace input profile
 +
#Defaults to false(hidp handled in hidp kernel module)
 +
UserspaceHID=true
  
Sometimes the device is not active right away - try starting the interface with
+
These changes will prevent device timeout in order to remain connected. The second setting enables userspace HID handling for bluetooth devices. Restart {{ic|bluetooth.service}} to test changes. You also may need a reboot and to re-pair the device.
# hciconfig hci0 up
 
and searching for devices as shown above.
 

Latest revision as of 08:20, 4 May 2018

This article describes configuration & troubleshooting steps specific to Bluetooth mice. The information here builds on the main Bluetooth article, and assumes the user has already followed any installation, configuration, or troubleshooting from that article.

Configuration

Apple Magic Mouse scroll speed

If the scroll speed is too slow, you can try

# rmmod hid_magicmouse
# modprobe hid_magicmouse scroll_acceleration=1 scroll_speed=55

Scroll speed can be set from 0 to 63.

If the speed suits you, you can make the change permanent in /etc/modprobe.d/

 /etc/modprobe.d/hid_magicmouse.conf 
options hid_magicmouse scroll_acceleration=1 scroll_speed=55

Apple Magic Mouse middle click

If you find the middle click to be too finicky, you can disable it

# rmmod hid_magicmouse
# modprobe hid_magicmouse emulate_3button=0

If this setting suits you, you can make the change permantent in /etc/modprobe.d/

 /etc/modprobe.d/hid_magicmouse.conf 
options hid_magicmouse emulate_3button=0

Mouse pairing and dual boot

When dual booting Windows and Linux, you may find yourself having to repair your Bluetooth mouse again and again. This will happen every time you switch OS, because when you pair your device, your Bluetooth service generates a unique set of pairing keys.

First, your computer stores the Bluetooth device's mac address and pairing key. Second, your Bluetooth device stores your computer's mac address and the matching key. This usually works fine, but the mac address for your Bluetooth port will be the same on both Linux and Windows (it is set on the hardware level). However, when you re-pair the device in Windows or Linux, it generates a new key. That key overwrites the previously stored key on the Bluetooth device. Windows overwrites the Linux key and vice versa.

To fix the problem, follow the instructions on this post at StackExchange.

Troubleshooting

Mouse lag

If you experience mouse lag you can try to increase the polling rate. See Mouse polling rate for more information.

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.

Mouse always disconnect

If the mouse stops working but works again after restarting bluetooth, you may need to disable USB autosuspend for the selected device.

The issue may also lie in the device timeout and HID settings. See #Thinkpad Bluetooth Laser Mouse problems.

Thinkpad Bluetooth Laser Mouse problems

If you are experiencing that your Thinkpad Bluetooth Laser Mouse rapidly connects and then (after a few milliseconds) disconnects again every few seconds (when you move the mouse or press a button), try pairing it with the code 0000 instead pairing without a code.

If the above is unhelpful, the issue may be in the device timeout settings. Edit/create the file /etc/bluetooth/input.conf and apply the following changes:

# Configuration file for the input service
# This section contains options which are not specific to any
# particular interface
[General]

# Set idle timeout (in minutes) before the connection will
# be disconnect (defaults to 0 for no timeout)
IdleTimeout=0

#Enable HID protocol handling in userspace input profile
#Defaults to false(hidp handled in hidp kernel module)
UserspaceHID=true

These changes will prevent device timeout in order to remain connected. The second setting enables userspace HID handling for bluetooth devices. Restart bluetooth.service to test changes. You also may need a reboot and to re-pair the device.