This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Bluetooth inactivity timeout making input devices unusable

Tags: bluetooth, bt keyboard, timeout bluetooth, bt keyboard, timeout bluetooth, bt keyboard, timeout
(comma "," separated)
thirtytwobit
Registered Member
Posts
4
Karma
0
Originally posted to the NEON board, viewtopic.php?f=309&t=165386, but realized that is probably the wrong place so reposting here.

Plasma 5.18.5, after upgrading to 20.04, bluetooth keyboard idle timeout is too fast. Worked fine in 19.10. I tried to set IdleTimeout to 0 in /etc/bluetooth/input.conf, and also tried to create a udev rule to prevent the timeout. No luck. Keyboard times out quickly, after 30 secs or so, and then takes time to wake up. Any suggestions would be great, it's pretty annoying
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
Funny, just tried with my keyboard, no wake-up delay at all, could this be a Neon specific thing? I use the default settings, it wakes up normally even after two minutes.
Or does the connection actually drop completely for you?


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
thirtytwobit
Registered Member
Posts
4
Karma
0
Good info. It does not drop, looks like the keyboard is still connected, just takes time to wake up. I removed all my attempts to change the configs so I am now using default settings too but still have the problem.
User avatar
Mamarok
Manager
Posts
6071
Karma
16
OS
Bluetooth is not really my domain, I am just happy when it works. One idea that comes up: could this be a protocol issue? Since there are several Bluetooth protocol versions out there and, different devices using different versions, this could explain the difference. My laptop supports up to version 5.0, the keyboard uses 3.0


