pop-os / default-settings

Distribution Default Settings
Other
44 stars 16 forks source link

Bluetooth off after waking from suspend 22.04 #158

Closed jravetch closed 2 years ago

jravetch commented 2 years ago

With bluetooth on, I enable suspend. After waking from suspend bluetooth is off, I need to turn it back on. I see the same issue was fixed for 20.04 now it's happening in 22.04 #147. I'm on a Dell XPS 13 7390.

RW21 commented 2 years ago

Yep. Can confirm that it is happening. I'm on a Dell XPS 15 9500, 22.04.

Strange that when I run lib/systemd/system-sleep/pop-default-settings_bluetooth-suspend from bash, it works fine. However if it runs when my machine resumes from sleep, it does run, but bluetooth does not get unblocked.

I also checked that this line does actually run.

[ ! -f "$BT_BLOCK_PATH" ] && rfkill unblock bluetooth

Other things I checked:

The script is working completely as intended, but perhaps something else is preventing bluetooth from unblocking?

RW21 commented 2 years ago

For the moment, I emptied the script. Bluetooth does not get unblocked when suspended, but that is fine for me.

jravetch commented 2 years ago

Clearing the script does enable bluetooth upon waking from suspend, but my devices no longer autoconnect. Unblocking is required for my bluetooth mouse to connect.

jackpot51 commented 2 years ago

This sounds to me like a timing issue. Perhaps adding a sleep to the script would help?

We may be able to remove this script now, if the Linux regression requiring it is fixed. I am hesitant to do that, however, in case the regression comes back.

jravetch commented 2 years ago

What was the regression that made this an issue? I'm fine with keeping the script as long as it does what it's intended. Where should I put the sleep?

jackpot51 commented 2 years ago

The regression is that a number of bluetooth controllers broke suspend with kernels 5.18 and newer. This script just turns them off prior to suspend, and back on after. A sleep before the rfkill unblock bluetooth command would work.

jackpot51 commented 2 years ago

[ ! -f "$BT_BLOCK_PATH" ] && sleep 1 && rfkill unblock bluetooth will sleep 1 second before trying to unblock bluetooth. Adjust the 1 up if it does not work until you have a good value.

jravetch commented 2 years ago

That worked perfectly! Thank you so much! Can I submit a pull request to add the sleep here https://github.com/pop-os/default-settings/blob/master_jammy/lib/systemd/system-sleep/pop-default-settings_bluetooth-suspend#L22 ?

jackpot51 commented 2 years ago

Absolutely. We will then have to put it through extensive QA to ensure there are no regressions.

backmeupplz commented 8 months ago

Hmm it seems to still happen to me on ThinkPad X1 Carbon gen 10 and 22.04