From ac41ddc86a3e2f45bd1fd889135fe4758feeddef Mon Sep 17 00:00:00 2001 From: VECTORG99 Date: Thu, 20 Aug 2026 17:13:12 -0400 Subject: [PATCH 1/2] feat: opt-in udev rule to keep AMD xHCI controllers awake on resume --- bin/omarchy-menu | 3 ++- bin/omarchy-toggle-amd-xhci-wakeup | 11 +++++++++++ install/config/all.sh | 2 ++ install/config/hardware/amd/fix-xhci-resume.sh | 18 ++++++++++++++++++ migrations/1787260348.sh | 4 ++++ 5 files changed, 37 insertions(+), 1 deletion(-) create mode 100755 bin/omarchy-toggle-amd-xhci-wakeup create mode 100644 install/config/hardware/amd/fix-xhci-resume.sh create mode 100644 migrations/1787260348.sh diff --git a/bin/omarchy-menu b/bin/omarchy-menu index 035405e74413..25ceabca3def 100755 --- a/bin/omarchy-menu +++ b/bin/omarchy-menu @@ -211,7 +211,7 @@ show_share_menu() { } show_toggle_menu() { - local options="󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰂛 Notifications\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n Direct Boot\n󰟵 Passwordless Sudo" + local options="󱄄 Screensaver\n󰔎 Nightlight\n󱫖 Idle Lock\n󰂛 Notifications\n󰍜 Top Bar\n󱂬 Workspace Layout\n Window Gaps\n 1-Window Ratio\n󰍹 Monitor Scaling\n Direct Boot\n󰟵 Passwordless Sudo\n󰾅 AMD xHCI Wake" case $(menu "Toggle" "$options") in *Screensaver*) omarchy-toggle-screensaver ;; @@ -225,6 +225,7 @@ show_toggle_menu() { *Scaling*) omarchy-hyprland-monitor-scaling-cycle ;; *"Direct Boot"*) present_terminal omarchy-config-direct-boot ;; *"Passwordless Sudo"*) present_terminal omarchy-sudo-passwordless ;; + *"AMD xHCI Wake"*) present_terminal omarchy-toggle-amd-xhci-wakeup ;; *) back_to show_trigger_menu ;; esac } diff --git a/bin/omarchy-toggle-amd-xhci-wakeup b/bin/omarchy-toggle-amd-xhci-wakeup new file mode 100755 index 000000000000..e2b56fbf0df3 --- /dev/null +++ b/bin/omarchy-toggle-amd-xhci-wakeup @@ -0,0 +1,11 @@ +#!/bin/bash + +# omarchy:summary=Keep AMD xHCI controllers awake to avoid the resume dead-USB bug +# omarchy:requires-sudo=true + +omarchy-toggle \ + --enabled-notification "󰾅 AMD xHCI wake fix enabled" \ + --disabled-notification "󰾅 AMD xHCI wake fix disabled" \ + amd-xhci-wakeup + +source "$OMARCHY_PATH/install/config/hardware/amd/fix-xhci-resume.sh" \ No newline at end of file diff --git a/install/config/all.sh b/install/config/all.sh index 0c3b839822b7..bd80569db5a8 100644 --- a/install/config/all.sh +++ b/install/config/all.sh @@ -67,6 +67,8 @@ run_logged $OMARCHY_INSTALL/config/hardware/apple/fix-t2.sh run_logged $OMARCHY_INSTALL/config/hardware/lenovo/fix-yoga-pro7-bass-speakers.sh +run_logged $OMARCHY_INSTALL/config/hardware/amd/fix-xhci-resume.sh + run_logged $OMARCHY_INSTALL/config/hardware/fix-bcm43xx.sh run_logged $OMARCHY_INSTALL/config/hardware/fix-surface-keyboard.sh run_logged $OMARCHY_INSTALL/config/hardware/fix-yt6801-ethernet-adapter.sh diff --git a/install/config/hardware/amd/fix-xhci-resume.sh b/install/config/hardware/amd/fix-xhci-resume.sh new file mode 100644 index 000000000000..f693ba250cd5 --- /dev/null +++ b/install/config/hardware/amd/fix-xhci-resume.sh @@ -0,0 +1,18 @@ +# Opt-in: keep AMD xHCI controllers awake to avoid the broken resume path. +# Off by default to preserve laptop power draw (see basecamp/omarchy#6671). +# Enable with: omarchy toggle amd-xhci-wakeup +omarchy-toggle-enabled amd-xhci-wakeup || exit 0 + +if lspci -nn | grep -qE "1022:(1587|15b6|15b7|15e0|15e1|15e5|1639|148c)"; then + echo "AMD xHCI detected (resume bug). Keeping controllers awake..." + + cat <<'EOF' | sudo tee /etc/udev/rules.d/99-omarchy-amd-xhci-wakeup.rules >/dev/null +# AMD xHCI controllers die on resume (Bugzilla 221073, Ubuntu 2158539). Keep +# them awake so the broken suspend->resume cycle never runs. Class-based match +# (PCI class 0x0c0330) covers all current and future AMD xHCI device IDs. +SUBSYSTEM=="pci", ATTR{vendor}=="0x1022", ATTR{class}=="0x0c0330", ATTR{power/control}="on", ATTR{d3cold_allowed}="0" +EOF + + sudo udevadm control --reload-rules + sudo udevadm trigger --subsystem-match=pci --attr-match=vendor=0x1022 +fi \ No newline at end of file diff --git a/migrations/1787260348.sh b/migrations/1787260348.sh new file mode 100644 index 000000000000..047d9d06fadf --- /dev/null +++ b/migrations/1787260348.sh @@ -0,0 +1,4 @@ +echo "Opt-in: keep AMD xHCI controllers awake on resume" + +# shellcheck source=install/config/hardware/amd/fix-xhci-resume.sh +source "$OMARCHY_PATH/install/config/hardware/amd/fix-xhci-resume.sh" \ No newline at end of file From 5783da82fa07cffa2b0060c559b1bdcb09c2e2db Mon Sep 17 00:00:00 2001 From: VECTORG99 Date: Thu, 20 Aug 2026 17:21:12 -0400 Subject: [PATCH 2/2] fix: make AMD xHCI wake toggle reversible (remove rule on disable) --- install/config/hardware/amd/fix-xhci-resume.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/install/config/hardware/amd/fix-xhci-resume.sh b/install/config/hardware/amd/fix-xhci-resume.sh index f693ba250cd5..3d1b4d7d6644 100644 --- a/install/config/hardware/amd/fix-xhci-resume.sh +++ b/install/config/hardware/amd/fix-xhci-resume.sh @@ -1,12 +1,21 @@ # Opt-in: keep AMD xHCI controllers awake to avoid the broken resume path. # Off by default to preserve laptop power draw (see basecamp/omarchy#6671). # Enable with: omarchy toggle amd-xhci-wakeup -omarchy-toggle-enabled amd-xhci-wakeup || exit 0 +RULE=/etc/udev/rules.d/99-omarchy-amd-xhci-wakeup.rules + +if ! omarchy-toggle-enabled amd-xhci-wakeup; then + if [[ -f $RULE ]]; then + echo "AMD xHCI wake fix disabled. Removing rule..." + sudo rm -f "$RULE" + sudo udevadm control --reload-rules + fi + exit 0 +fi if lspci -nn | grep -qE "1022:(1587|15b6|15b7|15e0|15e1|15e5|1639|148c)"; then echo "AMD xHCI detected (resume bug). Keeping controllers awake..." - cat <<'EOF' | sudo tee /etc/udev/rules.d/99-omarchy-amd-xhci-wakeup.rules >/dev/null + cat <<'EOF' | sudo tee "$RULE" >/dev/null # AMD xHCI controllers die on resume (Bugzilla 221073, Ubuntu 2158539). Keep # them awake so the broken suspend->resume cycle never runs. Class-based match # (PCI class 0x0c0330) covers all current and future AMD xHCI device IDs.