-
-
Save rscircus/ddafae0784e7e06e8769b67095c6a5f2 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 |
Awesome, thank you
@rscircus Thanks for sharing. I liked how you use both while and read commands instead of a for loop and command substitution. 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works like a charm