Bluetooth mouse not auto-reconnecting
Bluetooth settings are controlled from configuration files in /etc/bluetooth
. For input devices we can define a timeout before a connection will be disconnected. To disable this open /etc/bluetooth/input.conf
as root in an editor and either comment out the following line by adding #
(as it is done in the example below), or set timeout value to 0
:
#IdleTimeout=30
Other timeouts that can be set in /etc/bluetooth/main.conf
may not be affected in your case as they only play a role when a service may be interrupted (e.g. by bad signal strength) and will not be reconnected in case a timeout is set here. Default values for timeouts in main.conf
are:
DiscoverableTimeout = 0
PairableTimeout = 0
PageTimeout = 8192
I appear to have solved my problem, and perhaps yours as well. After going through troubleshooting steps, here's I what have working now:
- I commented out
AutoConnectTimeout
in/etc/bluetooth/main.conf
-- not set to0
, but commented it out completely. Not sure if this matters, but I'm keeping it that way for now. I don't wantAutoConnectTimeout
to time out. - I set my
IdleTimeout
ininput.conf
to240
minutes, this is a computer dedicated to watching movies, so can't hurt. - I set
RememberPowered
inmain.conf
tofalse
.
I was really wracking my brain on this, fearing I would ultimately have to write an F-ing script to ping my mouse via Bluetooth. However, after trying out different combinations of settings in the input.conf
and main.conf
files. My eyes rested on the RememberPowered
option in main.conf
. It was set to true
. Wait, I want my computer to remember that my mouse was powered off? I don't want my computer to remember any power-state of any mouse. Just go connect and keep powered and keep connected and keep talking, and I don't care if the mouse isn't listening because I turned it off. So I set that to false
. It appears this has solved my problem of my Bluetooth mouse not re-syncing up and re-connecting to input services after a long time of being turned off, with the computer still on.
I hope this helps you.
Note: It doesn't matter if you have USB mice or USB keyboards connected to your computer.
Check out my answer here:
https://askubuntu.com/a/582035/13903
Uninstall/purge blueman-manager or any extra bluetooth software. Go vanilla and just leave the original Ubuntu bluetooth software to rule out any conflicts.
Press the bluetooth mouse's discovery mode.
Open a terminal and type the command
hcitool scan
Then paste the first half of your bluetooth address as the OUI.
So if your bluetooth mouse's address is
AB:CD:EF:GH:IJ:KL
It would look like this:
<device oui="AB:CD:EF:" type="mouse" name="Microsoft Sculpt Comfort Mouse" pin="0000"/>
Insert that line with the rest of the entries in
/usr/share/gnome-bluetooth/pin-code-database.xml
This helps to reconnect mice that may require a pin to pair.
This should solve most reconnection issues because Ubuntu doesn't know the PIN when it reconnects. You need to provide it with one (if it needs it default is 0000
).
name
isn't required, pin
isn't required either. oui
is required however. First find out if your mouse needs apin
then try this. You can also try without using the name
parameter if you don't know it.