Bug 460077

Summary: Randomly, PC does not connect automatically to a device when opening kde session
Product: [Plasma] plasmashell Reporter: Philippe ROUBACH <philippe.roubach>
Component: Bluetooth in generalAssignee: David Rosca <nowrep>
Status: RESOLVED UPSTREAM    
Severity: normal CC: kdedev, nate, nicolas.fella, plasma-bugs-null
Priority: NOR    
Version First Reported In: 6.2.4   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
See Also: https://bugs.kde.org/show_bug.cgi?id=475959
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Philippe ROUBACH 2022-10-07 02:49:41 UTC
SUMMARY
***
when the PC starts in the morning, when opening a KDE session, Bluetooth is enabled, but the PC does not connect to the tablet
***


STEPS TO REPRODUCE
1. Start a PC, then open a KDE session
2. enable Bluetooth
3. connect the tablet
4. check that in Bluetooth settings "record previous state" is chosen
4. restart the PC and open the same user KDE session

OBSERVED RESULT

bluetooth is enabled
the PC is not connected to the tablet

EXPECTED RESULT

bluetooth is enabled
the PC is connected to the tablet

SOFTWARE/OS VERSIONS

Operating System: openSUSE Tumbleweed 20221004
KDE Gears 22.08.1
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6
Kernel Version: 5.19.13-1-default (64-bit)

ADDITIONAL INFORMATION

Black view tab8, BT 5.0
EDUP-LOVE EP-9651GS, Wi-Fi/Bluetooth PCI card, chipset Intel AX210, BT 5.3
Comment 1 Nate Graham 2022-10-10 16:52:54 UTC
Our code is only responsible for turning Bluetooth on or off, and manually connecting to devices; whether devices auto-reconnect at login is determined by something deeper in the Bluetooth stack, in bluez or the kernel. I would recommend you follow up at https://github.com/bluez/bluez/issues. Thanks!
Comment 2 Philippe ROUBACH 2022-10-15 06:34:27 UTC
Hello Nate

I got an answer from Bluez.

https://github.com/bluez/bluez/issues/410

If I understand (I am not sure because it is too techie for me) Bluez is not responsible for the problem.

He seems, saying that an action must be executed by KDE at login to reconnect the smartphone. As KDE does already. KDE stores at logout the session state and restore the session state at login.
Comment 3 Philippe ROUBACH 2023-10-17 07:36:27 UTC
Hello 

After no context restoration problem for about one or two months, again when opening a kde session then bluetooth is activated but the connection to my speaker is not restored.

Last days there were an update to kde gears 23.08.2 and to qt6 6.6 .
Comment 4 Philippe ROUBACH 2023-10-17 07:37:26 UTC
sorry i forgot

Operating System: openSUSE Tumbleweed 20231013
KDE Plasma Version: 5.27.8
KDE Frameworks Version: 5.110.0
Qt Version: 5.15.11
kde gears 23.08.2
Comment 5 Philippe ROUBACH 2023-10-20 08:22:18 UTC
Where is the issue ? They are many involved technologies :
- KDE Bluetooth
- bluez
- Qt Bluetooth
- pipewire Bluetooth
- networkmanager Bluetooth
Comment 6 Philippe ROUBACH 2023-10-20 08:25:10 UTC
If I ask a question, this is because "where to send a bug report ?"
Comment 7 Philippe ROUBACH 2023-10-21 09:47:33 UTC
It works again !

Sometimes it works. Sometimes it does not work. Is it a random phenomenon ?

IS there a bad interaction with something ?
Comment 8 Philippe ROUBACH 2023-12-04 15:00:44 UTC
(In reply to Philippe ROUBACH from comment #7)
> It works again !
> 
> Sometimes it works. Sometimes it does not work. Is it a random phenomenon ?
> 
> IS there a bad interaction with something ?

Hypothesis : some device switches to "wake" state. 
Perhaps this is the problem. In the morning when I start the PC the smartphone and the speaker are in a "wake' state then does not respond to a "connect" command".
In this case, kde bluetooth must wake up these kinds of device before attempting a connection.
Comment 9 Philippe ROUBACH 2023-12-08 08:50:41 UTC
1. Bluetooth speaker.

Trouble : connection fails when restoring the context.

I made this experiment :

Instead of asking for KDE to restore the context, I ask for KDE to just power on the Bluetooth controller.
I add a login script with these contents: 

sleep 15s
bluetoothctl connect <speaker mac address>

Now, for each login, I get my speaker connected.

Hypothesis : some processes started when PC starts or when opening a KDE session causes a connection failure.

2. the smartphone

Trouble : connection fails when restoring the context.

I made this experiment :

Manually I run "sudo l2ping" then "bluetoothctl connect <phone mac address>", then success I get a connection.

Hypothesis : l2ping wakes up the phone, then it is available for a connection.

So when restoring the context, KDE must awake the phone before attempting a connection.
Comment 10 TraceyC 2025-08-12 22:29:30 UTC
I'm sorry we weren't able to respond before now. Is this still a problem with Plasma 6.4.4 or later?
Comment 11 Philippe ROUBACH 2025-08-13 08:01:32 UTC
Operating System: openSUSE Tumbleweed 20250811
KDE Plasma Version: 6.4.4
KDE Frameworks Version: 6.17.0
Qt Version: 6.9.1
Kernel Version: 6.15.8-1-default (64-bit)
Graphics Platform: X11

Surprisingly when opening a kde session, bt tries to connect to all bt devices, not only the one previously connected !

I expect this result : only the one previously connected is connected when opening a KDE session.
Comment 12 Philippe ROUBACH 2025-08-13 08:04:15 UTC
connecting to my phone fails as already reported.
Comment 13 TraceyC 2025-08-13 16:37:46 UTC
Thanks for confirming this is for the same device. As determined in bug 475959, the connection problem is happening in the bluez software, which needs to be reported upstream to https://github.com/bluez/bluez/issues.