feat: Power-off fix for the Steam Machine; the kernel pin is optional

Kernels >= 7.2 keep the firmware's S4/S5 wake bit on GPIO pin 18, so the
Steam Machine starts again right after powering off. Steam Machine
support now builds a DKMS module (patches/steamify-fremont-poweroff.c)
that clears it before power-off, for every kernel. The kernel pin is no
longer ticked by default. Module sources and patches move to patches/,
embedded by the single-file build.
This commit is contained in:
theupriser committed 2026-09-27 12:13:23 +02:00
1 parent b2c4a0a00a
commit 443dbcdfb8
17 files changed
+297 -41

No files matched your search

+19 -8
View File
@@ -1,6 +1,7 @@
#!/bin/bash
# "Steam Machine support" menu item, only on Valve Fremont hardware: the
# front LED bar driver, LED access for Steam, and steamos-manager.
# front LED bar driver, LED access for Steam, steamos-manager, and the
# power-off fix (lib/fremont-poweroff.sh).
# Sourced by steamify.sh; not meant to be run on its own.
detect_valve_fremont() {
@@ -14,8 +15,8 @@ detect_valve_fremont() {
[[ "$vendor" == "OEM" && "$product" == "F7F" ]]
}
# Kernel pinned on a Steam Machine: with newer linux-cachyos releases it
# reboots instead of shutting down. The packages are kept in
# Kernel pinned on a Steam Machine (optional): newer linux-cachyos releases
# rebooted it instead of shutting down, which the power-off fix now handles. The packages are kept in
# PINNED_KERNEL_DIR, so re-applying (or reinstalling after an update slipped
# through) needs no download.
PINNED_KERNEL_VER="7.1.6-1"
@@ -334,13 +335,13 @@ reload_powerdevil() {
kernel_overview() {
# Per installed kernel: headers (needed to build DKMS modules), the
# in-kernel Steam controller driver, and, on a Steam Machine, whether the
# LED driver is built for it. Printed in the menu so it's easy to verify
# LED driver and the power-off fix are built for it. Printed in the menu so it's easy to verify
# a kernel update or a newly added kernel got everything.
local mark="${c_green}yes${c_reset}" miss="${c_red}no ${c_reset}" leds=false
detect_valve_fremont && command -v dkms >/dev/null 2>&1 && leds=true
local kdir k pkg headers hid led running line
local kdir k pkg headers hid led off running line
local legend="> = running; controller = Steam controller driver"
[[ "$leds" == true ]] && legend+=", LEDs = LED bar driver built"
[[ "$leds" == true ]] && legend+=", LEDs = LED bar driver built, power-off = power-off fix built"
echo -e " ${c_bold}Kernels${c_reset} ($legend)"
for kdir in /usr/lib/modules/*/; do
k="$(basename "$kdir")"
@@ -352,7 +353,8 @@ kernel_overview() {
line="$(printf '%-23s %-18s headers %b controller %b' "$k" "$pkg" "$headers" "$hid")"
if [[ "$leds" == true ]]; then
led="$miss"; dkms status -k "$k" leds-valve-dkms 2>/dev/null | grep -q installed && led="$mark"
line+="$(printf ' LEDs %b' "$led")"
off="$miss"; dkms status -k "$k" "$POWEROFF_DKMS_NAME" 2>/dev/null | grep -q installed && off="$mark"
line+="$(printf ' LEDs %b power-off %b' "$led" "$off")"
fi
echo -e " ${running}${line}"
done
@@ -369,7 +371,13 @@ kernel_overview() {
machine_available() { detect_valve_fremont; }
machine_status() {
pacman -Qi leds-valve-dkms-git >/dev/null 2>&1 && pacman -Qi steamos-manager >/dev/null 2>&1
pacman -Qi leds-valve-dkms-git >/dev/null 2>&1 && pacman -Qi steamos-manager >/dev/null 2>&1 &&
poweroff_fix_installed
}
# Set up before 2.2.0: no power-off fix yet; the menu ticks it to add it.
machine_repair() {
pacman -Qi leds-valve-dkms-git >/dev/null 2>&1 && pacman -Qi steamos-manager >/dev/null 2>&1 &&
! poweroff_fix_installed
}
machine_enable() {
@@ -381,6 +389,8 @@ machine_enable() {
ensure_aur_helper || { warn "Couldn't set up an AUR helper automatically. Install yay or paru, then run the wizard again."; return 1; }
install_valve_led_driver || { warn "LED driver setup ran into a problem - see errors above."; return 1; }
install_headers_boot_check
info "Installing the power-off fix (the machine stays off after shutting down)..."
poweroff_fix_enable || { err "Installing the power-off fix failed."; return 1; }
# The LED files are root-only. Steam runs as the user; let it write them
# in case it drives the bar directly (Valve's own privileged-write helper
@@ -424,6 +434,7 @@ machine_disable() {
sudo udevadm control --reload
sudo modprobe -r leds-valve 2>/dev/null
sudo pacman -Rns --noconfirm leds-valve-dkms-git 2>/dev/null
poweroff_fix_disable
krevert machine
reload_powerdevil
sudo systemctl disable ensure-kernel-headers.service 2>/dev/null