omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy-bluetooth-power off: type-wide rfkill block trips platform switches and removes the radio from the USB bus (ThinkPad/Dell)

Open DrakeMorrison opened this issue 3 months ago • 21 comments

Summary

omarchy-bluetooth-power off runs rfkill block bluetooth, a type-wide block. On laptops that expose a platform Bluetooth rfkill switch next to the adapter's own hci0 switch (ThinkPads via thinkpad_acpi, Dells via dell-laptop, …), that also blocks the platform switch — and the embedded controller answers by cutting USB power to the Bluetooth module. hci0 disappears from the kernel entirely rather than going Powered: no.

This is the root cause behind the "widget disappears" report in #6956 on this class of hardware, and it is what makes the panel-side fixes there (#7048, #7065) insufficient on it: keeping the toggle visible doesn't help when the radio is no longer on the bus.

Expected Behaviour

Turning Bluetooth off leaves the adapter present and soft-blocked (Powered: no), so BlueZ and the panel still see it and the toggle can turn it back on. The off state should still persist across reboots (the reason the block was chosen).

Actual Behaviour

On a ThinkPad E16 Gen 1, rfkill block bluetooth disconnects the module within 3–50 ms:

rfkill[343193]: block set for type bluetooth
kernel: usb 3-10: USB disconnect, device number 5
systemd[1]: Stopped target Bluetooth Support.

After that bluetoothctl list is empty, /sys/class/bluetooth/ is empty, the 8087:0026 device is gone from the USB bus, and the only rfkill left is the platform one:

$ rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
        Soft blocked: yes
        Hard blocked: no

Here rfkill unblock bluetooth does re-enumerate the module (~0.5 s + ~2 s firmware load), so omarchy-bluetooth-power on recovers it from a terminal. The Dell Latitude 7440 report on #6956 shows hardware where even that fails and only a suspend/resume or reboot brings the radio back.

Steps to Reproduce

On a machine where rfkill list shows a platform switch alongside hci0:

  1. omarchy-bluetooth-power off (or the panel switch / right-click on the bar icon).
  2. journalctl -k -f shows usb N-M: USB disconnect immediately after the block.
  3. bluetoothctl list → no controllers; rfkill list → only the platform switch.
  4. The bar icon vanishes (Panel.qml: visible: adapter !== null), and toggleBluetooth() returns early on !adapter, so there is no UI way back.

Cause

omarchy-bluetooth-power:

off)
    rfkill block bluetooth

rfkill block <type> is RFKILL_OP_CHANGE_ALL: the kernel sets the global state for the type and blocks every rfkill of that type, including platform switches whose set_block callback talks to firmware. On thinkpad_acpi that is the SBDC ACPI method, and the EC then powers the CNVi Bluetooth side down.

Suggested Fix

Block only the adapter rfkills, not the platform switches:

# indexes of the hci* rfkills
rfkill -n -o ID,DEVICE | awk '$2 ~ /^hci/ {print $1}' | xargs -r -n1 rfkill block

hci0's soft block still drops the adapter to Powered: no, and systemd-rfkill persists it under the adapter's own ID (/var/lib/systemd/rfkill/pci-…-usb-…:bluetooth), so the off state survives a reboot the same way. on can stay rfkill unblock bluetooth since unblocking the platform switch is harmless.

Two caveats worth handling:

  • The hci rfkill is recreated if the adapter is re-enumerated (suspend/resume on some machines), and a new rfkill inherits the global type state — which a per-index block never sets. So after a resume the adapter may come back unblocked even though the user turned it off. omarchy-bluetooth-power (or a udev rule on the hci rfkill add) may need to re-apply the saved state; alternatively keep the type-wide block but immediately unblock platform switches by index.
  • is-on/powered should treat "no controller but a platform switch is soft-blocked" as off, not no hardware, so the panel can show "Turned Off" — which is what #7048 / #7065 do.

Workaround I'm running

A udev rule that fires on the platform switch's change event with soft=1, unblocks that switch by index, and (if the adapter did re-enumerate) re-blocks just hci0 for a few seconds so systemd-rfkill's restore doesn't power it back up:

ACTION=="change", SUBSYSTEM=="rfkill", ATTR{name}=="tpacpi_bluetooth_sw", ATTR{soft}=="1", \
  RUN+="/usr/bin/systemd-run --no-block --collect --unit=thinkpad-bluetooth-keep-adapter /usr/local/bin/thinkpad-bluetooth-keep-adapter $attr{index}"

In practice the rule runs within ~6 ms — before the EC cuts power — so the module never even disconnects and the toggle just works. Happy to turn the per-index approach into a PR against omarchy-bluetooth-power if that direction is welcome.

System Details

  • Lenovo ThinkPad E16 Gen 1 (21JN0040US), BIOS R2AET59W 1.34
  • CPU: Intel Core i5-1335U · GPU: Iris Xe
  • Bluetooth: Intel (8087:0026) on Raptor Lake CNVi, USB-attached; platform rfkill tpacpi_bluetooth_sw from thinkpad_acpi
  • Kernel 7.1.9-arch1-2 · bluez 5.87-2
  • Omarchy 4.0.0-1 (Quattro)
  • Debug log (expires in 24 h; journal section deduplicated, dmesg skipped, relevant rfkill/USB journal lines appended at the end): https://logs.omarchy.org/BXDjuk

DrakeMorrison avatar Aug 23 '26 17:08 DrakeMorrison

Confirming this on a ThinkPad P1 Gen 2 (20QTS00W00), which adds a second ThinkPad model and a different Bluetooth generation to the report — the radio here is the Intel AX200 (8086:2723 on PCI, Bluetooth function USB-attached at 1-14) rather than the E16's Raptor Lake 8087:0026. Same failure.

Current state after Bluetooth was turned off from the bar widget, matching your "Actual Behaviour" exactly:

$ rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
        Soft blocked: yes
        Hard blocked: no
2: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no

The hci0 rfkill entry is gone entirely rather than soft-blocked, and the module is off the USB bus:

$ ls /sys/class/bluetooth/
(empty)

$ bluetoothctl list
(empty)

# scan of /sys/bus/usb/devices/*/idVendor
NO 8087:* device on the USB bus

$ lsmod | grep btusb
btusb    refcount=0        # nothing bound

rfkill unblock bluetooth re-enumerates the module and recovers it here, so this machine behaves like your E16 rather than the Dell Latitude 7440 in #6956.

Worth noting the trap is closed on both sides in the shell: the bar widget is hidden by Panel.qml:500 (visible: adapter !== null), and toggleBluetooth() returns early on if (!adapter) return at Panel.qml:636 — so even the omarchy.bluetooth IPC handler can't turn it back on. Recovery has to come from outside quickshell entirely. Working around it with a keybinding straight to the helper, which is unaffected because its powered() check reads rfkill rather than the absent adapter:

o.bind("SUPER + CTRL + SHIFT + B", "Bluetooth on/off", "omarchy-bluetooth-power toggle")

The per-index blocking fix you propose would address this properly.

System details
  • Lenovo ThinkPad P1 Gen 2 (20QTS00W00), BIOS N2OET66W 1.53 (2025-02-18)
  • CPU: Intel Core i7-9750H · GPU: Quadro T1000 Mobile + UHD 630
  • Bluetooth: Intel AX200 (8086:2723), USB-attached BT function; platform rfkill tpacpi_bluetooth_sw from thinkpad_acpi
  • Kernel 7.1.9-arch1-2 · bluez 5.87-2
  • Omarchy 4.0.2-1

I did not capture the usb N-M: USB disconnect line at the moment of blocking (kernel log not retained for the transition) — the above is the resulting state.

lkinley-rythmos avatar Aug 31 '26 20:08 lkinley-rythmos

Third platform confirm: ThinkPad X1 Carbon (hostname x1novo), Intel AX211 (firmware intel/ibt-0180-0041.sfi, version 42-20.25), Omarchy 4.0.2-1, kernel 7.1.9-arch1-2. This is a second ThinkPad where rfkill unblock bluetooth alone does NOT re-enumerate the radio (unlike the P1 Gen 2 / AX200 above), so the "ThinkPads recover on unblock" split is model/radio-dependent, not vendor-wide.

This machine retained the block-time kernel log lines the P1 report was missing (toggle-off via the bar widget, 2026-09-01 21:04 local):

Sep 01 21:04:23 x1novo kernel: usb usb3-port10: disabled by hub (EMI?), re-enabling...
Sep 01 21:04:23 x1novo kernel: usb 3-10: USB disconnect, device number 4
Sep 01 21:04:24 x1novo kernel: Bluetooth: hci0: HCI reset during shutdown failed
Sep 01 21:04:24 x1novo kernel: Bluetooth: hci0: Error when powering off device on rfkill (-19)
Sep 01 21:04:24 x1novo rfkill[184562]: block set for type bluetooth

The port-disable ("EMI?") lands one second before the rfkill block write; the radio never re-enumerated afterwards. Resulting state matches the report: tpacpi_bluetooth_sw soft-blocked, hci0 rfkill entry gone, no BT USB device on the bus, btusb refcount 0, /sys/class/bluetooth/ empty, widget hidden (Panel.qml:500), toggle unreachable (Panel.qml:636).

Recovery on this machine: rfkill unblock and systemctl restart bluetooth did not restore it; re-probing the xHCI controller hosting the BT port (echo 0000:00:14.0 > /sys/bus/pci/drivers/xhci_hcd/unbind, then bind) re-enumerated the radio.

Filed by deepseek-v4-flash via the omp agent harness.

lucserre avatar Sep 02 '26 01:09 lucserre

Hardware datapoint that sits in the “ThinkPad, but unblock does not re-enumerate” bucket already noted here — with a model/SKU and a USB-level failure mode that is more specific than “needs xHCI reset.”

Machine

  • Lenovo ThinkPad X1 Carbon Gen 12 (21KCS4S900)
  • Intel Meteor Lake CNVi Wi-Fi 8086:7e40 (iwlwifi) + AX211 Bluetooth USB 8087:0033 on usb 3-10
  • xHCI 0000:00:14.0 (8086:7e7d)
  • Omarchy 4.0.2-1, kernel 7.1.9-arch1-2, BlueZ 5.87-2, quickshell 0.3.1-1
  • rfkill while working: tpacpi_bluetooth_sw + hci0 (both bluetooth), plus phy0

Off (bar right-click / omarchy-bluetooth-power off)

kernel: usb 3-10: USB disconnect, device number 4
kernel: Bluetooth: hci0: HCI reset during shutdown failed
kernel: Bluetooth: hci0: Error when powering off device on rfkill (-19)

After that: no /sys/class/bluetooth/hci0, no 8087:0033 on lsusb, bar widget gone (Panel.qml visible: adapter !== null).

On does not recover, even after the platform switch is already enabled

omarchy bluetooth power on / rfkill unblock bluetooth left:

tpacpi_bluetooth_sw  SOFT=no  HARD=no
/proc/acpi/ibm/bluetooth  status:enabled
bluetooth_enable=1

…and still no controller. omarchy-bluetooth-power then failed with adapter did not come up. The port was not simply powered off: the kernel kept trying to bring usb 3-10 up as low-speed and dying with -71:

usb 3-10: new low-speed USB device number N using xhci_hcd
usb 3-10: device descriptor read/64, error -71
usb usb3-port10: attempt power cycle
usb 3-10: Device not responding to setup address.
usb usb3-port10: unable to enumerate USB device

Tried and failed (in order)

  1. ACPI disable/enable on /proc/acpi/ibm/bluetooth
  2. bluetooth_enable 0/1
  3. USB port usb3-port10/disable 1 then 0
  4. rfkill block then unblock + ACPI enable
  5. modprobe -r btusb && modprobe btusb
  6. PCI reset of the CNVi device 0000:00:14.3 (Wi-Fi dropped briefly; BT still missing)

What actually brought 8087:0033 back

Reset the xHCI controller that owns usb 3-10:

echo -n '0000:00:14.0' > /sys/bus/pci/drivers/xhci_hcd/unbind
sleep 3
echo -n '0000:00:14.0' > /sys/bus/pci/drivers/xhci_hcd/bind

Immediately after bind:

usb 3-10: new full-speed USB device number 4 using xhci_hcd
usb 3-10: New USB device found, idVendor=8087, idProduct=0033
Bluetooth: hci0: Found device firmware: intel/ibt-0180-0041.sfi
Bluetooth: hci0: Firmware Version: 42-20.25

Then bluetoothctl power on succeeded (Powered: yes). Camera and fingerprint on the same xHCI drop for a few seconds; Wi-Fi does not.

Implication for this issue

Same root as the report: type-wide rfkill block bluetooth trips tpacpi_bluetooth_sw and the EC yanks the CNVi BT USB function. On this Gen 12 / 8087:0033 the radio can then stick in a half-powered PHY state where:

  • the platform rfkill already reads unblocked
  • omarchy-bluetooth-power on is a no-op (no adapter)
  • only an xHCI host reset re-enumerates it as full-speed

So the “ThinkPad: unblock re-enumerates / Dell: only suspend-or-reboot” split is too coarse. A panel-only fix that calls omarchy-bluetooth-power on when adapter === null would still leave this machine with a visible, dead toggle. Narrowing the block to hci* (as suggested in the issue) is the Omarchy-side prevention; power_on() has no recovery path today for the -71 wedge.

stottm avatar Sep 06 '26 14:09 stottm

Dell datapoint, since the Dell side of the title has none in-thread yet. The platform switch here is dell-bluetooth (from dell-laptop), not tpacpi.

  • Dell Latitude 5540, BIOS 1.26.0. Intel Bluetooth USB 8087:0033 on usb 3-10, xHCI 0000:00:14.0.
  • Omarchy 4.0.1-1, kernel 7.1.9-arch1-2, bluez 5.87-2.

Turning Bluetooth off from the bar widget:

kernel: usb usb3-port10: disabled by hub (EMI?), re-enabling...
kernel: usb 3-10: USB disconnect, device number 4
kernel: Bluetooth: hci0: HCI reset during shutdown failed
kernel: Bluetooth: hci0: Error when powering off device on rfkill (-19)
rfkill: block set for type bluetooth

After rfkill unblock bluetooth, the port kept failing to enumerate for about 3 hours (usb 3-10: device not accepting address N, error -71, repeated). A second block/unblock cycle didn't help. Unbinding and rebinding 0000:00:14.0 from xhci_hcd brought it back. This is the same failure as the X1 Carbon reports, so the "unblock does not re-enumerate" group covers a Dell as well as ThinkPads.

Filed by Claude Opus 5.5 via Claude Code.

Hurleveur avatar Sep 24 '26 16:09 Hurleveur

Dell datapoint: same hardware as the wedged Latitude 5540 above, but it always recovers.

  • Dell Latitude 5431, BIOS 1.40.0. Intel Bluetooth USB 8087:0033 on usb 3-10 (Alder Lake-P CNVi), platform switch dell-bluetooth (dell-laptop) next to hci0.
  • Omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, bluez 5.87-2, quickshell 0.3.1-1.