Running Kubuntu 22.10 with Plasma 5.26.3, Frameworks 5.100.0, Qt 5.15.6, kernel 5.19.0-23 on Ryzen 5 4600H, AMD Renoir, X11
FWIW: it's always useful to state the exact Plasma version (+ distribution) when asking questions, makes it easier to help ...
steinhr
Registered Member
Posts
17
Karma
0
OS
How to get KDE Neon 5.19 Bluetooth keyboards to stay connected for at least 3 minutes: this is a fix that works for a standard KDE Neon 5.19 with a normal Bluetooth keyboard eg of the Deltaco type. There will be no wake-up delay if you have a connected Bluetooth keyboard and eg open a Terminal and leave it untouched for 3 minutes with this fix, given a normal KDE Neon. [This is the 2nd version of this answer, containing an element that perhaps hasn't been tried by the person who started this thread yet.] Note however there may be Bluetooth device managers inside for instance Power Managers that can override these settings.

A reason why this sort of issue has existed in an on-and-off fashion for years in various Ubuntu's, is, I think, due to partially misleading or obscure comment inside an ancient-but-still-used /etc config file for Bluetooth.

The virtue of the way of fixing it is that it works also with Wayland login to your KDE Neon and requires no new installations and certainly no complicated X Windows device manager.

Here I use gedit but you can use any simple text editor. This will retain a copy of the original configuration files in case there are some unintended effects that you want to remedy. f you have lots of Bluetooth devices, check whether they all match with this new timeout approach you are creating.

CHANGE #1
Open a terminal by CTRl-ALT-T, and type (note the dot after the line with 'cp'):
Code: Select all

cd
cp -i /etc/bluetooth/input.conf  .
cp -i /etc/bluetooth/main.conf  .
gedit input.conf


At approx line# 9 there is, usually, a line that begins with #IdleTimeout and a couple of lines onwards you find one that begins with #UserspaceHID. Remove those lines and put in
Code: Select all

IdleTimeout=0
UserspaceHID=true


And save it and quit the editor and type gedit main.conf. In main.conf you do the analogous thing with these three parameters:
Code: Select all

DiscoverableTimeout = 0
PairableTimeout = 0
AutoConnectTimeout = 0


Save this and quit the editor (note that the main.conf changes are probably superfluous and should be carefully tested with all the Bluetooth devices you are using). Then, still in terminal, type, where you replace USERNAME with your user name:
Code: Select all

sudo  cp -i /etc/bluetooth/input.conf /etc/bluetooth/input.conf.backup
sudo  cp -i /etc/bluetooth/main.conf /etc/bluetooth/main.conf.backup
sudo cp -i /home/USERNAME/input.conf  /etc/bluetooth/
sudo cp -i /home/USERNAME/main.conf  /etc/bluetooth/


Confirm the overwrite of the improved files and do a reboot. Is it pretty cool? Good. If not, reset it this way:
Code: Select all

sudo  cp -i /etc/bluetooth/input.conf.backup /etc/bluetooth/input.conf
sudo  cp -i /etc/bluetooth/main.conf.backup /etc/bluetooth/main.conf


And reboot. Note that the copies of the files at the /home/USERNAME directory are not necessary once you have put them in place in /etc/bluetooth.

CHANGE #2
By Change #1 the wake-up delay for such as a Bluetooth keyboard was removed for up to ca 3 minutes inactivity of the keyboard, in my experience; and when waiting for some more minutes, it did have a delay but without 'forgetting' the typed keys. Here we work on getting this record expanded.

By doing some additional changes in main.conf you can improve the result. These additional changes require even more checking with each Bluetooth device you use--regard them as experimentative. Do please retain the main.conf.backup file you created in Change #1 and be ready to go back to that in case one of the Bluetooth devices don't work.

Open the Terminal, and again do gedit main.conf and this time uncomment the line that begins with #ReconnectUUIDs= by removing the hashtag (lots of numbers and dashes and such follow on that line, leave them intact), and in addition uncomment and set these three parameters as follows (the first number, 77, can possibly be expanded much, but I suggest begin with this):
Code: Select all

FastConnectable = true
ReconnectAttempts=77
ReconnectIntervals=1, 1, 1, 1, 1


I repeat that these suggestions are somewhat tentative--I happened to try them without having read about them, and they turned out to do just what I wanted on my computer with regard to further improvement of a "wake-up delay"-free Bluetooth. In case you are running this on a tiny computer that possibly have a heat-issue, I would check the heat before permanently implementing changes that could increase Bluetooth adapter activity. If you go at this scientifically and divide up the changes one by one, you may find that only one or two of all the parameter changes listed in this answer is enough to solve the whole issue. If you do such research and find the snappy patch, please post it here, okay? :)

Anyway, after these additional changes, do this again:

Code: Select all

sudo cp -i /home/USERNAME/main.conf  /etc/bluetooth/


And reboot. You should now be able to leave such as a Bluetooth keyboard aside for considerably more time without getting a wake-up delay for it. Let us hope the official standard KDE Neon Linux gets a "wake-up delay"-free Bluetooth solution really fast, no longer requiring such patches. It is possible the issue originates in Ubuntu itself somehow, but KDE Neon Linux ought to have it straightened out.

Hope this helps! :)
thirtytwobit
Registered Member
Posts
4
Karma
0
Sorry for the delayed response. Thanks for all the detailed info. I tried change #1 and change #2 independently and both together.

Unfortunately these changes have no effect and the problem persists.

Apparently there is some other process that controls the timeout, like you mentioned.

i noticed

Code: Select all
$ bluetoothctl devices | grep "Keyboard"
Device D7:16:6C:D5:58:CF Surface Keyboard


if I look at the info file for this Surface keyboard

Code: Select all
$ sudo cat /var/lib/bluetooth/20\:79\:18\:28\:CA\:1B/D7\:16\:6C\:D5\:58\:CF/info
...
Timeout=200
...


This Timeout setting never changes. If I edit the info file and increase the timeout, after restart it goes back to 200. I suspect there is some other Power Management process with configs that override /etc/bluetooth. If only I could find them.

This is a Lenovo laptop running Kubutu 20.04, don't think it's a heat issue. Otherwise Kubuntu works great.


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]