Difference between revisions of "Bluetooth mouse"

From ArchWiki
Jump to: navigation, search
(Troubleshooting: options and not option)
 
(61 intermediate revisions by 23 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 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.
+
[[ru:Bluetooth mouse]]
 +
{{Related articles start}}
 +
{{Related|Bluetooth}}
 +
{{Related|Bluez4}}
 +
{{Related|Mouse polling rate}}
 +
{{Related articles end}}
  
== Required software ==
+
This article describes how to set up a [[Bluetooth]] mouse through the command line without relying upon a graphical application.
  
You need the '''bluez-utils''' and '''bluez-libs''' packages from the extra repository. Looks like you also need '''dbus''' 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.
+
== Installation ==
  
== Configuration ==
+
Install the {{Pkg|bluez}} package which contains the current Linux bluetooth stack (Bluez5). You may also want to install {{Pkg|bluez-utils}} which provides the ''bluetoothctl'' utility. See [[Bluetooth]] for more information.
The pertinent options in /etc/conf.d/bluetooth are
 
HIDD_ENABLE=true
 
after that, start bluetooth services with
 
/etc/rc.d/bluetooth start
 
  
== Finding out your mouse's bdaddr ==
+
== Bluez5 instructions ==
  
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.
+
{{Tip|Ensure that the bluetooth daemon is started before continuing.}}
  
== kernel modules ==
+
The ''bluetoothctl'' utility provides a simple interface for configuring bluetooth devices. The text below is an example of how you can connect a bluetooth mouse using ''bluetoothctl'':
  
The command
+
# bluetoothctl
  # modprobe -v btusb bluetooth hidp l2cap
+
[bluetooth]# list
loads the kernel modules you need, if they weren't loaded automatically.
+
Controller <controller mac> BlueZ 5.5 [default]
 +
[bluetooth]# select <controller mac>
 +
  [bluetooth]# power on
 +
[bluetooth]# scan on
 +
[bluetooth]# agent on
 +
[bluetooth]# devices
 +
Device <mouse mac> Name: Bluetooth Mouse
 +
[bluetooth]# pair <mouse mac>
 +
[bluetooth]# trust <mouse mac>
 +
[bluetooth]# connect <mouse mac>
  
(See below for some tips if you're stuck at this point)
+
In order for the device to start on boot you may have to create a [[udev]] rule. Please see [[Bluetooth#Bluetoothctl]] for more information.
  
== Connecting the mouse ==
+
{{Tip|In case you were using USB Bluetooth dongle and moved it to another USB port, you may need to remove the mouse's MAC address in ''bluetoothctl'' with ''remove <mouse mac>'' command and repeat the entire procedure again.}}
hidd --search
 
hcitool inq
 
are good for device scanning.
 
hidd --connect <bdaddr>
 
to actually connect.
 
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.
 
  
Note: If you have the ipw3945 module loaded (wifi on HP computer) the bluetooth wont work.
+
== Troubleshooting ==
  
== Connecting the mouse at startup ==
+
=== Mouse lag ===
Edit /etc/conf.d/bluetooth:
 
# Arguments to hidd
 
HIDD_OPTIONS="--connect <enter here your bluetooth mouse address>"
 
  
and test the new settings:
+
If you experience mouse lag you can try to increase the polling rate. See [[Mouse polling rate]] for more information.
/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:
+
=== Problems with the USB dongle ===
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.
+
If you have trouble with your USB dongle, you may also want to try:
  
== Troubleshooting tips ==
+
# modprobe -v rfcomm
  
If you have trouble with your USB dongle, you may also want to try
+
At this point, you should get an hci0 device with:
# modprobe -v rfcomm
 
  
At this point, you should get an hci0 device with
 
 
  # hcitool dev
 
  # hcitool dev
  
Sometimes the device is not active right away - try starting the interface with
+
Sometimes the device is not active right away. Try starting the interface with:
 +
 
 
  # hciconfig hci0 up
 
  # hciconfig hci0 up
 +
 
and searching for devices as shown above.
 
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 [[Power_management#USB_autosuspend|disable USB autosuspend]] for the selected device.
 +
 +
=== Failed to set power on: org.bluez.Error.Blocked ===
 +
 +
Check rfkill block list and unblock if necessary:
 +
 +
$ rfkill list
 +
$ rfkill unblock #
 +
 +
=== Apple Magic Mouse scroll speed ===
 +
 +
If the scroll speed is too slow, you can try
 +
# rmmod hid_magicmouse
 +
# modprobe hid_magicmouse croll_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 {{ic|/etc/modprobe.d/}}
 +
{{hc | /etc/modprobe.d/hid_magicmouse.conf |<nowiki>
 +
options hid_magicmouse croll_acceleration=1 scroll_speed=55</nowiki>}}
 +
 +
=== 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 {{ic|/etc/modprobe.d/}}
 +
{{hc | /etc/modprobe.d/hid_magicmouse.conf |<nowiki>
 +
options hid_magicmouse emulate_3button=0</nowiki>}}

Latest revision as of 03:15, 24 July 2017

This article describes how to set up a Bluetooth mouse through the command line without relying upon a graphical application.

Installation

Install the bluez package which contains the current Linux bluetooth stack (Bluez5). You may also want to install bluez-utils which provides the bluetoothctl utility. See Bluetooth for more information.

Bluez5 instructions

Tip: Ensure that the bluetooth daemon is started before continuing.

The bluetoothctl utility provides a simple interface for configuring bluetooth devices. The text below is an example of how you can connect a bluetooth mouse using bluetoothctl:

# bluetoothctl
[bluetooth]# list
Controller <controller mac> BlueZ 5.5 [default]
[bluetooth]# select <controller mac>
[bluetooth]# power on
[bluetooth]# scan on
[bluetooth]# agent on
[bluetooth]# devices
Device <mouse mac> Name: Bluetooth Mouse
[bluetooth]# pair <mouse mac>
[bluetooth]# trust <mouse mac>
[bluetooth]# connect <mouse mac>

In order for the device to start on boot you may have to create a udev rule. Please see Bluetooth#Bluetoothctl for more information.

Tip: In case you were using USB Bluetooth dongle and moved it to another USB port, you may need to remove the mouse's MAC address in bluetoothctl with remove <mouse mac> command and repeat the entire procedure again.

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.

Failed to set power on: org.bluez.Error.Blocked

Check rfkill block list and unblock if necessary:

$ rfkill list
$ rfkill unblock #

Apple Magic Mouse scroll speed

If the scroll speed is too slow, you can try

# rmmod hid_magicmouse
# modprobe hid_magicmouse croll_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 croll_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