A type-wide block (bar widget, omarchy-bluetooth-power off, or systemd-rfkill's restore at boot) always drops the module off the bus, and omarchy-bluetooth-power on has re-enumerated it every time (5 of 5, ~3 s, exit 0).

The shutdown varies. Some blocks disconnect cleanly; others log

hci0: Opcode 0x0c1a failed: -110
hci0: Error when powering off device on rfkill (-110)
hci0: Initiating acpi reset method
usb 3-10: USB disconnect
hci0: HCI reset during shutdown failed

with rfkill block itself hanging ~10 s, and those recovered too. So HCI reset during shutdown failed alone does not predict the wedge. What this machine never shows is the disabled by hub (EMI?) port-disable, the -19 (device already gone), or the -71 enumeration failures afterwards that the X1 Carbon and 5540 reports have.

Blocking only the hci rfkill by index, as suggested above, works here: 8 of 8 cycles kept the module on the bus (PowerState: off-blocked) with no kernel errors, and unblocking powered it straight back up. I'm running that in a local fork of the panel.

The panel trap (Panel.qml:500 and :636) is unchanged on current quattro.

Filed by Claude Opus 5.5 via Claude Code.

0xHouss avatar Sep 29 '26 11:09 0xHouss

Additional measured consequence of the platform-switch shutdown: WirePlumber crashed in PipeWire’s Bluetooth plugin during the same transition.

Environment: Omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, Quickshell 0.3.1-1, BlueZ 5.87-2, WirePlumber 0.5.17-1, pipewire-audio 1:1.6.8-1. Bluetooth was turned off through the bar.

On October 5, the journal recorded the Intel Bluetooth device 8087:0026 disconnecting at 11:14:30.954, followed by wp-client segfaulting in libspa-bluez5.so at 11:14:30.979. Systemd restarted WirePlumber.

Afterwards, tpacpi_bluetooth_sw was soft-blocked, /sys/class/bluetooth/ was empty, and BlueZ had no controller despite bluetooth.service remaining active. The bar icon disappeared.

The core confirms an invalid read at 0xb4 in libspa-bluez5.so + 0x4121e. Symbols were unavailable. This establishes an accompanying PipeWire-plugin crash, not that Omarchy owns the memory-safety defect.

Recovery by unblocking has not been tested.

Filed by GPT-6 via Codex.

prestoncabe avatar Oct 05 '26 15:10 prestoncabe

Confirming this on a Dell Precision 5470 as well. The cause is the platform rfkill switch from dell_laptop, and this time the USB disconnect at the moment of blocking is in the log.

After turning Bluetooth off from the bar widget:

$ rfkill list
1: dell-wifi: Wireless LAN
	Soft blocked: no
	Hard blocked: no
2: dell-bluetooth: Bluetooth
	Soft blocked: yes
	Hard blocked: no
3: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no

$ ls /sys/class/bluetooth/
(empty)

$ journalctl -k -b | grep 'USB disconnect'
Oct 08 22:13:44 5470 kernel: usb 3-10: USB disconnect, device number 5

The bar icon then disappears (Panel.qml visible: adapter !== null), and only omarchy bluetooth power on brings it back.

Unloading or blacklisting dell_laptop doesn't work as a workaround on Dells: the same module provides the battery charge thresholds (charge_control_*_threshold, charge_types) and the keyboard backlight. Blocking only the hci* rfkill index, as proposed here, would avoid that.

System details
  • Dell Precision 5470 · Intel Core i9-12900H · Iris Xe (Alder Lake-P)
  • Platform rfkill dell-bluetooth from dell_laptop (dell_rbtn also loaded)
  • Kernel 7.2.5-3-omarchy · bluez 5.87-2 · quickshell 0.3.1-1
  • Omarchy 4.0.4-1

mahbubhelal avatar Oct 08 '26 16:10 mahbubhelal

Reviewed against current quattro (c352b62d). The cause described here is still in the source: bin/omarchy-bluetooth-power issues the type-wide rfkill block bluetooth for off (line 73) and for toggle when powered (line 77). Every way the shell turns Bluetooth off (bar right-click, the panel switch, the omarchy.bluetooth IPC handler, the panel's keyboard toggle) and the migration 1786380259.sh go through that helper, and nothing else in the repository blocks Bluetooth type-wide. Nothing on quattro has fixed it another way. The firmware power cut itself was not reproduced, because a worker VM has no platform rfkill switch, so this rests on the source and on the hardware reports in this thread.

#12753 is the fix. It blocks only the hci* rfkill indexes and leaves the platform switch alone, which covers both lines above, and it already carries Fixes #7936, so this issue closes when it merges. It is reviewed separately as its own item. It has been tested on ThinkPad P15v Gen 3 (Intel), T420 (Broadcom) and T14 Gen 2a (Realtek). @DrakeMorrison, a run of its head d03abf559bcedf1872bfc52086c11fda6e8d85f4 on the E16 Gen 1 is the confirmation that PR is waiting on. A test from one of the Dell machines here would also help, since every test on that PR so far is from a ThinkPad.

One limitation that PR leaves open: if the adapter re-enumerates (some resumes do), its new rfkill takes the global type state, which a per-index block never sets, so it may come back on. #13342 tracks "off" not surviving a reboot.

Second opinion: Codex Medium checked the same four points (the blocking lines, other callers, whether quattro already fixes it, older duplicates) and reached the same conclusions. It also pointed out that the PR's fallback still blocks type-wide when no hci* switch is listed. That only happens once the adapter is already gone, so it does not reintroduce this bug. Its agreement is not guaranteed to be independent. It did not find an older open issue with the same cause (#6956 had it, and is closed).

This now waits on the maintainer's decision on #12753.

omarchybot avatar Oct 08 '26 23:10 omarchybot

Canonical report for this bug. #12494, #12599, #13523, and #15112 are the same failure filed again: the bar loses the adapter after Bluetooth is turned off. Please close them as duplicates of this issue.

Scope correction for the second caveat in the report. A controller that is already gone is an invalid state. The panel is right to say "No adapter" and hide the toggle. The helper has to refuse to create that state. A panel change that treats a missing adapter as "Turned Off" and turns the radio back on is a recovery path, so #10749, #12585, and #13204 are not the fix.

#12753 is the right guard: block only hci* indexes. It still has a hole, noted on that PR. When no hci* switch is listed it falls back to rfkill block bluetooth, and the new test requires that result for a list that contains only the platform switch.

vstoyanov avatar Oct 17 '26 15:10 vstoyanov

A correction to my earlier comment, prompted by @vstoyanov's point. I said #12753's fallback to a type-wide block "only happens once the adapter is already gone, so it does not reintroduce this bug". That was too strong. block_adapters() falls back to rfkill block bluetooth whenever the listing shows no hci* switch (bin/omarchy-bluetooth-power:85-87 on the PR head, d03abf559bcedf1872bfc52086c11fda6e8d85f4). That includes an adapter that never registered and a listing that failed, not only one that was removed. Migration 1786380259 on current quattro (386176ab) runs off whenever is-on is false, so it can reach that fallback with the platform switch present and trip it. This is a gap the PR leaves, not a regression from quattro, which blocks type-wide on every off. It is discussed in full on #12753, along with what removing the fallback outright would cost.

Nothing else here has changed. The cause is still in the source on quattro, #12753 is still the fix and still carries Fixes #7936, and the confirmation from @DrakeMorrison on the E16 Gen 1 is still outstanding. The four issues named above as duplicates are each compared against this one, report against report, when they are worked as their own items.

Second opinion: Codex Medium read this issue, the PR diff and its latest comments, and the four named issues. It agreed the earlier statement was inaccurate, and it added the failed-listing case. It could read the earlier comments, so its agreement is not guaranteed to be independent. I checked the migration and the fallback against the source myself.

This waits on the maintainer's decision on #12753.

omarchybot avatar Oct 17 '26 22:10 omarchybot

Another datapoint, this time on AMD with a Realtek radio (the confirmations so far look Intel-only): ThinkPad E16 Gen 3 (21ST0041MX), AMD Ryzen 7 250 / Radeon 780M, Realtek Bluetooth 0bda:5852 (USB). Omarchy 4.0.4-1, kernel 7.2.5-3-omarchy, Quickshell 0.3.1-1, bluez 5.87-2.

Same behavior: turning Bluetooth off from the bar soft-blocks tpacpi_bluetooth_sw, hci0 disappears and the widget vanishes.

# Bluetooth off (from the bar)
$ rfkill list bluetooth
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
$ bluetoothctl list
(empty)

# Bluetooth on
$ rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: no
	Hard blocked: no
2: phy0: Wireless LAN
	Soft blocked: no
	Hard blocked: no
16: hci0: Bluetooth
	Soft blocked: no
	Hard blocked: no

On this machine the unblock does re-enumerate: omarchy-bluetooth-power on brings hci0 back. So it sits in the "comes back after unblock" bucket, and scoping the block to hci* (#12753) should be enough to keep the widget in the bar here.

rollinjk avatar Oct 23 '26 05:10 rollinjk

#12753 has a new head, 048d6fa686d3e356e9a23d05820b001541846d7f, and it closes the gap I described in my last comment. At that head, a failed rfkill listing returns before anything is blocked (bin/omarchy-bluetooth-power:87), and a listing that names only the platform switch blocks nothing (:100-105). So neither off nor toggle, nor migration 1786380259 running off, can trip tpacpi_bluetooth_sw or dell-bluetooth any more. The type-wide block is kept only for a listing that succeeds and names no switch at all, where there is no platform switch to trip. The trade-off: with only the platform switch listed, off now succeeds without blocking anything, so a radio that comes back once that switch is unblocked comes back on. The cause is still in the source on current quattro (967bbdd7, lines 73 and 77).

@rollinjk's E16 Gen 3 report is the first on AMD with a Realtek radio. It was run on stock 4.0.4, so it confirms the cause on that hardware but not the fix.

What this waits on has changed only in the head to test. @DrakeMorrison, the head to run on the E16 Gen 1 is now 048d6fa, not the d03abf55 my first comment named; #12753 has the steps. Since that head, two reporters have tested it on ThinkPads (an X1 Carbon Gen 12 and a T14 Gen 2a), and both kept the adapter on the bus. A run from one of the Dells here would still help, since no Dell has tested any head of that PR, and so would one from @rollinjk's AMD machine.

Who checked it: reviewed by Claude Opus 5.5, with Codex Medium and muse-spark-1.3-contributor (via pi, thinking high) as second opinions. Both reread the helper on quattro and at the new head and agreed with the points above. Codex added that listing and blocking are separate steps, so a platform switch that appears between them would meet the empty-listing block. Nothing shows that happens on real hardware. Both reviewers could read my earlier comments, so their agreement is not guaranteed to be independent. No worker was used, because a VM has no platform rfkill switch. The PR itself was run on a worker when it was reviewed as its own item.

This waits on a hardware confirmation of 048d6fa or on the maintainer's decision on #12753.

omarchybot avatar Oct 23 '26 05:10 omarchybot

The Dell test requested above has arrived on #12753. At f3d81365d2d5a5b37ce8366bc02dabcbcf71000f, @h45sh reported that only hci0 was blocked, dell-bluetooth stayed unblocked, the controller stayed registered at Powered: no without a USB disconnect, and on restored Powered: yes. They also rechecked the actual exit status: off returned 0.

That is the current PR head; its helper is unchanged from 048d6fa, named in the previous comment. Current quattro (c6be7abb) still blocks Bluetooth type-wide at bin/omarchy-bluetooth-power:73,77. #12753 remains open and already links this issue.

One correction to the previous comment: the E16 Gen 3 was not the first AMD/Realtek report. @echennells had already reported the same USB disconnect on an AMD T14 Gen 2a.

@DrakeMorrison, please test the full head above on the E16 Gen 1 using these steps. This still waits on your confirmation or the maintainer's decision on #12753; the new Dell test is from another tester.

GPT-6 High in Codex checked the source and hardware reports. Opus 5.5 High and muse-wonder via pi, thinking high, agreed on the cause and remaining confirmation; their agreement is not guaranteed to be independent. Opus also caught the AMD-report correction above. No worker or hardware test ran in this session: a VM cannot reproduce the platform firmware's USB power cut.

omarchybot avatar Nov 18 '26 02:11 omarchybot

Datapoint from a ThinkPad X9-15 Gen 1 (Intel Core Ultra 5 228V, Intel Bluetooth USB 8087:0037), Omarchy 4.5.0-3, kernel 7.2.15-1-omarchy, linux-firmware 20260916-1, bluez 5.87-2, quickshell 0.3.2. Same failure as here, plus one more symptom on this hardware.

What happens

  1. The panel switch turns Bluetooth off. tpacpi_bluetooth_sw gets blocked, hci0 disappears, the switch is hidden, and toggleBluetooth() returns early because adapter is null, so the panel can't turn Bluetooth back on.
  2. New here: the type-wide block cuts power while the kernel is still shutting the controller down, and that sometimes hangs the Intel firmware:
    Bluetooth: hci0: Opcode 0x2039 failed: -110
    Bluetooth: hci0: Error when powering off device on rfkill (-110)
    Bluetooth: hci0: HCI reset during shutdown failed
    usb 3-6: device descriptor read/64, error -110
    
    rfkill block then hangs in the kernel. After an unblock the controller shows Powered: no / PowerState: on, and bluetoothctl power on fails with Failed to set mode: Authentication Failed (0x05). The only recovery was a slow block, a wait of about 8 s, then unblock.

Measured: 5 off/on cycles with a plain rfkill block bluetooth gave shutdown timeouts on every cycle (2 kernel errors each). 5 cycles with bluetoothctl power off run before the block gave 0 errors.

Local workaround (cloned omarchy.bluetooth plugin, nothing changed under /usr/share/omarchy):

  • Off runs timeout 5 bluetoothctl power off; omarchy-bluetooth-power off, so the controller is powered down over HCI before the platform switch cuts its power.
  • The panel tracks the Bluetooth rfkill switches (/sys/class/rfkill/*/{type,soft}, refreshed on rfkill event). When a radio exists but adapter is null or soft-blocked, the panel shows it as off and keeps the bar icon and switch visible, so on still reaches omarchy-bluetooth-power.

With both changes, 4/4 off/on cycles through the panel worked with no kernel errors. #12753 (blocking only hci*) should make the first change unnecessary on this machine too, since tpacpi_bluetooth_sw would no longer be touched. I haven't tested that PR here.

Vpestininkas avatar Nov 19 '26 09:11 Vpestininkas

@Vpestininkas, please test #12753 at f3d81365d2d5a5b37ce8366bc02dabcbcf71000f using the temporary-helper instructions. Start with a working controller, disable the local plugin workaround, and run that helper directly without a preceding bluetoothctl power off. Five off/on cycles would let us compare with your measurements. Please include each off exit status, whether tpacpi_bluetooth_sw stays unblocked and hci0 stays listed but blocked at Powered: no, and whether on restores Powered: yes. Check for shutdown timeouts and Authentication Failed as well as USB disconnects.

There is already a successful P1 Gen 5 test on Omarchy 4.5.0-3/kernel 7.2.15, but its Intel radio is 8087:0033; it does not establish the result on your 8087:0037. Your current workaround changes both shutdown ordering and panel recovery, so it does not test the HCI-only block by itself.

Current quattro still blocks type-wide. #12753 remains open at that head and already links this issue; this stays pending the maintainer's decision. Your test would add X9 coverage. Confirmation from the original issue reporter or a maintainer remains outstanding.

GPT-6 High in Codex checked the current source and hardware reports. Opus 5.5 High and muse-wonder via pi, thinking high, agreed with this assessment; their agreement is not guaranteed independent. No worker or hardware test ran here: a VM cannot exercise the platform firmware's USB power cut.

omarchybot avatar Nov 19 '26 09:11 omarchybot

Another confirmation, on a ThinkPad X1 Carbon 6th gen (20KH), Omarchy 4.5.0-3, kernel 7.2.15-1-omarchy.

Hardware: Intel 8087:0a2b Bluetooth (btusb) behind the tpacpi_bluetooth_sw platform rfkill switch.

Steps to reproduce

  1. Open the Bluetooth panel in the bar and flip the switch off (or right-click the icon).
  2. The Bluetooth icon disappears from the bar, and the panel can no longer be opened.
  3. There is no UI path to turn it back on. The only way back is omarchy bluetooth power on / rfkill unblock bluetooth.

Evidence After turning it off:

$ rfkill list
0: tpacpi_bluetooth_sw: Bluetooth
	Soft blocked: yes
	Hard blocked: no
(hci0 rfkill entry is gone)

$ bluetoothctl show
No default controller available

Blocking the tpacpi_bluetooth_sw switch cuts the USB controller, so hci0 leaves the bus. Bluetooth.defaultAdapter becomes null, and Panel.qml has visible: adapter !== null, icon: "" and an early return in toggleBluetooth() when there is no adapter. So the widget hides itself together with the only control that could bring the adapter back.

After rfkill unblock bluetooth, hci0 comes back after about 2 s and powers on normally.

Local workaround (verified) I cloned the widget (omarchy plugin clone omarchy.bluetooth) and kept it visible whenever a Bluetooth rfkill switch exists while no adapter is present. It probes /sys/class/rfkill/*/type and, in that state, shows the off icon and switch, and calls omarchy-bluetooth-power on. I tested an off → on → off → on cycle through the widget's IPC toggleBluetooth, and it works every time. This is the same approach as #15859 / #16970 / #13204, so +1 to getting one of those (or #12753, which scopes the block so the platform switch isn't tripped) merged.

Workaround diff against the stock Panel.qml
--- Panel.qml.orig	2026-11-24 15:35:39.658758022 +0100
+++ b/shell/plugins/panels/bluetooth/Panel.qml
@@ -24,6 +24,26 @@
 
   readonly property var adapter: Bluetooth.defaultAdapter
 
+  // Local fix: on some laptops (e.g. ThinkPads, tpacpi) an rfkill soft block
+  // removes the controller entirely, so BlueZ reports no adapter. Keep the
+  // widget visible while a Bluetooth rfkill switch exists so it can be turned
+  // back on.
+  property bool hasBluetoothRadio: false
+  readonly property bool radioOff: !adapter && hasBluetoothRadio
+
+  Process {
+    id: radioProbe
+    command: ["sh", "-c", "grep -qx bluetooth /sys/class/rfkill/*/type 2>/dev/null"]
+    onExited: function(code) { root.hasBluetoothRadio = (code === 0) }
+  }
+  Timer {
+    interval: 3000
+    repeat: true
+    running: !root.adapter
+    triggeredOnStart: true
+    onTriggered: if (!radioProbe.running) radioProbe.running = true
+  }
+
   // True while this instance owes BlueZ a StopDiscovery: set when it starts
   // discovery (or opens onto a session already running) and cleared once
   // discovery is confirmed down after close. Ownership, not state — BlueZ's
@@ -57,7 +77,7 @@
   readonly property var discoveredDevices: deviceGroups.discovered || []
 
   readonly property string icon: {
-    if (!adapter) return ""
+    if (!adapter) return radioOff ? "󰂲" : ""
     if (!adapter.enabled) return "󰂲"
     if (connectedDevices.length > 0) return "󰂱"
     return "󰂯"
@@ -76,7 +96,7 @@
   ]
   readonly property bool rotatingPhrases: adapter && adapter.enabled
   readonly property string heroStatusText: {
-    if (!adapter) return Commons.I18n.t("bluetooth.noAdapter")
+    if (!adapter) return radioOff ? Commons.I18n.t("bluetooth.turnedOff") : Commons.I18n.t("bluetooth.noAdapter")
     if (!adapter.enabled) return Commons.I18n.t("bluetooth.turnedOff")
     return activePhrases[phraseIndex % activePhrases.length]
   }
@@ -498,7 +518,7 @@
     if (selectedIndex < 0) selectedIndex = 0
   }
 
-  visible: adapter !== null
+  visible: adapter !== null || radioOff
   implicitWidth: button.implicitWidth
   implicitHeight: button.implicitHeight
 
@@ -634,7 +654,10 @@
   // switch only moves once BlueZ catches up, so a second click inside that window
   // would re-read the old state and undo the first.
   function toggleBluetooth() {
-    if (!adapter) return
+    if (!adapter) {
+      if (radioOff) Quickshell.execDetached(["omarchy-bluetooth-power", "on"])
+      return
+    }
     Quickshell.execDetached(["omarchy-bluetooth-power", adapter.enabled ? "off" : "on"])
   }
 
@@ -715,7 +738,7 @@
           // header's only cursor target.
           ToggleSwitch {
             id: powerSwitch
-            visible: !!root.adapter
+            visible: !!root.adapter || root.radioOff
             checked: !!root.adapter && root.adapter.enabled
             hasCursor: root.headerHasCursor
             foreground: root.bar.foreground

damascoElectronics avatar Nov 24 '26 14:11 damascoElectronics

@damascoElectronics, your panel workaround exercises recovery on the X1 Carbon Gen 6. To check prevention on that model, please run #12753 at f3d81365d2d5a5b37ce8366bc02dabcbcf71000f using the temporary-helper instructions. Start with a working controller and tpacpi_bluetooth_sw unblocked, disable the cloned-panel workaround, and run that helper’s off and on directly. Please include the exit statuses, rfkill list bluetooth, bluetoothctl show, and whether a USB disconnect appears. After off, the expected result is an unblocked platform switch, hci0 still listed but soft-blocked, and the controller present at Powered: no; on should restore Powered: yes.

Current quattro (3c295f27) still blocks Bluetooth type-wide in bin/omarchy-bluetooth-power:73,77. #12753 remains open at the head above and already links this issue. This remains pending the maintainer’s decision on that PR; confirmation at that head from the original issue reporter or a maintainer is still outstanding. An X1 Carbon Gen 6 test would add hardware coverage.

GPT-6 High in Codex checked the current source and the new report. Opus 5.5 High and muse-wonder via pi, thinking high, found no new source defect and agreed with this assessment; their agreement is not guaranteed independent. No worker or hardware test ran in this session: a VM cannot exercise the platform firmware’s USB power cut, and the new report has no kernel USB-disconnect log proving that step.

omarchybot avatar Nov 24 '26 15:11 omarchybot

Confirming on a ThinkPad T14 Gen 2a (20XL, AMD Ryzen 7 PRO 5850U), Omarchy 4.5.0-3, kernel 7.2.15-4-omarchy, BIOS 1.35.

"Turn off Bluetooth" in the bar soft-blocks tpacpi_bluetooth_sw; the module drops off USB (usb 3-4: USB disconnect), bluetoothctl show reports "No default controller available", and the bar icon disappears. omarchy bluetooth power on restores it.

kidskript3 avatar Nov 26 '26 19:11 kidskript3

@kidskript3, your report shows this is still occurring on 4.5.0-3. @echennells already tested the same helper successfully on a T14 Gen 2a. If you can test it on your machine too, use #12753 at f3d81365d2d5a5b37ce8366bc02dabcbcf71000f with the temporary-helper instructions. First recover with omarchy bluetooth power on and confirm the controller is present at Powered: yes and tpacpi_bluetooth_sw is unblocked. Then run the downloaded helper’s off and on directly, and include both exit statuses, rfkill list bluetooth, bluetoothctl show, and the kernel USB-disconnect log. After off, the platform switch should remain unblocked, hci0 should remain listed but soft-blocked, and the controller should show Powered: no with no USB disconnect; on should restore Powered: yes.

Current quattro (9bacda15) still blocks Bluetooth type-wide in bin/omarchy-bluetooth-power:73,77. #12753 remains open at the head above and already links this issue. This waits on the maintainer’s decision on that PR. The original reporter’s confirmation has been requested and not received; another test on your machine would add evidence alongside the existing hardware reports.

GPT-6 High in Codex checked the current source and new report. Opus 5.5 High and muse-wonder via pi, thinking high, found no new source defect; Opus also identified the earlier T14 Gen 2a test, which I checked against its report. Their agreement is not guaranteed independent. No worker or hardware test ran in this session: a VM cannot exercise this platform firmware’s USB power cut, and the new report does not include a full rfkill/journal trace establishing that mechanism on this unit.

omarchybot avatar Nov 26 '26 19:11 omarchybot

Tested #12753 at f3d81365d2d5a5b37ce8366bc02dabcbcf71000f on a ThinkPad X9-15 Gen 1 (Intel Bluetooth USB 8087:0037), Omarchy 4.5.0-3, kernel 7.2.15-1-omarchy, bluez 5.87-2, quickshell 0.3.2. I ran the pinned helper directly, with my local plugin workaround disabled and no preceding bluetoothctl power off.

Five off/on cycles, all clean. Before off, rfkill listed tpacpi_bluetooth_sw (id 0) and hci0 (id 3), both unblocked. A bash -x trace shows the helper ran only rfkill block 3. After each off:

  • exit status 0
  • tpacpi_bluetooth_sw unblocked, hci0 still listed and blocked
  • Powered: no, PowerState: off-blocked
  • no USB disconnect, no -110 shutdown timeout, no Authentication Failed

Each on exited 0 and restored Powered: yes. In my earlier report, five cycles of a plain rfkill block bluetooth gave shutdown timeouts on every cycle, so on this machine the hci*-only block fixes that failure too.

The bar still reproduces the bug through the unpatched helper. Turning Bluetooth off from the bar during this session logged rfkill: block set for type bluetooth, usb 3-6: USB disconnect and hci0: Error when powering off device on rfkill (-19). tpacpi_bluetooth_sw was soft-blocked and hci0 was gone. That is the bug itself: the bar goes through /usr/bin/omarchy-bluetooth-power. rfkill logs the PR helper's blocks as block set for id N, and every block it made in this test has that form. With a cloned panel pointed at a local copy of the PR's helper, turning off from the bar logged block set for id 6, with no USB disconnect, and on restored Powered: yes.

Vpestininkas avatar Nov 29 '26 11:11 Vpestininkas