mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7bef834b16 | ||
|
|
86b9744227 | ||
|
|
b0947d7a2f | ||
|
|
3f97c85c3c | ||
|
|
fd162c1e2e | ||
|
|
54ebddfe98 | ||
|
|
fe93dd3e67 | ||
|
|
ef585c0db1 | ||
|
|
32795bd5a5 | ||
|
|
3c8ca65902 | ||
|
|
11a91ef85c | ||
|
|
163f7908c4 | ||
|
|
e121b06fd8 | ||
|
|
19ca966913 | ||
|
|
56fb9080a7 | ||
|
|
6df19eba3e | ||
|
|
7694c97d68 | ||
|
|
a5e644d71a | ||
|
|
929ecfb349 | ||
|
|
4cc87aaea6 | ||
|
|
36d0a9d780 | ||
|
|
cb6361b49b | ||
|
|
c510f9e2e5 |
No files matched your search
@@ -31,6 +31,23 @@ version="v$(grep -oP '^VERSION=\K.*' "$entry"), $(git describe --always --dirty
|
||||
sed -e '1{/^#!/d}' -e '/^# Sourced by steamify.sh/d' "lib/$lib.sh"
|
||||
echo
|
||||
done
|
||||
# patches/ embedded: replaces lib/common.sh's patch_file, which reads
|
||||
# them from the checkout.
|
||||
echo "# ----- patches/ -----"
|
||||
echo "patch_file() {"
|
||||
echo ' case "$1" in'
|
||||
for f in patches/*; do
|
||||
[[ "$f" == patches/README.md ]] && continue
|
||||
grep -q '^STEAMIFY_PATCH_EOF$' "$f" && { echo "bundle: $f contains the heredoc delimiter" >&2; exit 1; }
|
||||
echo " $(basename "$f")) cat << 'STEAMIFY_PATCH_EOF'"
|
||||
cat "$f"
|
||||
echo "STEAMIFY_PATCH_EOF"
|
||||
echo " ;;"
|
||||
done
|
||||
echo ' *) return 1 ;;'
|
||||
echo ' esac'
|
||||
echo "}"
|
||||
echo
|
||||
echo "# ----- steamify.sh -----"
|
||||
echo "main() {"
|
||||
# Everything after the source loop is the entry point's body.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify.sh | bash
|
||||
# curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/download/latest/steamify.sh | bash
|
||||
# Each release also has the app (v2): steamify-app.tar.gz (ui/, steamify.sh,
|
||||
# lib/, the icon) and its launcher, run with:
|
||||
# lib/, patches/, the icon) and its launcher, run with:
|
||||
# curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify-app.sh | bash
|
||||
# A push to feat/v2-ui (the app, not released yet) updates the pre-release
|
||||
# v2-ui-preview instead, whose launcher gets that build:
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
.github/tools/bundle.sh dist/steamify.sh
|
||||
# The app: sources, not the single-file build (its backend mode runs
|
||||
# steamify.sh from its own folder).
|
||||
tar -czf dist/steamify-app.tar.gz steamify.sh lib ui assets/steam-gaming-settings.svg LICENSE.md
|
||||
tar -czf dist/steamify-app.tar.gz steamify.sh lib patches ui assets/steam-gaming-settings.svg LICENSE.md
|
||||
cp ui/steamify-app.sh dist/steamify-app.sh
|
||||
|
||||
- name: Check
|
||||
|
||||
@@ -15,6 +15,10 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine
|
||||
- `steamify.sh` - the only entry point. Pre-flight checks,
|
||||
sources `lib/*.sh`, runs the menu and applies the plan. No component
|
||||
logic here.
|
||||
- `patches/` - kernel module sources and patches the scripts build or
|
||||
apply, never inline in the shell code. Read them with `patch_file
|
||||
<name>` (`lib/common.sh`, from the checkout); the bundle embeds every file
|
||||
in `patches/` and overrides `patch_file`. Add new ones to its README.
|
||||
- `lib/*.sh` - one file per responsibility, each defining functions only
|
||||
(no top-level side effects besides constants). See the table in
|
||||
`TECHNICAL.md`.
|
||||
@@ -25,6 +29,14 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine
|
||||
`<id>_available` is checked via `component_available` (e.g. `machine`
|
||||
only on Fremont). Turn-on order is `COMPONENTS` order, turn-off reverse;
|
||||
`gaming` must stay first. Dependencies live in `toggle_component`.
|
||||
- **Feature versions.** Set `FEATURE_VERSION[<id>]` (`lib/menu.sh`) to the new
|
||||
`VERSION` whenever what `<id>_enable` sets up changes (a new component gets
|
||||
one too): installs recorded with an older version
|
||||
are ticked and re-applied ("update" in the plan and the app). New default
|
||||
options are ticked for installs whose parent (top-level: `gaming`) is on
|
||||
(`feature_new`, shown as "new").
|
||||
Status still comes from the system; don't add ad-hoc `<id>_repair` checks
|
||||
for new changes.
|
||||
- **Reversibility.** Every per-user KDE setting a component changes goes
|
||||
through `kset <component> <file> <group|group> <key> <value>`
|
||||
(`lib/state.sh`), which records the old value once; `<id>_disable` calls
|
||||
@@ -186,8 +198,48 @@ gamescope and the Plasma desktop. Primary target: the Valve Steam Machine
|
||||
<output>=<w>x<h>:<rates>`; without `--hdmi` the backend refuses it. debugfs is root-only
|
||||
(glob it under sudo), and `edid_override` takes exactly `reset` with no
|
||||
newline. Build the EDID from the DDC read, not from sysfs: a live override
|
||||
replaces the kernel's copy. The kernel command-line value holds a path, so
|
||||
`sed` uses `|` as its delimiter.
|
||||
replaces the kernel's copy. EDIDs are saved per display
|
||||
(`steamify-<id>.bin`, id = EDID bytes 8-17, listed in
|
||||
`/etc/steamify/hdmi-edid.conf`), never on the kernel command line (that
|
||||
applied to any display on the port): `steamify-edid-hotplug` (boot unit +
|
||||
udev drm hotplug rule) loads the connected display's file, else resets. It
|
||||
records what's loaded in `/run/steamify-edid` before its own
|
||||
`trigger_hotplug`, whose event runs it again. `hdmi_status` is on only
|
||||
while the connected display is boosted; disable forgets only that display
|
||||
(`kpin_disable` forgets all). The app manages the list (`hdmi-forget`,
|
||||
`hdmiDisplays` in status). Pre-2.1.0 setups are moved by `hdmi_migrate`.
|
||||
- Steam Machine CEC driver (`cec_driver_enable`, `lib/cec.sh`): mainline
|
||||
`cros_ec_cec` lacks Fremont, so HDMI-CEC builds Valve's copy (evlaV
|
||||
`linux-integration`, pinned commit + SHA-256) with DKMS for every kernel.
|
||||
It's patched to register its notifier without a port name when the board
|
||||
has one CEC port: amdgpu registers its HDMI notifier nameless, and the
|
||||
kernel only pairs that with a named lookup ("Port C") when the CEC driver
|
||||
registered first, which never happens since amdgpu loads from the
|
||||
initramfs. Without it `/dev/cec0` exists but stays at `f.f.f.f`.
|
||||
- Power-off fix (`poweroff`, `lib/fremont-poweroff.sh`, a default sub-option
|
||||
of `machine`): recent kernels (7.2 and the 6.x/7.0/7.1 updates with the
|
||||
backport) keep the firmware's S4/S5 wake bit on GPIO
|
||||
pin 18, so the Steam Machine boots again right after powering off
|
||||
(Valve's kernel clears it at probe, not for upstream). The DKMS module
|
||||
`steamify-fremont-poweroff` (`patches/steamify-fremont-poweroff.c`) clears
|
||||
it in a power-off-prepare handler, built for each kernel. It made the kernel pin
|
||||
unnecessary: `kpin` is only available while on (`kpin_available`), and
|
||||
`detect_components` unticks it, so a normal run removes an existing pin.
|
||||
`hdmi` (it needed the pin) is retired the same way: `hdmi_status` is on
|
||||
while anything of it is left (saved displays, hotplug unit, EDID files,
|
||||
old kernel parameter), `hdmi_available` only then, it's always unticked,
|
||||
and `hdmi_disable` removes all of it. CachyOS's
|
||||
`linux-cachyos` is clang-built, `-bore` GCC-built: let DKMS pick the
|
||||
compiler, never pass `LLVM=1`. Test shutdown on the real machine for every
|
||||
new major kernel.
|
||||
- VRAM booster (`vram`, `lib/vram-booster.sh`, top-level, ticked by
|
||||
default, 2.3.0; only available when `/sys/fs/cgroup/dmem.capacity` lists a
|
||||
VRAM region of at least 2 GB; greyed out with an NVIDIA card,
|
||||
`vram_selectable`, faked with `WIZARD_VRAM_FAKE_NVIDIA=1`): CachyOS's `dmemcg-booster` (system + user service) and
|
||||
`plasma-foreground-booster`, like SteamOS 3.9's VRAM management. The
|
||||
latter only starts with `kcgroupsrc [Foreground Booster] autostart=true`
|
||||
(set with `kset`). Disable removes only the packages it installed
|
||||
(`state_get vram installed_pkgs`).
|
||||
- `Relogin=true` means a gamescope that fails to start is relaunched in a
|
||||
tight loop; keep that in mind when changing session handling.
|
||||
|
||||
|
||||
+80
-1
@@ -5,9 +5,88 @@ All notable changes, per version and per commit. Versions follow
|
||||
`steamify.sh`. Versions before 0.7.0 were numbered afterwards,
|
||||
one per merged pull request.
|
||||
|
||||
## 2.3.0 - 2026-09-27
|
||||
|
||||
- **feat: VRAM booster greyed out with an NVIDIA card, with why**
|
||||
- `b0947d7` **feat: VRAM booster only for GPUs with at least 2 GB of their own VRAM**
|
||||
- `3f97c85` **feat: VRAM booster for every supported GPU, not only the Steam Machine**
|
||||
- `fd162c1` **feat: New badge for default sub-options added in this version**
|
||||
- `54ebddf` **feat: VRAM booster for the Steam Machine**
|
||||
|
||||
## 2.2.0 - 2026-09-27
|
||||
|
||||
- `ef585c0` **docs: Changelog entries per commit for 2.2.0**
|
||||
- `32795bd` **feat(ui): Update badge on the progress screen**
|
||||
- `3c8ca65` **fix(ui): Never write the sudo password to a file; Update label on the progress screen**
|
||||
- The app gave `sudo` the password through a short-lived file; the helper
|
||||
now reads it from a named pipe the app feeds from memory each time sudo
|
||||
asks. The progress screen showed "undefined" for an update.
|
||||
- `11a91ef` **feat: Update badge on components that get a newer version**
|
||||
- The menu (terminal and app) shows "(update)" / an Update badge after
|
||||
the name of a component a normal run will update.
|
||||
- `163f790` **feat: Feature versions are Steamify versions; Steam Machine support is 2.2.0**
|
||||
- Each component records the Steamify version of what it set up; when a
|
||||
release changes a component, installs with an older version are ticked
|
||||
and updated by a normal run ("update" in the plan and the app's
|
||||
review). A setup from before counts as 2.1.0, so Steam Machine support
|
||||
(2.2.0) is updated on machines set up with 2.1.0. New default
|
||||
sub-options (like the power-off fix) are ticked where their parent is on.
|
||||
- `e121b06` **fix: Remove whatever is left of HDMI refresh boost, pin or no pin**
|
||||
- HDMI refresh boost needed the pinned kernel and is retired (newer
|
||||
kernels do HDMI 2.1 themselves): whatever is left of it (saved
|
||||
displays, also ones not connected, its hotplug script, the old kernel
|
||||
parameter) is unticked and removed by the next run.
|
||||
- `19ca966` **docs: Drop the kernel pin and HDMI refresh boost descriptions**
|
||||
- `56fb908` **docs: Power-off fix texts cover every affected kernel, not just 7.2**
|
||||
- `6df19eb` **feat: Power-off fix as its own sub-option, drop the kernel pin, feature versions**
|
||||
- The power-off fix is a sub-option of Steam Machine support, ticked
|
||||
along with it (opt-out). The kernel pin is no longer offered: an
|
||||
existing pin is shown unticked, so the next run removes it and brings
|
||||
back CachyOS's current kernel.
|
||||
- `7694c97` **feat: Power-off fix for the Steam Machine; the kernel pin is optional**
|
||||
- With recent kernels (newer 6.x, 7.0 and 7.1 updates, 7.2 and probably
|
||||
later ones) the Steam Machine started again right after shutting down:
|
||||
they keep the wake bit the firmware sets on GPIO pin 18, which Valve's
|
||||
own kernel clears in a patch that won't reach CachyOS. A small module,
|
||||
built with DKMS for each installed kernel, clears it right before
|
||||
power-off. Tested with CachyOS 7.2.8: stays off, and without the module
|
||||
it rebooted.
|
||||
- Module sources and patches live in `patches/` instead of inside the
|
||||
shell code; the single-file build and the app package include them. The
|
||||
Steam Machine CEC driver change is now
|
||||
`patches/cros-ec-cec-single-port.patch`.
|
||||
|
||||
## 2.1.0 - 2026-09-26
|
||||
|
||||
- **feat(ui): Manage button for HDMI refresh boost**
|
||||
- The item's switch is a button: Set up… while no display is saved,
|
||||
Manage after that. Manage lists the saved displays (connected or not),
|
||||
removes one with its Remove button, and sets up the connected display
|
||||
when it has no saved rates yet.
|
||||
- **4cc87aa feat: HDMI refresh boost per display, with a Saved displays screen**
|
||||
- **36d0a9d feat: HDMI refresh boost only for the display it was set up for**
|
||||
- The EDID override was on the kernel command line, so any display on that
|
||||
HDMI port got the first display's timings. Rates are now saved per
|
||||
display and loaded at boot and at every hotplug for the display that's
|
||||
connected (its ID read over DDC); a display without saved rates, or
|
||||
unplugging, puts the port back on the display's own EDID. No initramfs
|
||||
or boot loader change any more. An existing setup is moved over when
|
||||
re-applied (`a`).
|
||||
- The item shows on only while the connected display is boosted, so a new
|
||||
display can be set up by ticking it; unticking removes only that one.
|
||||
|
||||
## 2.0.3 - 2026-09-26
|
||||
|
||||
- **fix: HDMI-CEC on the Steam Machine**
|
||||
- Mainline's `cros_ec_cec` driver doesn't know the Steam Machine, so there
|
||||
was no `/dev/cec0`. HDMI-CEC now builds Valve's version of the driver
|
||||
with DKMS (`steamify-cros-ec-cec`) for every installed kernel, with a fix
|
||||
so it finds amdgpu's HDMI port even though amdgpu loads first. An
|
||||
existing HDMI-CEC install is ticked in the menu to add it.
|
||||
|
||||
## 2.0.2 - 2026-09-26
|
||||
|
||||
- **docs: Non-affiliation disclaimer in the README**
|
||||
- **badfd84 docs: Non-affiliation disclaimer in the README**
|
||||
- States that the project isn't affiliated with Valve or CachyOS, and that
|
||||
Steam and SteamOS are Valve's trademarks.
|
||||
|
||||
|
||||
@@ -28,7 +28,12 @@ Steam Machine.
|
||||
5. **Steamify shortcut** - "Steamify CachyOS" on the desktop and in the
|
||||
launcher opens the newest Steamify app, so you don't need the install
|
||||
command again. "Steamify Terminal" in the launcher opens the terminal menu.
|
||||
6. **HDMI-CEC** (experimental; off by default, on by default on a Steam
|
||||
6. **VRAM booster** - on by default: the game you're playing keeps its video
|
||||
memory and background apps make room, like SteamOS 3.9. Shown for GPUs
|
||||
whose driver supports it (AMD, Intel) on kernel 7.2 or newer; greyed out
|
||||
with an NVIDIA card until NVIDIA's driver supports it
|
||||
([details](TECHNICAL.md#vram-booster)).
|
||||
7. **HDMI-CEC** (experimental; off by default, on by default on a Steam
|
||||
Machine) - use Steam with your TV's
|
||||
remote, and the TV turns on and off with the PC. Needs a PC with CEC (like
|
||||
the Steam Machine) or a USB CEC adapter; most graphics cards, NVIDIA
|
||||
@@ -43,20 +48,11 @@ What Steamify can do on a Valve Steam Machine:
|
||||
TV's remote, and the TV turns on and off with the Steam Machine
|
||||
([details](TECHNICAL.md#hdmi-cec)).
|
||||
- **Steam Machine support** - the front **LED bar** works, Steam's
|
||||
**hardware settings** (fan, performance) work, and the power
|
||||
button puts it to sleep like a console.
|
||||
- **Pin the kernel to 7.1.6-1** - on by default: with newer CachyOS kernels
|
||||
the Steam Machine reboots instead of shutting down. Untick it once CachyOS
|
||||
fixes that. The kernel comes from its own
|
||||
[release](https://github.com/theupriser/steamify-cachyos/releases/tag/kernel-7.1.6-1),
|
||||
checked against CachyOS's signature
|
||||
([details](TECHNICAL.md#kernel-pin-steam-machine)).
|
||||
- **HDMI refresh boost** - only with the pinned kernel, never ticked by
|
||||
default: gets the highest refresh rate your HDMI display runs at the
|
||||
desktop resolution (e.g. 110 Hz instead of 60 on a 3440x1440 monitor).
|
||||
Each step is shown and you confirm it; no answer within 15 s switches
|
||||
back. For more (e.g. 175 Hz), use DisplayPort
|
||||
([details](TECHNICAL.md#hdmi-refresh-boost-steam-machine)).
|
||||
**hardware settings** (fan, performance) work, and the power button puts
|
||||
it to sleep like a console.
|
||||
- **Power-off fix** - on by default: shutting down really turns the Steam
|
||||
Machine off, also with the newest CachyOS kernel
|
||||
([details](TECHNICAL.md#power-off-fix-steam-machine)).
|
||||
- **Update BIOS** - installs Valve's newest Steam Machine BIOS. Never ticked
|
||||
by default, at your own risk, and only after two warnings
|
||||
([details](TECHNICAL.md#bios-updates-steam-machine)).
|
||||
|
||||
+74
-56
@@ -208,68 +208,84 @@ upset CEC for the TV's other devices
|
||||
Turning it off removes the packages again (`linuxconsole` only if the
|
||||
wizard installed it).
|
||||
|
||||
## Kernel pin (Steam Machine)
|
||||
## Power-off fix (Steam Machine)
|
||||
|
||||
With CachyOS kernels newer than 7.1.6 a Steam Machine reboots instead of
|
||||
shutting down. The **Pin the kernel** sub-option (ticked along with Steam
|
||||
Machine support) installs `linux-cachyos` and `linux-cachyos-headers`
|
||||
7.1.6-1 and adds them to `IgnorePkg` in `/etc/pacman.conf`, so updates skip
|
||||
them. DKMS builds the LED driver for it; restart to boot it.
|
||||
With recent kernels a Steam Machine starts again right after powering off:
|
||||
the newer 6.x, 7.0 and 7.1 updates and 7.2 (and probably every kernel after
|
||||
it). Linux stopped clearing the S4/S5 wake bits at probe
|
||||
(`pinctrl-amd: Don't clear S4 wake bits at probe`, in 7.2 and backported to
|
||||
stable kernels), and the firmware leaves
|
||||
that bit set on GPIO pin 18 (`_SB.PCI0.GPP6`). Valve's own kernel
|
||||
(`linux-neptune-72`) clears it at probe on Fremont, in a patch marked not
|
||||
for upstream ("until the firmware is fixed"), so CachyOS and mainline won't
|
||||
get it.
|
||||
|
||||
The packages (and their signatures, which pacman checks) are kept in
|
||||
`/var/cache/steamify/kernel`, so re-applying needs no download. Missing
|
||||
files are taken from pacman's cache, else downloaded from this repo's
|
||||
`kernel-7.1.6-1` release, then `archive.cachyos.org`, then
|
||||
`mirror.cachyos.org` (which only has the current kernel). Every file must
|
||||
match the SHA-256 in the script and have a valid CachyOS signature; a bad
|
||||
one is deleted, so the next run downloads it again. Set `PINNED_KERNEL_URL`
|
||||
to a directory URL with the files to try another source first, or drop them
|
||||
into the kernel directory yourself.
|
||||
The **Power-off fix** sub-option of Steam Machine support (ticked along with
|
||||
it, can be unticked) builds a small module with DKMS for every installed
|
||||
kernel, `steamify-fremont-poweroff` (source in
|
||||
[`patches/steamify-fremont-poweroff.c`](patches/steamify-fremont-poweroff.c)).
|
||||
It only loads on Fremont (DMI board name) and touches one register: right
|
||||
before power-off (a `SYS_OFF_MODE_POWER_OFF_PREPARE` handler, after the
|
||||
drivers have shut down) it clears that pin's S4/S5 wake bit. On a kernel
|
||||
that already clears it, it does nothing. It logs the pin's state at load:
|
||||
`dmesg | grep 'GPIO 18'`; `/sys/kernel/debug/gpio` shows the S4/S5 column.
|
||||
Tested on a Steam Machine with `linux-cachyos-bore` 7.2.8: it stayed off
|
||||
three times in a row, and rebooted right away with the module unloaded.
|
||||
|
||||
Unticking it removes the pin and runs `sudo pacman -Syu`, which brings the
|
||||
kernel back to CachyOS's current version; the files stay for next time.
|
||||
Where Steam Machine support was set up before 2.2.0, the menu ticks the
|
||||
power-off fix as a new default sub-option (see feature versions below), so a
|
||||
normal run adds it.
|
||||
|
||||
## HDMI refresh boost (Steam Machine)
|
||||
## VRAM booster
|
||||
|
||||
With the pinned kernel (7.1.6), HDMI displays often stay at 60 Hz. Two
|
||||
reasons:
|
||||
SteamOS 3.9 manages the dGPU's VRAM per cgroup: the game in front is
|
||||
protected, background apps are evicted first. Without it a game that needs
|
||||
most of the VRAM (8 GB on the Steam Machine) can be pushed into system RAM
|
||||
by the desktop and other apps, and stutter. The kernel side is the `dmem`
|
||||
cgroup controller (7.2); amdgpu and Intel's xe register their VRAM with it,
|
||||
NVIDIA's driver doesn't: with an NVIDIA card the option is shown greyed
|
||||
out, with why (`WIZARD_VRAM_FAKE_NVIDIA=1` fakes that for tests). Otherwise
|
||||
the **VRAM booster** option is only shown when
|
||||
`/sys/fs/cgroup/dmem.capacity` lists a VRAM region of at least 2 GB (a
|
||||
dedicated GPU; an integrated one registers a small carve-out) or it's already on, and is
|
||||
ticked by default; new in 2.3.0, so setups with the SteamOS conversion on
|
||||
get it ticked. CachyOS packages the userspace side, which it installs:
|
||||
|
||||
- Monitors list their fast modes in an extra EDID block, announced by the
|
||||
HDMI Forum EEODB data block. 7.1.6 only reads the first extension block,
|
||||
so it never sees them. Newer kernels do.
|
||||
- Their fastest modes need HDMI 2.1 (FRL). 7.1.6's amdgpu only does HDMI
|
||||
2.0 (TMDS, at most 600 MHz), but a mode with the display's own shortest
|
||||
blanking at a slightly lower rate often fits.
|
||||
- `dmemcg-booster`: `dmemcg-booster-system.service` enables the `dmem`
|
||||
controller and sets `dmem.low` for the cgroup in front;
|
||||
`dmemcg-booster-user.service` runs in the user session.
|
||||
- `plasma-foreground-booster`: tells it which window is in front on the
|
||||
desktop. It only starts with `autostart=true` under `[Foreground Booster]`
|
||||
in `kcgroupsrc`, which the wizard sets (and reverts).
|
||||
|
||||
The menu item (only on a Steam Machine with the pinned kernel, never
|
||||
ticked by default, run from the desktop in Konsole):
|
||||
Check it with `cat /sys/fs/cgroup/cgroup.subtree_control` (lists `dmem`) and
|
||||
the `dmem.low` of the slices under `user@<uid>.service`. Turning it off
|
||||
disables the services and removes the packages the wizard installed.
|
||||
Not added: a fixed `dmem.max` cap for `app.slice` (as some guides do); only
|
||||
worth it if the booster itself turns out to cause stutter.
|
||||
|
||||
1. Takes the desktop resolution from KDE (`kscreen-doctor -j`) and reads the
|
||||
display's complete EDID over DDC (`i2ctransfer`, segment pointer 0x30).
|
||||
A live EDID left by an earlier test is cleared first.
|
||||
2. Calculates the highest rate that fits: the display's TMDS limit (HDMI
|
||||
Forum VSDB, capped at amdgpu's 600 MHz), its shortest blanking at that
|
||||
resolution and its maximum refresh (range limits, VRR maximum). Steps:
|
||||
that rate rounded down to ten, and the hundred below it as a safe option.
|
||||
Rates the display already lists, or that aren't faster than what works
|
||||
now, are left out.
|
||||
3. Builds the EDID: all of the display's blocks, the block count and EEODB
|
||||
fixed, plus a DisplayID block with the steps.
|
||||
4. Loads it live (debugfs `edid_override`, `trigger_hotplug`) and switches
|
||||
to each step, lowest first. Each one needs a "y" within 15 s
|
||||
(`WIZARD_HDMI_CONFIRM_SECONDS` for tests); anything else switches back
|
||||
and stops.
|
||||
5. Makes it permanent with only the confirmed steps:
|
||||
`/usr/lib/firmware/edid/steamify-<connector>.bin`, in the initramfs via
|
||||
`/etc/mkinitcpio.conf.d/90-steamify-edid.conf` (amdgpu loads from there),
|
||||
and `drm.edid_firmware=<connector>:edid/steamify-<connector>.bin` on the
|
||||
kernel command line: `/etc/default/limine` (`limine-mkinitcpio`),
|
||||
`/etc/sdboot-manage.conf` or `/etc/default/grub`.
|
||||
## Feature versions (updates)
|
||||
|
||||
The display's manufacturer, model and serial are stored; re-applying with
|
||||
another display connected tests that one instead. Turning it off removes
|
||||
the files and the parameter and rebuilds. Untick it before removing the
|
||||
kernel pin: newer kernels read the EDID themselves and can do HDMI 2.1.
|
||||
Each component has a feature version (`FEATURE_VERSION` in `lib/menu.sh`):
|
||||
the Steamify version in which what it sets up last changed (2.1.0 for
|
||||
everything that hasn't changed since). After a component is turned on
|
||||
successfully, that version is recorded in `~/.local/state/cachyos-gamescope-boot/features.state`
|
||||
(turning it off records `off`). Whether a component is on is always checked
|
||||
on the system itself; the version only decides about updates:
|
||||
|
||||
- **On, recorded version older** than the current one: ticked and
|
||||
re-applied by a normal run; the plan (and the app's review) says
|
||||
"update". A setup from before versions were recorded counts as 2.1.0,
|
||||
so on a machine set up with 2.1.0, Steam Machine support (2.2.0) is
|
||||
updated.
|
||||
- **A new default option** (not in `NO_PRESELECT`) whose parent is on (for
|
||||
a top-level one: the SteamOS conversion) and that was never turned on or
|
||||
off: ticked, so a normal run adds it. Turning it off once records `off`,
|
||||
so it isn't ticked again. The menu and the app show it with a **New**
|
||||
badge, and the plan says "new in this version".
|
||||
|
||||
Set a component's entry to the new `VERSION` whenever what its
|
||||
`<id>_enable` sets up changes.
|
||||
|
||||
## BIOS updates (Steam Machine)
|
||||
|
||||
@@ -339,9 +355,11 @@ immediately, which can turn into a loop - see
|
||||
| `lib/wizard-shortcut.sh` | Steamify shortcut: desktop icon and launcher entry that run the newest release |
|
||||
| `lib/bios.sh` | Update BIOS (Steam Machine, opt-in): current/newest version, double confirmation, fwupd |
|
||||
| `lib/cec.sh` | HDMI-CEC: Valve's `cecd` and friends from its `holo` repository |
|
||||
| `lib/steam-machine.sh` | Steam Machine support: LED driver, LED access, steamos-manager; kernel pin |
|
||||
| `lib/hdmi-refresh.sh` | HDMI refresh boost (Steam Machine, pinned kernel): EDID over DDC, calculated steps, live test, `drm.edid_firmware` |
|
||||
| `.github/tools/bundle.sh` | Builds the single-file version (`dist/steamify.sh`) |
|
||||
| `lib/steam-machine.sh` | Steam Machine support: LED driver, LED access, steamos-manager |
|
||||
| `lib/fremont-poweroff.sh` | Steam Machine support: the power-off fix (DKMS module from `patches/`) |
|
||||
| `lib/vram-booster.sh` | VRAM booster (`dmemcg-booster`, `plasma-foreground-booster`) |
|
||||
| `patches/` | Module sources and patches the scripts build or apply (`patch_file`); see its README |
|
||||
| `.github/tools/bundle.sh` | Builds the single-file version (`dist/steamify.sh`), with `patches/` embedded |
|
||||
| `.github/workflows/bundle.yml` | Builds and checks it on every push; publishes it on `main` |
|
||||
|
||||
The single-file version is generated: on every push to `main`, GitHub
|
||||
|
||||
+26
-5
@@ -14,6 +14,8 @@
|
||||
# hdmi-options event: every HDMI output, its mode and rates to offer.
|
||||
# steamify.sh --backend hdmi-try <connector> <w> <h> <hz> [<rate>...]
|
||||
# steamify.sh --backend hdmi-reset <connector> <w> <h> <hz>
|
||||
# steamify.sh --backend hdmi-forget <display id>
|
||||
# removes a saved display (hdmi-forgotten event); status lists them.
|
||||
# switch to a rate live (hdmi-tried event), or back to the display's
|
||||
# own EDID (hdmi-reset event); the app asks in between.
|
||||
# steamify.sh --backend bios-prepare | bios-flash
|
||||
@@ -60,6 +62,8 @@ backend_status() {
|
||||
items+=",\"kind\":\"$kind\",\"parent\":$(json_str "$parent")"
|
||||
items+=",\"on\":$( [[ "$now" == 1 ]] && echo true || echo false)"
|
||||
items+=",\"wanted\":$( [[ "${WANTED[$c]:-0}" == 1 ]] && echo true || echo false)"
|
||||
items+=",\"update\":$(feature_outdated "$c" && echo true || echo false)"
|
||||
items+=",\"new\":$(feature_new "$c" && echo true || echo false)"
|
||||
items+=",\"selectable\":$(component_selectable "$c" && echo true || echo false)}"
|
||||
done
|
||||
local cec="" f
|
||||
@@ -68,13 +72,20 @@ backend_status() {
|
||||
if bios_available; then
|
||||
bios="{\"current\":$(json_str "$(bios_current)"),\"newest\":$(json_str "${BIOS_NEWEST:-}"),\"selectable\":$(bios_selectable && echo true || echo false),\"dryRun\":$([[ -n "$BIOS_DRY_RUN" ]] && echo true || echo false)}"
|
||||
fi
|
||||
printf '{"version":%s,"firstRun":%s,"steamMachine":%s,"kernel":%s,"pinnedKernel":%s,"cecDevices":%s,"leds":%s,"bios":%s,"items":[%s]}\n' \
|
||||
# HDMI refresh boost's saved displays; "active" = connected and boosted.
|
||||
local hdmi_list="" active hid hname hmode hrates
|
||||
active=" $(hdmi_active_ids | tr '\n' ' ') "
|
||||
while IFS=$'\t' read -r hid hname hmode hrates; do
|
||||
[[ -n "$hid" ]] || continue
|
||||
hdmi_list+="${hdmi_list:+,}{\"id\":$(json_str "$hid"),\"name\":$(json_str "$hname"),\"mode\":$(json_str "$hmode"),\"rates\":$(json_str "$hrates"),\"active\":$([[ "$active" == *" $hid "* ]] && echo true || echo false)}"
|
||||
done < <(hdmi_saved)
|
||||
printf '{"version":%s,"firstRun":%s,"steamMachine":%s,"kernel":%s,"pinnedKernel":%s,"cecDevices":%s,"leds":%s,"bios":%s,"hdmiDisplays":[%s],"items":[%s]}\n' \
|
||||
"$(json_str "$VERSION")" "$first_run" \
|
||||
"$(detect_valve_fremont && echo true || echo false)" \
|
||||
"$(json_str "$(uname -r)")" "$(json_str "${PINNED_KERNEL_VER:-}")" \
|
||||
"$(json_str "$cec")" \
|
||||
"$(compgen -G '/sys/class/leds/valve-leds*' | wc -l)" \
|
||||
"$bios" "$items"
|
||||
"$bios" "$hdmi_list" "$items"
|
||||
}
|
||||
|
||||
backend_run_component() {
|
||||
@@ -151,6 +162,8 @@ backend_apply() {
|
||||
# The same rules as the menu's toggles.
|
||||
[[ "${WANTED[single]:-0}" == 1 ]] && WANTED[gaming]=1
|
||||
[[ "${WANTED[gaming]:-0}" == 0 ]] && { WANTED[single]=0; WANTED[boot]=0; }
|
||||
[[ "${WANTED[poweroff]:-0}" == 1 ]] && WANTED[machine]=1
|
||||
[[ "${WANTED[machine]:-0}" == 0 ]] && WANTED[poweroff]=0
|
||||
[[ "${WANTED[kpin]:-0}" == 1 ]] && WANTED[machine]=1
|
||||
[[ "${WANTED[machine]:-0}" == 0 ]] && WANTED[kpin]=0
|
||||
[[ "${WANTED[hdmi]:-0}" == 1 ]] && { WANTED[machine]=1; WANTED[kpin]=1; }
|
||||
@@ -170,14 +183,18 @@ backend_apply() {
|
||||
LOGIN_MANAGER=plasmalogin
|
||||
[[ "${WANTED[single]}" == 1 ]] && LOGIN_MANAGER=sddm
|
||||
local -a failed=()
|
||||
for c in "${TO_DISABLE[@]}"; do backend_run_component "$c" disable || failed+=("$c"); done
|
||||
for c in "${TO_ENABLE[@]}"; do backend_run_component "$c" enable || failed+=("$c"); done
|
||||
for c in "${TO_DISABLE[@]}"; do
|
||||
if backend_run_component "$c" disable; then feature_record "$c" disable; else failed+=("$c"); fi
|
||||
done
|
||||
for c in "${TO_ENABLE[@]}"; do
|
||||
if backend_run_component "$c" enable; then is_action "$c" || feature_record "$c" enable; else failed+=("$c"); fi
|
||||
done
|
||||
[[ " ${TO_DISABLE[*]} ${TO_ENABLE[*]} " =~ \ (gaming|single|boot|kpin)\ ]] && RESTART_FOR_LOGIN=true
|
||||
backend_event finished "\"failed\":$(json_list "${failed[@]}"),\"restart\":$(restart_needed && echo true || echo false)"
|
||||
}
|
||||
|
||||
backend_hdmi() {
|
||||
# backend_hdmi options|try|reset [args]: the app's HDMI screen. Events
|
||||
# backend_hdmi options|try|reset|forget [args]: the app's HDMI screen. Events
|
||||
# only (no "finished"): the app goes on from its own screen.
|
||||
local what="$1" rc
|
||||
shift
|
||||
@@ -192,6 +209,9 @@ backend_hdmi() {
|
||||
reset)
|
||||
hdmi_reset "$@" >/dev/null 2>&1
|
||||
backend_event hdmi-reset ;;
|
||||
forget)
|
||||
[[ "${1:-}" =~ ^[0-9a-f]{20}$ ]] && hdmi_forget "$1" >/dev/null 2>&1; rc=$?
|
||||
backend_event hdmi-forgotten "\"id\":$(json_str "${1:-}"),\"ok\":$([[ $rc -eq 0 ]] && echo true || echo false)" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -204,6 +224,7 @@ backend_main() {
|
||||
hdmi-options) backend_hdmi options ;;
|
||||
hdmi-try) shift; backend_hdmi try "$@" ;;
|
||||
hdmi-reset) shift; backend_hdmi reset "$@" ;;
|
||||
hdmi-forget) shift; backend_hdmi forget "$@" ;;
|
||||
*) err "Usage: steamify.sh --backend status | apply [--reapply] [--boot gamescope|desktop] <id>..."; return 2 ;;
|
||||
esac
|
||||
}
|
||||
+72
-5
@@ -3,8 +3,9 @@
|
||||
# volume control (cec-audio-control) and the units that attach USB CEC
|
||||
# adapters (Pulse-Eight, RainShadow) with inputattach. They're only in
|
||||
# Valve's SteamOS (holo) repository, not in CachyOS or the AUR. Works with
|
||||
# any /dev/cec*: a GPU with CEC (e.g. the Steam Machine) or a USB adapter.
|
||||
# On a Steam Machine, steamos-manager configures cecd from Steam's settings.
|
||||
# any /dev/cec*: a GPU with CEC or a USB adapter. On a Steam Machine it also
|
||||
# builds Valve's CEC driver (see cec_driver_enable), and steamos-manager
|
||||
# configures cecd from Steam's settings.
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
CEC_PKGS=(cecd cec-audio-control inputattach-cec-units)
|
||||
@@ -16,6 +17,15 @@ CEC_ORDER_DROPIN=/etc/systemd/user/steamos-manager.service.d/10-steamify-after-c
|
||||
# file. A later EnvironmentFile= overrides it.
|
||||
CEC_STEAM_ENV=/etc/steamify/steam-cec.env
|
||||
CEC_STEAM_DROPIN=/etc/systemd/user/steam-launcher.service.d/10-steamify-cec.conf
|
||||
# The Steam Machine's CEC runs through its embedded controller (cros_ec_cec).
|
||||
# Mainline's driver doesn't list Fremont, so there's no /dev/cec0; Valve's
|
||||
# kernel does. We build Valve's copy with DKMS for every kernel, pinned to a
|
||||
# reviewed commit.
|
||||
CEC_DKMS_NAME=steamify-cros-ec-cec
|
||||
CEC_DKMS_VER=1
|
||||
CEC_DKMS_SRC="/usr/src/$CEC_DKMS_NAME-$CEC_DKMS_VER"
|
||||
CEC_DRIVER_URL="https://raw.githubusercontent.com/evlaV/linux-integration/10c8c8800ccd3ae359203b4eefb6479f613b3b8e/drivers/media/cec/platform/cros-ec/cros-ec-cec.c"
|
||||
CEC_DRIVER_SHA256=e89fd4e87fceb32d713ffc59b64794779b3c2b3c012b0e2f2e9f0c40b42f4373
|
||||
|
||||
cec_link_steamos_manager() {
|
||||
# On a Steam Machine: steamos-manager writes cecd's config from Steam's
|
||||
@@ -33,9 +43,64 @@ cec_link_steamos_manager() {
|
||||
}
|
||||
|
||||
cec_installed() { pacman -Q "${CEC_PKGS[@]}" >/dev/null 2>&1; }
|
||||
# On = installed and Steam told to show its CEC settings. An install from
|
||||
# before 1.1.3 lacks the latter; the menu then ticks it (see cec_repair).
|
||||
cec_status() { cec_installed && [[ -f "$CEC_STEAM_DROPIN" ]]; }
|
||||
cec_driver_ok() { ! detect_valve_fremont || [[ -d "$CEC_DKMS_SRC" ]]; }
|
||||
# On = installed, Steam told to show its CEC settings and, on a Steam
|
||||
# Machine, the driver built. An install from before 1.1.3 (settings) or
|
||||
# 2.0.3 (driver) lacks one; the menu then ticks it (see cec_repair).
|
||||
cec_status() { cec_installed && [[ -f "$CEC_STEAM_DROPIN" ]] && cec_driver_ok; }
|
||||
|
||||
cec_reload_driver() {
|
||||
# cecd keeps /dev/cec0 open, so the old module can't be unloaded under it.
|
||||
systemctl --user stop cecd.service 2>/dev/null
|
||||
sudo modprobe -r cros_ec_cec 2>/dev/null
|
||||
sudo modprobe cros_ec_cec 2>/dev/null
|
||||
systemctl --user start cecd.service 2>/dev/null
|
||||
}
|
||||
|
||||
cec_driver_enable() {
|
||||
detect_valve_fremont || return 0
|
||||
local tmp k
|
||||
if ! pacman -Q dkms patch >/dev/null 2>&1; then
|
||||
sudo pacman -S --needed --noconfirm dkms patch || { err "Installing dkms failed."; return 1; }
|
||||
fi
|
||||
install_kernel_headers || return 1
|
||||
tmp="$(mktemp -d)"
|
||||
info "Downloading Valve's Steam Machine CEC driver..."
|
||||
if ! curl -fsL "$CEC_DRIVER_URL" -o "$tmp/cros-ec-cec.c" ||
|
||||
! echo "$CEC_DRIVER_SHA256 $tmp/cros-ec-cec.c" | sha256sum -c --quiet -; then
|
||||
rm -rf "$tmp"
|
||||
err "Downloading Valve's CEC driver failed (or its checksum didn't match)."
|
||||
return 1
|
||||
fi
|
||||
# So it finds amdgpu's HDMI port (see the patch for why).
|
||||
patch_file cros-ec-cec-single-port.patch | patch -s -d "$tmp" -p1 ||
|
||||
{ rm -rf "$tmp"; err "Patching Valve's CEC driver failed."; return 1; }
|
||||
echo 'obj-m += cros-ec-cec.o' >"$tmp/Makefile"
|
||||
printf '%s\n' "# Written by Steamify: Valve's cros_ec_cec, which knows the Steam Machine." \
|
||||
"PACKAGE_NAME=\"$CEC_DKMS_NAME\"" "PACKAGE_VERSION=\"$CEC_DKMS_VER\"" \
|
||||
'BUILT_MODULE_NAME[0]="cros-ec-cec"' 'DEST_MODULE_LOCATION[0]="/updates/dkms"' \
|
||||
'AUTOINSTALL="yes"' >"$tmp/dkms.conf"
|
||||
sudo dkms remove "$CEC_DKMS_NAME/$CEC_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$CEC_DKMS_SRC"
|
||||
sudo install -d "$CEC_DKMS_SRC" && sudo install -m644 "$tmp"/{cros-ec-cec.c,Makefile,dkms.conf} "$CEC_DKMS_SRC/"
|
||||
rm -rf "$tmp"
|
||||
sudo dkms add "$CEC_DKMS_NAME/$CEC_DKMS_VER" >/dev/null || { err "Adding the CEC driver to DKMS failed."; return 1; }
|
||||
# Every kernel with headers; one that fails to build only lacks CEC.
|
||||
for k in /usr/lib/modules/*/build; do
|
||||
k="$(basename "$(dirname "$k")")"
|
||||
info "Building the CEC driver for $k..."
|
||||
sudo dkms install "$CEC_DKMS_NAME/$CEC_DKMS_VER" -k "$k" >/dev/null ||
|
||||
warn "Building the CEC driver for $k failed; that kernel has no HDMI-CEC."
|
||||
done
|
||||
cec_reload_driver
|
||||
}
|
||||
|
||||
cec_driver_disable() {
|
||||
[[ -d "$CEC_DKMS_SRC" ]] || return 0
|
||||
sudo dkms remove "$CEC_DKMS_NAME/$CEC_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$CEC_DKMS_SRC"
|
||||
cec_reload_driver
|
||||
}
|
||||
cec_repair() { cec_installed && ! cec_status; }
|
||||
|
||||
fetch_holo_pkg() {
|
||||
@@ -79,6 +144,7 @@ cec_enable() {
|
||||
return 1
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
cec_driver_enable || return 1
|
||||
# Its udev rule gives the user /dev/cec*; cecd starts with the graphical
|
||||
# session, after steamos-manager wrote its config from Steam's settings.
|
||||
sudo udevadm control --reload
|
||||
@@ -108,6 +174,7 @@ cec_disable() {
|
||||
systemctl --user disable --now cecd.service cec-audio-control.socket cec-audio-control.service 2>/dev/null
|
||||
systemctl --user disable steamos-manager-configure-cecd.service 2>/dev/null
|
||||
sudo pacman -Rns --noconfirm "${CEC_PKGS[@]}" 2>/dev/null
|
||||
cec_driver_disable
|
||||
sudo rm -f "$CEC_ORDER_DROPIN" "$CEC_STEAM_DROPIN" "$CEC_STEAM_ENV"
|
||||
sudo rmdir "$(dirname "$CEC_ORDER_DROPIN")" "$(dirname "$CEC_STEAM_DROPIN")" "$(dirname "$CEC_STEAM_ENV")" 2>/dev/null
|
||||
systemctl --user daemon-reload
|
||||
|
||||
@@ -6,6 +6,9 @@ c_reset="\033[0m"; c_bold="\033[1m"; c_green="\033[32m"; c_yellow="\033[33m"; c_
|
||||
|
||||
info() { echo -e "${c_cyan}[INFO]${c_reset} $*"; }
|
||||
ok() { echo -e "${c_green}[OK]${c_reset} $*"; }
|
||||
# patch_file <name>: a file from patches/ (module sources, patches). The
|
||||
# single-file build replaces this with one that has them embedded.
|
||||
patch_file() { cat "$SCRIPT_DIR/patches/$1"; }
|
||||
warn() { echo -e "${c_yellow}[WARN]${c_reset} $*"; }
|
||||
err() { echo -e "${c_red}[ERROR] $*${c_reset}" >&2; }
|
||||
ask_yn() {
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
#!/bin/bash
|
||||
# "Power-off fix" menu item (poweroff), a sub-option of Steam Machine support
|
||||
# ticked along with it (opt-out): the Steam Machine powers off instead of
|
||||
# booting up again. Recent kernels (7.2, and the 6.x, 7.0 and 7.1 updates
|
||||
# that got the change backported) keep the S4/S5 wake bit the firmware
|
||||
# leaves set on GPIO pin 18 ("pinctrl-amd: Don't clear S4 wake bits at
|
||||
# probe"), so the machine starts again right after powering off. Valve's kernel clears it at probe on Fremont, in
|
||||
# a patch not meant for upstream, so CachyOS won't get it. A small module
|
||||
# (patches/steamify-fremont-poweroff.c) clears it right before power-off;
|
||||
# DKMS builds it for each installed kernel. On a kernel that clears it
|
||||
# itself it does nothing.
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
POWEROFF_DKMS_NAME=steamify-fremont-poweroff
|
||||
POWEROFF_DKMS_VER=1
|
||||
POWEROFF_DKMS_SRC="/usr/src/$POWEROFF_DKMS_NAME-$POWEROFF_DKMS_VER"
|
||||
POWEROFF_MODULES_LOAD=/etc/modules-load.d/steamify-fremont-poweroff.conf
|
||||
|
||||
poweroff_fix_installed() { [[ -f "$POWEROFF_DKMS_SRC/dkms.conf" && -f "$POWEROFF_MODULES_LOAD" ]]; }
|
||||
|
||||
poweroff_fix_enable() {
|
||||
detect_valve_fremont || return 0
|
||||
local tmp k
|
||||
if ! pacman -Q dkms >/dev/null 2>&1; then
|
||||
sudo pacman -S --needed --noconfirm dkms || { err "Installing dkms failed."; return 1; }
|
||||
fi
|
||||
install_kernel_headers || return 1
|
||||
tmp="$(mktemp -d)"
|
||||
patch_file "$POWEROFF_DKMS_NAME.c" > "$tmp/$POWEROFF_DKMS_NAME.c"
|
||||
echo "obj-m += $POWEROFF_DKMS_NAME.o" >"$tmp/Makefile"
|
||||
printf '%s\n' "# Written by Steamify: the Steam Machine powers off instead of booting up again." \
|
||||
"PACKAGE_NAME=\"$POWEROFF_DKMS_NAME\"" "PACKAGE_VERSION=\"$POWEROFF_DKMS_VER\"" \
|
||||
"BUILT_MODULE_NAME[0]=\"$POWEROFF_DKMS_NAME\"" 'DEST_MODULE_LOCATION[0]="/updates/dkms"' \
|
||||
'AUTOINSTALL="yes"' >"$tmp/dkms.conf"
|
||||
sudo dkms remove "$POWEROFF_DKMS_NAME/$POWEROFF_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$POWEROFF_DKMS_SRC"
|
||||
sudo install -d "$POWEROFF_DKMS_SRC" &&
|
||||
sudo install -m644 "$tmp"/{"$POWEROFF_DKMS_NAME.c",Makefile,dkms.conf} "$POWEROFF_DKMS_SRC/"
|
||||
rm -rf "$tmp"
|
||||
sudo dkms add "$POWEROFF_DKMS_NAME/$POWEROFF_DKMS_VER" >/dev/null ||
|
||||
{ err "Adding the power-off fix to DKMS failed."; return 1; }
|
||||
for k in /usr/lib/modules/*/build; do
|
||||
k="$(basename "$(dirname "$k")")"
|
||||
info "Building the power-off fix for $k..."
|
||||
sudo dkms install "$POWEROFF_DKMS_NAME/$POWEROFF_DKMS_VER" -k "$k" >/dev/null ||
|
||||
warn "Building the power-off fix for $k failed; with that kernel it may start again after shutting down."
|
||||
done
|
||||
echo "$POWEROFF_DKMS_NAME" | sudo tee "$POWEROFF_MODULES_LOAD" >/dev/null
|
||||
sudo modprobe "$POWEROFF_DKMS_NAME" 2>/dev/null
|
||||
return 0
|
||||
}
|
||||
|
||||
poweroff_fix_disable() {
|
||||
sudo rm -f "$POWEROFF_MODULES_LOAD"
|
||||
sudo modprobe -r "$POWEROFF_DKMS_NAME" 2>/dev/null
|
||||
[[ -d "$POWEROFF_DKMS_SRC" ]] || return 0
|
||||
sudo dkms remove "$POWEROFF_DKMS_NAME/$POWEROFF_DKMS_VER" --all >/dev/null 2>&1
|
||||
sudo rm -rf "$POWEROFF_DKMS_SRC"
|
||||
}
|
||||
|
||||
poweroff_status() { poweroff_fix_installed; }
|
||||
poweroff_enable() {
|
||||
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; }
|
||||
ok "Power-off fix on: the Steam Machine stays off after shutting down."
|
||||
}
|
||||
poweroff_disable() {
|
||||
poweroff_fix_disable
|
||||
ok "Power-off fix removed; with recent kernels the Steam Machine may start again after shutting down."
|
||||
}
|
||||
+197
-60
@@ -1,8 +1,8 @@
|
||||
#!/bin/bash
|
||||
# "HDMI refresh boost" menu item, Steam Machine (Fremont) only: finds the
|
||||
# highest refresh rate the display runs at the desktop resolution over HDMI,
|
||||
# tests it live and makes it permanent with an EDID override
|
||||
# (drm.edid_firmware). Two things keep displays below what they can do:
|
||||
# tests it live and saves an EDID override per display, loaded only while
|
||||
# that display is connected (see hdmi_install_hotplug). Two things keep displays below what they can do:
|
||||
# - Monitors put their fast modes in an extra EDID block (HDMI Forum EEODB);
|
||||
# the pinned kernel (7.1.6) only reads the first extension. Newer kernels
|
||||
# do, and do HDMI 2.1, so it's only offered with the pinned kernel.
|
||||
@@ -14,7 +14,17 @@
|
||||
# black). Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
HDMI_FW_DIR=/usr/lib/firmware/edid
|
||||
# Before 2.1.0 the override was on the kernel command line; only removed now.
|
||||
HDMI_INITRAMFS_CONF=/etc/mkinitcpio.conf.d/90-steamify-edid.conf
|
||||
# The saved displays, one per line: <id> TAB <name> TAB <w>x<h> TAB <rates>.
|
||||
# Their EDIDs are $HDMI_FW_DIR/steamify-<id>.bin.
|
||||
HDMI_MAP=/etc/steamify/hdmi-edid.conf
|
||||
# Per output, the ID of the display whose EDID is loaded, or "reset".
|
||||
HDMI_RUN=/run/steamify-edid
|
||||
HDMI_HOTPLUG=/usr/local/bin/steamify-edid-hotplug
|
||||
HDMI_UNIT_NAME=steamify-edid.service
|
||||
HDMI_UNIT="/etc/systemd/system/$HDMI_UNIT_NAME"
|
||||
HDMI_UDEV_RULE=/etc/udev/rules.d/90-steamify-edid.rules
|
||||
# No answer within this time switches back; longer for scripted tests.
|
||||
HDMI_CONFIRM_SECONDS="${WIZARD_HDMI_CONFIRM_SECONDS:-15}"
|
||||
# amdgpu's HDMI 2.0 limit; the display's own limit (from its EDID) may be lower.
|
||||
@@ -46,12 +56,27 @@ hdmi_cmdline_param() {
|
||||
}
|
||||
|
||||
hdmi_available() {
|
||||
# Stays available while on, so it can be turned off after the pin is gone.
|
||||
detect_valve_fremont || return 1
|
||||
hdmi_status || { pinned_kernel_installed && [[ -n "$(hdmi_connectors)" && -n "$(hdmi_boot_file)" ]]; }
|
||||
# No longer offered (it needed the pinned kernel): only shown while
|
||||
# anything of it is left, so a normal run removes it.
|
||||
detect_valve_fremont && hdmi_status
|
||||
}
|
||||
|
||||
hdmi_status() { [[ -n "$(hdmi_cmdline_param)" ]] && compgen -G "$HDMI_FW_DIR/steamify-*.bin" >/dev/null; }
|
||||
hdmi_status() {
|
||||
# On while anything of it is left: saved displays (connected or not), the
|
||||
# hotplug script, an EDID file, or the kernel parameter of versions
|
||||
# before 2.1.0.
|
||||
[[ -n "$(hdmi_saved)" || -f "$HDMI_UNIT" || -n "$(hdmi_cmdline_param)" ]] ||
|
||||
compgen -G "$HDMI_FW_DIR/steamify-*.bin" >/dev/null
|
||||
}
|
||||
|
||||
hdmi_saved() { [[ -f "$HDMI_MAP" ]] && grep -v '^#' "$HDMI_MAP"; }
|
||||
|
||||
hdmi_active_ids() {
|
||||
# IDs of the connected displays whose saved EDID is loaded.
|
||||
local f
|
||||
for f in "$HDMI_RUN"/*; do [[ -f "$f" ]] && grep -vx reset "$f"; done
|
||||
return 0
|
||||
}
|
||||
|
||||
hdmi_edid_tool() {
|
||||
# hdmi_edid_tool <command> ...: EDID parsing and building (python, as
|
||||
@@ -160,6 +185,11 @@ if cmd == 'blocks':
|
||||
print(nblocks(load(args[0])))
|
||||
elif cmd == 'id':
|
||||
print(load(args[0])[8:18].hex())
|
||||
elif cmd == 'name':
|
||||
e = load(args[0])
|
||||
for o in range(54, 126, 18):
|
||||
if e[o:o + 3] == b'\0\0\0' and e[o + 3] == 0xfc:
|
||||
print(e[o + 5:o + 18].split(b'\n')[0].decode('ascii', 'replace').strip())
|
||||
elif cmd == 'plan':
|
||||
e = load(args[0]); w, h, cur = int(args[1]), int(args[2]), float(args[3])
|
||||
lim, t = tmds_khz(e), shortest(e, w, h)
|
||||
@@ -322,23 +352,16 @@ hdmi_confirm() {
|
||||
[[ "$reply" =~ ^[Yy]$ ]]
|
||||
}
|
||||
|
||||
hdmi_boot_param() {
|
||||
# hdmi_boot_param <value|"">: set or remove our drm.edid_firmware= in
|
||||
# the boot loader's command line, then rebuild the initramfs and entries.
|
||||
local f value="$1"
|
||||
f="$(hdmi_boot_file)" || return 1
|
||||
[[ -n "$f" ]] || { err "No supported boot loader (Limine, systemd-boot with sdboot-manage, GRUB) found."; return 1; }
|
||||
hdmi_remove_boot_param() {
|
||||
# Removes the drm.edid_firmware= older versions put on the kernel command
|
||||
# line (it applied to whatever display was on that port), then rebuilds
|
||||
# the initramfs and boot entries.
|
||||
local f
|
||||
[[ -n "$(hdmi_cmdline_param)" ]] || { sudo rm -f "$HDMI_INITRAMFS_CONF"; return 0; }
|
||||
f="$(hdmi_boot_file)"
|
||||
backup_file "$f"
|
||||
sudo sed -i -E 's/drm\.edid_firmware=[^ "]*steamify-[^ "]* ?//' "$f"
|
||||
if [[ -n "$value" ]]; then
|
||||
case "$f" in
|
||||
# | as delimiter: the value holds a path.
|
||||
/etc/default/limine) sudo sed -i -E "0,\|^KERNEL_CMDLINE\[default\]\+?=\"|s||&$value |" "$f" ;;
|
||||
/etc/sdboot-manage.conf) sudo sed -i -E "0,\|^LINUX_OPTIONS=\"|s||&$value |" "$f" ;;
|
||||
/etc/default/grub) sudo sed -i -E "0,\|^GRUB_CMDLINE_LINUX_DEFAULT=\"|s||&$value |" "$f" ;;
|
||||
esac
|
||||
grep -qF "$value" "$f" || { err "Couldn't add $value to $f."; return 1; }
|
||||
fi
|
||||
sudo rm -f "$HDMI_INITRAMFS_CONF"
|
||||
info "Rebuilding the initramfs and boot entries..."
|
||||
case "$f" in
|
||||
/etc/default/limine) sudo limine-mkinitcpio ;;
|
||||
@@ -347,6 +370,136 @@ hdmi_boot_param() {
|
||||
esac
|
||||
}
|
||||
|
||||
hdmi_write_map() {
|
||||
# hdmi_write_map <lines>: the saved displays list.
|
||||
sudo mkdir -p "$(dirname "$HDMI_MAP")"
|
||||
{ printf '# Written by steamify: HDMI refresh boost, one display per line:\n'
|
||||
printf '# <id>\t<name>\t<w>x<h>\t<rates>\n'
|
||||
[[ -n "$1" ]] && printf '%s\n' "$1"; } | sudo tee "$HDMI_MAP" >/dev/null
|
||||
}
|
||||
|
||||
hdmi_save() {
|
||||
# hdmi_save <edid> <w>x<h> <rates>: keep an EDID for the display it was
|
||||
# built from (block 0 is the display's own, so is its ID), replacing
|
||||
# what was saved for that display before.
|
||||
local id name
|
||||
id="$(hdmi_edid_tool id "$1")" && [[ -n "$id" ]] || return 1
|
||||
name="$(hdmi_edid_tool name "$1")"
|
||||
sudo install -Dm644 "$1" "$HDMI_FW_DIR/steamify-$id.bin" || return 1
|
||||
hdmi_write_map "$(hdmi_saved | awk -F'\t' -v i="$id" '$1 != i'
|
||||
printf '%s\t%s\t%s\t%s' "$id" "${name:-HDMI display}" "$2" "$3")"
|
||||
}
|
||||
|
||||
hdmi_forget() {
|
||||
# hdmi_forget <id>|all: remove saved displays; the hotplug script puts
|
||||
# a connected one back on its own EDID, and goes when none are left.
|
||||
local rest=""
|
||||
if [[ "$1" == all ]]; then
|
||||
sudo rm -f "$HDMI_FW_DIR"/steamify-*.bin
|
||||
else
|
||||
rest="$(hdmi_saved | awk -F'\t' -v i="$1" '$1 != i')"
|
||||
sudo rm -f "$HDMI_FW_DIR/steamify-$1.bin"
|
||||
fi
|
||||
if [[ -z "$rest" ]]; then hdmi_remove_hotplug; return; fi
|
||||
hdmi_write_map "$rest"
|
||||
sudo systemctl restart "$HDMI_UNIT_NAME"
|
||||
}
|
||||
|
||||
hdmi_migrate() {
|
||||
# Setups before 2.1.0: steamify-<output>.bin on the kernel command line,
|
||||
# the display's ID and mode in the state file. Saved per display now.
|
||||
local f out
|
||||
local -a smode
|
||||
for f in "$HDMI_FW_DIR"/steamify-*-*.bin; do
|
||||
[[ -e "$f" ]] || continue
|
||||
out="${f##*/steamify-}"; out="${out%.bin}"
|
||||
read -ra smode <<< "$(state_get hdmi "$out-mode")"
|
||||
[[ ${#smode[@]} -ge 2 ]] && hdmi_save "$f" "${smode[0]}x${smode[1]}" "${smode[*]:2}"
|
||||
sudo rm -f "$f"
|
||||
done
|
||||
state_clear hdmi
|
||||
hdmi_remove_boot_param
|
||||
}
|
||||
|
||||
hdmi_install_hotplug() {
|
||||
# A saved EDID is only loaded while its display is connected: a udev
|
||||
# rule runs the script at every hotplug (and a unit at boot, before the
|
||||
# login manager). The script reads the display's ID over DDC, which
|
||||
# shows the real display even while an override is loaded, and loads
|
||||
# that display's file or resets to its own EDID. Unplugging resets too,
|
||||
# so the next display never starts on the wrong one.
|
||||
sudo tee "$HDMI_HOTPLUG" > /dev/null << 'EOF'
|
||||
#!/bin/bash
|
||||
# Steamify CachyOS, HDMI refresh boost: load a display's saved EDID only
|
||||
# while it is connected. Runs as root (debugfs).
|
||||
FW=/usr/lib/firmware/edid RUN=/run/steamify-edid
|
||||
modprobe i2c-dev 2>/dev/null
|
||||
mkdir -p "$RUN"
|
||||
# Hotplug events come in bursts, and the link needs a moment before DDC works.
|
||||
sleep 1
|
||||
for c in /sys/class/drm/card*-HDMI-A-*; do
|
||||
[ -e "$c" ] || continue
|
||||
out="${c##*/}"; out="${out#card*-}"
|
||||
new=reset id=""
|
||||
if [ "$(cat "$c/status")" = connected ]; then
|
||||
bus="$(basename "$(readlink -f "$c/ddc")")"
|
||||
for i in 1 2 3 4 5; do
|
||||
# Bytes 8-17 of block 0: manufacturer, product, serial, date.
|
||||
id="$(i2ctransfer -y "${bus#i2c-}" w1@0x50 0 r18@0x50 2>/dev/null | tr -d ' ' | sed 's/0x//g')"
|
||||
[ ${#id} -eq 36 ] && break
|
||||
sleep 1
|
||||
done
|
||||
[ ${#id} -eq 36 ] && [ -f "$FW/steamify-${id:16}.bin" ] && new="${id:16}"
|
||||
fi
|
||||
[ "$(cat "$RUN/$out" 2>/dev/null || echo reset)" = "$new" ] && continue
|
||||
for d in /sys/kernel/debug/dri/*/"$out"; do [ -e "$d/edid_override" ] && break; done
|
||||
[ -e "$d/edid_override" ] || continue
|
||||
if [ "$new" = reset ]; then printf reset > "$d/edid_override"
|
||||
else cat "$FW/steamify-$new.bin" > "$d/edid_override"; fi
|
||||
# Before the hotplug below, whose own event runs this again.
|
||||
echo "$new" > "$RUN/$out"
|
||||
echo 1 > "$d/trigger_hotplug"
|
||||
done
|
||||
exit 0
|
||||
EOF
|
||||
sudo chmod 755 "$HDMI_HOTPLUG"
|
||||
# StartLimitIntervalSec=0: a burst of hotplugs must not get it rate-limited.
|
||||
sudo tee "$HDMI_UNIT" > /dev/null << EOF
|
||||
[Unit]
|
||||
Description=Steamify CachyOS: HDMI refresh boost EDID for the connected display
|
||||
StartLimitIntervalSec=0
|
||||
Wants=sys-kernel-debug.mount
|
||||
After=sys-kernel-debug.mount
|
||||
Before=display-manager.service sddm.service plasmalogin.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=$HDMI_HOTPLUG
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical.target
|
||||
EOF
|
||||
# restart, not start: a hotplug during a run must still be looked at.
|
||||
printf '%s\n' '# Written by steamify: HDMI refresh boost, check the display at every hotplug.' \
|
||||
"ACTION==\"change\", SUBSYSTEM==\"drm\", ENV{HOTPLUG}==\"1\", RUN+=\"/usr/bin/systemctl --no-block restart $HDMI_UNIT_NAME\"" |
|
||||
sudo tee "$HDMI_UDEV_RULE" >/dev/null || return 1
|
||||
sudo systemctl daemon-reload
|
||||
sudo udevadm control --reload
|
||||
sudo systemctl enable "$HDMI_UNIT_NAME" >/dev/null 2>&1 || { err "Enabling $HDMI_UNIT_NAME failed."; return 1; }
|
||||
sudo systemctl restart "$HDMI_UNIT_NAME"
|
||||
}
|
||||
|
||||
hdmi_remove_hotplug() {
|
||||
local conn
|
||||
sudo systemctl disable "$HDMI_UNIT_NAME" >/dev/null 2>&1
|
||||
sudo rm -f "$HDMI_UDEV_RULE" "$HDMI_UNIT" "$HDMI_HOTPLUG" "$HDMI_MAP"
|
||||
sudo rm -rf "$HDMI_RUN"
|
||||
sudo systemctl daemon-reload
|
||||
sudo udevadm control --reload
|
||||
for conn in $(hdmi_connectors); do hdmi_override_live "$conn" reset 2>/dev/null; done
|
||||
return 0
|
||||
}
|
||||
|
||||
hdmi_tune() {
|
||||
# hdmi_tune <card-connector> <tmpdir>: find and confirm the highest rate
|
||||
# at the desktop resolution. Sets HDMI_RESULT to "<w> <h> <hz>..." (the
|
||||
@@ -485,6 +638,16 @@ hdmi_choose() {
|
||||
|
||||
hdmi_enable() {
|
||||
local -a HDMI_RESULTS=()
|
||||
if [[ -n "$(hdmi_cmdline_param)" ]]; then
|
||||
info "Moving the EDID override off the kernel command line, so it only applies to its display..."
|
||||
hdmi_migrate && hdmi_install_hotplug || { err "Moving it failed."; return 1; }
|
||||
ok "HDMI refresh boost now only applies to the display it was set up for."
|
||||
return 0
|
||||
fi
|
||||
if hdmi_status; then
|
||||
ok "Already set up for the connected display. Untick and tick it again to re-test."
|
||||
return 0
|
||||
fi
|
||||
if [[ "${BACKEND:-false}" == true && ${#HDMI_CHOICE[@]} -eq 0 ]]; then
|
||||
err "HDMI refresh boost needs you at the screen: pick and test the rates in the app first."
|
||||
return 1
|
||||
@@ -493,22 +656,10 @@ hdmi_enable() {
|
||||
err "Run this from the Plasma desktop: the test switches the display mode through KDE."
|
||||
return 1
|
||||
fi
|
||||
if hdmi_status; then
|
||||
local conn stale=false
|
||||
for conn in $(hdmi_connectors); do
|
||||
[[ -f "$HDMI_FW_DIR/steamify-${conn#card*-}.bin" ]] || continue
|
||||
[[ "$(state_get hdmi "${conn#card*-}")" == "$(hdmi_edid_tool id "/sys/class/drm/$conn/edid")" ]] || stale=true
|
||||
done
|
||||
if [[ "$stale" == false ]]; then
|
||||
ok "Already set up for the connected display(s). Untick and tick it again to re-test."
|
||||
return 0
|
||||
fi
|
||||
warn "Set up for another display; setting up the one connected now."
|
||||
hdmi_disable || return 1
|
||||
fi
|
||||
sudo pacman -S --needed --noconfirm i2c-tools python >/dev/null 2>&1 || { err "Installing i2c-tools failed."; return 1; }
|
||||
|
||||
local tmp conn out param="" files=() rc=0 res
|
||||
local tmp conn out res saved=false rc=0
|
||||
local -a smode
|
||||
tmp="$(mktemp -d)"
|
||||
if [[ ${#HDMI_CHOICE[@]} -gt 0 ]]; then
|
||||
# Picked and tested in the app.
|
||||
@@ -520,40 +671,26 @@ hdmi_enable() {
|
||||
done
|
||||
fi
|
||||
for res in "${HDMI_RESULTS[@]}"; do
|
||||
out="${res%%|*}"
|
||||
sudo install -Dm644 "$tmp/$out.final" "$HDMI_FW_DIR/steamify-$out.bin" || { rc=1; continue; }
|
||||
state_set hdmi "$out" "$(hdmi_edid_tool id "$tmp/$out.orig")"
|
||||
state_set hdmi "$out-mode" "${res#*|}"
|
||||
param+="${param:+,}$out:edid/steamify-$out.bin"
|
||||
files+=("$HDMI_FW_DIR/steamify-$out.bin")
|
||||
out="${res%%|*}"; read -ra smode <<< "${res#*|}"
|
||||
hdmi_save "$tmp/$out.final" "${smode[0]}x${smode[1]}" "${smode[*]:2}" && saved=true || rc=1
|
||||
done
|
||||
rm -rf "$tmp" "$HDMI_CACHE"
|
||||
[[ -n "$param" ]] || return $rc
|
||||
|
||||
# amdgpu loads from the initramfs (the kms hook), before the root
|
||||
# filesystem: the EDID file has to be in there too.
|
||||
sudo mkdir -p "$(dirname "$HDMI_INITRAMFS_CONF")"
|
||||
printf '# Written by steamify: EDID override for HDMI refresh boost.\nFILES+=(%s)\n' "${files[*]}" |
|
||||
sudo tee "$HDMI_INITRAMFS_CONF" >/dev/null
|
||||
if ! hdmi_boot_param "drm.edid_firmware=$param"; then
|
||||
[[ "$saved" == true ]] || return $rc
|
||||
if ! hdmi_install_hotplug; then
|
||||
# Nothing half-done left behind; the live EDID lasts until a restart.
|
||||
sudo rm -f "$HDMI_INITRAMFS_CONF" "${files[@]}"
|
||||
for conn in $(hdmi_connectors); do hdmi_override_live "$conn" reset 2>/dev/null; done
|
||||
state_clear hdmi
|
||||
hdmi_remove_hotplug
|
||||
err "Making it permanent failed; the display is back on its own EDID."
|
||||
return 1
|
||||
fi
|
||||
ok "HDMI refresh boost is set up; it's active now and after every restart."
|
||||
ok "HDMI refresh boost is saved for this display; other displays keep their own settings."
|
||||
return $rc
|
||||
}
|
||||
|
||||
hdmi_disable() {
|
||||
local f conn
|
||||
# Drop-in and files first: the rebuild below leaves them out.
|
||||
sudo rm -f "$HDMI_INITRAMFS_CONF"
|
||||
for f in "$HDMI_FW_DIR"/steamify-*.bin; do [[ -e "$f" ]] && sudo rm -f "$f"; done
|
||||
hdmi_boot_param "" || return 1
|
||||
for conn in $(hdmi_connectors); do hdmi_override_live "$conn" reset 2>/dev/null; done
|
||||
# Everything, for every saved display: newer kernels read the whole EDID
|
||||
# themselves, and an old one loaded at the next hotplug would be wrong.
|
||||
hdmi_forget all
|
||||
hdmi_remove_boot_param || return 1
|
||||
state_clear hdmi
|
||||
ok "HDMI refresh boost removed; the display uses its own EDID again."
|
||||
ok "HDMI refresh boost removed; displays use their own EDID again."
|
||||
}
|
||||
+86
-13
@@ -5,18 +5,30 @@
|
||||
|
||||
# Menu order. Components are turned on in this order and off in reverse;
|
||||
# gaming must come first (single user builds on it).
|
||||
COMPONENTS=(gaming boot theme glyphs single launcher cec machine kpin hdmi bios)
|
||||
COMPONENTS=(gaming boot theme glyphs single launcher vram cec machine poweroff kpin hdmi bios)
|
||||
# One-off actions rather than on/off components: never preselected, never
|
||||
# re-applied, not listed as on or off.
|
||||
ACTIONS=(bios)
|
||||
# Sub-options, shown indented under their parent and only while it's ticked.
|
||||
declare -A PARENT=([boot]=gaming [kpin]=machine [hdmi]=machine [bios]=machine)
|
||||
declare -A PARENT=([boot]=gaming [poweroff]=machine [kpin]=machine [hdmi]=machine [bios]=machine)
|
||||
# Never preselected on a first run: booting into the desktop is a choice,
|
||||
# gamescope is the default; HDMI-CEC is opt-in (it can wake the machine or
|
||||
# upset other devices on the TV, even on SteamOS), except on a Steam Machine,
|
||||
# which has CEC like on SteamOS. HDMI refresh boost needs someone at the
|
||||
# screen to confirm each step.
|
||||
NO_PRESELECT=(boot cec hdmi)
|
||||
NO_PRESELECT=(boot cec kpin hdmi)
|
||||
# Feature versions: the Steamify version in which what a component's enable
|
||||
# sets up last changed; set it to the new VERSION whenever you change one.
|
||||
# Each successful run records it (state "features"); a component that's on
|
||||
# with an older one is ticked and re-applied by a normal run, and the app
|
||||
# shows it as an update. A setup from before these were recorded counts as
|
||||
# FEATURE_BASELINE.
|
||||
FEATURE_BASELINE=2.1.0
|
||||
declare -A FEATURE_VERSION=(
|
||||
[gaming]=2.1.0 [boot]=2.1.0 [theme]=2.1.0 [glyphs]=2.1.0 [single]=2.1.0
|
||||
[launcher]=2.1.0 [cec]=2.1.0 [machine]=2.2.0 [poweroff]=2.2.0 [vram]=2.3.0
|
||||
[kpin]=2.1.0 [hdmi]=2.1.0
|
||||
)
|
||||
|
||||
declare -A LABEL=(
|
||||
[gaming]="SteamOS conversion: boot into gaming mode, Steam on the desktop"
|
||||
@@ -25,9 +37,11 @@ declare -A LABEL=(
|
||||
[glyphs]="Install Steam Deck/Machine icons: Deck button icons in gaming mode"
|
||||
[single]="Single user mode: no password, lock screen or log out (SDDM)"
|
||||
[launcher]="Steamify shortcut: the app on the desktop, Steamify Terminal in the launcher"
|
||||
[vram]="VRAM booster: the game in front keeps its VRAM, background apps make room"
|
||||
[cec]="HDMI-CEC: use Steam with the TV remote, TV on/off with the PC (experimental)"
|
||||
[machine]="Steam Machine support: LED bar driver, hardware settings in Steam"
|
||||
[kpin]="Pin the kernel to $PINNED_KERNEL_VER (fixes rebooting after shutdown)"
|
||||
[poweroff]="Power-off fix: the Steam Machine stays off after shutting down"
|
||||
[kpin]="Pin the kernel to $PINNED_KERNEL_VER (untick for CachyOS's current kernel)"
|
||||
[hdmi]="HDMI refresh boost: highest refresh your HDMI display runs"
|
||||
[bios]="Update BIOS"
|
||||
)
|
||||
@@ -35,7 +49,9 @@ declare -A CURRENT WANTED
|
||||
|
||||
component_available() {
|
||||
case "$1" in
|
||||
machine|kpin) machine_available ;;
|
||||
machine|poweroff) machine_available ;;
|
||||
vram) vram_available ;;
|
||||
kpin) kpin_available ;;
|
||||
hdmi) hdmi_available ;;
|
||||
bios) bios_available ;;
|
||||
esac
|
||||
@@ -56,10 +72,52 @@ menu_visible() {
|
||||
[[ -z "${PARENT[$1]:-}" || "${WANTED[${PARENT[$1]}]:-0}" == 1 ]]
|
||||
}
|
||||
|
||||
feature_record() {
|
||||
# feature_record <component> <enable|disable>: after a successful run.
|
||||
if [[ "$2" == enable ]]; then state_set features "$1" "${FEATURE_VERSION[$1]:-$FEATURE_BASELINE}"
|
||||
else state_set features "$1" off; fi
|
||||
}
|
||||
|
||||
feature_outdated() {
|
||||
# On, but set up by an older version of that feature (compared as
|
||||
# versions: 2.10.0 is newer than 2.9.0).
|
||||
local have want
|
||||
[[ "${CURRENT[$1]:-0}" == 1 ]] || return 1
|
||||
have="$(state_get features "$1" "$FEATURE_BASELINE")"
|
||||
[[ "$have" == off ]] && have="$FEATURE_BASELINE"
|
||||
want="${FEATURE_VERSION[$1]:-$FEATURE_BASELINE}"
|
||||
[[ "$have" != "$want" && "$(printf '%s\n' "$have" "$want" | sort -V | head -n 1)" == "$have" ]]
|
||||
}
|
||||
|
||||
menu_label() {
|
||||
# The label, with "(update)" after the name when a newer version of it
|
||||
# will be applied, "(new)" for a default sub-option added since the
|
||||
# last run.
|
||||
local l="${LABEL[$1]}" b=""
|
||||
if feature_outdated "$1"; then b="${c_yellow}(update)${c_reset}"
|
||||
elif feature_new "$1"; then b="${c_green}(new)${c_reset}"; fi
|
||||
if [[ -n "$b" ]]; then
|
||||
if [[ "$l" == *:* ]]; then l="${l%%:*} $b:${l#*:}"
|
||||
else l+=" $b"; fi
|
||||
fi
|
||||
printf '%s' "$l"
|
||||
}
|
||||
|
||||
feature_new() {
|
||||
# A default option added after its parent was set up (e.g. the power-off
|
||||
# fix under Steam Machine support; a top-level one counts the SteamOS
|
||||
# conversion as its parent): never turned on or off.
|
||||
local p="${PARENT[$1]:-gaming}"
|
||||
[[ "$1" != gaming && "${CURRENT[$p]:-0}" == 1 && "${CURRENT[$1]:-0}" == 0 ]] &&
|
||||
! is_action "$1" && component_selectable "$1" && [[ " ${NO_PRESELECT[*]} " != *" $1 "* ]] &&
|
||||
[[ -z "$(state_get features "$1")" ]]
|
||||
}
|
||||
|
||||
component_selectable() {
|
||||
# Greyed out and not tickable when it has nothing to do.
|
||||
case "$1" in
|
||||
bios) bios_selectable ;;
|
||||
vram) vram_selectable ;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -72,15 +130,28 @@ detect_components() {
|
||||
done
|
||||
# HDMI-CEC set up by an older version: tick it, so a normal run fixes it.
|
||||
component_available cec && cec_repair && WANTED[cec]=1
|
||||
# Updated features and new default sub-options: ticked, so a normal run
|
||||
# applies them.
|
||||
for c in "${COMPONENTS[@]}"; do
|
||||
component_available "$c" || continue
|
||||
{ feature_outdated "$c" || feature_new "$c"; } && WANTED[$c]=1
|
||||
done
|
||||
# The kernel pin is no longer needed (the power-off fix), and HDMI
|
||||
# refresh boost needed the pin: whatever is left of either is unticked,
|
||||
# so a normal run removes it.
|
||||
component_available kpin && WANTED[kpin]=0
|
||||
component_available hdmi && WANTED[hdmi]=0
|
||||
# The terminal-only Steamify shortcut from before 2.0.1: tick it, so a
|
||||
# normal run replaces it with the app.
|
||||
launcher_repair && WANTED[launcher]=1
|
||||
# Shows the current and newest BIOS version.
|
||||
bios_available && { bios_lookup_newest; LABEL[bios]="$(bios_label)"; }
|
||||
# Greyed out with an NVIDIA card: say why.
|
||||
component_available vram && ! vram_selectable && LABEL[vram]="VRAM booster: not supported by NVIDIA's driver yet"
|
||||
# First run: preselect the full SteamOS experience (never an action).
|
||||
if [[ "$any" == false ]]; then
|
||||
for c in "${COMPONENTS[@]}"; do
|
||||
component_available "$c" && ! is_action "$c" &&
|
||||
component_available "$c" && component_selectable "$c" && ! is_action "$c" &&
|
||||
[[ " ${NO_PRESELECT[*]} " != *" $c "* ]] && WANTED[$c]=1
|
||||
done
|
||||
machine_available && WANTED[cec]=1
|
||||
@@ -96,8 +167,10 @@ toggle_component() {
|
||||
if [[ "$c" == gaming && "${WANTED[gaming]}" == 0 ]]; then WANTED[single]=0; WANTED[boot]=0; fi
|
||||
# Where to boot to is part of the conversion, too.
|
||||
if [[ "$c" == boot && "${WANTED[boot]}" == 1 ]]; then WANTED[gaming]=1; fi
|
||||
# The kernel pin is opt-out: ticked along with Steam Machine support.
|
||||
if [[ "$c" == machine ]]; then WANTED[kpin]=${WANTED[machine]}; fi
|
||||
# The power-off fix is opt-out: ticked along with Steam Machine support.
|
||||
if [[ "$c" == machine ]]; then WANTED[poweroff]=${WANTED[machine]}; fi
|
||||
if [[ "$c" == poweroff && "${WANTED[poweroff]}" == 1 ]]; then WANTED[machine]=1; fi
|
||||
if [[ "$c" == machine && "${WANTED[machine]}" == 0 ]]; then WANTED[kpin]=0; fi
|
||||
if [[ "$c" == kpin && "${WANTED[kpin]}" == 1 ]]; then WANTED[machine]=1; fi
|
||||
# HDMI refresh boost and the BIOS update sit under Steam Machine support;
|
||||
# the boost also needs the pinned kernel (newer kernels don't need it).
|
||||
@@ -131,9 +204,9 @@ show_menu() {
|
||||
local tree=""; [[ -n "${PARENT[$c]:-}" ]] && tree=" └ "
|
||||
printf " %b%-3s %-6s %-6s %s%s (not available)%b\n" "$c_dim" "$i" "$now" "$want" "$tree" "${LABEL[$c]}" "$c_reset"
|
||||
elif [[ -n "${PARENT[$c]:-}" ]]; then
|
||||
printf " %-3s %b %-6s └ %s\n" "$i" "$now" "$want" "${LABEL[$c]}"
|
||||
printf " %-3s %b %-6s └ %b\n" "$i" "$now" "$want" "$(menu_label "$c")"
|
||||
else
|
||||
printf " %-3s %b %-6s %s\n" "$i" "$now" "$want" "${LABEL[$c]}"
|
||||
printf " %-3s %b %-6s %b\n" "$i" "$now" "$want" "$(menu_label "$c")"
|
||||
fi
|
||||
done
|
||||
echo
|
||||
@@ -266,7 +339,7 @@ plan_changes() {
|
||||
component_available "$c" || continue
|
||||
[[ "${WANTED[$c]}" == 1 ]] || continue
|
||||
if is_action "$c"; then TO_ENABLE+=("$c"); continue; fi
|
||||
if [[ "${CURRENT[$c]}" == 0 || "$REAPPLY" == true ]] ||
|
||||
if [[ "${CURRENT[$c]}" == 0 || "$REAPPLY" == true ]] || feature_outdated "$c" ||
|
||||
[[ "$c" == gaming && "${CURRENT[single]}" != "${WANTED[single]}" ]]; then
|
||||
TO_ENABLE+=("$c")
|
||||
fi
|
||||
@@ -281,13 +354,13 @@ apply_changes() {
|
||||
for c in "${TO_DISABLE[@]}"; do
|
||||
if [[ "$c" == boot ]]; then echo; echo -e "${c_bold}Boot into: gamescope${c_reset}"
|
||||
else echo; echo -e "${c_bold}Turning off: ${LABEL[$c]}${c_reset}"; fi
|
||||
"${c}_disable" || failed+=("$c")
|
||||
if "${c}_disable"; then feature_record "$c" disable; else failed+=("$c"); fi
|
||||
done
|
||||
for c in "${TO_ENABLE[@]}"; do
|
||||
if [[ "$c" == boot ]]; then echo; echo -e "${c_bold}Boot into: desktop${c_reset}"
|
||||
elif is_action "$c"; then echo; echo -e "${c_bold}Running: ${LABEL[$c]%%:*}${c_reset}"
|
||||
else echo; echo -e "${c_bold}Turning on: ${LABEL[$c]}${c_reset}"; fi
|
||||
"${c}_enable" || failed+=("$c")
|
||||
if "${c}_enable"; then is_action "$c" || feature_record "$c" enable; else failed+=("$c"); fi
|
||||
done
|
||||
FAILED=("${failed[@]}")
|
||||
}
|
||||
+18
-9
@@ -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 and steamos-manager. Its
|
||||
# sub-option "Power-off fix" is 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"
|
||||
@@ -148,7 +149,9 @@ remove_kernel_pin() {
|
||||
RESTART_FOR_LOGIN=true
|
||||
}
|
||||
|
||||
# "Pin the kernel" menu item, a sub-option of Steam Machine support.
|
||||
# "Pin the kernel" menu item, a sub-option of Steam Machine support. The
|
||||
# power-off fix made it unnecessary: only shown while on, to remove it.
|
||||
kpin_available() { detect_valve_fremont && kpin_status; }
|
||||
kpin_status() {
|
||||
pinned_kernel_installed && grep -Eq '^IgnorePkg\s*=.*\slinux-cachyos(\s|$)' /etc/pacman.conf
|
||||
}
|
||||
@@ -163,7 +166,12 @@ kpin_enable() {
|
||||
fi
|
||||
}
|
||||
|
||||
kpin_disable() { remove_kernel_pin; }
|
||||
kpin_disable() {
|
||||
# Saved HDMI refresh boost EDIDs are for the pinned kernel only (newer
|
||||
# ones read the whole EDID), also those of displays not connected now.
|
||||
[[ -n "$(hdmi_saved)" ]] && hdmi_forget all
|
||||
remove_kernel_pin
|
||||
}
|
||||
|
||||
install_kernel_headers() {
|
||||
# DKMS can only build leds-valve against kernels whose headers are
|
||||
@@ -329,13 +337,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")"
|
||||
@@ -347,7 +355,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
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/bin/bash
|
||||
# "VRAM booster" menu item (vram), ticked by default, like SteamOS 3.9's
|
||||
# dGPU VRAM management: the game in front keeps its VRAM, background apps
|
||||
# are evicted first, so a game that needs most of it doesn't spill into
|
||||
# system RAM and stutter. The kernel side is the dmem cgroup controller
|
||||
# (7.2; amdgpu and xe register their VRAM, NVIDIA's driver doesn't), so it's
|
||||
# only offered when the kernel lists a VRAM region of at least 2 GB. CachyOS packages the userspace
|
||||
# side: dmemcg-booster (a system service that enables the controller and
|
||||
# sets the limits, plus a user service) and plasma-foreground-booster, which
|
||||
# tells it which window is in front on the desktop. The latter only starts
|
||||
# with "autostart" set in kcgroupsrc.
|
||||
# Sourced by steamify.sh; not meant to be run on its own.
|
||||
|
||||
VRAM_PKGS=(dmemcg-booster plasma-foreground-booster)
|
||||
VRAM_MIN_BYTES=$((2 * 1024 * 1024 * 1024))
|
||||
|
||||
vram_supported() {
|
||||
# WIZARD_VRAM_FAKE_NVIDIA=1 (tests): as with an NVIDIA card.
|
||||
[[ -n "${WIZARD_VRAM_FAKE_NVIDIA:-}" ]] && return 1
|
||||
# Only for a GPU with its own VRAM: an integrated GPU registers a small
|
||||
# carve-out too, but mostly uses system RAM, so there's little to boost.
|
||||
awk -v min="$VRAM_MIN_BYTES" '$1 ~ /\/vram$/ && $2 >= min { found = 1 } END { exit !found }' \
|
||||
/sys/fs/cgroup/dmem.capacity 2>/dev/null
|
||||
}
|
||||
|
||||
vram_nvidia() {
|
||||
# An NVIDIA display controller (PCI vendor 10de, class 03xxxx).
|
||||
local d
|
||||
[[ -n "${WIZARD_VRAM_FAKE_NVIDIA:-}" ]] && return 0
|
||||
for d in /sys/bus/pci/devices/*; do
|
||||
[[ "$(cat "$d/vendor" 2>/dev/null)" == 0x10de && "$(cat "$d/class" 2>/dev/null)" == 0x03* ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
# Shown where it works, and greyed out with an NVIDIA card, whose driver
|
||||
# doesn't register its VRAM with the kernel (yet): so it's clear why it
|
||||
# can't be turned on. Hidden elsewhere (integrated graphics, older kernel).
|
||||
vram_available() { vram_supported || vram_status || vram_nvidia; }
|
||||
vram_selectable() { vram_supported || vram_status; }
|
||||
|
||||
vram_status() {
|
||||
pacman -Q "${VRAM_PKGS[@]}" >/dev/null 2>&1 &&
|
||||
systemctl is-enabled -q dmemcg-booster-system.service 2>/dev/null &&
|
||||
systemctl --user is-enabled -q dmemcg-booster-user.service 2>/dev/null
|
||||
}
|
||||
|
||||
vram_enable() {
|
||||
local p missing=()
|
||||
info "Installing the VRAM booster (the game in front keeps its VRAM)..."
|
||||
for p in "${VRAM_PKGS[@]}"; do pacman -Q "$p" >/dev/null 2>&1 || missing+=("$p"); done
|
||||
if ((${#missing[@]})); then
|
||||
sudo pacman -S --needed --noconfirm "${missing[@]}" ||
|
||||
{ err "Installing ${missing[*]} failed."; return 1; }
|
||||
state_set vram installed_pkgs "${missing[*]}"
|
||||
fi
|
||||
sudo systemctl enable --now dmemcg-booster-system.service >/dev/null 2>&1 ||
|
||||
{ err "Starting dmemcg-booster failed."; return 1; }
|
||||
systemctl --user enable --now dmemcg-booster-user.service >/dev/null 2>&1 ||
|
||||
{ err "Starting dmemcg-booster for $USER failed."; return 1; }
|
||||
kset vram kcgroupsrc "Foreground Booster" autostart true
|
||||
# Started by the Plasma session from now on; start it in this one too.
|
||||
[[ "${XDG_CURRENT_DESKTOP:-}" == KDE ]] &&
|
||||
systemctl --user start plasma-foreground-booster.service >/dev/null 2>&1
|
||||
ok "VRAM booster on: the game in front keeps its VRAM."
|
||||
}
|
||||
|
||||
vram_disable() {
|
||||
local pkgs
|
||||
systemctl --user disable --now plasma-foreground-booster.service dmemcg-booster-user.service >/dev/null 2>&1
|
||||
sudo systemctl disable --now dmemcg-booster-system.service >/dev/null 2>&1
|
||||
krevert vram
|
||||
pkgs="$(state_get vram installed_pkgs)"
|
||||
# shellcheck disable=SC2086 # a list of package names
|
||||
[[ -n "$pkgs" ]] && sudo pacman -Rns --noconfirm $pkgs >/dev/null 2>&1
|
||||
state_clear vram
|
||||
ok "VRAM booster off."
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
# Patches and extra sources
|
||||
|
||||
Files Steamify builds or applies, kept out of the shell code so they can be
|
||||
read and reviewed on their own. `lib/*.sh` reads them with `patch_file
|
||||
<name>`; the single-file build (`.github/tools/bundle.sh`) embeds them.
|
||||
|
||||
| File | Used by | What |
|
||||
|---|---|---|
|
||||
| `steamify-fremont-poweroff.c` | `lib/fremont-poweroff.sh` (Steam Machine support) | Kernel module (DKMS): clears GPIO 18's S4/S5 wake bit before power-off, so the Steam Machine stays off with recent kernels |
|
||||
| `cros-ec-cec-single-port.patch` | `lib/cec.sh` (HDMI-CEC) | Makes Valve's Steam Machine CEC driver find amdgpu's HDMI port |
|
||||
@@ -0,0 +1,21 @@
|
||||
Steam Machine CEC: find amdgpu's HDMI port with a single CEC port.
|
||||
|
||||
amdgpu registers its HDMI notifier without a port name, which only matches
|
||||
the driver's named lookup ("Port C") if the CEC driver loaded first; amdgpu
|
||||
loads from the initramfs, so it never does and /dev/cec0 stays at f.f.f.f.
|
||||
With a single CEC port, look the notifier up by device alone.
|
||||
|
||||
Applies to Valve's drivers/media/cec/platform/cros-ec/cros-ec-cec.c
|
||||
(evlaV/linux-integration 10c8c880, see CEC_DRIVER_URL in lib/cec.sh).
|
||||
|
||||
--- a/cros-ec-cec.c
|
||||
+++ b/cros-ec-cec.c
|
||||
@@ -485,7 +485,7 @@
|
||||
goto out_probe_adapter;
|
||||
}
|
||||
|
||||
- port->notify = cec_notifier_cec_adap_register(hdmi_dev, conns[port_num],
|
||||
+ port->notify = cec_notifier_cec_adap_register(hdmi_dev, conns[1] ? conns[port_num] : NULL,
|
||||
port->adap);
|
||||
if (!port->notify) {
|
||||
ret = -ENOMEM;
|
||||
@@ -0,0 +1,80 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Steam Machine (Fremont): power off instead of booting up again.
|
||||
*
|
||||
* Since "pinctrl-amd: Don't clear S4 wake bits at probe" (Linux 7.2, also
|
||||
* backported to 6.x, 7.0 and 7.1 updates) the S4/S5 wake bit the firmware
|
||||
* leaves set on GPIO pin 18 (_SB.PCI0.GPP6) stays set, and the machine starts again right after powering off.
|
||||
* Valve's kernel clears that bit at probe on Fremont (not for upstream);
|
||||
* this does the same right before power-off, for kernels without it.
|
||||
*/
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/bits.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reboot.h>
|
||||
|
||||
#define FREMONT_GPP6_PIN 18
|
||||
#define WAKE_CNTRL_OFF_S4 15
|
||||
|
||||
static void __iomem *pin_reg;
|
||||
static struct sys_off_handler *handler;
|
||||
|
||||
static int fremont_poweroff_prepare(struct sys_off_data *data)
|
||||
{
|
||||
u32 v = readl(pin_reg);
|
||||
|
||||
if (v & BIT(WAKE_CNTRL_OFF_S4))
|
||||
writel(v & ~BIT(WAKE_CNTRL_OFF_S4), pin_reg);
|
||||
return NOTIFY_DONE;
|
||||
}
|
||||
|
||||
static int __init fremont_poweroff_init(void)
|
||||
{
|
||||
struct acpi_device *adev;
|
||||
struct device *dev;
|
||||
struct resource *res;
|
||||
u32 v;
|
||||
|
||||
if (!dmi_match(DMI_BOARD_NAME, "Fremont"))
|
||||
return -ENODEV;
|
||||
adev = acpi_dev_get_first_match_dev("AMDI0030", NULL, -1);
|
||||
if (!adev)
|
||||
return -ENODEV;
|
||||
dev = bus_find_device_by_acpi_dev(&platform_bus_type, adev);
|
||||
acpi_dev_put(adev);
|
||||
if (!dev)
|
||||
return -ENODEV;
|
||||
res = platform_get_resource(to_platform_device(dev), IORESOURCE_MEM, 0);
|
||||
put_device(dev);
|
||||
if (!res || resource_size(res) < (FREMONT_GPP6_PIN + 1) * 4)
|
||||
return -ENODEV;
|
||||
/* pinctrl-amd owns the region; only this one register is touched. */
|
||||
pin_reg = ioremap(res->start + FREMONT_GPP6_PIN * 4, 4);
|
||||
if (!pin_reg)
|
||||
return -ENOMEM;
|
||||
v = readl(pin_reg);
|
||||
pr_info("GPIO %d register 0x%08x, S4/S5 wake %s\n", FREMONT_GPP6_PIN, v,
|
||||
v & BIT(WAKE_CNTRL_OFF_S4) ? "set (cleared at power-off)" : "clear");
|
||||
handler = register_sys_off_handler(SYS_OFF_MODE_POWER_OFF_PREPARE,
|
||||
SYS_OFF_PRIO_DEFAULT, fremont_poweroff_prepare, NULL);
|
||||
if (IS_ERR(handler)) {
|
||||
iounmap(pin_reg);
|
||||
return PTR_ERR(handler);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit fremont_poweroff_exit(void)
|
||||
{
|
||||
unregister_sys_off_handler(handler);
|
||||
iounmap(pin_reg);
|
||||
}
|
||||
|
||||
module_init(fremont_poweroff_init);
|
||||
module_exit(fremont_poweroff_exit);
|
||||
MODULE_DESCRIPTION("Steam Machine: clear GPIO 18's S4 wake bit before power-off");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("dmi:*:rnFremont:*");
|
||||
+6
-3
@@ -15,11 +15,11 @@
|
||||
set -uo pipefail
|
||||
|
||||
# Release version, see CHANGELOG.md.
|
||||
VERSION=2.0.2
|
||||
VERSION=2.3.0
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
for lib in common state packages login-manager single-user steam-desktop steam-machine hdmi-refresh cec boot-session vapor-theme steamos-extras bios desktop-shortcut wizard-shortcut menu backend; do
|
||||
for lib in common state packages login-manager single-user steam-desktop steam-machine fremont-poweroff vram-booster hdmi-refresh cec boot-session vapor-theme steamos-extras bios desktop-shortcut wizard-shortcut menu backend; do
|
||||
# shellcheck source=/dev/null
|
||||
source "$SCRIPT_DIR/lib/$lib.sh"
|
||||
done
|
||||
@@ -139,7 +139,10 @@ while true; do
|
||||
for c in "${TO_ENABLE[@]}"; do
|
||||
if [[ "$c" == boot ]]; then echo " - boot into: desktop (from the next boot)"
|
||||
elif is_action "$c"; then echo " - run: ${LABEL[$c]%%:*} at your own risk (checks, then asks twice more)"
|
||||
elif [[ "${CURRENT[$c]}" == 1 ]]; then echo " - re-apply: ${LABEL[$c]}"; else echo " - turn on: ${LABEL[$c]}"; fi
|
||||
elif feature_outdated "$c"; then echo " - update: ${LABEL[$c]} (changed in this version)"
|
||||
elif [[ "${CURRENT[$c]}" == 1 ]]; then echo " - re-apply: ${LABEL[$c]}"
|
||||
elif feature_new "$c"; then echo " - turn on: ${LABEL[$c]} (new in this version)"
|
||||
else echo " - turn on: ${LABEL[$c]}"; fi
|
||||
done
|
||||
ask_yn "Go ahead?" y || { info "Nothing changed."; continue; }
|
||||
|
||||
|
||||
+152
-21
@@ -45,6 +45,11 @@ ApplicationWindow {
|
||||
}
|
||||
|
||||
// --- Texts per item (the backend's labels are the fallback) ---
|
||||
// Replaces the explanation of an option that can't be turned on here.
|
||||
readonly property var unsupported: ({
|
||||
vram: { body: "Not available with your NVIDIA graphics card: NVIDIA's driver doesn't tell Linux how its video memory is used yet, so there's nothing to steer. It works with AMD and Intel graphics cards, and shows up here as soon as NVIDIA's driver supports it.",
|
||||
changes: ["Nothing: can't be turned on with NVIDIA's driver"] }
|
||||
})
|
||||
readonly property var texts: ({
|
||||
gaming: { label: "SteamOS conversion", hint: "Boot into gaming mode, Steam on the desktop",
|
||||
body: "Boots straight into gaming mode. Switch to Desktop in Steam works, and Return to Gaming Mode on the desktop brings you back.",
|
||||
@@ -69,12 +74,18 @@ ApplicationWindow {
|
||||
machine: { label: "Steam Machine support", hint: "LED bar, fan and performance settings in Steam",
|
||||
body: "The front LED bar works, Steam's hardware settings work, and the power button puts it to sleep like a console.",
|
||||
changes: ["leds-valve driver for every kernel (DKMS)", "steamos-manager for Steam's settings", "Console-like power handling"] },
|
||||
kpin: { label: "Pin the kernel", hint: "Fixes rebooting after shutdown",
|
||||
body: "Newer CachyOS kernels make the Steam Machine reboot instead of shutting down. Untick once CachyOS fixes that.",
|
||||
poweroff: { label: "Power-off fix", hint: "Stays off after shutting down",
|
||||
body: "With recent kernels the Steam Machine starts again right after shutting down: the firmware leaves a wake bit set, and newer kernels (7.2, and updates of 6.x, 7.0 and 7.1) no longer clear it. Valve's own kernel clears it; this small module does the same right before power-off.",
|
||||
changes: ["steamify-fremont-poweroff module for each installed kernel (DKMS)", "Only on a Steam Machine, only touches that one wake bit", "Off: recent kernels may start it again after shutting down"] },
|
||||
vram: { label: "VRAM booster", hint: "The game in front keeps its VRAM",
|
||||
body: "Like SteamOS 3.9: the game you're playing keeps its video memory, and background apps are moved out first. Without it a game that needs most of the video memory can spill into system RAM and stutter. Shown for GPUs whose driver supports it (AMD, Intel) on kernel 7.2 or newer.",
|
||||
changes: ["dmemcg-booster (system and user service)", "plasma-foreground-booster, which tells it which window is in front", "Off: removed again, unless you had installed them yourself"] },
|
||||
kpin: { label: "Pin the kernel", hint: "Untick for CachyOS's current kernel",
|
||||
body: "Keeps the Steam Machine on CachyOS kernel 7.1.6. Untick it to go back to CachyOS's current kernel; HDMI refresh boost goes with it.",
|
||||
changes: ["linux-cachyos from Steamify's release (signature checked)", "Kept in /var/cache/steamify/kernel", "Added to IgnorePkg"] },
|
||||
hdmi: { label: "HDMI refresh boost", hint: "Higher refresh rates over HDMI",
|
||||
body: "The pinned kernel keeps many HDMI displays at 60 Hz. Turning this on shows which refresh rates your display can run at the desktop resolution; you pick them, and each one is tried for 15 seconds so you can check the picture before it's installed.",
|
||||
changes: ["The display's EDID with the rates you confirmed", "In the initramfs, drm.edid_firmware on the kernel command line", "Off: the display uses its own EDID again"] },
|
||||
changes: ["The display's EDID with the rates you confirmed, saved for that display only", "Loaded whenever that display is connected; other displays keep their own settings", "Manage: every saved display, remove one or set up the connected display"] },
|
||||
bios: { label: "Update BIOS", hint: "",
|
||||
body: "Installs Valve's newest Steam Machine BIOS, at your own risk. It checks Valve's checksum and asks fwupd whether the file fits this machine, then warns you twice before anything is written.",
|
||||
changes: ["Valve's fremont-hw-support package (checksum checked)", "fwupd writes the BIOS during the next restart", "Keep the power on until the machine has fully started again"] }
|
||||
@@ -193,6 +204,32 @@ ApplicationWindow {
|
||||
|
||||
readonly property var status: backend.status || ({})
|
||||
readonly property var items: status.items || []
|
||||
// HDMI refresh boost, saved displays: [{id, name, mode, rates, active}].
|
||||
readonly property var hdmiSaved: status.hdmiDisplays || []
|
||||
property int hdmiListSel: 0
|
||||
property string hdmiConfirm: "" // the display being removed
|
||||
function hdmiRowHint() {
|
||||
var on = hdmiSaved.filter(function (d) { return d.active; });
|
||||
var others = hdmiSaved.length - on.length;
|
||||
if (on.length) return "On for " + on[0].name + (others ? " · " + others + " more saved" : "");
|
||||
if (others) return "Not set up for this display · " + others + " saved";
|
||||
return "";
|
||||
}
|
||||
// Manage offers setting up the connected display when it has no saved rates.
|
||||
readonly property bool hdmiCanAdd: !hdmiSaved.some(function (d) { return d.active; })
|
||||
function openHdmiList() {
|
||||
if (!hdmiSaved.length) return;
|
||||
hdmiListSel = 0; hdmiConfirm = ""; hdmiNote = ""; screen = "hdmilist";
|
||||
}
|
||||
function hdmiForget() {
|
||||
var d = hdmiSaved[hdmiListSel];
|
||||
if (!d) return;
|
||||
hdmiConfirm = d.id;
|
||||
if (!sessionPassword && askPassword("forget")) return;
|
||||
hdmiForgetNow();
|
||||
}
|
||||
function hdmiForgetNow() { screen = "hdmilist"; whenIdle(function () { backend.hdmiForget(sessionPassword, hdmiConfirm); }); }
|
||||
function hdmiListBack() { hdmiConfirm = ""; sessionPassword = ""; syncFromStatus(); screen = "menu"; }
|
||||
readonly property var rows: items.filter(function (i) { return !i.parent || want[i.parent]; })
|
||||
|
||||
function nowOn(id) {
|
||||
@@ -212,15 +249,20 @@ ApplicationWindow {
|
||||
|
||||
function toggle(id) {
|
||||
hdmiNote = "";
|
||||
var cur = items.find(function (i) { return i.id === id; });
|
||||
if (cur && cur.kind === "toggle" && cur.selectable === false) return;
|
||||
var w = Object.assign({}, want);
|
||||
w[id] = !w[id];
|
||||
if (id === "gaming" && !w.gaming) { w.single = false; }
|
||||
if (id === "single" && w.single) w.gaming = true;
|
||||
// Turning HDMI refresh boost on goes through its own screen: pick
|
||||
// the rates and try each one first.
|
||||
if (id === "hdmi" && !hdmiChoice && hdmiSaved.length) { openHdmiList(); return; }
|
||||
if (id === "hdmi" && w.hdmi && !nowOn("hdmi") && !hdmiChoice) { startHdmi(); return; }
|
||||
if (id === "hdmi" && !w.hdmi) hdmiChoice = "";
|
||||
if (id === "machine") w.kpin = w.machine;
|
||||
if (id === "machine") w.poweroff = w.machine;
|
||||
if (id === "poweroff" && w.poweroff) w.machine = true;
|
||||
if (id === "machine" && !w.machine) w.kpin = false;
|
||||
if (id === "kpin" && w.kpin) w.machine = true;
|
||||
if (id === "hdmi" && w.hdmi) { w.machine = true; w.kpin = true; }
|
||||
if (!w.machine || !w.kpin) w.hdmi = false;
|
||||
@@ -232,9 +274,9 @@ ApplicationWindow {
|
||||
var it = items[i];
|
||||
if (it.kind !== "toggle") continue;
|
||||
if (it.parent && !want[it.parent]) { if (it.on) p.push({ id: it.id, action: "off" }); continue; }
|
||||
if (want[it.id] && !it.on) p.push({ id: it.id, action: "on" });
|
||||
if (want[it.id] && !it.on) p.push({ id: it.id, action: "on", isNew: !!it["new"] });
|
||||
else if (!want[it.id] && it.on) p.push({ id: it.id, action: "off" });
|
||||
else if (want[it.id] && reapply) p.push({ id: it.id, action: "again" });
|
||||
else if (want[it.id] && (reapply || it.update)) p.push({ id: it.id, action: reapply ? "again" : "update" });
|
||||
}
|
||||
var bootNow = nowOn("boot") ? "desktop" : "gamescope";
|
||||
if (want.gaming && boot !== bootNow) p.push({ id: "boot", action: boot === "desktop" ? "desktop" : "gaming" });
|
||||
@@ -274,6 +316,7 @@ ApplicationWindow {
|
||||
var p = pw.text; pw.text = "";
|
||||
if (pending === "bios") { sessionPassword = p; biosCheck(); }
|
||||
else if (pending === "hdmi") { sessionPassword = p; hdmiLoad(); }
|
||||
else if (pending === "forget") { sessionPassword = p; hdmiForgetNow(); }
|
||||
else startApply(p);
|
||||
}
|
||||
// --- BIOS: check -> warning 1 -> warning 2 -> flash ---
|
||||
@@ -330,7 +373,12 @@ ApplicationWindow {
|
||||
else { hdmiPhase = "failed"; hdmiReject(); }
|
||||
}
|
||||
else if (ev.event === "hdmi-reset") { }
|
||||
else if (ev.event === "finished" && (screen === "hdmi" || screen === "hdmitest")) {
|
||||
else if (ev.event === "hdmi-forgotten") {
|
||||
hdmiConfirm = "";
|
||||
if (!ev.ok) hdmiNote = "Removing the saved display failed.";
|
||||
backend.refresh();
|
||||
}
|
||||
else if (ev.event === "finished" && (screen === "hdmi" || screen === "hdmitest" || screen === "hdmilist")) {
|
||||
// Only on an error (sudo): the HDMI commands end without one.
|
||||
runError = ev.error === "wrong-password" ? "The password didn't work." : "sudo isn't available.";
|
||||
failed = []; restartNeeded = false; sessionPassword = ""; screen = "done";
|
||||
@@ -376,7 +424,7 @@ ApplicationWindow {
|
||||
else if (a === "back") { reapply = false; screen = "menu"; }
|
||||
} else if (screen === "password") {
|
||||
if (a === "accept" || a === "apply") submitPassword();
|
||||
else if (a === "back") { pw.text = ""; if (pending === "hdmi") hdmiCancel(); else screen = "review"; }
|
||||
else if (a === "back") { pw.text = ""; if (pending === "hdmi") hdmiCancel(); else if (pending === "forget") { hdmiConfirm = ""; screen = "hdmilist"; } else screen = "review"; }
|
||||
} else if (screen === "bios1") {
|
||||
if (a === "left") biosFocus = 0;
|
||||
else if (a === "right") biosFocus = 1;
|
||||
@@ -397,6 +445,12 @@ ApplicationWindow {
|
||||
// A second Back meant for the test (it takes a moment to switch
|
||||
// back) would otherwise leave the whole screen.
|
||||
else if (a === "back" && Date.now() - hdmiBackAt > 1500) hdmiCancel();
|
||||
} else if (screen === "hdmilist") {
|
||||
if (backend.busy) return;
|
||||
if (a === "up") { hdmiListSel = Math.max(0, hdmiListSel - 1); hdmiConfirm = ""; }
|
||||
else if (a === "down") { hdmiListSel = Math.min(hdmiSaved.length - (hdmiCanAdd ? 0 : 1), hdmiListSel + 1); hdmiConfirm = ""; }
|
||||
else if (a === "accept") { if (hdmiListSel === hdmiSaved.length) { hdmiConfirm = ""; startHdmi(); } else hdmiForget(); }
|
||||
else if (a === "back") hdmiListBack();
|
||||
} else if (screen === "hdmitest") {
|
||||
if (a === "accept" || a === "apply") hdmiKeep();
|
||||
else if (a === "back") hdmiReject();
|
||||
@@ -507,7 +561,7 @@ ApplicationWindow {
|
||||
anchors.left: parent.left; anchors.leftMargin: 40; anchors.verticalCenter: parent.verticalCenter; spacing: 14
|
||||
Image { source: iconUrl; width: 40; height: 40; sourceSize: Qt.size(80, 80); anchors.verticalCenter: parent.verticalCenter }
|
||||
Text { text: "Steamify"; color: t.text; font.family: t.display; font.pixelSize: 28; font.weight: Font.Bold; anchors.verticalCenter: parent.verticalCenter }
|
||||
Text { text: screen === "menu" ? "v" + (status.version || "") : "/ " + ({review: "Review", password: "Password", applying: biosRun ? "BIOS update" : "Applying", done: "Done", bios1: "BIOS update", bios2: "BIOS update", hdmi: "HDMI refresh boost", hdmitest: "HDMI refresh boost"})[screen]
|
||||
Text { text: screen === "menu" ? "v" + (status.version || "") : "/ " + ({review: "Review", password: "Password", applying: biosRun ? "BIOS update" : "Applying", done: "Done", bios1: "BIOS update", bios2: "BIOS update", hdmi: "HDMI refresh boost", hdmitest: "HDMI refresh boost", hdmilist: "HDMI refresh boost"})[screen]
|
||||
color: t.faint; font.family: screen === "menu" ? t.mono : t.body; font.pixelSize: screen === "menu" ? 13 : 15; anchors.verticalCenter: parent.verticalCenter }
|
||||
}
|
||||
Rectangle {
|
||||
@@ -560,7 +614,7 @@ ApplicationWindow {
|
||||
readonly property bool selected: shown && rowIndex === sel
|
||||
readonly property bool on: modelData.kind === "choice" ? true : !!want[modelData.id]
|
||||
// HDMI refresh boost is set up on its own screen: a button while off.
|
||||
readonly property bool setup: modelData.id === "hdmi" && !modelData.on
|
||||
readonly property bool setup: modelData.id === "hdmi"
|
||||
onSelectedChanged: if (selected) Qt.callLater(list.showSelected)
|
||||
width: list.width - 12; x: 2
|
||||
height: shown ? 62 : 0
|
||||
@@ -582,13 +636,19 @@ ApplicationWindow {
|
||||
anchors.verticalCenter: parent.verticalCenter; spacing: 2
|
||||
x: row.modelData.parent ? 46 : 16
|
||||
width: controls.x - x - 16
|
||||
opacity: row.modelData.kind === "action" && !(bios && bios.selectable) ? 0.6 : 1
|
||||
Text { text: label(row.modelData); color: t.textHi; font.family: t.body; font.pixelSize: 17; font.weight: Font.DemiBold; elide: Text.ElideRight; width: parent.width }
|
||||
Text { text: row.modelData.id === "bios" ? biosHint() : ((texts[row.modelData.id] && texts[row.modelData.id].hint) || row.modelData.hint); color: t.mute; font.family: t.body; font.pixelSize: 13; elide: Text.ElideRight; width: parent.width }
|
||||
opacity: (row.modelData.kind === "action" && !(bios && bios.selectable)) || (row.modelData.kind === "toggle" && row.modelData.selectable === false) ? 0.6 : 1
|
||||
// The name, with an Update badge when a newer version of it will be
|
||||
// applied, New for a default sub-option added since the last run.
|
||||
Row { width: parent.width; spacing: 10
|
||||
Text { text: label(row.modelData); color: t.textHi; font.family: t.body; font.pixelSize: 17; font.weight: Font.DemiBold; elide: Text.ElideRight
|
||||
width: Math.min(implicitWidth, parent.width - (upd.visible ? upd.width + parent.spacing : 0)) }
|
||||
Chip { id: upd; visible: !!row.modelData.update || !!row.modelData["new"]; text: row.modelData.update ? "Update" : "New"; fg: row.modelData.update ? t.warn : t.good; bgc: row.modelData.update ? t.warnBg : t.goodBg; height: 20; anchors.verticalCenter: parent.verticalCenter } }
|
||||
Text { text: row.modelData.id === "bios" ? biosHint() : row.modelData.selectable === false ? row.modelData.hint : ((row.modelData.id === "hdmi" && hdmiRowHint()) || (texts[row.modelData.id] && texts[row.modelData.id].hint) || row.modelData.hint); color: t.mute; font.family: t.body; font.pixelSize: 13; elide: Text.ElideRight; width: parent.width }
|
||||
}
|
||||
// Right: every control ends on the same edge
|
||||
Item {
|
||||
id: controls
|
||||
opacity: row.modelData.kind === "toggle" && row.modelData.selectable === false ? 0.4 : 1
|
||||
anchors.right: parent.right; anchors.rightMargin: 16; anchors.verticalCenter: parent.verticalCenter
|
||||
width: 180; height: 32
|
||||
// choice
|
||||
@@ -612,8 +672,8 @@ ApplicationWindow {
|
||||
width: sut.implicitWidth + 24; height: 30; radius: 8; color: hdmiChoice && want.hdmi ? t.goodBg : "#1b2b40"
|
||||
Text { id: sut; anchors.centerIn: parent; font.family: t.body; font.pixelSize: 13; font.weight: Font.DemiBold
|
||||
color: hdmiChoice && want.hdmi ? t.good : "#7cc4ff"
|
||||
text: hdmiChoice && want.hdmi ? (hdmiChoice.split(":")[1] ? hdmiChoice.split(":")[1].split(",").join(", ") + " Hz ✓" : "Own modes ✓") : "Set up…" }
|
||||
MouseArea { anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: { sel = row.rowIndex; startHdmi(); } } }
|
||||
text: hdmiChoice && want.hdmi ? (hdmiChoice.split(":")[1] ? hdmiChoice.split(":")[1].split(",").join(", ") + " Hz ✓" : "Own modes ✓") : (hdmiSaved.length ? "Manage" : "Set up…") }
|
||||
MouseArea { anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: { sel = row.rowIndex; toggle("hdmi"); } } }
|
||||
// action
|
||||
Rectangle { visible: row.modelData.kind === "action"; anchors.right: parent.right; anchors.verticalCenter: parent.verticalCenter
|
||||
width: at.implicitWidth + 24; height: 30; radius: 8; color: t.warnBg
|
||||
@@ -630,7 +690,7 @@ ApplicationWindow {
|
||||
id: detail
|
||||
width: parent.width; height: parent.height - sys.height - 16; radius: 16; color: t.card
|
||||
readonly property var it: sel < rows.length ? rows[sel] : null
|
||||
readonly property var tx: it ? (texts[it.id] || {}) : {}
|
||||
readonly property var tx: it ? (it.selectable === false && unsupported[it.id] ? Object.assign({}, texts[it.id], unsupported[it.id]) : (texts[it.id] || {})) : {}
|
||||
// Long texts scroll instead of running out of the card;
|
||||
// each item starts at the top.
|
||||
onItChanged: detailFlick.contentY = 0
|
||||
@@ -709,12 +769,13 @@ ApplicationWindow {
|
||||
model: plan
|
||||
ScrollBar.vertical: ScrollBar { policy: ScrollBar.AsNeeded }
|
||||
delegate: Rectangle { required property var modelData; width: 740; height: 56; radius: 12; color: t.card
|
||||
readonly property var st: ({ on: ["Turn on", t.good, t.goodBg], off: ["Turn off", t.bad, t.badBg], again: ["Re-apply", "#7cc4ff", "#1b2b40"],
|
||||
readonly property var st: ({ on: ["Turn on", t.good, t.goodBg], off: ["Turn off", t.bad, t.badBg], again: ["Re-apply", "#7cc4ff", "#1b2b40"], update: ["Update", t.warn, t.warnBg],
|
||||
desktop: ["Desktop", "#7cc4ff", "#1b2b40"], gaming: ["Gaming", "#7cc4ff", "#1b2b40"],
|
||||
check: ["Check", t.warn, t.warnBg], flash: ["Flash", t.bad, t.badBg] })[modelData.action] || ["", t.text, t.card]
|
||||
Row { anchors.fill: parent; anchors.leftMargin: 18; spacing: 14
|
||||
Chip { text: parent.parent.st[0]; fg: parent.parent.st[1]; bgc: parent.parent.st[2]; width: 84; anchors.verticalCenter: parent.verticalCenter }
|
||||
Text { text: (texts[parent.parent.modelData.id] || {}).label || parent.parent.modelData.id; color: t.textHi; font.family: t.body; font.pixelSize: 17; font.weight: Font.DemiBold; anchors.verticalCenter: parent.verticalCenter }
|
||||
Chip { visible: !!parent.parent.modelData.isNew; text: "New"; fg: t.good; bgc: t.goodBg; height: 20; anchors.verticalCenter: parent.verticalCenter }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -722,10 +783,10 @@ ApplicationWindow {
|
||||
Text { anchors.verticalCenter: parent.verticalCenter; x: 18; text: "Your password is asked once. Changes to how the PC starts need a restart."; color: t.soft; font.family: t.body; font.pixelSize: 14 } }
|
||||
}
|
||||
Rectangle {
|
||||
x: parent.width - 468; y: 32; width: 428; height: 210; radius: 16; color: t.card
|
||||
x: parent.width - 468; y: 32; width: 428; height: 250; radius: 16; color: t.card
|
||||
Column { anchors.fill: parent; anchors.margins: 24; spacing: 12
|
||||
Text { text: "SUMMARY"; color: t.faint; font.family: t.body; font.pixelSize: 12; font.weight: Font.DemiBold; font.letterSpacing: 0.8 }
|
||||
Repeater { model: [["Turn on", "on"], ["Re-apply", "again"], ["Turn off", "off"]]
|
||||
Repeater { model: [["Turn on", "on"], ["Update", "update"], ["Re-apply", "again"], ["Turn off", "off"]]
|
||||
Row { required property var modelData; width: 380
|
||||
Text { text: parent.modelData[0]; color: t.soft; font.family: t.body; font.pixelSize: 15; width: 300 }
|
||||
Text { text: plan.filter(function (p) { return p.action === parent.modelData[1]; }).length; color: t.text; font.family: t.mono; font.pixelSize: 15; width: 80; horizontalAlignment: Text.AlignRight } } }
|
||||
@@ -810,8 +871,15 @@ ApplicationWindow {
|
||||
border.width: parent.parent.st === "wait" || parent.parent.st === "run" ? 2 : 0; border.color: parent.parent.st === "run" ? t.accent : "#343f50"
|
||||
Text { anchors.centerIn: parent; text: parent.parent.parent.st === "ok" ? "✓" : (parent.parent.parent.st === "fail" ? "!" : ""); color: parent.parent.parent.st === "ok" ? t.good : t.bad; font.pixelSize: 13; font.weight: Font.Bold }
|
||||
RotationAnimator on rotation { running: parent.parent.parent.st === "run"; from: 0; to: 360; duration: 1000; loops: Animation.Infinite } }
|
||||
Text { text: ({ on: "Turn on ", off: "Turn off ", again: "Re-apply ", desktop: "Boot into ", gaming: "Boot into ", check: "Download and check the ", flash: "Hand to fwupd: the " })[parent.parent.modelData.action] + ((texts[parent.parent.modelData.id] || {}).label || parent.parent.modelData.id)
|
||||
color: parent.parent.st === "wait" ? t.faint : t.textHi; font.family: t.body; font.pixelSize: 16; font.weight: Font.DemiBold; anchors.verticalCenter: parent.verticalCenter; width: 380; elide: Text.ElideRight }
|
||||
// The step; an update or new sub-option shows its badge, like the menu.
|
||||
Item { width: 380; height: parent.height
|
||||
readonly property var step: parent.parent.modelData
|
||||
readonly property bool update: step.action === "update"
|
||||
Row { anchors.verticalCenter: parent.verticalCenter; width: parent.width; spacing: 10
|
||||
Text { text: (({ on: "Turn on ", off: "Turn off ", again: "Re-apply ", desktop: "Boot into ", gaming: "Boot into ", check: "Download and check the ", flash: "Hand to fwupd: the " })[parent.parent.step.action] || "") + ((texts[parent.parent.step.id] || {}).label || parent.parent.step.id)
|
||||
color: parent.parent.parent.parent.st === "wait" ? t.faint : t.textHi; font.family: t.body; font.pixelSize: 16; font.weight: Font.DemiBold; anchors.verticalCenter: parent.verticalCenter; elide: Text.ElideRight
|
||||
width: Math.min(implicitWidth, parent.width - (stepUpd.visible ? stepUpd.width + parent.spacing : 0)) }
|
||||
Chip { id: stepUpd; visible: parent.parent.update || !!parent.parent.step.isNew; text: parent.parent.update ? "Update" : "New"; fg: parent.parent.update ? t.warn : t.good; bgc: parent.parent.update ? t.warnBg : t.goodBg; height: 20; anchors.verticalCenter: parent.verticalCenter } } }
|
||||
Text { text: ({ wait: "Waiting", run: "Working…", ok: "Done", fail: "Problem" })[parent.parent.st]; color: parent.parent.st === "ok" ? t.good : (parent.parent.st === "fail" ? t.bad : "#b8c3d1"); font.family: t.body; font.pixelSize: 13; anchors.verticalCenter: parent.verticalCenter }
|
||||
}
|
||||
}
|
||||
@@ -964,6 +1032,69 @@ ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
// ================= HDMI: saved displays =================
|
||||
Item {
|
||||
visible: screen === "hdmilist"
|
||||
anchors.top: header.bottom; anchors.bottom: parent.bottom; width: parent.width
|
||||
Text { visible: hdmiSaved.length === 0; anchors.centerIn: parent; text: "No saved displays."; color: t.mute; font.family: t.body; font.pixelSize: 18 }
|
||||
Column {
|
||||
visible: hdmiSaved.length > 0
|
||||
x: 40; y: 28; width: 740; spacing: 12
|
||||
Text { text: "Manage displays"; color: t.text; font.family: t.display; font.pixelSize: 30; font.weight: Font.DemiBold }
|
||||
Text { text: "Each display gets its own rates; they're loaded whenever it's connected."; color: t.mute; font.family: t.body; font.pixelSize: 14 }
|
||||
Repeater {
|
||||
model: hdmiSaved
|
||||
Rectangle {
|
||||
required property var modelData; required property int index
|
||||
readonly property bool confirm: hdmiConfirm === modelData.id
|
||||
width: 740; height: 64; radius: 12
|
||||
color: hdmiListSel === index ? t.cardSel : t.card; border.width: hdmiListSel === index ? 2 : 0; border.color: confirm ? t.bad : t.accent
|
||||
MouseArea { anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: { inputType = "keyboard"; hdmiListSel = parent.index; } }
|
||||
Column { anchors.left: parent.left; anchors.leftMargin: 18; anchors.verticalCenter: parent.verticalCenter; spacing: 2
|
||||
Text { text: parent.parent.modelData.name; color: t.textHi; font.family: t.body; font.pixelSize: 18; font.weight: Font.DemiBold }
|
||||
Text { text: parent.parent.modelData.mode.replace("x", "×") + (parent.parent.modelData.rates ? " · " + parent.parent.modelData.rates.split(" ").join(", ") + " Hz" : " · its own modes")
|
||||
color: t.mute; font.family: t.mono; font.pixelSize: 13 } }
|
||||
Row { anchors.right: parent.right; anchors.rightMargin: 14; anchors.verticalCenter: parent.verticalCenter; spacing: 12
|
||||
Chip { anchors.verticalCenter: parent.verticalCenter; text: parent.parent.modelData.active ? "Connected" : "Not connected"
|
||||
fg: parent.parent.modelData.active ? t.good : "#b8c3d1"; bgc: parent.parent.modelData.active ? t.goodBg : t.line }
|
||||
Btn { height: 38; anchors.verticalCenter: parent.verticalCenter; focusRing: hdmiListSel === parent.parent.index
|
||||
k: hdmiListSel === parent.parent.index ? g.ok : ""; color: parent.parent.confirm ? "#8a2c2c" : "#232c38"
|
||||
text: parent.parent.confirm && backend.busy ? "Removing…" : "Remove"
|
||||
onClicked: { hdmiListSel = parent.parent.index; hdmiForget(); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
visible: hdmiSaved.length > 0 && hdmiCanAdd
|
||||
x: 40; y: 28 + 84 + hdmiSaved.length * 76; width: 740; height: 64; radius: 12
|
||||
color: hdmiListSel === hdmiSaved.length ? t.cardSel : t.card; border.width: hdmiListSel === hdmiSaved.length ? 2 : 0; border.color: t.accent
|
||||
MouseArea { anchors.fill: parent; cursorShape: Qt.PointingHandCursor; onClicked: { inputType = "keyboard"; hdmiListSel = hdmiSaved.length; } }
|
||||
Column { anchors.left: parent.left; anchors.leftMargin: 18; anchors.verticalCenter: parent.verticalCenter; spacing: 2
|
||||
Text { text: "The connected display"; color: t.textHi; font.family: t.body; font.pixelSize: 18; font.weight: Font.DemiBold }
|
||||
Text { text: "No saved rates yet"; color: t.mute; font.family: t.body; font.pixelSize: 13 } }
|
||||
Btn { anchors.right: parent.right; anchors.rightMargin: 14; anchors.verticalCenter: parent.verticalCenter; height: 38
|
||||
focusRing: hdmiListSel === hdmiSaved.length; k: hdmiListSel === hdmiSaved.length ? g.ok : ""; text: "Set up…"
|
||||
onClicked: { hdmiConfirm = ""; startHdmi(); } }
|
||||
}
|
||||
Rectangle {
|
||||
visible: hdmiSaved.length > 0
|
||||
x: parent.width - 468; y: 28; width: 428; height: 200; radius: 16; color: t.card
|
||||
Column { anchors.fill: parent; anchors.margins: 24; spacing: 12
|
||||
Text { text: "REMOVING"; color: t.faint; font.family: t.body; font.pixelSize: 12; font.weight: Font.DemiBold; font.letterSpacing: 0.8 }
|
||||
Text { width: parent.width; wrapMode: Text.WordWrap; color: t.soft; font.family: t.body; font.pixelSize: 15; lineHeight: 1.35
|
||||
text: "A removed display uses its own EDID again (right away when it's connected). To get its rates back, set it up again from the menu." }
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.bottom: parent.bottom; width: parent.width; height: 64; color: t.bar
|
||||
Rectangle { width: parent.width; height: 1; color: t.line }
|
||||
Btn { anchors.left: parent.left; anchors.leftMargin: 40; anchors.verticalCenter: parent.verticalCenter; k: g.back; text: "Back to the menu"; onClicked: hdmiListBack() }
|
||||
Text { anchors.right: parent.right; anchors.rightMargin: 40; anchors.verticalCenter: parent.verticalCenter; visible: !!hdmiNote
|
||||
text: hdmiNote; color: t.bad; font.family: t.body; font.pixelSize: 14 }
|
||||
}
|
||||
}
|
||||
|
||||
// ================= HDMI: keep this rate? =================
|
||||
Item {
|
||||
visible: screen === "hdmitest"
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# Steamify CachyOS - get and start the app (v2), for `curl | bash`:
|
||||
# curl -fsSL https://github.com/theupriser/steamify-cachyos/releases/latest/download/steamify-app.sh | bash
|
||||
# Downloads the newest release's app package (steamify-app.tar.gz: the app,
|
||||
# steamify.sh and lib/) to ~/.local/share/steamify/app, installs PySide6 if
|
||||
# steamify.sh, lib/ and patches/) to ~/.local/share/steamify/app, installs PySide6 if
|
||||
# it's missing, adds a launcher entry, and starts the app.
|
||||
# STEAMIFY_RELEASE=<tag> takes that release instead of the newest (the
|
||||
# v2-ui-preview build's copy of this script sets it). STEAMIFY_BRANCH=<branch>
|
||||
|
||||
+39
-8
@@ -197,19 +197,19 @@ class Backend(QObject):
|
||||
p.start()
|
||||
|
||||
def _make_askpass(self, password):
|
||||
"""A private folder with the password, a helper that prints it for
|
||||
`sudo -A`, and a `sudo` that always uses the helper (makepkg and
|
||||
yay call plain sudo)."""
|
||||
"""A private folder with a helper that `sudo -A` runs for the
|
||||
password, and a `sudo` that always uses it (makepkg and yay call
|
||||
plain sudo). The password is never written to a file: the helper
|
||||
reads it from a named pipe, and the app writes it into the pipe from
|
||||
memory each time sudo asks, until _drop_askpass."""
|
||||
base = os.environ.get("XDG_RUNTIME_DIR") or tempfile.gettempdir()
|
||||
d = tempfile.mkdtemp(prefix="steamify-", dir=base)
|
||||
os.chmod(d, stat.S_IRWXU)
|
||||
secret = os.path.join(d, "secret")
|
||||
fd = os.open(secret, os.O_WRONLY | os.O_CREAT | os.O_EXCL, 0o600)
|
||||
with os.fdopen(fd, "w") as f:
|
||||
f.write(password + "\n")
|
||||
pipe = os.path.join(d, "pipe")
|
||||
os.mkfifo(pipe, 0o600)
|
||||
askpass = os.path.join(d, "askpass")
|
||||
with open(askpass, "w") as f:
|
||||
f.write("#!/bin/sh\nexec cat %s\n" % json.dumps(secret))
|
||||
f.write("#!/bin/sh\nexec cat %s\n" % json.dumps(pipe))
|
||||
os.chmod(askpass, 0o700)
|
||||
bindir = os.path.join(d, "bin")
|
||||
os.mkdir(bindir)
|
||||
@@ -217,9 +217,35 @@ class Backend(QObject):
|
||||
with open(wrapper, "w") as f:
|
||||
f.write("#!/bin/sh\nexec /usr/bin/sudo -A \"$@\"\n")
|
||||
os.chmod(wrapper, 0o700)
|
||||
stop = threading.Event()
|
||||
data = (password + "\n").encode()
|
||||
|
||||
def serve():
|
||||
while not stop.is_set():
|
||||
try:
|
||||
fd = os.open(pipe, os.O_WRONLY) # waits for a reader
|
||||
except OSError:
|
||||
return
|
||||
try:
|
||||
if not stop.is_set():
|
||||
os.write(fd, data)
|
||||
except OSError:
|
||||
pass
|
||||
finally:
|
||||
os.close(fd)
|
||||
threading.Thread(target=serve, daemon=True).start()
|
||||
self._askpass_stop = (stop, pipe)
|
||||
return d, askpass, bindir
|
||||
|
||||
def _drop_askpass(self):
|
||||
if getattr(self, "_askpass_stop", None):
|
||||
stop, pipe = self._askpass_stop
|
||||
self._askpass_stop = None
|
||||
stop.set()
|
||||
try: # wakes the writer waiting for a reader, which then ends
|
||||
os.close(os.open(pipe, os.O_RDONLY | os.O_NONBLOCK))
|
||||
except OSError:
|
||||
pass
|
||||
if self._secret_dir:
|
||||
shutil.rmtree(self._secret_dir, ignore_errors=True)
|
||||
self._secret_dir = None
|
||||
@@ -289,6 +315,11 @@ class Backend(QObject):
|
||||
"""The display's own EDID and the old rate again (hdmi-reset event)."""
|
||||
self._start(["hdmi-reset", conn, str(w), str(h), "%g" % hz], password)
|
||||
|
||||
@Slot(str, str)
|
||||
def hdmiForget(self, password, display):
|
||||
"""Removes a saved display (hdmi-forgotten event)."""
|
||||
self._start(["hdmi-forget", display], password)
|
||||
|
||||
def _read(self, p):
|
||||
self._buf += bytes(p.readAllStandardOutput())
|
||||
while b"\n" in self._buf:
|
||||
|
||||
Reference in new issue
Block a user