Open elthariel opened 2 years ago
@elthariel I suspect this could be either due to the kernel not disconnecting properly or something similar to https://github.com/bluez/bluez/issues/275, anyway we did made a lot of changes around how the suspend work but you will likely need to update your kernel in order to get it working properly.
Thanks for the answer @Vudentz.
I've just today upgraded to 5.13. Are the relevant changes included in that one ? Or should I use a more recent one ? In all the cases, I'm away from my office now and will give it a try when I get back in about a week. <3
@elthariel I think the suspend/resume changes is only available on 5.16 an later.
@elthariel also it is worth checking if is nothing like #275 which was causing bluetoothd to be unable to load LTK of devices after resume.
Thanks @Vudentz for the hints. I'll check those issues out.
By the way, I've built a newer kernel (5.16.0) and disabled my hack but the issue still persist. I haven't had a look at the trace and logs yet though, maybe the situation evolved. Also, is there a chance that I need to upgrade my system version of bluez to use some new kernel side bluetooth features ?
I'm running into a similar issue with a logitch wireless mouse, although it didn't show up until a few weeks ago. of the 100 times i've awaken my system over the past few weeks, maybe 2 or 3 times it automatically reconnected.
debian testing Linux version 5.18.0-3-amd64 bluez 5.64-2
i checked journalctl and there aren't any logs except for this, right at the time the system was awaken
Aug 06 10:58:17 x15 bluetoothd[1392]: Controller resume with wake event 0x0
i'm using gnome 42 (with some components coming in from 43) and as soon as i check the box in the bluetooth settings, the mouse connects almost instantly
i did some more testing and I think what is happening is just that it takes a really long time before it tries to reconnect. sometimes 10 to 20 seconds. but the mouse is only actively trying to connect for a short time while the light blinks, so i have to continuously move the mouse for that entire time so it's ready when the system tries to connect to it. seems like fixing that delay would fix the problem.
FYI, I've bought myself a new keyboard, so I don't have any incentive to investigate this issue anymore. You're on your own buddy(ies)
Is this still reproduces?
Hey ! <3
This is half a bug report and half a note to have a workaround documented somewhere on the internet.
I'm running:
Here's my hci config:
Here's the issue:
Whenever I suspend and resume the laptop, the bluetooth keyboard takes a very long time to reconnect and some times just doesn't. Restarting the bluetooth daemon would eventually fix the issue but still would take some time.
Information I've gathered
The bluez log would include a bunch of line like this
device 68:D9:3C:DE:6D:D9 profile input-hid state changed: disconnected -> connected (0)
and eventually drop this line after which it would soon reconnect:src/device.c:device_bonding_failed() status 14
.After trying a bunch of thing and reading a few btmon traces I realized it always reconnected after emitting the following line:
After this, the discovery would start, the keyboard would initiate a connection and it would start working.
With a few other experiments I started to realize connecting from the host to the keyboard doesn't work, only the keyboard could initiate the connection. But it seems that when suspending the bluetooth daemon still thinks it can resume the connection to the keyboard. The opinion of bluez on the matter seems rather reasonnable to me, but it seems the keyboard disagrees [insert apple troll here]
In order to prevent this reconnection, I've added a hacky suspend script in /lib/systemd/system-sleep/bluetooth:
After adding this, the keyboard resumes quite quickly and consistently it seems.
So I'm wondering whether there's a nice config option in bluez to make it behave this way ? if this is a bug in the default ubuntu configuration ? or a bug in bluez ? or just if the apple keyboard doesn't behave nicely.
I can provide the bluez logs and btmon traces if it is of any help.