Bug 457130 - Bluetooth Remember Previous Status setting works on reboot, but not shutdown
Summary: Bluetooth Remember Previous Status setting works on reboot, but not shutdown
Status: REPORTED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_bluetooth (show other bugs)
Version: 5.25.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Rosca
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-25 18:19 UTC by Gurenko Alex
Modified: 2023-12-16 16:53 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gurenko Alex 2022-07-25 18:19:13 UTC
SUMMARY

When Bluetooth is set to remember previous state it only saves the state on reboot, but not on shutdown

STEPS TO REPRODUCE
1. Bluetooth is set to Remember previous state
2. Boot system with Bluetooth on
3. Turn off Bluetooth
4. Shutdown
5. Boot system and login

OBSERVED RESULT

Bluetooth is on again

EXPECTED RESULT

Bluetooth should be off

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora Linux 36 KDE
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.96
Qt Version: 5.15.3

ADDITIONAL INFORMATION
This actually works if instead of shutdown the system reboots, then it saves and restores the state
Comment 1 Nate Graham 2022-07-26 19:52:26 UTC
> KDE Plasma Version: 5.23.3

Are you sure? Did yo mean 5.25.3? I ask because this was supposed to be fixed in Plasma 5.25.
Comment 2 Gurenko Alex 2022-07-27 09:51:08 UTC
(In reply to Nate Graham from comment #1)
> > KDE Plasma Version: 5.23.3
> 
> Are you sure? Did yo mean 5.25.3? I ask because this was supposed to be
> fixed in Plasma 5.25.

Yes, sorry, I mean 5.25.3 and I just checked to be sure and it's not working as expected.
Comment 3 Nate Graham 2022-07-27 19:08:44 UTC
Thanks. Will check.
Comment 4 Stefan Hoffmeister 2022-09-11 07:53:04 UTC
I can confirm the defective behaviour for KDE 5.25.4 (Wayland) on Fedora 36 (up-to-date).

I observe the following behaviour:
* have KDE desktop running as user "myself", Bluetooth is enabled, Bluetooth mouse, keyboard work
* shutdown
* cold boot
* SDDM comes up - Bluetooth works (mouse and keyboard work)
* log into user "myself"
* Bluetooth is actively being turned off by KDE
* enable Bluetooh

Repeat, rinse, lather ...

My Bluetooth is  built into my notebook, "Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth", addressed by "BlueZ 5.65"
Comment 5 Stefan Hoffmeister 2022-09-11 08:04:29 UTC
Elsewhere it was mentioned that Microsoft Windows fast start-up could play a role; this is definintely not the case for me.

a) While I do have an installation of Microsoft Windows, my reproducing scenario is strictly the loop "cold boot Fedora 36; clean shutdown from KDE menu" 

b) Note that SDDM does have working Bluetooth, it's just that KDE turns it off ...
Comment 6 Stefan Hoffmeister 2022-09-11 08:44:33 UTC
Confirmed with KDE 5.25.5 (which just came via Fedora 36 updates).

The contents of `~/.config/bluedevilglobalrc ` are

 ```
[Adapters]
xx:xx:xx:xx:xx:xx_powered=false

[Devices]
connectedDevices=
```

The contents of this file do change if I change the configuration via system settings, e.g. adding:
```
[Global]
launchState=enable
```
Comment 7 Stefan Hoffmeister 2022-09-11 08:52:28 UTC
From casual browsing of master of https://invent.kde.org/plasma/bluedevil/-/tree/master/src (i.e. upcoming 5.26) it would seem as if up to https://invent.kde.org/plasma/bluedevil/-/blob/18f444a67f91b0bfeef6ddbbcc9938b2d9c0a971/src/kded/devicemonitor.cpp#L174 all the right things take place (with "bluetoothBlocked", "launchState" not being persisted), which may point towards BluezQt::setBluetoothBlocked doing things it should not be doing?
Comment 8 Nate Graham 2022-09-12 18:38:32 UTC
I would think so, yeah. :( Feel free to file an upstream bug report, link it here, and we'll see what happens.
Comment 9 Stefan Hoffmeister 2022-09-12 19:15:10 UTC
My plan of action is to sprinkle log statements into bluedevil - at least on the restore path -, to add some observability.

I am trying to set up a reasonably complete KDE build environment (master) and figure out how to run this (on an isolated account) without putting my system at large at risk. May take a while.

Additional data point: Just this night I cold booted into KDE/X11 - and Bluetooth stayed on after logging in from SDDM (i.e. it "remembered").