-
-
Save yfkhar/9d74f0931e01fb1a070a77c301a03e33 to your computer and use it in GitHub Desktop.
Fix bluetooth mouse lag on Ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
MouseIdentifierString="Mouse" | |
writeOpts() { | |
sudo cat <<'EOF' | sudo tee -a /var/lib/bluetooth/$1/$2/info | |
[ConnectionParameters] | |
MinInterval=6 | |
MaxInterval=7 | |
Latency=0 | |
Timeout=216 | |
EOF | |
sudo systemctl restart bluetooth | |
} | |
eachDev() { | |
if sudo grep -q $MouseIdentifierString /var/lib/bluetooth/$1/$2/info | |
then | |
if ! sudo grep -q "ConnectionParameters" /var/lib/bluetooth/$1/$2/info | |
then | |
writeOpts $1 $2 | |
fi | |
fi | |
} | |
eachCtrl() { | |
sudo ls -1 /var/lib/bluetooth/$1 | egrep -v "(cache|settings)" | while read dev; do | |
eachDev $1 $dev | |
done | |
} | |
ls -1 /var/lib/bluetooth | while read ctrl; do | |
eachCtrl $ctrl | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment