Linux bluetooth mouse lag

Bluetooth mouse lags and eventually disconnects

I just installed Ubuntu 13.10. I have a bluetooth mouse (Adesso iMouse S100). Initially, the mouse works fine, but after a few minutes, it starts to lag a lot and it eventually disconnects. And then, it takes forever to reconnect. The mouse works fine on my win-7 issue (dual boot win-7/ubuntu). So I know it’s not an hardware issue Anyone has an idea?

same issue here with a magic mouse on macbook pro. worked fine on 13.04. my problem is that the mouse is lagging and jumping a lot. unusable.

@ubfan1 I’ll, Ubuntu claims the mouse battery is 87% which seems fine, and since it worked before I upgraded. Currently I don’t have new batteries available, but I must do a test.

@ubfan1 not a battery issue =/ just bought new batteries. This is a bug on saucy. my magic mouse just lagged and disconnected.

2 Answers 2

Sounds like an USB problem to me. Here is what you might try : A) Install a different kernel or B) Build you own kernel.

A) Install a different kernel, not build FOR Ubuntu. Cannonical may have done some mistakes on their kernels. Current Ubuntu 13.10’s kernel is 3.11 but you can download recent version (today it’s 13.12 the latest stable version) on http://kernel.ubuntu.com/~kernel-ppa/mainline/ .

Choose the 2 packages for your architecture (64 bits = amd64, 32 bits = i386) and install them in this order : linux-image-XXX first, then linux-header-XXX second. You can install the .deb packages with gdebi ( sudo apt-get install gdebi ) with visual interface by double-click on the .deb file, or you can use these commandline :

(replace path/to/file by the directory containing the .deb packages, default is ~/Downloads)

sudo dpkg -i package_to_install 

(replace package_to_install by the name of the .deb file you want to install, here it should be something like linux-image-XXX-amd64.deb)

B) Build you own kernel with a modified hid.h value (usb2.0 driver), to allow the USB 2.0 to be more permissive. I used to do that until kernel 3.11 was out for my Perixx gaming mouse (wired mouse). This custom kernel is based on your system’s current kernel, so it’s guaranteed to be fully compatible with your Ubuntu. The steps are just below this paragraph.

See What is HID_MAX_USAGES for knowing a little more about HID.H and why recompiling kernel can be a solution for your bluetooth mouse.

Building a new kernel with modifier hid.h value :

1) Open a terminal (ctrl-alt-T)

2) Launch the command :

  • sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev

It installs the requiered packages for the kernel building. You can apt-get remove afterwards to uninstall them if you wish.

3) Enter the following commands to create a directory for the kernel sources :

Press Tab to auto-fill the name, then press Enter.

Find (Ctrl + F) the line #define HID_MAX_USAGES and change it’s value to ‘64000’ .

cp -vi /boot/config-`uname -r` .config 

To copy the configuration file of your current system.

Читайте также:  Linux windows linux первым

7) (Optionnal) To speed up the building process, you can adjust the concurrency level. Launch :

Replace # by the number of your CPU’s cores + 1 (Dual-core will be «3», Quad-core «5», …)

To prepare the directory needed by the building process.

This will start the kernel building process. It can take a while (between 1h and 8h following your hardware). If the process is interrupted for some reason, you should launch the command rm ~/source and start over from step 3. The kernel binaries .deb will be placed in ~/source.

To install the new kernel :

1) Open nautilus (file explorer) and go to /lib/modules.

2) Open a Terminal and launch :

3) Type the following commands and press **Tab to auto-fill the version of kernel, named here (KERNEL_VERSION) :**

Both commands (once filled by Tab) must end by .deb

You have to replace KERNEL_NAME by the name used by the directory containing the modifier kernel (should end with «-sk» in nautilus).

(and also sudo update-burg if you use BURG).

6) Restart the computer.

You now run a custom kernel ! Congrats’

If that doesn’t work, the problem is NOT caused by HID (usb2.0 driver) and I have no idea how to help you 🙂

Источник

Bluetooth mouse

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

# modprobe -r 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

# modprobe -r 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 re-pair 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. And the core reason is that the set of pairing keys cannot be shared between the two OS.

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 [1].

if using a Bluetooth LE device use this python script, slightly edited to adapt for arch, originally discussed on [2].

Читайте также:  Astra linux разблокировать пользователя root

Troubleshooting

Mouse lag

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

You can try to set the minimum/maximum latency for the mouse in BlueZ [3]:

Add or modify the following section in /var/lib/bluetooth/mac-of-your-adapter/mac-of-your-mouse/info (adapt the path accordingly):

[ConnectionParameters] MinInterval=6 MaxInterval=9 Latency=44 Timeout=216

Also, you can use hcitool (in bluez-utils-compat AUR ) to change latency parameters of the device:

# HANDLE="$(hcitool con | grep '' | awk '')" # get the device handle # hcitool lecup --handle $HANDLE --latency 0 --min 6 --max 8

Note that this method is only effective for the current connection. If the mouse gets disconnected, you will need to execute again.

Alternatively, you can change the default latency settings via debugfs. See /sys/kernel/debug/bluetooth/hci0/conn__interval> .

