Created
December 21, 2020 10:15
-
-
Save productiveme/8b39f5799fcb3e5681d0ef985884fb51 to your computer and use it in GitHub Desktop.
Fix bluetooth mouse lag on Ubuntu
This file contains hidden or 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