getsolus / packages

Solus Package Monorepo & Issue Tracker
66 stars 85 forks source link

Plasma 6 - Bluetooth devices do not reconnect when waking from sleep or hibernation #1963

Closed WetGeek closed 4 months ago

WetGeek commented 8 months ago

Please confirm there isn't an existing open bug report

Summary

While testing Solus Plasma 6 Beta, @TraceyC77 discovered some unexpected behavior when a Bluetooth keyboard was connected and so was another Bluetooth device. The keyboard would disconnect. That's unlike my experience with Bluetooth on my daily-driver laptop with Plasma 5, and she asked me to confirm what she experienced.

I had no problem getting both an Arteck BT keyboard and a Logitech BT Triathlon mouse paired and connected with the laptop. That process was very smooth and without any drama, as I would expect with Plasma. Both devices remained paired and connected as I continued to configure the new OS, so I was unable to confirm Tracey's finding.

As it was getting late, and I'd been awake since early that morning, I decided to hibernate the laptop, and get some sleep myself. Upon waking the laptop from hibernation the next morning, the keyboard and mouse were still paired with the laptop, but both were disconnected. That was unexpected. On my Solus Plasma 5 laptop, both devices would automatically be connected and ready for use upon waking from hibernation.

The configuration settings dialogs for both versions are identical, and contain settings that define what to do upon login. image

On the Plasma 5 laptop, on login it's set to Restore previous status, as in the image above. That's by default, as I'd never needed to change that setting. On the Plasma 6 laptop, its default setting was the first one, Enable Bluetooth. It may be that the "On login:" part is significant, because upon waking the laptop from hibernation, I was already logged in, as it was simply the continuation of the previous night's session. Thus, it's possible that none of those settings was invoked.

Today I plan to see whether I can find a way to reconnect those disconnected devices without requiring another non-Bluetooth mouse to be installed on the laptop. I need to find out if waking from hibernation can be made to do it, or it actually requires a login to invoke those settings. My assumption is that if its behavior differs from that of Plasma 5, then it's a bug that needs to be fixed.

Steps to reproduce

See Summary, and attach a Bluetooth keyboard and mouse to a computer for the first time. After spending some time configuring the new installation, hibernate the computer until the next day.

Expected result

I expected the keyboard and mouse to be enabled upon the computer's waking from hibernation. That's what happens with my Plasma 5 laptop, which is identical to the Plasma 6 laptop I'm in the process of configuring after its initial OS installation.

Actual result

Upon wakeup from hibernation, neither keyboard nor mouse is enabled. Using a wi-fi mouse, I was able to determine that both devices are paired and listed in the Bluetooth settings, but are both marked "Disconnected." It was easy to use the wi-fi mouse to acess the keyboard and mouse and reconnect them.

Environment

Repo

Unstable

Desktop Environment

Plasma

System details

image

Other comments

No response

WetGeek commented 8 months ago

Discussion for this matter begain on #1046, which is about Bluetooth not working corrrectly on Xfce. Since more investigation was found to be necesary for the Plasma 6 problem, and it was off-topic there, I created this new issue for it.

WetGeek commented 8 months ago

My first test was to shut down the laptop - as opposed to hibernating it - and observe whether any setting under the On login: section of the Bluetooth settings dialog was invoked upon login. That turned out to be true. With the behavior set to Restore previous status, that's exactly what happened, just as with my Plasma 5 laptop. So my current theory is that - unlike with Plasma 5 - a period of inactivity, or the invocation of the hibernation state, caused the Bluetooth devices to disconnect, and waking from hibernation did not involve logging in, so the devices were both left disconnected upon wakeup. Much more debugging will follow.

WetGeek commented 8 months ago

After the previous effort, I needed to take a break from this issue in order to prepare and eat breakfast. Since it was to be a brief break, I didn't hibernate the laptop, but just left it running. After breakfast, I returned to find a black screen, which was not cleared up by moving the BT mouse, so I knew what had happened.
image

The laptop was sleeping - not hibernating - and in the proces, after tthe assigned timeout, both BT devices had become disconnected. I then used the wi-fi mouse to enter the settings and have the laptop "forget" both devices, then I added them again, and was able to use them once again. While I'm working on this issue, I'm going to leave the wi-fi mouse installed, because when the BT mouse fails, I need the other mouse to re-enable it and the keyboard.

What I learned from this episode is that awaking from sleep is the same as awaking from hibernation, in the sense that a login is not required. Thus the setting that returns Bluetooth to its previous status is not invoked. It appears we need to figure out how to invoke that same "login" behavior upon waking from hibernation or sleep.

TraceyC77 commented 8 months ago

To clarify, the setting for Enable / Disable Bluetooth on login is for the Bluetooth service itself. If it is set to Disable on login, then on login, Bluetooth is turned off entirely. If set to Enable on login, then Bluetooth will be turned on.

WetGeek commented 8 months ago

This is just getting more and more complicated. I walked away for a few minutes to attend to a personal issue, and when I returned the mouse was disconnected. But unlike previous eopsodes, I was able to reconnect using the wi-fi mouse just by clicking "Connect" on the BT mouse in the Bluetooth device list.

This has pretty much ended my plans to use this laptop as my daily-driver, although it's now configured as such. But this Bluetooth issue just requires reconnecting the Bluetooth devices too often for everyday use. And that requires keeping a second (wi-fi) mouse connected until the first mouse (BT) can be reconnected again.

I'll keep this laptop standing by with Plasma 6 on it, and updated whenever that's possible, but there's not much more I can learn from it until developers have given the problem some attention.

TraceyC77 commented 8 months ago

I was able to replicate the issue on Plasma 6 on my Lenovo Flex

Steps Used to Reproduce

Expected: Earbuds reconnect and I can hear sound through them

Actual Result: Earbuds do not reconnect. Bluetooth was enabled as expected. I can manually reconnect the earbuds with the Connect button

TraceyC77 commented 4 months ago

I can confirm this still exists, however, after a little research, I've found this is an upstream bug in the kernel. I found a report on the KDE bug tracker where it was stated that

FWIW It's working perfectly for me on Fedora 35 right now. The upstream Bluetooth stack lives in the kernel, so I guess bugs should be reported at https://bugzilla.kernel.org/enter_bug.cgi?product=Drivers.

Fedora may have a patch or another mitigation, but ultimately this is an issue for the kernel maintainers to solve.