This example will solve the lag problems, but you must un pair and pair the mouse:

# echo 0 > /sys/kernel/debug/bluetooth/hci0/conn_latency # echo 6 > /sys/kernel/debug/bluetooth/hci0/conn_min_interval # echo 7 > /sys/kernel/debug/bluetooth/hci0/conn_max_interval

Problems with the USB dongle

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

At this point, you should get an hci0 device with:

Sometimes the device is not active right away. Try starting the interface with:

and searching for devices as shown above.

Mouse always disconnects

If the mouse stops working but works again after restarting bluetooth, or the mouse seemingly keeps «falling asleep» after a couple of seconds of inactivity (which is the case for at least some models of Dell XPS 13 [4] [dead link 2022-09-17 ⓘ] ), 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.

If you are using a Logitech device, this issue may be resolved by following the procedure in #Problems with the Logitech BLE mouse (M557, M590, M720, anywhere mouse 2, etc).

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.

Kensington Expert Wireless Trackball problems

The Kensington Expert Wireless Trackball has default polling rates in the 200ms range, which make it laggy. To fix that, add or modify the [ConnectionParameters] section in /var/lib/bluetooth/mac-of-your-adapter/mac-of-your-mouse/info (adapt the path according to your mouse bluetooth address) as shown above, especially lower the latency to a small number or even 0 .

Читайте также:  Linux chmod 777 all

Problems with the Logitech BLE mouse (M557, M590, M720, anywhere mouse 2, etc)

In some case, the mouse is paired but not moving when used. The device add to be trusted and unblocked. First of all open a terminal and run bluetoothctl

[bluetooth] # remove XX:XX:XX:XX:XX:XX
[bluetooth] # trust XX:XX:XX:XX:XX:XX
[bluetooth] # pair XX:XX:XX:XX:XX:XX
[bluetooth] # connect XX:XX:XX:XX:XX:XX

If the mouse does not work directly, just power off and power on the mouse.

In some cases, it may also be necessary to load the uhid kernel module.

Problems with all BLE mice on kernel 5.9+

See Also

Источник

Lag when using Bluetooth Mouse

After the latest Ubuntu update (using 19.04) I get an extraordinary lag when using my Logitech M720 mouse connected via Bluetooth. When using the USB dongle it works flawless. Any ideas on why this might have occurred? (tried removing it, pairing it again and so forth)

I have exactly the same problem with the same mouse on Kubuntu 18.04. I observed that sometimes (probably a specific uptime/boot, not physical location), it worked via BT at home and needed dongle at work and sometimes the opposite.

4 Answers 4

After trying to downgrade the bluetooth package to see if that made a difference, I decided/realized that while it may have improved somewhat, it did not fix the issue. Continued researching and found: https://ubuntuforums.org/showthread.php?t=2372916.

echo «options iwlwifi bt_coex_active=0» | sudo tee /etc/modprobe.d/iwlopt.conf

Seems to be working substantially better

Do you happen to know what «bluetooth coexistence parameter» means. Or what could be possible side effects of this solution?

Here is a more technical explanation (which might be based on this whitepaper) and a more accessible explanation can be found here. TL;DR: older (2.4Ghz) wifi can sometimes interfere with BT. Those speed/connectivity issues can be mitigated with BT co-existence thing, if both BT devices support it.

The issue you are facing is not related to the Bluetooth timeout but more likely the USB auto suspend feature built into the kernel.

I am running Ubuntu 22.04 LTS and i have a Logitech MX Anywhere 2S

This is how i went about fixing it:

$ lsusb -vt /: Bus 02.Port 1: Dev 1, Driver=xhci_hcd/6p, 10000M ID 1d6b:0003 Linux Foundation 3.0 root hub /: Bus 01.Port 1: Dev 1, Driver=xhci_hcd/12p, 480M ID 1d6b:0002 Linux Foundation 2.0 root hub |__ Port 5: Dev 2, If 0, Specific Class, Driver=, 12M ID 27c6:538d Shenzhen Goodix Technology Co.,Ltd. |__ Port 6: Dev 3, If 0, Driver=uvcvideo, 480M ID 0bda:565a Realtek Semiconductor Corp. |__ Port 6: Dev 3, If 1, Driver=uvcvideo, 480M ID 0bda:565a Realtek Semiconductor Corp. |__ Port 10: Dev 4, If 0, Driver=btusb, 12M ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP) |__ Port 10: Dev 4, If 1, Driver=btusb, 12M ID 8087:0aaa Intel Corp. Bluetooth 9460/9560 Jefferson Peak (JfP) 

The id of my bluetooth module is 8087:0aaa

$ echo 'ACTION=="add", SUBSYSTEM=="usb", ATTR=="8087", ATTR=="0aaa", ATTR="-1"' >> /etc/udev/rules.d/50-usb_power_save.rules 

After this reboot your pc and the lag should go away.

Note that idVendor was set to 8087 and idProduct was set to 0aaa to reflect my bluetooth settings

I used following links for reference.

Источник

Оцените статью
Adblock
detector