Compare commits

...
Author SHA1 Message Date
enricobuehler 6a82a602a1 fix(clients/android): the button correction fired on pads that never needed it
ci / docs-drift (pull_request) Successful in 50s
ci / web (pull_request) Successful in 1m12s
ci / bun-nix (pull_request) Successful in 1m13s
ci / docs-site (pull_request) Successful in 1m16s
ci / rust-arm64 (pull_request) Successful in 2m12s
ci / rust (pull_request) Successful in 5m27s
android / android (pull_request) Successful in 6m41s
Two field reports (2026-08-21), one shape: a GameSir G8+ and an Xbox Elite
Series 2 ("Xbox Wireless Controller" over Bluetooth) with X answering Y, Y
answering LB, and the two shoulders answering menu buttons — everything else
correct. That is not a stray mapping, it is exactly what `GENERIC_XBOX` does to
scancodes `0x133`/`0x134`/`0x136`/`0x137`, so the correction added yesterday was
firing on pads whose buttons were already where `Generic.kl` says they are.

It fired because it asked the wrong question. `hasKeys(BUTTON_C, BUTTON_Z)`
answers for what a device DECLARES, not what it reports: `hid-input` allocates
`BTN_A + n` straight through for every button in the descriptor, so BTN_C
(`0x132`) and BTN_Z (`0x135`) are set on ANY pad declaring six or more —
including a standard-layout pad that never presses either. The signal is
therefore identical on the pad that needs correcting and the pad that does not,
and no amount of tightening it could have separated them. It is the same pad
model in both reports: an Elite Series 2 needed the correction on a Fire TV and
another Elite Series 2 was broken by it here.

What does separate them is the axes. A HID gamepad describes its triggers either
as the Accelerator/Brake usages — which become `ABS_GAS`/`ABS_BRAKE`, names
Android has words for — or as two more generic axes on `ABS_Z`/`ABS_RZ`, which
it does not. A descriptor well-formed enough to name its triggers puts its
buttons at the standard positions too. It is also the firmware line on the pad in
the report: an Xbox Wireless Controller over Bluetooth reports GAS/BRAKE after
its firmware update and Z/Rz before it, and only the older one was ever wrong.

`padButtons` now takes `namedTriggers` and answers NATIVE whenever it is set —
no correction of any kind, on buttons or axes, for a pad Android already reads.
`padMap` computed that fact one line below and only ever spent it on the axes;
it now decides both. `hasKeys` stays for the narrower question it can answer —
WHICH straight-through order, once the axes have established there is one — where
a false positive costs nothing.

Moonlight decides it on the same fact (`ControllerHandler`, `gasRange == null`
beside the `"Xbox Wireless Controller"` name); yesterday's commit cited its
tables and then replaced its discriminator, which is where this came in.

Verified: `:kit:testDebugUnitTest` and `:app:testDebugUnitTest` green (16 cases
in PadButtonsTest, 3 new: the gate holds for every vendor/declaration
combination, the four reported buttons stay themselves, and the report-order
choice past the gate is unchanged), `:app:compileDebugKotlin` clean. The
DualSense report filed alongside these — Triangle dead in the client UI and in
the stream — is NOT explained by this and is not fixed here: a button that
reaches neither is one `buttonBit` maps to nothing, which no branch of the
correction produces for Triangle. The Controllers screen prints the raw scancode
and keycode of every press; that line off the reporter's pad will pin it.
2026-08-21 13:10:23 +02:00
enricobuehler 2be444b329 Merge pull request 'A provider plugin can report which of its titles are running' (#361) from worktree-playnite-runstate into main
ci / docs-site (push) Successful in 1m14s
ci / web (push) Successful in 1m19s
ci / bun-nix (push) Successful in 1m24s
ci / docs-drift (push) Successful in 27s
deb / build-publish-gamescope (push) Successful in 43s
ci / rust-arm64 (push) Successful in 3m26s
deb / build-publish-client-arm64 (push) Successful in 1m20s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 13s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 1m7s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 14s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 15s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 15s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 15s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 15s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
deb / build-publish (push) Successful in 4m16s
nix / flake (push) Successful in 20m48s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 57s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m59s
ci / rust (push) Successful in 8m24s
arch / build-publish (push) Successful in 8m31s
deb / build-publish-host (push) Successful in 7m6s
docker / builders-arm64cross (push) Successful in 15s
docker / deploy-docs (push) Successful in 39s
plugin-kit-publish / publish (push) Successful in 41s
android / android (push) Successful in 12m41s
windows-host / package (push) Successful in 13m2s
windows-host / winget-source (push) Skipped
deb / smoke-install (push) Successful in 4m17s
windows-host / canary-manifest (push) Successful in 31s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m1s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 18m45s
Reviewed-on: #361
2026-08-20 19:22:10 +00:00
enricobuehler 669a1bc0ce The video data port was never open, and nothing could tell us (#360)
ci / docs-drift (push) Successful in 29s
ci / bun-nix (push) Successful in 53s
ci / docs-site (push) Successful in 1m13s
ci / web (push) Successful in 1m17s
apple / swift (push) Failing after 1m34s
apple / distribute (push) Skipped
apple / screenshots (push) Skipped
ci / rust-arm64 (push) Successful in 1m52s
deb / build-publish-gamescope (push) Successful in 1m9s
decky / build-publish (push) Successful in 1m5s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 22s
deb / build-publish-client-arm64 (push) Successful in 1m55s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 16s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 13s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 11s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 44s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 10s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 27s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m59s
deb / build-publish-host (push) Successful in 6m4s
ci / rust (push) Successful in 7m23s
arch / build-publish (push) Successful in 8m11s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 16s
docker / builders-arm64cross (push) Successful in 14s
docker / deploy-docs (push) Successful in 39s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 8m14s
android / android (push) Successful in 10m46s
flatpak / build-publish (push) Successful in 7m15s
deb / build-publish (push) Successful in 5m6s
deb / smoke-install (push) Successful in 3m49s
windows-host / package (push) Successful in 13m18s
windows-host / winget-source (push) Skipped
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 16m56s
windows-host / canary-manifest (push) Successful in 27s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m4s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m54s
Merged with `apple / swift` red: the Mac runner's volume is out of space (594 "No space left on device" lines; the only distinct error is "You can't save the file because the volume 'Macintosh HD' is out of space"). It passed on the parent commit 1280f697 and the only delta since was one line in scripts/ci/docs-undocumented-env-baseline.txt — Swift compilation of the Apple client cannot be affected by a Rust host firewall rule, a core control message, or a CI text baseline. A rerun hit the same wall, so the mac-mini-1 disk needs the owed cleanup.

Every check that can validate this change is green: ci/rust (480 core tests), ci/rust-arm64, android, docs-drift, web, docs-site, bun-nix, and both windows-client legs. The Windows HOST build — which the PR checks never run, and which is the only thing that compiles the cfg(windows) firewall function — was dispatched separately on the branch and passed, including "Clippy (host + tray, Windows)".
2026-08-20 18:48:28 +00:00
enricobuehler 8ff6fe6093 fix(host): regenerate the API spec, and stop the runstate tests colliding
ci / bun-nix (pull_request) Successful in 23s
ci / web (pull_request) Successful in 1m9s
ci / docs-site (pull_request) Successful in 1m13s
ci / docs-drift (pull_request) Successful in 1m5s
ci / rust-arm64 (pull_request) Successful in 2m54s
android / android (pull_request) Successful in 5m23s
ci / rust (pull_request) Successful in 7m17s
nix / flake (pull_request) Successful in 7m49s
`api/openapi.json` (and its docs-site copy) gain exactly the new route and its
three schemas — nothing else moved, which is the check worth doing on a
regenerated spec.

The test fix is one the tests found themselves, on the first run in an
environment that actually executes them: all three shared the provider id
`playnite` and cleared the whole process-global table between cases, so under
parallel scheduling they flipped each other's answers — `omitted_is_not_running`
read `None` for a title another test had just wiped. Each now takes ids only it
uses and forgets only its own row, which also retires the blunt `reset()` that
made the collision possible.
2026-08-20 20:38:08 +02:00
enricobuehler 1758266bda chore(plugin-kit): export the running-report surface, and bump to 0.4.4
`reportRunning` and its two types were reachable only through the deep
`./reconcile.js` path — `index.ts` re-exports an explicit list, not a star — so
no plugin could import them from the package root the way it imports every
other provider symbol.

Version bumped because it is a published package and the addition is what a
consumer would depend on; the playnite plugin deliberately does NOT, calling the
route through the untyped host seam instead so it is not gated on this publish.
2026-08-20 20:38:08 +02:00
enricobuehler d5fb1e4479 feat(host): a provider plugin can report which of its titles are running
The host derives liveness by scanning, which needs something recognizable on
disk. A Playnite-launched emulated game, a manually added one, or a library
plugin that records no install directory has none — and its launch is a
`playnite://` hand-off, so the host holds no process either. The lease went
`Untracked`: the exit was never noticed, `session_on_game_exit` could not fire,
and `POST /game/end` had nothing to aim at. Playnite knew the whole time.

New `PUT /library/provider/{provider}/running` takes a provider's complete
running set (with the pid where it knows one) — declarative and idempotent like
the reconcile beside it, so a missed event or a plugin restart self-corrects
rather than drifting. `crate::runstate` holds it and expires it after 90s
unless restated, which is what makes it safe for a live provider to hold a
session open for a game the host cannot see: a plugin that dies stops counting
and the host falls back to scanning, exactly as today.

`LeaseKind::Reported` is the lease that follows from it. `open` reaches it when
the spec is empty and a provider speaks for the id, and — the load-bearing part
on Windows, where every launch is a hand-off by construction — the three shim
reclassification paths now fall back to it where they fell to `Untracked`.
Phase 1 takes "running" as the game appearing; phase 2 takes "stopped" as the
exit. Unlike `procscan::running_hint`, which may only ever delay an exit because
Steam's registry flag survives an unclean one, a fresh report is decisive in
both directions. A reported pid joins the termination ladders on the same terms
as a spawned one: re-resolved and start-time-pinned at the moment of use.

The route is the plugin lane's, like the reconcile. No new authority — the host
maps `external_id` through the catalog, so a provider can only speak about
entries it published; an unknown id is counted, not refused, because a report
legitimately races its own reconcile and 400-ing the batch would throw away the
liveness of every other running title.

plugin-kit gains `ProviderClient.reportRunning`; a 404 from an older host means
"this host tracks games by scanning".
2026-08-20 20:38:08 +02:00
enricobuehler ea3c9e1202 ci(docs-drift): baseline the new control-message constant
ci / bun-nix (pull_request) Successful in 40s
ci / web (pull_request) Successful in 1m14s
ci / docs-drift (pull_request) Successful in 27s
ci / docs-site (pull_request) Successful in 1m23s
ci / rust-arm64 (pull_request) Successful in 2m23s
ci / rust (pull_request) Successful in 6m15s
android / android (pull_request) Successful in 6m42s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m22s
apple / swift (pull_request) Failing after 1m35s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m49s
`check-docs-drift.sh` scans for `PUNKTFUNK_*` identifiers and asks that
each be documented in docs-site or explicitly baselined. It cannot tell
an env knob from a cbindgen-exported `#define`, so the new
`PUNKTFUNK_MSG_DELIVERY_REPORT` header constant tripped it.

It is a wire message type byte, not a knob an operator can set — same as
every other `PUNKTFUNK_MSG_*`, all of which are already in the baseline.
Added in sorted position beside them.
2026-08-20 20:27:37 +02:00
enricobuehler 685c4bd99a Merge pull request 'A pad that was never there kept the console UI on, and the picture sat in the corner' (#359) from worktree-android-gamepad-ui-and-corner into main
ci / rust-arm64 (push) Successful in 2m19s
ci / web (push) Successful in 1m28s
ci / bun-nix (push) Successful in 28s
ci / docs-drift (push) Successful in 26s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 17s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 14s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 14s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 12s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 17s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 17s
ci / docs-site (push) Successful in 2m10s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 29s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 32s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 18s
docker / builders-arm64cross (push) Successful in 25s
ci / rust (push) Successful in 8m23s
docker / deploy-docs (push) Successful in 1m43s
android / android (push) Successful in 10m20s
2026-08-20 18:22:33 +00:00
enricobuehler 0519b057d5 fix(clients/android): a pad that was never there, and a picture in the corner
ci / rust-arm64 (pull_request) Successful in 3m37s
ci / web (pull_request) Successful in 1m55s
android / android (pull_request) Successful in 8m52s
ci / bun-nix (pull_request) Successful in 19s
ci / docs-site (pull_request) Successful in 2m25s
ci / docs-drift (pull_request) Successful in 23s
ci / rust (pull_request) Successful in 11m0s
Two field reports from one Android user, with one shape between them: a
decision taken once, at a moment when the answer was still wrong, and never
revisited.

The console UI could not be dismissed. "With a controller" asks whether a pad
is attached, and the client answered that with `isPad` — does this device's
source class include gamepad or joystick. That is the right question for
ROUTING an event and the wrong one for presence: devices publish inputs that
claim the source class while being no such thing (OEM game-mode overlays, the
gaming-phone shoulder triggers), and one of them is enough to pin the console
UI on forever, because a pad that was never there can never disconnect.

`pads()` now filters on `looksLikeController`: the source claim AND hardware
behind it — a stick, a HAT, or the A/B face buttons — on a device the platform
did not synthesize itself. The claim is cheap; the hardware is not. `isPad`
keeps its looser meaning for the event lane, where it is correct. It is not a
complete defence (an OEM device that declares BTN_GAMEPAD and two axes is
indistinguishable from a pad at this layer), so the master switch stays the
guaranteed way out — and the Controllers screen still lists everything real in
one column or the other, which is where someone looks when the client's idea of
"a pad is attached" disagrees with the room.

The picture sat in the top-left corner. The ASurfaceControl layer composites
into the SurfaceView's on-screen rectangle, read once at `surfaceCreated` — but
the stream screen hides the system bars and switches the window to draw into
the display cutout a frame or two later, and each of those grows the view under
a surface that is never recreated. The layer went on painting at the size it
started with, anchored at the origin. It passed on glass because a device whose
bars were already hidden when the surface arrived never sees the gap.

The size is now live: a packed atomic on the session handle, seeded by
`nativeStartVideo`, re-reported by `nativeVideoSurfaceSize` from every
`surfaceChanged`, and read by the layer before each present. One atomic load per
frame, and rotation and multi-window come along for free.

Verified: `:kit:cargoNdkClippy` (arm64 + armv7, deny warnings), `:kit:` and
`:app:` unit tests, and the native crate's own suite. The new JNI symbol is
exported in the built `.so`.
2026-08-20 20:07:57 +02:00
enricobuehler 33b029695f Merge pull request 'The gamescope prune deleted the compositor and shipped only its launcher' (#355) from gamescope-show-version-banner into main
ci / rust-arm64 (push) Successful in 1m48s
ci / web (push) Successful in 1m2s
ci / bun-nix (push) Successful in 30s
ci / docs-drift (push) Successful in 24s
ci / docs-site (push) Successful in 1m23s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 14s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 15s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 18s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 13s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 13s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 33s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 28s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 15s
docker / deploy-docs (push) Successful in 42s
docker / builders-arm64cross (push) Successful in 27s
ci / rust (push) Canceled after 16m22s
nix / flake (push) Successful in 28m29s
Reviewed-on: #355
2026-08-20 18:00:07 +00:00
enricobuehler 1f6f01cb76 Merge pull request 'The in-stream "Switch to Desktop" went unwatched on Nobara, and both distro families leaked an idled Game Mode' (#358) from worktree-nobara-gamemode-switch into main
ci / web (push) Successful in 1m25s
ci / rust-arm64 (push) Successful in 2m36s
ci / bun-nix (push) Successful in 23s
ci / docs-site (push) Successful in 1m43s
ci / docs-drift (push) Successful in 26s
ci / rust (push) Canceled after 5m55s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
deb / build-publish-gamescope (push) Successful in 52s
deb / build-publish-client-arm64 (push) Successful in 1m30s
deb / build-publish (push) Successful in 4m43s
deb / build-publish-host (push) Successful in 5m38s
arch / build-publish (push) Successful in 9m37s
android / android (push) Successful in 11m1s
windows-host / package (push) Successful in 13m55s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 45s
deb / smoke-install (push) Successful in 5m43s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 23m26s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 24m6s
2026-08-20 17:51:44 +00:00
enricobuehler fade2f7af3 Merge remote-tracking branch 'origin/main' into worktree-nobara-gamemode-switch
ci / bun-nix (pull_request) Successful in 33s
ci / web (pull_request) Successful in 1m12s
ci / docs-site (pull_request) Successful in 1m21s
ci / docs-drift (pull_request) Successful in 48s
ci / rust-arm64 (pull_request) Successful in 1m55s
android / android (pull_request) Successful in 7m59s
ci / rust (pull_request) Successful in 16m58s
2026-08-20 19:48:15 +02:00
enricobuehler 6e4cc335c5 Merge pull request 'The console can switch itself off, and a TV remote can reach everything it offers' (#354) from worktree-console-ui-off-toggle into main
ci / bun-nix (push) Successful in 25s
ci / docs-drift (push) Successful in 31s
deb / build-publish (push) Canceled after 46s
ci / web (push) Successful in 1m36s
ci / docs-site (push) Successful in 1m48s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 25s
ci / rust-arm64 (push) Successful in 2m47s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 20s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 24s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 18s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 14s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 14s
deb / build-publish-client-arm64 (push) Successful in 1m53s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m6s
android / android (push) Canceled after 5m17s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m27s
arch / build-publish (push) Canceled after 5m27s
ci / rust (push) Canceled after 5m33s
deb / build-publish-host (push) Canceled after 4m21s
deb / build-publish-gamescope (push) Canceled after 19s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 15s
docker / builders-arm64cross (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 0s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 2m4s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 6m48s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Failing after 12m41s
flatpak / build-publish (push) Successful in 7m18s
Reviewed-on: #354
2026-08-20 17:46:35 +00:00
enricobuehler d9662c010d fix(gamescope): 0.31.0's idled takeover left nothing watching for "Switch to Desktop"
The managed takeover stopped stopping the display manager and started idling the
box's autologin session instead (c2f5e91b). That commit also deleted the two lines
the old DM stop carried — `record_session_select_baseline()` and
`STOPPED_DM = Some(dm)` — and 38a0f54b then removed every remaining writer of that
static. The in-stream switch gate in `create_managed_session` still reads it, so
`honor_session_select_switch` became unreachable code on every box.

Bazzite never noticed, for two reasons measured on `.41`: its `os-session-select`
is a thin wrapper over `steamosctl` D-Bus calls and writes NO sentinel (verified —
`~/.config/steamos-session-select` does not exist before or after a completed
switch), and `is_steam_htpc_platform()` defaults the mid-stream session watcher ON
for bazzite/steamos, which follows the switch by itself.

Nobara gets neither. `ID=nobara` matches no HTPC default, so no watcher; and its
ChimeraOS-layout `os-session-select` DOES write the sentinel, which was the only
thing the host had to see the switch by. So on Nobara the user's "Switch to
Desktop" went entirely unhandled: the capture loss it causes drives a rebuild, the
rebuild relaunches game mode over the booting desktop, and the stream is thrown
straight back in — the 2026-07-24 field report, reopened by a user 2026-08-20.

Arm the gate on the takeover that actually exists now. `takeover_idled()` reads
IDLE_DROPIN_ARMED, the idle drop-in re-baselines the sentinel when it goes in, and
STOPPED_DM is documented as what it has become: adoption-only state for a takeover
stranded by a pre-0.31.0 host. The hand-back keeps that host's DM restore + switch
replay (now `replay_switch_under_restored_dm`) but runs it only for such an adopted
takeover — a 0.31.0 takeover leaves the DM up precisely so the OS does that work
itself, and on the VM it does: `Updated user selected session to plasma`, then
Plasma.

Both hand-back paths also give the box its own Game Mode back, which neither did.
The takeover replaces that session's ExecStart with a sleep, and a mid-stream
switch is the one exit that leaked it — the disconnect restore sweeps it, but a
switch is not a disconnect. Measured on Bazzite `.41`: after a completed switch to
KDE the unit still carried `ExecStart=/usr/bin/sleep infinity`, so "Return to
Gaming Mode" would have started a unit that does nothing. That is the same barred
way back `release_autologin_mask` already exists to prevent for the mask this
drop-in replaced, so it goes there — covering the watcher-driven distros — and in
`honor_session_select_switch`, covering the sentinel-driven ones.

Verified on the Nobara VM (123 on home-node-3) by driving the real path against
live systemd: takeover -> real `steamos-session-select plasma` -> rebuild. The
rebuild refuses to relaunch game mode, the idle drop-in is gone, and the box
arrives in KDE. Backed out to the 0.31.0 shape on the same box it fails at "the
switch did not advance the sentinel" — the blindness itself. The extended
`the_mask_comes_off_only_when_the_box_takes_itself_back` covers the watcher path
against a live user manager, and fails without the hand-back.
2026-08-20 19:33:19 +02:00
enricobuehler 2b0913cf53 Merge pull request 'A DualSense and an Elite Series 2 on a Fire TV pressed each other's buttons — Android reads the scancode now' (#357) from worktree-android-pad-hid-remap into main
docker / builders-arm64cross (push) Successful in 13s
ci / docs-drift (push) Successful in 31s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 18s
ci / web (push) Successful in 1m22s
ci / docs-site (push) Successful in 1m15s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 19s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 21s
ci / rust-arm64 (push) Successful in 2m31s
ci / bun-nix (push) Successful in 2m18s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 56s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 34s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 29s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 38s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 31s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m27s
docker / deploy-docs (push) Successful in 43s
ci / rust (push) Successful in 6m35s
android / android (push) Successful in 8m48s
2026-08-20 17:18:46 +00:00
enricobuehler 1280f697be fix(host,core): the video data port was never open, and nothing could tell
apple / swift (pull_request) Successful in 2m16s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m15s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m53s
ci / rust-arm64 (pull_request) Successful in 2m38s
ci / web (pull_request) Successful in 1m29s
ci / docs-site (pull_request) Successful in 58s
ci / docs-drift (pull_request) Failing after 28s
ci / bun-nix (pull_request) Successful in 56s
android / android (pull_request) Successful in 7m21s
ci / rust (pull_request) Canceled after 7m48s
A field host streamed 1919 frames into a black screen while its own log
blamed the client. Four faults, each of which alone makes the failure
invisible.

The Windows firewall rules are `localport=`-scoped (47998-48010, 9777,
5353), but the media data plane binds an EPHEMERAL port per session. No
such rule can ever cover it, so Windows Firewall drops the client's
hole-punch on EVERY session on EVERY Windows host — `punched=false` on
the "data plane bound" line, in all six sessions of two field logs. The
punch then never opens the return path and video is sent blind to an
address the client merely reported. `service install` now also adds a
program-scoped inbound UDP rule for the host executable, which covers
whatever port a session picks. Program-scoped rather than a pinned port:
pinning into 47998-48010 would collide with Sunshine/Apollo.

`LossReport` carried only `loss_ppm`, which is ambiguous at zero — loss
is a ratio over the packets that arrived, so a flawless link and a link
delivering NOTHING both report 0. The host read total silence as perfect
and decayed adaptive FEC to its floor. Clients now also send a
`DeliveryReport` with the session's received-packet count. It is a new
type byte, NOT a field appended to `LossReport`: that message is
length-checked exactly, so lengthening it would make every shipped host
reject the loss reports its FEC runs on. Sent every window while the
count is zero, once when the first packets land, then never — an older
host warns per unknown message and must not be flooded on a good
session.

`NO_VIDEO_RETRY` (client got nothing) and `FLUSH_COOLDOWN` (client
drowning) were both 2000 ms, so the host's cadence classifier could not
tell two opposite faults apart and picked the wrong one out loud. The
no-video cooldown moves to core beside `FLUSH_COOLDOWN` at 2600 ms, and
both sides compare against the shared constant rather than a copy.

The diagnosis now leads with the delivery count: zero is an error naming
the data plane, a confirmed count keeps the old confident wording, and an
old client that cannot answer gets a warning that says so instead of
guessing. A punch that never arrives is also its own warning now, rather
than a debug field on an info line.
2026-08-20 19:14:49 +02:00
enricobuehler 3b39710a5a fix(clients/android): controllers Android has no key layout for stop landing on the wrong buttons
ci / web (pull_request) Successful in 1m37s
ci / docs-site (pull_request) Successful in 1m43s
ci / bun-nix (pull_request) Successful in 30s
ci / docs-drift (pull_request) Successful in 27s
ci / rust-arm64 (pull_request) Successful in 2m19s
android / android (pull_request) Successful in 6m57s
ci / rust (pull_request) Successful in 7m23s
Reported from a Fire TV Stick 4K Max: a DualSense and an Xbox Elite Series 2,
both over Bluetooth, both identified correctly but with buttons on the wrong
actions ("L1 being L2"). Both work in Moonlight on the same box.

Android names a pad's buttons through a KEY LAYOUT file matched on VID/PID. A
pad with no matching file falls back to AOSP's `Generic.kl`, which assigns
keycodes by SCANCODE POSITION — 0x130→BUTTON_A, 0x131→BUTTON_B, 0x132→BUTTON_C
and up. That is only right if the pad's buttons sit where the file assumes, and
a HID gamepad with no kernel driver numbers its buttons 1..n straight through in
its OWN report order, so every keycode past the first divergence is somebody
else's button. Neither pad has a layout there: AOSP ships none for the Elite
Series 2 over Bluetooth (045e:0b05) on any version, and the DualSense's
(054c:0ce6) both postdates Fire OS and carries `requires_kernel_config
CONFIG_HID_PLAYSTATION`, which a Fire TV kernel has not. A DualSense reporting
straight through puts L2 on 0x136, which `Generic.kl` calls BUTTON_L1 — the
reported symptom exactly, and Circle and R1 (BUTTON_C / BUTTON_Z) mapped to
nothing at all and were dropped.

This client read `KeyEvent.keyCode` only, so it inherited every one of those
errors — in the stream, in the console shell's navigation, and in the
Controllers screen's own tester, which is why the tester agreed with the bug.

Resolve buttons from the SCANCODE instead, which is the pad's own report
position and immune to the layout file — the same reason `Keymap.toVk` reads
`scanCode` for keyboards. Two things keep it off pads that already work:

  1. the correction applies ONLY where the delivered keycode is what
     `Generic.kl` would have said, so a device-specific layout always wins;
  2. which report order to read is decided from what the DEVICE declares —
     a pad numbering straight through claims BUTTON_C and BUTTON_Z, keycodes
     no real controller has a button for — never from a model table.

`Gamepad.padKeyCode(event)` is a drop-in for `event.keyCode` and every pad
reader now goes through it: the streaming branch, the Skia console shell's
probe, the older Compose navigation, and the Controllers tester. The console and
the game must not disagree about which button a user pressed.

Axes get the same treatment: a pad declaring none of LTRIGGER/RTRIGGER,
BRAKE/GAS or BRAKE/THROTTLE is one Android never mapped, and its triggers are on
raw axes. A Sony pad reporting straight through lays out X, Y, Z, Rz, Rx, Ry, so
only the triggers (RX/RY) were missed; every other such pad puts the right stick
on Rx/Ry and the triggers on Z/Rz — the shape that makes pulling a trigger swing
the right stick. Whether those idle at −1 is measured off the device's own range
rather than assumed, so a pad reporting an honest 0..1 is not rescaled to a
permanent half-pull.

Also: the Controllers screen now reports each press as its raw scancode and
keycode plus the correction, names the resolved layout on the pad's card, and
reads axes through the same map the stream does — so it can be trusted again,
and so an unmapped pad can be pinned from a field report without the hardware.
The Xbox Bluetooth product ids (One S, Elite Series 2 and its Core) join the
identity table; without them an Elite streamed under the Xbox 360 identity.

Moonlight carries the same two report-order tables (`ControllerHandler`'s
`isNonStandardDualShock4` / `isNonStandardXboxBtController`), which is why both
pads work there on the same box.

Verified: :kit:testDebugUnitTest and :app:testDebugUnitTest both green (13 new
cases in PadButtonsTest covering the scancode tables and the axis resolution),
:app:compileDebugKotlin clean. NOT yet tested on glass — the reporter's Fire TV
is the confirmation this needs. The Xbox pad's Guide button stays unreachable
either way: it arrives as KEY_HOMEPAGE, and Android never delivers KEYCODE_HOME
to an app.
2026-08-20 18:46:56 +02:00
enricobuehler 19243c30b4 Merge pull request 'GameStream sessions built the XUSB pad that Steam cannot see — Xbox backend parity with the native plane' (#356) from worktree-gamestream-xbox-hid-parity into main
deb / build-publish-host (push) Successful in 5m28s
ci / bun-nix (push) Successful in 29s
ci / docs-drift (push) Successful in 50s
ci / docs-site (push) Successful in 1m18s
ci / web (push) Successful in 1m27s
ci / rust-arm64 (push) Successful in 1m55s
deb / build-publish-gamescope (push) Successful in 46s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 24s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 20s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 9s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 10s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 10s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 11s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 10s
deb / build-publish-client-arm64 (push) Successful in 2m29s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 18s
deb / build-publish (push) Successful in 5m35s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 2m4s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 2m7s
docker / builders-arm64cross (push) Successful in 20s
docker / deploy-docs (push) Successful in 48s
ci / rust (push) Successful in 7m27s
android / android (push) Successful in 10m54s
deb / smoke-install (push) Successful in 3m58s
arch / build-publish (push) Successful in 11m11s
windows-host / package (push) Successful in 14m38s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 34s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 19m16s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m13s
2026-08-20 16:33:41 +00:00
enricobuehler dfcffcdd50 fix(gamestream/windows): Moonlight sessions built the XUSB pad that Steam cannot see
ci / bun-nix (pull_request) Successful in 36s
ci / docs-drift (pull_request) Successful in 35s
ci / web (pull_request) Successful in 1m36s
ci / docs-site (pull_request) Successful in 1m37s
ci / rust-arm64 (pull_request) Successful in 1m39s
ci / rust (pull_request) Successful in 5m36s
android / android (pull_request) Successful in 5m51s
Reported from the field: gamepad input does nothing on GameStream clients, and it
reproduces across every client and device a user tries (Artemis on a Steam Deck and
on an Android phone both). That breadth is the tell — it is not a client at all.

On Windows there are two virtual Xbox backends and they are not interchangeable to a
game. The XUSB companion registers only GUID_DEVINTERFACE_XUSB and exposes no HID
collection (pf_xusb.inx says so in its own header: "a non-HID UMDF2 driver", Class =
System), so Steam's hidapi enumeration, SDL, RawInput, DirectInput, joy.cpl and
WGI/GameInput cannot see it at all — only classic XInputGetState can. The native plane
moved to the real HID pad as its DEFAULT on 2026-08-09 (bd5735b8) for exactly that
reason; its doc comment records the reporter who lost a controller for two weeks to it.

The GameStream plane never got that change. It has bound `crate::inject::gamepad`
since the first gamepad commit, when that name meant uinput and Windows had no second
backend; Windows later gave the same name the XUSB companion, so this plane inherited
it by module-name coincidence rather than by any decision. bd5735b8 did touch
control.rs — but only to widen the rumble closure's arity, and its note reasons about
"the uinput backend", not about the Windows one sitting behind the same import. So
every Moonlight session since has presented a pad most games cannot enumerate, while
native punktfunk sessions on the same host got the good one.

There was also no way out: `windows_xbox_hid` was `pub(super)`, i.e. unreachable from
this module, so PUNKTFUNK_XBOX_BACKEND did nothing here — and the Windows manager
ignores the arrival `kind` byte, so a client could not ask for a DualSense either, the
escape that saved the earlier reporter.

- native.rs / native/gamepad.rs: `mod gamepad` and `windows_xbox_hid` become
  pub(crate). The knob keeps ONE definition and one name; widening visibility breaks
  no existing caller. Its doc now records that both planes read it, and why being
  `pub(super)` was itself the bug.
- gamestream/control.rs: a `SessionPads` enum is the one place this plane picks a
  backend — the HID pad when the shared knob says so, the XUSB companion otherwise,
  and on every other platform the single backend that exists.
  `PUNKTFUNK_XBOX_BACKEND=xusb` now reverts both planes together.

The HID pad's rich-feedback plane is dropped rather than plumbed: an Xbox pad has no
lightbar or adaptive triggers, and GameStream has no vocabulary for one — its rumble
message (0x010B) carries the two handle motors and nothing else, which is why the
trigger levels were already dropped at the call site.

No test: a `cfg(target_os = "windows")` #[test] would compile NOWHERE. ci.yml excludes
it by target, and windows-host.yml lints the host with `cargo clippy -p punktfunk-host`
without `--all-targets`, which does not build `cfg(test)` modules at all — the same
blind spot that workflow's own comments blame for letting the Linux twin's tests rot to
the wrong arity. It would be dead weight, not coverage.

VERIFIED
  * ON WINDOWS (.133, the only box where this arm compiles at all):
    `cargo check -p punktfunk-host` clean in 57s, then
    `cargo clippy -p punktfunk-host -- -D warnings` clean in 42s — both on default
    features, which include `gamestream`. This compiles BOTH enum arms: `Xusb` and
    `Hid` are Windows types alike.
    Non-vacuous by construction: `cargo clean -p punktfunk-host` ran first (a scp'd
    tree plus this box's lagging clock and a warm shared target dir otherwise yield a
    fresh `Finished` having compiled nothing), and both passes logged
    `Compiling punktfunk-host v0.31.0`. The only warning is punktfunk-core's
    header-write notice — benign and pre-existing.
  * `cargo fmt --all --check` clean.

NOT VERIFIED — owed
  * Linux: no box could run it (.25's root filesystem is 100% full; .21/.136/.138 were
    down; OrbStack here hangs even on `docker run alpine echo`). Exposure is small —
    the Linux arm is three calls on a `GamepadManager` whose Windows XUSB sibling has
    the identical method surface and just compiled — and ci.yml DOES run on
    pull_request, so opening a PR closes this.
  * On glass: no Moonlight session has driven the HID pad through this plane yet. That
    is the real acceptance test, and the log line to look for is
    "virtual Xbox pad created (Windows UMDF HID)" where it used to say
    "virtual Xbox 360 created (Windows XUSB companion)".
  * windows-host.yml has NO `pull_request` trigger (push to main, v* tags,
    workflow_dispatch only), so CI will not re-check this arm on a PR — the .133 run
    above is deliberately standing in for it.
2026-08-20 18:19:19 +02:00
enricobuehler f2b5b3e567 Merge pull request '0.31.0 release notes, re-cut on current main — and the bun install CI flake' (#351) from worktree-release-next-prep into main
ci / bun-nix (push) Successful in 26s
ci / docs-drift (push) Successful in 29s
ci / docs-site (push) Successful in 1m22s
ci / web (push) Successful in 2m13s
ci / rust-arm64 (push) Successful in 2m35s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 4m5s
android-screenshots / screenshots (push) Successful in 2m12s
ci / rust (push) Successful in 8m26s
decky / build-publish (push) Successful in 41s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 8m37s
android / android (push) Successful in 9m57s
linux-client-screenshots / screenshots (push) Successful in 2m32s
sbom / sbom (push) Successful in 26s
arch / build-publish (push) Successful in 10m14s
flatpak / build-publish (push) Successful in 5m2s
docker / builders-arm64cross (push) Successful in 13s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 8s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 10s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 10s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 11s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 13s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 13s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 13s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m11s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 29s
docker / deploy-docs (push) Successful in 17s
deb / smoke-install (push) Successful in 4m40s
deb / build-publish (push) Successful in 3m24s
deb / build-publish-host (push) Successful in 7m31s
deb / build-publish-gamescope (push) Successful in 22s
deb / build-publish-client-arm64 (push) Successful in 1m11s
web-screenshots / screenshots (push) Successful in 6m19s
windows-host / package (push) Successful in 13m57s
windows-host / canary-manifest (push) Skipped
windows-host / winget-source (push) Successful in 19s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 17m11s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m43s
apple / swift (push) Failing after 18s
apple / distribute (push) Skipped
apple / screenshots (push) Skipped
2026-08-20 07:50:58 +00:00
enricobuehler 6d7e6f71c0 release: 0.31.0 — verification pass before the tag
ci / bun-nix (pull_request) Successful in 28s
ci / web (pull_request) Successful in 1m8s
ci / docs-drift (pull_request) Successful in 1m31s
ci / docs-site (pull_request) Successful in 1m47s
ci / rust-arm64 (pull_request) Successful in 2m23s
ci / rust (pull_request) Successful in 5m4s
Re-measured every version-table row against the tree rather than
trusting the earlier cut: ABI 25, wire 2, driver 6/min 3, gamepad 3,
index schema 1, event schema 1, edition 2024, MSRV 1.85, 27 crate dirs,
39 workspace members, SDK 0.1.5, plugin-kit 0.4.3, openapi 0.31.0 with
both copies byte-identical, gamescope +pfhdr8 with 10 patch files and
no diff against the tag. All match what the table claims. The C header
diff against v0.30.0 removes exactly two things — the old ABI define and
the ex11 doc paragraph that stated the superseded hi-res rule — so
'addition only' holds.

Three fixes to the text itself:

  * The commit count is now taken at the tip being released (170/113 at
    d7fa5847) instead of at this branch, where it moved every time I
    committed to it.

  * The two NixOS items in Before-you-update are one item. They were
    separated by three unrelated bullets, so the audience that has to
    act on both — builds are failing AND there is now a cache — had to
    find them in two places.

  * A TL;DR line read 'it repaired itself on no retry', which says the
    opposite of what it means.

Checked and left alone: the Gaming Mode 'Switch to Desktop' entry is
presented as a bug users hit, and that is right — v0.30.0's takeover
does stop the display manager on mask-fragile flavors
(gamescope.rs:259 at the tag), so it shipped. Only the mask-vs-stop
detail moved inside this cycle.

Gates: fmt clean, punktfunk-core --lib 273 passed, cargo metadata ok,
Play notes 456/500 and unique, voice scan finds no internal names in the
notes body.
2026-08-20 09:42:02 +02:00
enricobuehler 9e3fba10c1 release: 0.31.0 — fold in the four commits that landed during the re-cut
ci / bun-nix (pull_request) Successful in 29s
ci / docs-drift (pull_request) Successful in 29s
ci / web (pull_request) Successful in 1m43s
ci / docs-site (pull_request) Successful in 1m52s
ci / rust-arm64 (pull_request) Successful in 2m27s
ci / rust (pull_request) Canceled after 5m1s
170 -> 173 commits since v0.30.0 (115 non-merge, counted on this branch).

One is user-facing and is in the notes: the web console's Virtual
displays page rendered the Streamed-screen and session-lifetime cards
below the tab shell, so both tabs showed them and the Live tab read as
a duplicate of Configuration. They are policy surfaces and now sit
inside Configuration.

The other three are CHANGELOG-only: the guides trim's second round, the
fifth get-started screenshot (a client's host list), and the workflow
change that made it reachable — linux-client-screenshots now publishes
its PNGs to the generic registry as well, because the v3 artifact store
is browser-only and nothing could pull the shots out of it.

The CI bullet also records this branch's own retry.sh wrapping, since a
reader hitting 'Fail extracting tarball' deserves to find the diagnosis
rather than repeat it.

Gates re-run on this tip: fmt clean, punktfunk-core --lib 273 passed,
Play notes 456/500, both openapi copies identical at 0.31.0.
2026-08-20 09:36:58 +02:00
enricobuehler fd4f032d20 ci: retry bun install — a truncated tarball reads as a corrupt package
ci / bun-nix (pull_request) Successful in 44s
ci / docs-drift (pull_request) Successful in 43s
ci / web (pull_request) Successful in 1m14s
ci / rust (pull_request) Canceled after 2m3s
ci / rust-arm64 (pull_request) Canceled after 2m2s
ci / docs-site (pull_request) Canceled after 2m1s
docs-site died on `error: Fail extracting tarball for
"@rolldown/binding-linux-x64-gnu"` (run 19630, 2026-08-20). The message
points at the package; the package is fine.

MEASURED, because the message invites the wrong fix:
  * The tarball's sha512 matches docs-site/bun.lock exactly, and it is
    an ordinary 3-entry npm tgz — same gzip framing, same modes, no pax
    headers — as the 1.2.0 one that installs fine. Only the payload
    differs in size (20.6 MB vs 19.0 MB of .node).
  * bun 1.3.13 AND 1.3.14 both extract that exact tarball from disk in
    under 80 ms. So it is not the bun bump the floating oven/bun:1 tag
    brought in, and not a format bun stopped accepting.
  * In the SAME run, the web job installed the same registry over the
    same network and passed — it was 25 s ahead of docs-site.
  * Run 19632, seven minutes later, installed the identical lockfile
    and passed.

So: a transient truncation, not a bad package. bun streams
download-and-extract, so a tarball cut off mid-stream surfaces at the
extract step and names the package it was reading — which is why this
looks like `@rolldown/binding-linux-x64-gnu` is broken and why the
obvious fixes (bump rolldown, pin bun, refresh the lockfile) would all
have "worked" by changing which bytes were in flight, and none of them
would have fixed anything.

scripts/ci/retry.sh already exists for precisely this and its header
already diagnosed it: "the runner box executes many jobs in parallel and
its network drops packets under that load … Wrap every single-shot
network command in CI with this instead." `bun install` is a single-shot
network command and was the one class still unwrapped, so it is wrapped
now at all nine Linux sites — ci.yml (web, docs-site), arch, deb, rpm,
web-screenshots, sdk-publish and plugin-kit-publish (both installs).

3 attempts, not retry.sh's usual 5: a genuinely stale lockfile fails
deterministically under --frozen-lockfile, and 10s+20s of backoff is
enough to outlive a load burst without making that honest failure wait
a minute and a half.

The two windows-host.yml installs are left alone: pwsh, and a Windows
box that is not the contended runner.

Verified: all seven workflows still parse; the helper resolves from
web/, docs-site/ and sdk/ (the three working-directory shapes used);
the wrapper recovers a command that fails once and succeeds on the
retry; and `bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile
--ignore-scripts` in docs-site installs all 1138 packages, so the
lockfile is sound and the wrapper does not change the command.

Not done, deliberately: docs-site's lockfile still pins rolldown 1.1.2
where web has 1.2.0. That difference is real but it is not this bug,
and refreshing a lockfile to chase a network flake would have buried it.
2026-08-20 09:34:50 +02:00
enricobuehler 892e683f0e Merge remote-tracking branch 'origin/main' into worktree-release-next-prep 2026-08-20 09:24:01 +02:00
enricobuehler 7af6c323d0 Merge remote-tracking branch 'origin/main' into worktree-console-ui-off-toggle
android / android (pull_request) Successful in 7m15s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m44s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m8s
ci / bun-nix (pull_request) Successful in 31s
ci / docs-drift (pull_request) Successful in 31s
ci / web (pull_request) Successful in 1m4s
ci / docs-site (pull_request) Successful in 2m3s
ci / rust-arm64 (pull_request) Successful in 2m14s
ci / rust (pull_request) Successful in 6m34s
# Conflicts:
#	docs-site/content/docs/client-settings.md
2026-08-20 09:13:10 +02:00
enricobuehler 76e6618b84 fix(console-ui): Settings and the library are reachable without face buttons, for a TV remote
ci / docs-drift (pull_request) Successful in 36s
ci / bun-nix (pull_request) Successful in 38s
ci / web (pull_request) Successful in 1m15s
ci / docs-site (pull_request) Successful in 1m16s
ci / rust-arm64 (pull_request) Successful in 1m29s
android / android (pull_request) Canceled after 1m54s
ci / rust (pull_request) Canceled after 1m26s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Canceled after 0s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 1m59s
An Android TV's only input is its remote — a D-pad, OK and Back — and the
console bound both Settings and the game library to face buttons that
remote does not have. X opened Settings, Y opened the shelf, and neither
event could be produced: the Kotlin bridge emits Move/Confirm/Back for a
remote and nothing else, the carousel's only action tiles are Add Host and
Rescan, and the hint chips that also carry those actions need a finger on
a touchscreen. So on a TV the two were simply unreachable. This is the
gap the deleted Compose home used to paper over with its own "no face
buttons" mapping, and the same wall Apple hit on the Siri Remote.

Down on the carousel now opens Settings — the other free direction beside
up, which already opens the host menu. It is a second route on a pad and
the only route on a remote, so the hint bar names the one the device in
hand actually has: ▼ with no pad attached, X with one. That is the whole
extent of the legend change; Y still opens the library and still says so.

The shelf gains a Library row on the host's own options menu, which up
reaches, offered on exactly the terms Y offers it (saved AND paired). It
replaces the menu rather than stacking on it, so Back from the shelf lands
on the carousel and not on a menu about the host just left. This is also
the route `docs/game-library.md` has been describing all along — "open its
options and choose Library" — which until now did not exist.

▼ is a new hint glyph: the ▲ triangle stood on its head rather than a
second drawing routine, and pressable in the hint bar exactly as ▲ is.
2026-08-20 09:06:05 +02:00
enricobuehler 7d2a8778d1 fix(nix): the prune deleted the compositor and shipped only its launcher
ci / docs-drift (pull_request) Successful in 30s
ci / bun-nix (pull_request) Successful in 1m0s
ci / web (pull_request) Successful in 1m15s
ci / docs-site (pull_request) Successful in 1m16s
ci / rust-arm64 (pull_request) Successful in 1m52s
ci / rust (pull_request) Successful in 5m16s
nix / flake (pull_request) Successful in 12m29s
ROOT CAUSE of every gamescope symptom chased today. nixpkgs WRAPS this package:
makeWrapper leaves the real compositor ELF at bin/.gamescope-wrapped and
installs a small launcher at bin/gamescope that sets PATH (xwininfo) before
exec'ing it. Our prune kept only `gamescope`:

    find $out/bin -mindepth 1 ! -name gamescope -delete

so it deleted the compositor and shipped the launcher pointing at a path that
no longer existed. MEASURED (run 19622): $out/bin held one 16 KB file, and
`strings` on it showed the PATH prologue and '/bin/.gamescope-wrapped'.

That single line explains all of it:
  * `--version` printed NOTHING — the launcher exec'd a deleted target. I had
    attributed this to the build sandbox, and to upstream's PrintVersion()
    landing after 3.16.25. Both were wrong.
  * the +pfhdr marker was 'missing from the binary' — a wrapper carries no
    version string, so it never could have been there.

Keep the target through the prune, and assert on the WRAPPED ELF rather than
the launcher (which would otherwise pass or fail by accident). The launcher
references its target by absolute path, so renaming the launcher stays safe.

The guards were right on every run; they were reporting a genuinely broken
artifact, not a flaky check.
2026-08-20 07:02:22 +00:00
enricobuehler 6007bc42cd docs(client-settings): the console-off switch is in both places on Android, and neither row is offered on a TV
The Interface section owned two facts this changes: which surfaces carry
"Gamepad-optimized browsing" (the Android console home carries it now, so
that home can be left from inside it) and what an Android TV sees — the
mode row used to be described as present-but-inert there, and both rows are
simply absent now.
2026-08-20 08:40:59 +02:00
enricobuehler 16d54b73a1 feat(console-ui): the console can switch itself off, where there is a touch UI to switch off to
The Android console's settings screen had a picker for WHEN it fronts the
app but no switch for WHETHER it does — that lived only in the touch
settings, which a user already inside the console has no way to reach.
The console UI became the only UI on Android, so the way back out was a
setting you could only change from the thing you were trying to get to.

Adds the "Controller-optimized UI" row over the same `gamepadUiEnabled`
the touch switch writes, folded through `extra` under
`android.gamepad_ui_enabled` like the other Android-only rows. Off
returns to the touch home immediately: the console's save bumps the
snapshot generation, the host emits its settings event, and Kotlin's
`applySettings` now folds the flag back into the App state that
`gamepadUiActive` reads.

Shown only where "off" has somewhere to land. `ConsoleOptions.fallback_ui`
(new, threaded to `Ctx` beside `deck`) is true only for the Android touch
shell — false on a TV and for the desktop session, where this console IS
the interface and an off switch would strand the user in nothing.

The mode row follows the same rule and moves under it: it decides nothing
on a TV (the tv term satisfies `gamepadUiActive`'s OR on its own) or while
the switch is off, so it is hidden in both cases rather than offered as a
control that changes nothing. Renamed to the touch screen's own word for
it, "Show it" — "Controller UI" directly under "Controller-optimized UI"
was two rows told apart by their tails.
2026-08-20 08:40:59 +02:00
enricobuehler d60b1dda29 fix(nix): split the +pfhdr failure into its two possible stages
The marker is not in the installed ELF, and patch 0005 applies cleanly to a
src/meson.build that still carries the exact line it rewrites. Those two facts
cannot both be reasoned from the log as it stands, so stop guessing and
instrument the two stages separately:

  * postPatch now asserts +pfhdr is in src/meson.build after our vcs_tag
    substitution — the same gate build-punktfunk-gamescope.sh applies. If it
    fires, patch 0005 or the substitution lost the marker, and it prints the
    version block as patched.
  * the installCheck failure branch now prints evidence instead of an
    assertion: $out/bin, anything under $out mentioning pfhdr, and the
    version-shaped strings actually present in the binary.

Whichever fires, the next run says which stage drops it. Each guess here costs
a full compositor build, and I have now spent three on this one symptom.
2026-08-20 06:39:28 +00:00
enricobuehler d7fa5847f1 Merge pull request 'Virtual displays: the Streamed-screen and session⇄game cards showed on both tabs — they join the Configuration tab' (#353) from worktree-displays-tab-dup into main
ci / bun-nix (push) Successful in 39s
ci / web (push) Successful in 1m14s
ci / docs-site (push) Successful in 1m38s
ci / docs-drift (push) Successful in 1m4s
ci / rust-arm64 (push) Successful in 2m28s
deb / build-publish-gamescope (push) Successful in 41s
deb / build-publish-client-arm64 (push) Successful in 1m36s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 14s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 1m50s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 18s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 13s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 47s
deb / build-publish (push) Successful in 5m1s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m49s
arch / build-publish (push) Successful in 8m38s
deb / build-publish-host (push) Successful in 6m58s
docker / builders-arm64cross (push) Successful in 9s
docker / deploy-docs (push) Successful in 37s
deb / smoke-install (push) Successful in 3m7s
windows-host / package (push) Successful in 18m26s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 34s
ci / rust (push) Successful in 20m18s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m7s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 19m2s
2026-08-20 06:38:08 +00:00
enricobuehler e473a4be7b fix(web): the Virtual displays page's trailing cards join the Configuration tab
ci / bun-nix (pull_request) Successful in 28s
ci / docs-drift (pull_request) Successful in 1m1s
ci / web (pull_request) Successful in 1m23s
ci / rust-arm64 (pull_request) Successful in 2m3s
ci / docs-site (pull_request) Failing after 11m15s
ci / rust (pull_request) Successful in 20m0s
The Streamed screen and session-game lifetime cards sat BELOW the tab
shell, so they rendered on both tabs — from the Live displays tab the
page read as the Configuration tab's content duplicated (reported the
other way round, same sight). Both are policy surfaces, so they ride
inside the Configuration tab as siblings of the config card; the Live
tab is now only the live list + arrangement.
2026-08-20 08:34:05 +02:00
enricobuehler 675030935a fix(nix): assert +pfhdr in the installed binary, not by running --version
`--version` produces EMPTY output under nix's build sandbox — measured on BOTH
nixpkgs' 3.16.25 and the pinned 5fb8dce4 (runs 19551 / 19573 / 19594). It is a
sandbox property, not a defect: gamescope calls PrintVersion() before the getopt
loop (src/main.cpp:721), so `gamescope --version` does print the banner on a
real system, which is what the host's capability probe reads. My earlier claim
that the probe itself was broken was wrong.

packaging/gamescope/build-punktfunk-gamescope.sh already avoids running the
binary, asserting on src/meson.build instead. Grepping the installed ELF is
strictly stronger than either: the version string reaches .rodata via
GamescopeVersion.h's k_szGamescopeVersion, so this proves the marker survived
patching, meson configuration and compilation into the artifact we ship — and it
cannot be defeated by the binary being unable to start.

The src pin from the previous commit stays. It is still right for its own
reason: the patches are authored against 5fb8dce4, nixpkgs' 3.16.24 could not
take patch 0009 at all, and every other channel ships this exact commit.
2026-08-20 06:21:37 +00:00
enricobuehler 21d9190324 Merge pull request 'The fifth get-started screenshot — a client's host list — and the workflow change that made it reachable' (#352) from docs-host-list-shot into main
ci / bun-nix (push) Successful in 29s
ci / web (push) Successful in 1m9s
ci / docs-site (push) Successful in 1m17s
ci / docs-drift (push) Successful in 2m15s
ci / rust-arm64 (push) Successful in 3m17s
ci / rust (push) Successful in 13m27s
2026-08-20 06:19:35 +00:00
enricobuehler 7ae8866a5c Merge pull request 'Guides trim round 2: the five biggest pages each shed one prose category — −16%, no facts, anchors stable' (#350) from docs-guides-trim-round2 into main
ci / rust (push) Canceled after 24s
ci / docs-site (push) Canceled after 23s
ci / web (push) Canceled after 23s
ci / rust-arm64 (push) Canceled after 23s
ci / bun-nix (push) Canceled after 24s
ci / docs-drift (push) Canceled after 24s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 13s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 13s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 14s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 15s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 17s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 11s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 59s
docker / builders-arm64cross (push) Successful in 9s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 2m36s
docker / deploy-docs (push) Successful in 1m1s
2026-08-20 06:19:20 +00:00
enricobuehlerandClaude Fable 5 a8099e0f5b docs(quickstart): the client host list — the fifth get-started screenshot, pulled from the pipeline the previous commit teaches to publish
ci / web (pull_request) Successful in 3m38s
ci / bun-nix (pull_request) Successful in 51s
ci / docs-site (pull_request) Successful in 1m25s
ci / rust-arm64 (pull_request) Successful in 5m53s
ci / docs-drift (pull_request) Successful in 50s
ci / rust (pull_request) Successful in 7m46s
Saved hosts with their pairing state + an unpaired host found on the network, from
linux-client-screenshots run 19593 via the new generic-package publish (fixed 'ci' version,
anonymous GET), cropped to the cards. Completes the handoff's screenshot list: console login,
Waiting for approval + PIN, the Approve dialog, live status, and a client's host list.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 01:25:44 +02:00
enricobuehler b4b24f8b57 release: 0.31.0 — re-cut on d801cb72, folding in the 41 commits since #320
ci / rust-arm64 (pull_request) Successful in 1m59s
ci / web (pull_request) Successful in 1m25s
ci / bun-nix (pull_request) Successful in 54s
ci / docs-site (pull_request) Successful in 1m27s
ci / docs-drift (pull_request) Successful in 30s
ci / rust (pull_request) Successful in 16m35s
#320 merged but v0.31.0 was never tagged, and 69 more commits (41
non-merge) landed on top of it. The version stays 0.31.0 and Cargo.toml
does not move; the notes, Play notes and CHANGELOG section are
re-measured on the new tip.

THE NUMBER IS NOW FORCED, where the first cut's was a judgement call.
The C ABI moves 24 -> 25: punktfunk_set_log_callback plus the
PunktfunkLogCb typedef (#338's core half), so an embedder can hear the
core's tracing lines. Addition only — no declaration moved, no repr(C)
struct grew a field, and an embedder that never calls it is byte-
compatible with v24. include/punktfunk_core.h is therefore NO LONGER
byte-identical to the v0.30.0 tag, which the first cut's table and both
"nothing versioned moves" paragraphs claimed.

Table re-measured on d801cb72. Two rows changed since the first cut and
two were already corrected in-tree by their own commits:
  * C ABI 24 -> 25 (above).
  * api/openapi.json 0.29.0 -> 0.31.0 — the STAMP only. No management
    surface moved; the file had been left two versions stale and #337's
    regenerate-and-diff caught it. Both copies cmp identical.
  * SDK 0.1.5 and plugin-kit 0.4.3 were cut during the cycle (#348,
    #334), so the rows the first cut wrote as "owed" are now past tense.
    The registry still skips 0.4.2 on purpose.
Everything else holds: wire 2, driver protocol 6 / min 3, gamepad
channel 3, plugin index schema 1, host event schema 1, edition 2024,
MSRV 1.85, 27 crate dirs, gamescope +pfhdr8 with no new patches. The
PKGBUILD pfhdr7 discrepancy is unchanged and still pre-existing.

REWRITTEN RATHER THAN APPENDED TO, because the intervening work never
shipped and a user must not read a within-cycle correction as a second
bug:
  * The Gaming Mode takeover section. The first cut described "stops the
    login manager first, then steps in" — which #342 replaced before
    shipping, after a field report that a stopped display manager leaves
    the box unable to service Steam's own Switch to Desktop (it hung
    until reboot, and could not even be detected around: every trace of
    that switch is written by the component we had stopped). End state:
    idle the autologin over the gamescope-session-plus@ template, leave
    the DM running. #343 then deleted the whole 142-line stop/linger
    chain the old approach needed. Two shipped facts became false with
    it — the takeover no longer stops the DM and no longer needs the
    punktfunk group (that group still gates the usbip pad nodes) — and
    the notes' Before-you-update says so for Deck/Bazzite operators.
  * The Android ASC entries. HDR seeded from the codec's echo, untagged
    SDR raising blacks to grey, and the console's dispose re-showing the
    system bars over the stream are all regressions against THIS cycle's
    unreleased presenter, so they are folded into the Android story, not
    listed as fixes users hit.

NEW USER-FACING WORK, in rough order of how much it changes:
  * Windows client (#349): the default download becomes a signed
    per-user Inno Setup installer + portable zip; MSIX stays for the
    Store. This is the Steam fix — MSIX puts the exe under WindowsApps,
    which Steam's picker cannot browse, and alias activation defeats
    overlay injection. Before-you-update carries the one action in the
    release: an MSIX user who wants it must Remove-AppxPackage first and
    will re-pair once, because pairing identity lives with the package.
  * install.sh (#345/#346): one command from nothing to a pairable Linux
    host, running platforms.json's lines verbatim, with Sunshine
    coexistence, --dry-run, --uninstall and env twins. Shipped PREVIEW
    on purpose and the notes say so.
  * Send logs to host completes on Apple (#338) and Android (#339) — the
    two legs 0.30's notes named as follow-ups.
  * KWin 6.6 (#344/#331): it refuses to stream an output it created
    disabled, in the session's language, logged nowhere, and persists
    the disable against the stable per-client name so it repeats
    forever. Enable and retry; and a translated refusal no longer burns
    all 8 retries.
  * Deck Wake-on-LAN (#347, closes #322), portable Playnite covers
    (#330), plugin-kit republish on startup/manual (#334), console touch
    gestures and idle gates (#333), cancel-connect (#329), NixOS host
    builds failing outright (#328 + #332 + #336).
  * Docs overhaul (#337/#340/#343/#346): get-started track, Switching
    from Sunshine, screenshots, and data/platforms.json as the single
    source for install facts with seven CI drift gates over it.

Gates on this tree: cargo fmt --all --check clean (no drift this time —
the first cut needed a whitespace commit, which is already in main);
cargo metadata --offline ok; cargo test -p punktfunk-core --lib 273
passed; Play notes gate verbatim 456/500 and unique; voice scan clean
outside For developers; both openapi copies cmp identical at 0.31.0.

⚠ The C ABI harness still did not run here — no libopus on this MacBook
— and this time the header DID change, so ABI 25's C compile is owed to
CI. Named in Verification status rather than left to be found.

⚠ Owed outside this repo: platforms.json changed (the Windows download),
so punktfunk-website needs `bun run sync-platforms` committed — the step
#346 added to docs/releases/README.md, and this is its first exercise.
2026-08-20 01:24:15 +02:00
enricobuehlerandClaude Fable 5 c23fc84bef docs(guides): trim round 2 — each page sheds one prose category, no fact rows, headings or commands touched
ci / rust-arm64 (pull_request) Successful in 1m44s
ci / web (pull_request) Successful in 1m3s
ci / bun-nix (pull_request) Successful in 29s
ci / docs-site (pull_request) Successful in 1m24s
ci / docs-drift (pull_request) Successful in 23s
ci / rust (pull_request) Successful in 12m33s
The category sacrificed, per page (RFC 'screenshots over prose' / phase-2 handoff item 3):
- client-settings.md (4368→3144 words): the why-rationale narrative around each setting; every
  default, number, availability list, env var and link stays.
- virtual-displays.md (3724→3015): status/history notes (the 'What's live today' tracker
  paragraph, 'Windows has always lingered 10 s') and design rationale; compositor-specific
  operational facts stay.
- plugins.mdx (2835→2418): narrative duplication — restart instructions stated twice, story
  asides the linked plugin repos carry.
- input.md (2499→2403) and wake-on-lan.md (2286→2186): rationale asides and historical notes
  ('the plugin used to fire a packet itself…'); these two are per-platform fact tables end to
  end, so only a light pass was honest.

15712→13166 words over the five biggest Guides (−16%). Zero heading changes (anchors stable),
docs-drift + docs-links green, docs-site build + lint green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 01:17:16 +02:00
enricobuehler 0e5a059098 fix(nix): pin gamescope's src to 5fb8dce4, like every other channel
nix was the ONLY channel not pinning the compositor — the RPM spec, the
PKGBUILD, build-punktfunk-gamescope.sh and packaging/gamescope/README.md all
ship 5fb8dce4 (3.16.25-11), while gamescope.nix patched whatever version
nixpkgs happened to carry. That produced two failures in two days, both the
same bug:

  * nixpkgs shipped 3.16.24, where patch 0009's context does not exist, so the
    build died at patchPhase. host.gamescopeHdr defaults true, so every
    `services.punktfunk.host.enable = true` failed the same way.
  * bumping the lock to 3.16.25 fixed the patches, and then --version printed
    NOTHING. Upstream's `gamescope::PrintVersion()` landed AFTER the 3.16.25
    tag; in that tag `--version` is `return 0;` with the comment "We always
    print the version to stderr anyway". The host reads that banner to decide a
    session's bit depth and cursor compositing BEFORE the virtual display
    exists, so a silent banner is a silent fall back to SDR.

The installCheck was right to fail — this was not a check problem.

Also in this commit: the +pfhdr guard now prints the banner it read. That is
how the empty output was identified at all; without it the failure is
indistinguishable from the binary not starting, at ~15 min per guess.

vcs_tag now substitutes the PINNED version (old.version is the pre-override
attr and would still say 3.16.25).

nix-instantiate --parse clean. Hash from nix-prefetch-git --fetch-submodules.
2026-08-19 23:16:18 +00:00
enricobuehlerandClaude Fable 5 674b16d8eb linux-client-screenshots: publish the PNGs to the generic package registry too — the v3 artifact is browser-only, which blocked reusing the shots for the docs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-20 01:08:31 +02:00
enricobuehler d801cb72f2 Merge pull request 'Windows client: per-user installer + portable zip as the default download — a stable exe path Steam can launch (overlay, Big Picture); MSIX stays for the Store' (#349) from worktree-win-client-installer into main
ci / rust-arm64 (push) Successful in 2m26s
ci / web (push) Successful in 1m53s
ci / bun-nix (push) Successful in 35s
ci / docs-drift (push) Successful in 31s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 12s
ci / docs-site (push) Successful in 2m11s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 13s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 21s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 11s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 9s
ci / rust (push) Successful in 7m57s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 24s
installer-smoke / smoke (arch) (push) Successful in 45s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m34s
installer-smoke / smoke (fedora-44) (push) Successful in 1m18s
installer-smoke / smoke (debian-13) (push) Successful in 2m26s
docker / builders-arm64cross (push) Successful in 31s
docker / deploy-docs (push) Successful in 32s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m39s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m48s
2026-08-19 23:05:32 +00:00
enricobuehler b03acc9153 Windows client: ship a per-user Inno Setup installer + portable zip as the default download; keep the MSIX for the Store
ci / web (pull_request) Successful in 1m21s
ci / docs-site (pull_request) Successful in 1m32s
ci / bun-nix (pull_request) Successful in 21s
ci / rust-arm64 (pull_request) Successful in 2m4s
ci / docs-drift (pull_request) Successful in 25s
installer-smoke / smoke (arch) (pull_request) Successful in 43s
installer-smoke / smoke (fedora-44) (pull_request) Successful in 1m0s
installer-smoke / smoke (debian-13) (pull_request) Successful in 1m33s
ci / rust (pull_request) Successful in 8m26s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m23s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m48s
A user report: launching via Big Picture doesn't work and the Steam overlay never appears.
Not because the app is UWP (it's full-trust Win32 under MSIX too) but because of the MSIX
install SHAPE: the exe lives under the ACL'd WindowsApps dir Steam's non-Steam-game picker
can't browse, and alias/shell:AppsFolder activation defeats the overlay's injection — Steam
must spawn the exe itself from a normal path.

- punktfunk-client.iss: per-user (no UAC) install to %LOCALAPPDATA%\Programs\Punktfunk.
  Re-creates the manifest's grants in HKCU (punktfunk:// scheme, Start entries, {app} on the
  user PATH for the punktfunk CLI) and fetches the Windows App Runtime when missing.
- pack-client-installer.ps1: consumes pack-msix.ps1's layout (one assembly, three artifacts),
  signs the four exes individually, emits setup.exe + a portable zip. Same signing backends
  and fail-closed-on-tags rule as the sibling scripts; no .cer (an exe runs untrusted).
- windows-client.yml: pack step after the MSIX, publish + release-attach the new artifacts
  (canary/latest aliases punktfunk-client-setup_<arch>.exe, ..._<arch>-portable.zip).
- deeplink.rs: write_shortcut targets the app-execution alias only under package identity;
  unpackaged installs have no alias but a stable path, so they target current_exe().
  has_package_identity() now shared with main.rs's AppUserModelID probe.
- docs: install-client (installer default + a 'Launching through Steam' section + MSIX/portable
  as alternates), channels, uninstall, clients, platforms.json (both copies, drift check green).
2026-08-20 00:52:46 +02:00
enricobuehler ace01f06a2 Merge pull request 'Cut SDK 0.1.5 — the mgmt-endpoint fix cannot reach a plugin until it ships' (#348) from release-sdk-0.1.5 into main
ci / bun-nix (push) Successful in 42s
ci / rust-arm64 (push) Successful in 1m42s
ci / docs-drift (push) Successful in 23s
ci / docs-site (push) Successful in 2m49s
ci / web (push) Successful in 2m51s
deb / build-publish-gamescope (push) Successful in 47s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 38s
deb / build-publish-client-arm64 (push) Successful in 1m41s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 15s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 15s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 10s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 18s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m1s
sdk-publish / publish (push) Successful in 42s
deb / build-publish (push) Successful in 5m5s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m34s
deb / build-publish-host (push) Successful in 4m57s
arch / build-publish (push) Successful in 11m7s
docker / builders-arm64cross (push) Successful in 11s
ci / rust (push) Canceled after 40s
docker / deploy-docs (push) Canceled after 0s
deb / smoke-install (push) Successful in 3m9s
windows-host / package (push) Successful in 17m26s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 36s
nix / flake (push) Failing after 24m46s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 27m7s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 29m36s
2026-08-19 22:51:11 +00:00
enricobuehler e4ec4cec31 chore(sdk): cut 0.1.5 — the mgmt-endpoint fix cannot reach a plugin until it ships
ci / rust-arm64 (pull_request) Successful in 1m33s
ci / bun-nix (pull_request) Successful in 22s
ci / web (pull_request) Successful in 2m7s
ci / docs-drift (pull_request) Successful in 30s
ci / docs-site (pull_request) Successful in 2m12s
ci / rust (pull_request) Successful in 7m25s
nix / flake (pull_request) Successful in 15m37s
v0.31.0's changelog recorded this cut as owed and said why: plugins resolve
`@punktfunk/host` from the registry, so a fix sitting in `sdk/` reaches nobody
until a version carries it. Four commits have touched the SDK since sdk-v0.1.4,
the headline one being the mgmt-port fix — a moved `PUNKTFUNK_MGMT_BIND` left
every plugin and the tray dialing 47990.

`SDK_VERSION` moves with it. It is a hand-maintained constant (the bundled
runner has no package.json to read at runtime), and the runner compares it
against the SDK actually installed in the plugins tree to decide whether to
reinstall — so shipping 0.1.5 with the constant still reading 0.1.4 would have
published the fix and then never delivered it. `version.test.ts` exists for
exactly this and caught it.

Gates: 83/83 SDK tests pass.
2026-08-20 00:50:46 +02:00
enricobuehler 245173a731 fix(nix): make the +pfhdr guard show the banner it actually read
The memory raise got gamescope building, and it now reaches installCheckPhase
and fails there:

    punktfunk-gamescope: the +pfhdr marker is missing — the patches did not take

Patch 0005 applied cleanly to src/meson.build in that same run, so the message
is misleading: the patch DID take. Two very different causes are
indistinguishable from the log as written —

  * the binary never ran (shrunk RPATH, missing loader dep), so --version
    printed nothing at all; or
  * it ran and printed a version without +pfhdrN, meaning upstream no longer
    builds the banner from VCS_TAG.

A guard that reports 'missing' without showing what it read cannot be acted on,
and each guess costs a full compositor build. Capture the output and print it on
failure, with a note on how to read the two cases apart.

No behaviour change: same assertion, same exit. Also verified in this run: the
chmod fix works (prune, rename and layer install all completed) and the WSI
layer is installed.
2026-08-19 22:46:07 +00:00
enricobuehler 230d253b06 Merge pull request 'The Deck learns a host's wake MAC, so Wake-on-LAN can fire there at all' (#347) from worktree-deck-wol-learn-mac into main
ci / web (push) Successful in 1m37s
ci / bun-nix (push) Successful in 28s
ci / docs-drift (push) Successful in 35s
ci / rust-arm64 (push) Successful in 2m42s
ci / docs-site (push) Successful in 2m30s
deb / build-publish-gamescope (push) Successful in 1m40s
deb / build-publish-client-arm64 (push) Successful in 1m58s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 20s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 22s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 20s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 19s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 17s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 16s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 13s
ci / rust (push) Successful in 7m16s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 59s
deb / build-publish (push) Successful in 5m8s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m19s
arch / build-publish (push) Canceled after 8m19s
deb / build-publish-host (push) Canceled after 5m10s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 1s
docker / builders-arm64cross (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 49s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 48s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Failing after 6m43s
android / android (push) Successful in 11m48s
flatpak / build-publish (push) Successful in 4m58s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m14s
Reviewed-on: #347
2026-08-19 22:41:32 +00:00
enricobuehler def215ae8e Merge pull request 'Installer bedding-in (--uninstall, NVIDIA silent-failure checks, detection matrix as gate 7) and screenshots for the get-started track' (#346) from worktree-docs-phase2 into main
android / android (push) Canceled after 44s
arch / build-publish (push) Canceled after 40s
ci / rust (push) Canceled after 38s
ci / rust-arm64 (push) Canceled after 37s
ci / web (push) Canceled after 36s
ci / docs-site (push) Canceled after 35s
ci / bun-nix (push) Canceled after 0s
ci / docs-drift (push) Canceled after 0s
deb / build-publish (push) Canceled after 4s
deb / build-publish-host (push) Canceled after 0s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 12s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 10s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 10s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 2s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 0s
decky / build-publish (push) Successful in 47s
installer-smoke / smoke (arch) (push) Successful in 42s
apple / swift (push) Successful in 2m13s
installer-smoke / smoke (debian-13) (push) Successful in 1m2s
installer-smoke / smoke (fedora-44) (push) Successful in 2m15s
apple / distribute (push) Successful in 11m38s
apple / screenshots (push) Successful in 10m38s
2026-08-19 22:40:55 +00:00
enricobuehlerandClaude Fable 5 dfcc530ee7 installer bedding-in: --uninstall, NVIDIA silent-failure checks, the detection matrix as CI gate 7 — and the get-started track gets its screenshots
ci / docs-drift (pull_request) Successful in 48s
ci / docs-site (pull_request) Successful in 1m30s
ci / web (pull_request) Successful in 2m8s
apple / swift (pull_request) Successful in 2m16s
apple / distribute (pull_request) Skipped
installer-smoke / smoke (debian-13) (pull_request) Successful in 58s
apple / screenshots (pull_request) Skipped
installer-smoke / smoke (fedora-44) (pull_request) Successful in 43s
ci / bun-nix (pull_request) Successful in 30s
ci / rust-arm64 (pull_request) Successful in 3m6s
installer-smoke / smoke (arch) (pull_request) Successful in 1m34s
ci / rust (pull_request) Successful in 7m54s
android / android (pull_request) Successful in 8m7s
Phase 2 of the docs-and-onboarding overhaul (items 1-partial, 2 and 4 of the handoff):

install.sh: --uninstall reverses step 1 + step 6 per family (user units off first, only the
punktfunk packages actually installed, then the repo; config/groups/firewall stay, as
/docs/uninstall states) — smoke-tested as a new installer-smoke step on all three families.
The end-of-run check now catches the two NVIDIA silent failures on every family: no driver at
all, and a module the kernel refused to load (Secure Boot) via an nvidia-smi probe pointing at
the troubleshooting anchor; the Fedora ffmpeg-libs/NVENC warning folds into the same block.

check-docs-drift.sh gate 7: the manual 16-file os-release matrix PR #345 was verified with,
committed — every family's detection, its install line, its removal line and the four
unsupported pointers run through the real script under --dry-run on every push (docs-drift's
container gains curl, the script's own prerequisite).

Screenshots (RFC: "screenshots over prose"): four console shots captured from the same
storybook-fixture pipeline web-screenshots.yml runs — login and the armed Pairing page into
quickstart.md, the Approve dialog (access level + expiry + guest fast-path) into pairing.md
replacing the prose that described it, live status into web-console.md. Files under
docs-site/public/img/, dark-theme, bundled+preloaded by the docs build (verified served).
Still missing: a client host-list shot — linux-client-screenshots run 19546 built it, but its
artifact isn't API-downloadable; add it when a browser session can fetch the zip.

WP5 rider: the release-flow docs-freshness step now includes the website content look-over.

NOT flipped: installer stays preview — the handoff gates the default flip on real-box mileage
(Bazzite above all), which a Mac can't provide.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 23:56:19 +02:00
enricobuehler 6b5307618f Merge pull request 'KWin creates our virtual output disabled and refuses to stream it — enable it and retry' (#344) from worktree-kwin-vout-enable-repair into main
ci / bun-nix (push) Successful in 23s
ci / web (push) Successful in 1m23s
ci / docs-drift (push) Successful in 1m10s
ci / docs-site (push) Successful in 1m44s
ci / rust-arm64 (push) Successful in 2m12s
deb / build-publish-gamescope (push) Successful in 59s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 42s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 34s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 17s
deb / build-publish-client-arm64 (push) Successful in 1m36s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 13s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 14s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 17s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m8s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m31s
android / android (push) Failing after 7m23s
deb / build-publish-host (push) Successful in 5m43s
ci / rust (push) Successful in 7m28s
docker / builders-arm64cross (push) Successful in 10s
docker / deploy-docs (push) Successful in 34s
arch / build-publish (push) Successful in 8m37s
deb / build-publish (push) Successful in 4m5s
deb / smoke-install (push) Successful in 3m8s
windows-host / package (push) Successful in 12m55s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 35s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 17m26s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Failing after 7m12s
2026-08-19 20:48:43 +00:00
enricobuehler cdacd5636e Merge remote-tracking branch 'origin/main' into worktree-kwin-vout-enable-repair
ci / bun-nix (pull_request) Successful in 32s
ci / docs-drift (pull_request) Successful in 35s
ci / web (pull_request) Successful in 1m13s
ci / docs-site (pull_request) Successful in 1m43s
ci / rust-arm64 (pull_request) Successful in 2m20s
android / android (pull_request) Successful in 5m39s
ci / rust (pull_request) Successful in 6m20s
2026-08-19 22:39:11 +02:00
enricobuehler 47f01149bf Merge pull request 'Guided Linux installer (preview): one command from nothing to a pairable host, running exactly what platforms.json states, smoke-tested in CI per package family' (#345) from worktree-wp4-install-script into main
apple / swift (push) Successful in 2m10s
ci / web (push) Successful in 2m2s
ci / rust-arm64 (push) Successful in 3m4s
ci / bun-nix (push) Successful in 26s
ci / docs-drift (push) Successful in 25s
ci / docs-site (push) Successful in 2m12s
deb / build-publish-gamescope (push) Successful in 27s
decky / build-publish (push) Successful in 1m3s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 24s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 19s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
deb / build-publish-client-arm64 (push) Successful in 2m19s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 15s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 15s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 21s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 11s
deb / build-publish (push) Successful in 4m5s
ci / rust (push) Successful in 8m17s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 27s
arch / build-publish (push) Successful in 10m11s
installer-smoke / smoke (arch) (push) Successful in 56s
installer-smoke / smoke (fedora-44) (push) Successful in 1m0s
installer-smoke / smoke (debian-13) (push) Successful in 1m16s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m41s
docker / builders-arm64cross (push) Successful in 22s
android / android (push) Successful in 11m46s
docker / deploy-docs (push) Successful in 39s
deb / build-publish-host (push) Successful in 8m27s
apple / distribute (push) Successful in 12m59s
deb / smoke-install (push) Successful in 2m35s
apple / screenshots (push) Successful in 9m45s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 16m1s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 17m39s
2026-08-19 19:01:45 +00:00
enricobuehlerandClaude Fable 5 59ef285f08 process: the PR template asks whether a user-facing fact changed, and the release flow gets a docs-freshness step
ci / bun-nix (pull_request) Successful in 25s
ci / docs-drift (pull_request) Successful in 59s
ci / docs-site (pull_request) Successful in 1m32s
ci / web (pull_request) Successful in 1m39s
apple / swift (pull_request) Successful in 2m9s
installer-smoke / smoke (arch) (pull_request) Successful in 32s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust-arm64 (pull_request) Successful in 2m26s
installer-smoke / smoke (debian-13) (pull_request) Successful in 2m47s
installer-smoke / smoke (fedora-44) (pull_request) Successful in 2m8s
android / android (pull_request) Successful in 8m1s
ci / rust (pull_request) Successful in 8m18s
WP5 of the docs-and-onboarding overhaul, the two riders the RFC attaches to WP2–WP4:

- .gitea/PULL_REQUEST_TEMPLATE.md — one question: did a user-facing fact change, and is the
  docs-site page that owns it updated in this PR (install/repo/port facts in data/platforms.json).
  CI's docs-drift only catches the mechanical half; this is the reminder for the rest.
- docs/releases/README.md step 1 — while the release diff is in front of you, check docs freshness,
  and if platforms.json changed, run `bun run sync-platforms` in punktfunk-website and commit,
  because the download page vendors that file and only refreshes when someone does.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 21:01:00 +02:00
enricobuehler 5bec450402 install.sh: probe /dev/tty by opening it — a container has the node but no controlling terminal, so -r/-w said yes and the redirect failed (first installer-smoke run); name the matrix jobs by family
ci / bun-nix (pull_request) Successful in 41s
ci / docs-drift (pull_request) Successful in 46s
ci / web (pull_request) Successful in 1m12s
ci / docs-site (pull_request) Successful in 1m49s
ci / rust-arm64 (pull_request) Successful in 1m54s
installer-smoke / smoke (arch) (pull_request) Successful in 49s
apple / swift (pull_request) Successful in 2m17s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
installer-smoke / smoke (fedora-44) (pull_request) Successful in 1m22s
installer-smoke / smoke (debian-13) (pull_request) Successful in 1m45s
android / android (pull_request) Canceled after 3m55s
ci / rust (pull_request) Canceled after 3m56s
2026-08-19 20:57:02 +02:00
enricobuehlerandClaude Fable 5 cd6ce34892 install.sh: a guided Linux installer (preview) that runs exactly the commands platforms.json states, with a CI smoke test per package family
ci / bun-nix (pull_request) Successful in 35s
ci / docs-drift (pull_request) Successful in 20s
ci / docs-site (pull_request) Successful in 1m21s
installer-smoke / smoke (arch, archlinux:base, pacman -Sy --noconfirm --needed curl git nodejs && (pacman-key --init >/dev/null 2>&1 || true)) (pull_request) Failing after 23s
installer-smoke / smoke (fedora-44, fedora:44, dnf install -y -q curl git nodejs) (pull_request) Failing after 0s
ci / web (pull_request) Successful in 1m27s
ci / rust-arm64 (pull_request) Successful in 1m31s
installer-smoke / smoke (debian-13, debian:trixie, apt-get update -qq && apt-get install -y -qq --no-install-recommends ca-certificates curl git nodejs) (pull_request) Failing after 21s
apple / swift (pull_request) Successful in 2m19s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
android / android (pull_request) Canceled after 2m37s
ci / rust (pull_request) Canceled after 2m38s
WP4 of the docs-and-onboarding overhaul (punktfunk-planning design/docs-and-onboarding-overhaul.md).

scripts/install.sh — plain POSIX sh (dash-clean), ~380 lines, `curl -fsSL https://punktfunk.unom.io/install.sh | sh`:
detect the distro from os-release (apt / dnf / pacman / rpm-ostree→sysext; NixOS, SteamOS, Windows
and unknown distros get a one-line pointer and stop; Debian 12 / Ubuntu 24.04 / Mint 22 / Fedora
45 hit the documented floors with the right docs link) → install with the platforms.json lines
VERBATIM (channel and the Fedora group are edited into the string at run time; `--yes` rewrites
them non-interactive, a tty hands the package manager its own prompt; stdin is never read, because
under `curl | sh` stdin is the script) → `punktfunk-host detect-conflicts` (exit 1 = active
Sunshine-family host) → offer to keep both by moving the management API port (PUNKTFUNK_MGMT_BIND,
default 47991, the firewall step opens it) → input group (ujust on Bazzite; no-op if already in) →
optional punktfunk group, GameStream compat, shared clipboard (all default no) → firewalld/ufw
profiles → enable host + console (+ the plugin runner where it isn't) → optional linger → verify
(unit active, UDP 9777 bound) and print the console URL, the password command and the pairing
steps. `--dry-run` prints every command and changes nothing; every prompt has a PUNKTFUNK_INSTALL_*
environment twin; re-running is safe (install skipped when the binary exists). Running under sudo
is refused (host.env and the units belong to the user); root without sudo gets a shim so the
verbatim lines still work.

Decisions: the canonical URL is punktfunk.unom.io/install.sh, a 302 on the website to the script at
raw/branch/main (versioned with the code it installs; precedent: the Bazzite sysext bootstrap) —
the website half is punktfunk-website PR #4. GPU drivers stay the docs pages' job; the one silent
failure (Fedora + NVIDIA without RPM Fusion's ffmpeg-libs → no NVENC) is called out at the end.

Gates: check-docs-drift.sh gate 6 — every apt/pacman/dnf/sysext install line in data/platforms.json
must appear verbatim in the script, and the script must parse (shown to fail on a planted drift).
New path-filtered workflow installer-smoke.yml runs the script unattended in debian:trixie,
fedora:44 and archlinux:base against the real registry, then `punktfunk-host --version`,
`detect-conflicts`, and a re-run that must say "already installed".

Docs: install hub gains "Guided install (preview)" rendered from platforms.json's new `installer`
block via an <Installer/> component (one-liner + inspect-first form + flags); CONTRIBUTING names
the new gate. Verified locally: sh/dash -n, both docs gates, docs-site build + lint, and a
--dry-run matrix over 16 faked os-release files (all four families, every floor, canary, every
option, piped stdin). The container run itself is the CI job's to report — Docker on this machine
was wedged under another session's emulated build.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 20:54:13 +02:00
enricobuehler 20568d988f fix(kwin): KWin creates our virtual output disabled and refuses to stream it — enable it and retry
ci / web (pull_request) Successful in 1m29s
ci / rust-arm64 (pull_request) Successful in 2m30s
ci / docs-site (pull_request) Successful in 1m14s
ci / docs-drift (pull_request) Failing after 19s
ci / bun-nix (pull_request) Successful in 1m42s
android / android (pull_request) Successful in 10m8s
ci / rust (pull_request) Failing after 10m48s
On KWin >= 6.6 `streamVirtualOutput` creates the output on the backend and then
passes `workspace()->findOutput(output)` to the stream, which is null for an
output the workspace does not manage (`wantsToManage` = `isEnabled() &&
!isNonDesktop()`). So an output KWin creates DISABLED is refused with
"Could not find output" — translated into the session's language, and logged
nowhere, because disabling an output is a perfectly valid configuration that
applies successfully. 6.4/6.5 passed the backend output straight through and
streamed it either way.

It repeats forever. The host asks for a STABLE per-client output name precisely
so KWin persists that client's scale and mode against it, so a stored setup
naming it `enabled: false` is reapplied to every future session for that client
— and the user cannot fix it in System Settings, because the output only exists
for the few milliseconds the request is alive.

Repair it instead. On a refusal, enable the head over kde_output_management_v2
and let the retry go again. Two properties of KWin make that possible, both read
off Plasma/6.7 rather than assumed:

  * `sendFailed` only sends the event — it does not emit `finished`, and
    `removeVirtualOutput` is wired to `finished`. The disabled output therefore
    stays alive for as long as we hold the failed stream open, which is the
    window the repair runs in (and why it must run inside the worker thread,
    before the connection drops).
  * `WaylandServer::handleOutputAdded` offers EVERY backend output to the
    output-device registry, gating only placeholders and non-desktop ones. Only
    `wl_output` is gated on being enabled, so a disabled output is invisible to
    `stream_output` but fully addressable over output management.

Enabling it is a user-applied configuration, so KWin persists it against that
output's identity: the retry's fresh request finds a stored setup that enables
it. The repair therefore fixes attempt N+1, never attempt N.

`REPAIRED_HINT` keeps that retry reachable. The opener wraps every worker error
with "KWin virtual output failed", which is the phrase the host's
`is_permanent_build_error` matches to short-circuit the retry loop — so a
repaired refusal carrying it would be classified permanent and the retry that
consumes the repair would never run, making the whole path dead code. A repaired
refusal is reported verbatim without that wrapper; an unrepairable one keeps it
and still fails fast, because nothing about the box changed. The host-side test
pins both halves.
2026-08-19 20:29:27 +02:00
enricobuehler 2a60f94f74 Merge pull request 'Land the WP2 docs rewrite on main (#340 merged into the already-merged #337 branch) and make docs-drift green again' (#343) from docs-wp2-to-main into main
apple / swift (push) Successful in 2m8s
ci / rust-arm64 (push) Successful in 2m29s
ci / docs-site (push) Successful in 1m24s
ci / web (push) Successful in 1m33s
ci / bun-nix (push) Successful in 26s
ci / docs-drift (push) Successful in 26s
deb / build-publish-gamescope (push) Successful in 30s
deb / build-publish-client-arm64 (push) Successful in 1m42s
decky / build-publish (push) Successful in 38s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 10s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 16s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 17s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 16s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 14s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
arch / build-publish (push) Successful in 10m27s
deb / build-publish (push) Successful in 5m7s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 48s
android / android (push) Successful in 11m33s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m4s
deb / build-publish-host (push) Successful in 5m46s
apple / distribute (push) Successful in 11m16s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 14s
docker / deploy-docs (push) Successful in 55s
docker / builders-arm64cross (push) Successful in 13s
ci / rust (push) Successful in 22m5s
apple / screenshots (push) Successful in 9m53s
deb / smoke-install (push) Successful in 7m18s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 16m47s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 20m7s
2026-08-19 18:23:48 +00:00
enricobuehler 60406c9d72 Merge origin/main into the docs WP2 branch — bazzite.md was rewritten as bazzite.mdx here and re-touched by #342 there; #342's fact (the Gaming Mode takeover no longer needs the punktfunk group) is ported into bazzite.mdx and the four distro pages, and the Apple client's PUNKTFUNK_CORE_LOG_LEVEL (from #338) is baselined so docs-drift is green on main again.
ci / web (pull_request) Successful in 2m8s
apple / swift (pull_request) Successful in 2m18s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / bun-nix (pull_request) Successful in 31s
ci / docs-drift (pull_request) Successful in 36s
ci / rust-arm64 (pull_request) Successful in 2m57s
ci / docs-site (pull_request) Successful in 1m43s
android / android (pull_request) Successful in 6m54s
ci / rust (pull_request) Successful in 8m37s
2026-08-19 20:21:44 +02:00
enricobuehler 65f697651e Merge pull request 'The bun OOM is a 7 GiB cgroup cap, not a big build — measure it in the log' (#341) from nix-serialise-bun-builds into main
ci / docs-drift (push) Failing after 28s
ci / bun-nix (push) Successful in 30s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 13s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 11s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 11s
ci / docs-site (push) Successful in 1m9s
ci / web (push) Successful in 1m18s
ci / rust-arm64 (push) Successful in 1m26s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 29s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 40s
docker / builders-arm64cross (push) Successful in 39s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m17s
docker / deploy-docs (push) Successful in 1m15s
ci / rust (push) Canceled after 5m30s
nix / flake (push) Failing after 15m16s
Reviewed-on: #341
2026-08-19 18:18:28 +00:00
enricobuehler a00c4d2a6a Merge pull request 'Docs for two audiences: a get-started track that fits on one screen, a Switching-from-Sunshine page, and install commands quoted from platforms.json' (#340) from worktree-docs-wp2-rewrite into worktree-docs-wp0-wp1-anti-drift
Reviewed-on: #340
2026-08-19 18:16:28 +00:00
enricobuehler e12ef6633c Merge pull request 'A stopped display manager left the box unable to switch sessions — idle its autologin instead' (#342) from worktree-kwin-vout-failed-permanent into main
ci / bun-nix (push) Successful in 26s
ci / docs-drift (push) Failing after 26s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 15s
deb / build-publish-gamescope (push) Successful in 33s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 9s
ci / docs-site (push) Successful in 1m19s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 13s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 47s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 56s
deb / build-publish-client-arm64 (push) Successful in 2m37s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m18s
deb / build-publish-host (push) Successful in 7m10s
android / android (push) Successful in 9m56s
ci / rust-arm64 (push) Successful in 3m39s
arch / build-publish (push) Successful in 9m45s
ci / web (push) Successful in 1m45s
windows-host / package (push) Successful in 13m41s
windows-host / winget-source (push) Skipped
docker / builders-arm64cross (push) Successful in 17s
docker / deploy-docs (push) Successful in 43s
windows-host / canary-manifest (push) Successful in 30s
ci / rust (push) Failing after 11m34s
deb / build-publish (push) Successful in 5m49s
deb / smoke-install (push) Successful in 4m53s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 25m37s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 26m25s
2026-08-19 17:40:07 +00:00
enricobuehler 38a0f54b09 refactor(gamescope): delete the display-manager stop chain the idled takeover retired
ci / bun-nix (pull_request) Successful in 37s
ci / web (pull_request) Successful in 1m14s
ci / docs-site (pull_request) Successful in 1m23s
android / android (pull_request) Successful in 6m52s
ci / rust-arm64 (pull_request) Successful in 2m23s
ci / rust (pull_request) Successful in 9m30s
`cargo check` on Linux flagged six functions the previous commit orphaned. The
linger machinery existed for one reason — stopping the display manager ends the
user's last login session, and logind would take the host down with it about 10 s
later — and nothing stops a display manager any more, so the whole chain goes:
`try_stop_display_manager`, `ensure_host_survives_dm_stop`,
`host_is_under_user_manager`, `cgroup_under_user_manager`, `linger_enabled`, and
the one test that covered only the cgroup predicate. 142 lines out, 17 in.

`mask_unit` becomes `#[cfg(test)]` rather than going with them. Its only caller
now is the mask-lift test, and that test still guards live code:
`lift_autologin_mask` cleans up a takeover adopted from a host old enough to have
laid a mask, so the state it undoes has to stay constructible.

`pf-dm-helper` keeps its `stop` and `linger` verbs even though no caller is left —
only `restore` is still reached — because removing them changes the shipped polkit
action's surface, which is a packaging decision rather than a cleanup.
2026-08-19 19:38:57 +02:00
enricobuehler c420ae4676 Merge pull request 'The Apple client can send its logs to the host — and finally keeps a log worth sending' (#338) from worktree-apple-send-logs into main
audit / bun-audit (sdk) (push) Successful in 23s
audit / bun-audit (plugin-kit) (push) Successful in 30s
audit / bun-audit (web) (push) Successful in 29s
audit / docs-site-audit (push) Successful in 21s
audit / pnpm-audit (push) Successful in 21s
audit / cargo-audit (push) Failing after 57s
apple / swift (push) Successful in 2m13s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m24s
android / android (push) Canceled after 4m34s
arch / build-publish (push) Canceled after 4m40s
ci / rust (push) Canceled after 3m47s
ci / rust-arm64 (push) Canceled after 38s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
ci / docs-drift (push) Canceled after 0s
deb / build-publish (push) Canceled after 15s
deb / build-publish-host (push) Canceled after 10s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 19s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 11s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 13s
audit / license-gate (push) Successful in 5m3s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 28s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 28s
windows-host / package (push) Canceled after 0s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
audit / c-abi-asan (push) Successful in 5m35s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m11s
audit / miri (push) Successful in 11m8s
apple / distribute (push) Successful in 11m13s
flatpak / build-publish (push) Successful in 6m6s
apple / screenshots (push) Successful in 9m46s
nix / flake (push) Failing after 23m42s
2026-08-19 17:35:44 +00:00
enricobuehlerandClaude Fable 5 bfd0de8973 docs: two audiences, one home per fact — get-started rewrite, a Switching-from-Sunshine page, and install commands quoted from platforms.json
ci / rust-arm64 (pull_request) Successful in 1m30s
apple / swift (pull_request) Successful in 1m59s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / web (pull_request) Successful in 2m5s
ci / bun-nix (pull_request) Successful in 46s
ci / docs-site (pull_request) Successful in 1m25s
ci / docs-drift (pull_request) Successful in 46s
android / android (pull_request) Successful in 8m17s
ci / rust (pull_request) Successful in 22m6s
WP2 of the docs-and-onboarding overhaul (punktfunk-planning design/docs-and-onboarding-overhaul.md),
stacked on #337 (WP0+WP1).

Nav (meta.json) is now Get started / Guides / Switching from Sunshine / Reference / Troubleshooting.

Get-started track, rewritten for someone with no Linux expertise — one task per page, happy path,
under two minutes each: quickstart (5 steps), install (a pick-your-system hub), ubuntu, debian,
fedora, arch, bazzite (+ a firewall step it was missing), a new nixos page (moved out of install),
pairing. Every distro page quotes its install snippet through a new <Install platform="…"/> MDX
component that reads docs-site/src/data/platforms.json — a byte-identical snapshot of
data/platforms.json (the Docker build context is docs-site/ alone, same arrangement as
openapi.json) which scripts/ci/check-docs-drift.sh now gates. <Ports/> renders the port table the
same way on a new reference page, ports.mdx, so the four distro pages stop restating port lists.

platforms.json itself was fixed while wiring it up: the apt snippet lacked the keyring lines, the
winget one lacked `winget source add`, the Arch repo-add is now idempotent (grep guard — the
documented double-append gotcha disappears at the source), names match the real floors (Ubuntu
26.04+, Windows 11 22H2+), a web-console port entry and the firewall profile names were added, and
client platforms (Windows MSIX, macOS, TestFlight, Play, Steam Deck) so the website can render its
cards from the same file.

Dense material moved down rather than deleted: build-from-source.md (the three distro appendices),
the Mint/LMDE/Cinnamon analysis → requirements.md, TOFU/`--open` → security.md, Secure Boot MOK
paths and the Arch libavcodec soname refusal → troubleshooting, sysext channels/rollback/rebase →
updating.md, the 0.28.1 cert note → windows-host.

New page switching-from-sunshine.md: coexistence via the 47990 move (PUNKTFUNK_MGMT_BIND), the
Windows display-topology overlap, detect-conflicts exit semantics (1 only for an active host — the
troubleshooting page said "non-zero if any"), what maps to what, migration steps. The
troubleshooting Sunshine section is tightened and points there.

The three facts whose only home was a README now live in troubleshooting — the ffmpeg-libs weak
dependency (no NVENC on Fedora), the pacman double-append error, the ds_inhibit SELinux storm with
DualSense pads on Bazzite — and packaging/bazzite + packaging/arch READMEs are pointers.

Stale claims corrected against the tree: the packaged unit runs the native-only `serve` and
GameStream is opt-in on every route (kde, hyprland, security, steamos-host said otherwise);
host.env is optional (EnvironmentFile=-); Fedora 43 uses the `bazzite` group; the iOS clipboard
bridge exists; PUNKTFUNK_GAMESCOPE_SDR_NITS defaults to 203.

Guides trimmed for verbosity (~5% by words — they are fact-dense; every heading, command, number,
env var and link target is preserved, verified by token-inventory diffs). Tooling: docs-site README
and CONTRIBUTING describe the platforms snapshot; input/uninstall/support-matrix links retargeted.

Verified: check-docs-drift.sh and check-docs-links.sh green, docs-site `bun run build` + `bun run
lint` green, and the built site served locally to confirm every cross-page anchor the rewrite
links to (37) renders, plus the <Install/> blocks and the <Ports/> table.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 19:08:38 +02:00
enricobuehlerandClaude Fable 5 1dd5df0127 ci: the drift gate matched its own comment, and the OpenAPI snapshot was two versions stale
Two reds on #337's first CI run, both self-inflicted:

- Gate 3 greps every quoted "PUNKTFUNK_*" literal outside docs-site — including the gate's own
  explanatory comment, which spelled out ("PUNKTFUNK_X") as an example and so reported PUNKTFUNK_X
  as a new undocumented knob. Reworded the comment; the regex is unchanged.
- The `rust` job's regenerate-and-diff found `api/openapi.json` still saying `"version": "0.29.0"`
  while the crate is 0.31.0 — the only difference in the whole spec. Regenerated with
  `cargo run -p punktfunk-host -- openapi` (in the punktfunk-rust-ci image) and copied the
  docs-site snapshot.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-19 19:07:56 +02:00
enricobuehler 08c45b96eb fix(nix): measure the cgroup cap instead of guessing at the bun OOM
ci / web (pull_request) Successful in 1m15s
ci / rust-arm64 (pull_request) Successful in 2m11s
ci / docs-drift (pull_request) Failing after 23s
ci / docs-site (pull_request) Successful in 1m42s
ci / bun-nix (pull_request) Successful in 1m55s
ci / rust (pull_request) Failing after 7m38s
nix / flake (pull_request) Failing after 14m44s
Reverts the --max-jobs 1 from the previous commit. The hypothesis it encoded —
that punktfunk-web and punktfunk-scripting bundling concurrently exhausted the
box — is DISPROVEN: run 19444 failed identically with it, and the Environment
step it added shows why the premise was wrong:

    Mem: 125Gi total, 48Gi available     Swap: 8.0Gi     nproc: 16
    overlay 172G, 108G avail

Nothing was scarce. Serialising also would have cost real wall-clock on the
publish tier, which builds six derivations including an hour of Rust, so it does
not stay on an unproven basis.

Also ruled out: bun is 1.3.13 in BOTH the old and new nixpkgs, so the lock bump
did not change the bundler.

What remains is what those numbers cannot see. Inside a container /proc/meminfo
and free(1) report the HOST, so a cgroup memory cap is invisible to them — and a
cap is the only explanation left for a SIGKILL with 48Gi apparently free. So
read it directly: cgroup v2 memory.max, falling back to v1
memory.limit_in_bytes.

No fix in this commit, deliberately. Two guesses have already cost a day of red
runs; the next change should follow the number.
2026-08-19 17:06:24 +00:00
enricobuehler a52d60e242 test(core): the log-sink collector asserts nothing itself — an extern "C" fn must not panic (hygiene gate B)
ci / bun-nix (pull_request) Successful in 24s
ci / web (pull_request) Successful in 1m10s
ci / docs-site (pull_request) Successful in 2m3s
apple / swift (pull_request) Successful in 2m15s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust-arm64 (pull_request) Successful in 3m5s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m0s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m36s
android / android (pull_request) Successful in 9m4s
ci / rust (pull_request) Successful in 24m47s
nix / flake (pull_request) Successful in 15m51s
2026-08-19 19:02:21 +02:00
enricobuehler c2f5e91b3d fix(gamescope): a stopped display manager left the box unable to switch sessions — idle its autologin instead
The managed takeover freed Steam by stopping the box's gaming session and,
because a display-manager autologin puts that session straight back, by stopping
the display manager too. That worked until the user asked for a desktop session:
with no DM there is nothing on the box able to start one, so Steam's own "Switch
to Desktop" sat on its modal until a reboot (field report 2026-08-18, .41).

It also could not be detected and worked around. On a steamos-manager box the
switch is a D-Bus call whose every trace is written by the display manager we had
just stopped — measured on .41: the `~/.config/steamos-session-select` sentinel is
never written (that is the ChimeraOS/Nobara layout), `/var/lib/sddm/state.conf`
only advances when sddm actually STARTS a session, `get-default-login-mode` stays
`game` for a non-persistent switch, and `graphical-session.target` going inactive
fires at takeover time too. There is nothing to watch, because the component that
would produce the signal is the one we disabled.

So stop disabling it. The takeover now idles the box's autologin session for the
stream's duration — a drop-in over the `gamescope-session-plus@` template that
replaces `ExecStart` with a process that sleeps — and leaves the DM running. The
autologin still SUCCEEDS, so there is no failed unit to relogin against (a masked
one fails in milliseconds, which is the storm's engine); the session runs nothing,
so Steam is free; and the DM is alive, so the box can service the switch itself.
No privilege, no DM-flavor matrix, and no detection.

Measured on .41, both directions: takeover leaves `steam` down, `sddm` active and
the unit `active (running)` with NRestarts=0; the switch that used to hang brings
Plasma up in ~10 s; the restore puts Steam back within 5 s.

The drop-in lives under $XDG_RUNTIME_DIR for the same reason the bind one does —
it replaces the box's game-mode ExecStart, so a copy outliving the host would be a
box whose Game Mode silently does nothing — and is swept unconditionally at
startup. Its removal sits above every early return in the restore, next to the
bind drop-in's, because the desktop-active return is exactly the path that would
leak it. The restore restarts rather than starts: the unit is active-but-idle, and
`start` on an active unit is a no-op that would log success over it.

Docs and the shipped Bazzite host.env said the takeover has to stop the display
manager and needs the `punktfunk` group; both are now false. The group still gates
the usbip nodes the virtual Steam Deck pad attaches through, which is what the
advice narrows to.
2026-08-19 18:58:18 +02:00
enricobuehler 44cb7f7815 test(core): keep the SAFETY comment on the line before its unsafe block (rustfmt had split them)
apple / swift (pull_request) Successful in 2m10s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m54s
ci / rust-arm64 (pull_request) Successful in 3m43s
ci / web (pull_request) Successful in 3m20s
ci / docs-site (pull_request) Successful in 1m22s
ci / rust (pull_request) Failing after 6m0s
ci / bun-nix (pull_request) Successful in 2m24s
android / android (pull_request) Canceled after 8m49s
nix / flake (pull_request) Canceled after 3m42s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 6m9s
2026-08-19 18:53:20 +02:00
enricobuehler 52b89a1592 style(core): rustfmt the log-sink additions
apple / swift (pull_request) Successful in 2m6s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m51s
ci / rust-arm64 (pull_request) Failing after 2m19s
ci / rust (pull_request) Failing after 4m2s
ci / docs-site (pull_request) Successful in 1m22s
android / android (pull_request) Canceled after 4m58s
ci / web (pull_request) Canceled after 2m11s
ci / bun-nix (pull_request) Canceled after 40s
nix / flake (pull_request) Canceled after 27s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 2m28s
2026-08-19 18:47:47 +02:00
enricobuehler 57446f9ed9 feat(core): ABI v25 — punktfunk_set_log_callback, so the Apple client hears the core's log lines
ci / rust (pull_request) Failing after 5m3s
android / android (pull_request) Canceled after 6m35s
apple / swift (pull_request) Canceled after 1m41s
apple / distribute (pull_request) Canceled after 0s
apple / screenshots (pull_request) Canceled after 0s
ci / rust-arm64 (pull_request) Canceled after 5m46s
ci / web (pull_request) Canceled after 1m39s
ci / docs-site (pull_request) Canceled after 1m29s
ci / bun-nix (pull_request) Canceled after 0s
nix / flake (pull_request) Canceled after 2s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Canceled after 40s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 0s
The core logs through tracing; the desktop and Android shells install a subscriber/logger and
see those lines, the Swift client installed none and saw nothing — every transport warning,
quinn connection event and rustls handshake note vanished, and a client log bundle sent to the
host carried the shell's half only.

- punktfunk_set_log_callback(max_level, cb, user): a log::Log backend behind a C callback
  (level, target, message, user), level-gated by log::set_max_level so anything above the
  ceiling costs no formatting; NULL detaches; Unsupported when another log backend already owns
  the process (android_logger). tracing's `log` feature declared explicitly by the core — it was
  on transitively via quinn, which an ABI promise must not rest on. ABI_VERSION 24 → 25, header
  regenerated, embedding doc §2.6.
- Apple: CoreLog.install() at app start routes the lines into ClientLog under core.<crate>
  (os_log + the send-to-host ring), info ceiling by default (PUNKTFUNK_CORE_LOG_LEVEL raises it).
- Test: a log record and a tracing event both reach the callback with level/target/message,
  interior NUL dropped not truncated, ceiling honoured, detach silences.
2026-08-19 18:33:59 +02:00
enricobuehler a4f6e259e3 fix(nix): serialise the bun builds — punktfunk-web is OOM-killed beside scripting
The nix job's recurring red is not a broken bundle, it is memory:

    punktfunk-web> error: script "build" was terminated by signal SIGKILL (Forced quit)
    Reason: builder failed with exit code 137

MEASURED 2026-08-19: five runs across main and two branches died exactly there,
while other runs on the SAME commits passed — the signature of pressure, not of
a defect. nix builds punktfunk-web and punktfunk-scripting concurrently, and
each one runs a memory-hungry bundler; that pairing is what the runner cannot
afford.

`--max-jobs 1` caps how many DERIVATIONS build at once, not the cores inside
one, so two bundles that each pin a core simply run in sequence. Applied to the
publish tier too, which builds six derivations including those same two.

This step sits BEFORE the publish tier, so every one of those failures also
stopped the binary cache from filling — it has blocked more runs today than
every real bug combined.

Also prints memory in the Environment step. An exit 137 cannot be explained by
the disk numbers that step used to gather on their own.
2026-08-19 16:30:41 +00:00
enricobuehler 6d82716598 Merge pull request 'Android "Send logs to host": the logcat-teed ring uploads over the client's own mTLS' (#339) from worktree-console-ui-sendlogs-android into main
ci / rust-arm64 (push) Successful in 2m3s
ci / web (push) Successful in 2m23s
ci / docs-site (push) Successful in 2m31s
ci / bun-nix (push) Successful in 23s
ci / docs-drift (push) Failing after 25s
deb / build-publish-gamescope (push) Successful in 50s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 11s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 9s
ci / rust (push) Failing after 7m50s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 8s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 10s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 9s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 9s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 7s
deb / build-publish-client-arm64 (push) Successful in 2m31s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 53s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m22s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m27s
deb / build-publish-host (push) Successful in 5m2s
arch / build-publish (push) Successful in 11m31s
deb / build-publish (push) Successful in 5m53s
android / android (push) Successful in 13m17s
flatpak / build-publish (push) Successful in 7m7s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m15s
docker / builders-arm64cross (push) Successful in 11s
docker / deploy-docs (push) Successful in 48s
deb / smoke-install (push) Successful in 3m24s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 21m57s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 25m9s
Reviewed-on: #339
2026-08-19 16:28:27 +00:00
enricobuehler f584eebb92 feat(android): "Send logs to host" works from the console — the ring, teed from logcat, uploads over the client's own mTLS
ci / bun-nix (pull_request) Successful in 40s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m36s
ci / web (pull_request) Successful in 1m38s
ci / docs-site (pull_request) Successful in 1m40s
ci / rust-arm64 (pull_request) Successful in 3m54s
ci / rust (pull_request) Successful in 6m42s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m40s
android / android (pull_request) Successful in 9m5s
WP5b of punktfunk-planning design/console-ui-sweep-2026-08-19.md (the last open item):

- pf-client-core: the logring's RING half (note/render/wallclock — std only) is
  Android-enabled; `send_to_host` stays desktop-gated with the rest of the ureq
  fetches. `wallclock` moves in from the session's ring_layer so every ring feeder
  stamps lines the same way.
- Android native: JNI_OnLoad installs a RingTee — every `log` record goes to logcat
  AND into the ring, in the desktop ring_layer's line shape. `nativeRenderLogs(header)`
  hands Kotlin the rendered bundle.
- Kotlin: `SkiaConsole.sendLogs` replaces the not-available stub — renders the ring
  and POSTs it to /api/v1/client-logs over `mtlsHttpClient` (the library/art path),
  noticing the desktop wording on success/failure. The upload deliberately stays on
  the Kotlin side: OkHttp already owns HTTPS-to-the-pinned-host on this platform,
  and pulling ureq+rustls into the .so for one POST would be a dependency change,
  not a feature.
- console-ui: the host menu's "Send logs" desktop-only gate is gone — paired and
  reachable is the whole condition again; the pinning test flips to assert both
  platforms offer it.
2026-08-19 18:26:13 +02:00
enricobuehler cd0a370229 Merge pull request 'One home per fact: IA rules, docs drift gates in CI, and the READMEs stop restating the docs' (#337) from worktree-docs-wp0-wp1-anti-drift into main
ci / bun-nix (push) Successful in 58s
ci / web (push) Successful in 1m25s
ci / docs-site (push) Successful in 1m34s
ci / docs-drift (push) Failing after 43s
apple / swift (push) Successful in 2m11s
ci / rust-arm64 (push) Successful in 2m8s
deb / build-publish-gamescope (push) Successful in 56s
decky / build-publish (push) Successful in 51s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 23s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
deb / build-publish-client-arm64 (push) Successful in 2m33s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 21s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 10s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 10s
docker / deploy-docs (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 7s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 8s
deb / build-publish (push) Successful in 4m21s
android / android (push) Canceled after 6m11s
arch / build-publish (push) Canceled after 5m59s
ci / rust (push) Canceled after 4m32s
deb / build-publish-host (push) Canceled after 4m19s
deb / smoke-install (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 44s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 44s
flatpak / build-publish (push) Canceled after 26s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 24s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 16s
apple / distribute (push) Successful in 11m33s
apple / screenshots (push) Successful in 10m3s
Reviewed-on: #337
2026-08-19 16:22:04 +00:00
enricobuehler 3301f5aa60 feat(clients/apple): Send logs to host — a bounded in-app log ring, posted to the paired host from the card menu and the gamepad host options
ci / bun-nix (pull_request) Successful in 26s
ci / web (pull_request) Successful in 1m16s
ci / rust-arm64 (pull_request) Successful in 1m25s
ci / docs-site (pull_request) Successful in 1m26s
apple / swift (pull_request) Successful in 2m16s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust (pull_request) Successful in 5m20s
The Gaming Mode console got "Send logs to host" in 0.30 (pf_client_core::logring +
POST /api/v1/client-logs); the Apple client had no ring to send and no POST on its mgmt
transport, and its own session lifecycle was never logged at all — a field report from an
Apple TV carried only the host's half.

- ClientLog: drop-in for Logger(subsystem: "io.unom.punktfunk", category:) — same call
  shape (privacy:/format: interpolations accepted), writes os_log AND a process-global ring
  bounded by 4096 lines / 768 KiB (under the host's 1 MiB cap), stamped with wall-clock
  ISO-8601 so a bundle lines up with the host log. .debug stays out of the ring (per-key
  input chatter would flush it — the Steam Deck DPB lesson). 13 Logger declarations swapped.
- MgmtTransport/MgmtConnection: POST with a length-framed body on the same pooled, pinned
  mTLS connection; LibraryClient.sendLogs posts the ring and returns the bundle id.
- SendLogs.toHost (app): identity + pinned fingerprint required, same gates as the library.
- UI: "Send Logs to Host" in the host card's context menu (paired hosts) with an alert for
  the outcome; a "Send logs to host" row on the gamepad host options screen whose label and
  detail band report Sending…/Logs sent/Couldn't send in place, like Copy link.
- SessionModel logs connect asked/landed/refused, disconnect and session-ended reason.
- ClientLogTests: ring bounds + eviction note + truncation, logger format, POST framing.
2026-08-19 18:17:59 +02:00
enricobuehler 1f0b12de6d Merge pull request 'The gamescope prune can't delete reshade — it installs under read-only directories' (#336) from gamescope-prune-writable into main
ci / bun-nix (push) Successful in 1m24s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 15s
ci / docs-site (push) Successful in 1m51s
ci / web (push) Successful in 1m58s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 15s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 14s
ci / rust-arm64 (push) Successful in 2m18s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 18s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 19s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 40s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 48s
docker / builders-arm64cross (push) Successful in 14s
docker / deploy-docs (push) Successful in 55s
ci / rust (push) Successful in 6m43s
nix / flake (push) Failing after 13m24s
Reviewed-on: #336
2026-08-19 14:42:29 +00:00
enricobuehler 3def50a88a Merge pull request '"Capture system shortcuts" on Mac reaches ⌘Space and ⌘Tab, with Accessibility' (#335) from worktree-apple-system-shortcut-tap into main
ci / bun-nix (push) Successful in 28s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 15s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 11s
ci / web (push) Successful in 1m13s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 11s
ci / docs-site (push) Successful in 1m43s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 27s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 14s
ci / rust (push) Canceled after 1m55s
ci / rust-arm64 (push) Canceled after 2m6s
apple / swift (push) Successful in 2m16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 28s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 26s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
apple / distribute (push) Successful in 11m55s
apple / screenshots (push) Successful in 9m58s
Reviewed-on: #335
2026-08-19 14:40:15 +00:00
enricobuehlerandClaude Opus 5 8f9e451395 docs: one home per fact — IA rules, CI drift gates, and READMEs stop restating the docs
ci / web (pull_request) Successful in 1m3s
ci / bun-nix (pull_request) Successful in 41s
ci / rust-arm64 (pull_request) Successful in 1m58s
ci / docs-drift (pull_request) Failing after 47s
ci / docs-site (pull_request) Successful in 1m48s
android / android (pull_request) Successful in 7m26s
ci / rust (pull_request) Failing after 8m7s
apple / swift (pull_request) Successful in 2m4s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
WP0+WP1 of the docs-and-onboarding overhaul (punktfunk-planning
design/docs-and-onboarding-overhaul.md):

- CONTRIBUTING.md + docs-site/README.md state the ownership rule (docs-site
  owns user-facing facts; READMEs keep rationale + pointers; the website
  deep-links) and the get-started vs reference audience split.
- ci.yml gains a docs-drift job (scripts/ci/check-docs-drift.sh +
  check-docs-links.sh): the OpenAPI snapshot must be a byte copy of
  api/openapi.json, PUNKTFUNK_* vars the docs mention must exist in the tree,
  the undocumented-var set is ratcheted against a named baseline file,
  host-cli.md commands must exist in the host crate, data/platforms.json must
  parse, and internal doc/README links must resolve. The rust job additionally
  regenerates the spec from the built host and diffs it — closing the 'not
  gated' hole CONTRIBUTING itself confessed to. All seven gates were shown to
  FAIL on planted violations before landing (the gate-of-the-gate rule).
- data/platforms.json: single source for install commands, repo URLs, ports
  and the Sunshine/Apollo/Vibeshine conflict facts — the docs rewrite (WP2),
  website download page (WP3) and guided installer (WP4) consume it.
- READMEs (root, bazzite, debian, arch, rpm, flatpak) stop restating docs
  walkthroughs (net -444 lines); facts whose only home a README was (the
  ds_inhibit SELinux storm, the ffmpeg-libs weak dep, the pacman.conf
  double-append) stay put, marked for the WP2 migration.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-19 16:39:39 +02:00
enricobuehler 0d22333831 Merge pull request 'Console-UI sweep: touch gestures, controller-audio rows, host-menu bind/clipboard, Android idle gates' (#333) from worktree-console-ui-sweep-wps into main
ci / bun-nix (push) Successful in 29s
ci / web (push) Successful in 1m25s
ci / docs-site (push) Successful in 1m33s
ci / rust-arm64 (push) Successful in 2m18s
deb / build-publish-gamescope (push) Successful in 47s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 17s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 10s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m12s
deb / build-publish-client-arm64 (push) Successful in 1m52s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 11s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 25s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 22s
deb / build-publish (push) Successful in 4m29s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 34s
ci / rust (push) Successful in 6m39s
deb / build-publish-host (push) Successful in 5m54s
docker / builders-arm64cross (push) Successful in 13s
docker / deploy-docs (push) Successful in 35s
arch / build-publish (push) Successful in 10m24s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Failing after 6m42s
android / android (push) Successful in 12m1s
flatpak / build-publish (push) Successful in 7m11s
deb / smoke-install (push) Successful in 3m17s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 18m41s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 19m48s
Reviewed-on: #333
2026-08-19 14:26:32 +00:00
enricobuehler 47602f7e59 feat(apple): "Capture system shortcuts" reaches ⌘Space and ⌘Tab, with Accessibility
ci / docs-site (pull_request) Successful in 1m27s
ci / web (pull_request) Successful in 1m30s
ci / bun-nix (pull_request) Successful in 1m32s
apple / swift (pull_request) Successful in 2m10s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust-arm64 (pull_request) Successful in 2m15s
ci / rust (pull_request) Successful in 6m56s
A 0.30.0 user reported the setting does nothing for ⌘Space. It never could:
the macOS implementation (0.29, b2146f33) is an NSEvent local monitor, which
only sees the keys AppKit delivers to the app — ⌘Q, ⌘W and their like. The
shortcuts macOS itself owns (⌘Space → Spotlight, ⌘Tab → the Dock, ⌃↑ →
Mission Control, everything under System Settings › Keyboard › Shortcuts) are
consumed by WindowServer before any app is asked. The SDL clients take those
via the private CGSSetGlobalHotKeyOperatingMode, which SDL only compiles in
outside the sandbox; this app is sandboxed on both channels.

The sandbox-legal way is a session-level CGEventTap, which needs Accessibility.
`InputCapture` now installs one while forwarding (and only then — it comes
down with setForwarding(false)/stop(), and capture already releases on any
focus loss, so the tap is never live with another app frontmost). The tap
forwards nothing itself: it takes each keyDown/keyUp off the system and
re-posts it into this app's own queue, addressed to the key window, so it
arrives exactly where the same key would have had macOS not claimed it — the
monitor first (client chords, ⌘ chords → host), then StreamLayerView (the
rest). One key path, no second VK table, no second release bookkeeping; and
the ⌘-chord keyUps macOS used to swallow now arrive too.

Two things verified in standalone harnesses rather than assumed: a reposted
event does reach a local monitor, and a windowless NSEvent(cgEvent:) does NOT
reach the first responder — NSApp.sendEvent routes key events by
event.window — hence the re-stamp onto the key window's number. The
intercept half (tap ahead of Spotlight, inside the sandbox) needs a granted
Accessibility switch this machine doesn't have; that is the live test left.

Gating per event: forwarding, capture mouse model (⌃⌥⇧M flips it
mid-capture, so it is read live rather than at install), app active. Any
other state passes the key through untouched — a tap that swallows keys for
the whole Mac is the failure mode designed against. Installed on the main
run loop on purpose: a hung main thread trips the tap timeout and macOS hands
the keyboard back; the callback re-arms on kCGEventTapDisabledBy* otherwise.

The Accessibility prompt is asked only from Settings — on a genuine off→on
flip of the toggle, or an explicit "Allow Accessibility access…" button that
also opens the pane — never at stream start, and never for the default-on
users this update lands on. Without the grant the setting keeps doing what it
did in 0.29, and its caption now says exactly which half works. App Review
notes carry the justification.
2026-08-19 15:55:02 +02:00
enricobuehler f415c7d090 Merge pull request 'Cut plugin-kit 0.4.3 — the sync-engine changes plugins cannot pick up otherwise' (#334) from release-plugin-kit-0.4.3 into main
ci / rust-arm64 (push) Successful in 3m40s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 7s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 21s
ci / web (push) Successful in 1m17s
ci / bun-nix (push) Successful in 36s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 11s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 14s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 9s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 11s
ci / docs-site (push) Successful in 1m11s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 20s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 28s
docker / builders-arm64cross (push) Successful in 24s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m15s
docker / deploy-docs (push) Successful in 35s
ci / rust (push) Successful in 7m38s
plugin-kit-publish / publish (push) Successful in 44s
nix / flake (push) Failing after 11m57s
2026-08-19 13:51:03 +00:00
enricobuehler e86c6367e1 chore(plugin-kit): cut 0.4.3 — the sync-engine changes plugins cannot pick up otherwise
ci / web (pull_request) Successful in 1m12s
ci / bun-nix (pull_request) Successful in 53s
ci / docs-site (pull_request) Successful in 1m23s
ci / rust-arm64 (pull_request) Successful in 1m35s
ci / rust (pull_request) Successful in 7m35s
nix / flake (pull_request) Failing after 12m52s
Two changes have been sitting in `sync-engine.ts` with no way to reach a
plugin: `minInterval` (the fs-change rate cap), which v0.31.0's changelog
already recorded as owing a cut, and the always-apply sync reasons — `startup`
and `manual` publish even when the fingerprint matches, so an operator who
fixes a host-side art-root problem recovers by restarting the runner instead
of deleting the plugin's cache file.

The registry skips 0.4.2 deliberately. `plugin-kit-v0.4.2` was tagged at the
Steam cover-art commit but its publish never landed — the registry's newest kit
is still 0.4.1 — and the tag is left exactly where it is rather than moved onto
newer code. Every consumer's range is a caret (`^0.4.1`, `^0.4.2`), so 0.4.3
satisfies all of them, and the plugin that asked for `^0.4.2` gets the
cover-art scan it was waiting for in the same package.
2026-08-19 15:47:34 +02:00
enricobuehler 0fd44d8242 fix(console-ui): drop_non_drop in the bind-profile test — NLL already ends the borrow
ci / bun-nix (pull_request) Successful in 28s
ci / web (pull_request) Successful in 1m11s
ci / docs-site (pull_request) Successful in 1m17s
ci / rust-arm64 (pull_request) Successful in 3m12s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m32s
ci / rust (pull_request) Successful in 8m5s
android / android (pull_request) Successful in 8m48s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m51s
2026-08-19 15:45:53 +02:00
enricobuehler 6807d7951c fix(nix): make $out writable before the prune — reshade installs read-only
ci / bun-nix (pull_request) Successful in 25s
ci / docs-site (pull_request) Successful in 1m12s
ci / web (pull_request) Successful in 1m17s
ci / rust-arm64 (pull_request) Successful in 1m43s
ci / rust (pull_request) Successful in 5m13s
nix / flake (pull_request) Failing after 10m41s
With the WSI layer building, the derivation reaches the prune and dies on every
reshade file it tries to remove:

    rm: cannot remove '.../share/gamescope/reshade/Shaders/lilium__tone_mapping.fx':
        Permission denied

gamescope's own default_extras_install.sh installs those under read-only
DIRECTORIES (mode 555), and rm needs write permission on the CONTAINING
directory rather than on the file. The compositor is fully built and installed
by that point, so the log reads as finished right up to the failure.

Only reachable now that #332 got the build past the layer assertion — the third
latent fault in this install path, each one having masked the next: patch drift
(#328), enableWsi defaulting off (#332), and now this.

Nix seals $out read-only after the builder exits, so widening it mid-build costs
nothing and changes nothing in the output.
2026-08-19 13:39:04 +00:00
enricobuehler f50721aedb fix(console-ui): the two HostRow literals the field sweep missed (pair test, settings test)
ci / bun-nix (pull_request) Successful in 44s
ci / rust-arm64 (pull_request) Failing after 1m9s
ci / web (pull_request) Successful in 1m11s
ci / docs-site (pull_request) Successful in 1m12s
ci / rust (pull_request) Failing after 3m2s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Failing after 4m8s
android / android (pull_request) Successful in 5m58s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m10s
2026-08-19 15:32:37 +02:00
enricobuehler 5d3301ed9b feat(console-ui): touch gestures, controller-audio rows, host-menu bind/clipboard, Android idle gates
ci / bun-nix (pull_request) Successful in 27s
ci / rust-arm64 (pull_request) Failing after 57s
ci / web (pull_request) Successful in 1m2s
ci / docs-site (pull_request) Successful in 1m17s
ci / rust (pull_request) Failing after 3m7s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Failing after 3m31s
android / android (pull_request) Successful in 6m14s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m57s
The 2026-08-19 console-ui sweep (punktfunk-planning design/console-ui-sweep-2026-08-19.md),
WP1-WP6:

- WP1 — touch deferred-tap + drag-to-scroll. PointerInput::Down grows a touch flag
  (SDL Finger* arms and Android toolType feed it; SDL's touch-synthesized mouse events
  are dropped); the shell tracks the gesture: within slop a lift is a tap delivered at
  the anchor, past it drags emit one synthetic scroll tick per 56dp of dominant-axis
  travel. Fixes the on-glass defect where any swipe across the settings list cycled the
  value it landed on (MenuList presses focus AND activate). Mouse behavior unchanged.
  Fling deliberately not included; the Release edge stays for it.
- WP2 — Controller haptics + Controller speaker rows (trust::Settings::{pad_haptics,
  pad_speaker}) in the Controller tab, forwarding-gated like their siblings; the
  speaker row speaks the GTK switch's dialect over the stored string. Detail strings
  are platform-aware now (the Stats/Mouse desktop chords are not taught on Android).
- WP3 — Send logs was already desktop-gated in actions(); pinned by a test.
- WP4 — ConsoleCmd::BindProfile lands (the port design's WP5 leftover): a Default
  profile… host-menu action opens a pin_hosts-style chooser; desktop arm writes
  KnownHost::profile_id, Kotlin arm mirrors it.
- WP5 — per-host Shared clipboard toggle on the host menu (HostRow::clipboard_sync,
  ConsoleCmd::SetClipboard, both service arms). Platform defaults stay divergent on
  purpose; the console shows and writes the stored value only.
- WP6 — Android idle gates: the reachability sweep only probes while the console is
  attached, and the render thread drops to half rate after 60s without input.
2026-08-19 15:14:20 +02:00
enricobuehler bd140bd232 Merge pull request 'gamescope builds no WSI layer, so nothing under it could get an HDR10 swapchain' (#332) from gamescope-enable-wsi-layer into main
ci / rust-arm64 (push) Successful in 3m24s
ci / bun-nix (push) Successful in 22s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 11s
ci / web (push) Successful in 2m13s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 9s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 8s
ci / docs-site (push) Successful in 2m25s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 9s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 6s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 29s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 9s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 31s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m18s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m16s
ci / rust (push) Successful in 7m46s
docker / builders-arm64cross (push) Successful in 14s
docker / deploy-docs (push) Successful in 56s
nix / flake (push) Failing after 14m23s
Reviewed-on: #332
2026-08-19 12:51:39 +00:00
enricobuehler d161c12680 Merge pull request 'A translated KWin refusal burned all 8 retries, and ex11's docs still stated a rule we replaced' (#331) from worktree-kwin-vout-failed-permanent into main
ci / bun-nix (push) Successful in 40s
apple / swift (push) Successful in 2m14s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 27s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 27s
ci / docs-site (push) Successful in 1m33s
ci / web (push) Successful in 1m46s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 20s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 23s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 14s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 16s
ci / rust-arm64 (push) Successful in 2m29s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 45s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 36s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m17s
deb / build-publish-gamescope (push) Successful in 54s
deb / build-publish-client-arm64 (push) Successful in 1m31s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m24s
deb / build-publish-host (push) Successful in 5m30s
deb / build-publish (push) Successful in 3m49s
docker / builders-arm64cross (push) Successful in 8s
docker / deploy-docs (push) Successful in 33s
android / android (push) Successful in 10m12s
flatpak / build-publish (push) Successful in 7m22s
deb / smoke-install (push) Successful in 3m1s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 6m54s
arch / build-publish (push) Successful in 11m6s
ci / rust (push) Successful in 7m36s
apple / distribute (push) Successful in 12m8s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 17m53s
apple / screenshots (push) Successful in 9m35s
windows-host / package (push) Successful in 13m13s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 35s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 22m20s
Reviewed-on: #331
2026-08-19 12:33:20 +00:00
enricobuehler 7537e8e6b2 Merge pull request 'A portable Playnite's covers were dropped, and nothing republished them once you fixed it' (#330) from worktree-playnite-art-roots-and-blank-sources into main
ci / bun-nix (push) Successful in 29s
ci / web (push) Successful in 1m17s
ci / docs-site (push) Successful in 1m54s
ci / rust-arm64 (push) Successful in 2m43s
deb / build-publish-gamescope (push) Successful in 52s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 22s
android / android (push) Canceled after 3m55s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 28s
arch / build-publish (push) Canceled after 4m10s
ci / rust (push) Canceled after 4m9s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 17s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 18s
deb / build-publish-client-arm64 (push) Successful in 1m39s
deb / build-publish (push) Canceled after 4m6s
deb / build-publish-host (push) Canceled after 3m19s
deb / smoke-install (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 19s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 18s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 20s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 22s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 11s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 0s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 58s
windows-host / package (push) Canceled after 5m31s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
Reviewed-on: #330
2026-08-19 12:29:25 +00:00
enricobuehler 2b81bd286f fix(clients): the Deck learns a host's wake MAC, so Wake-on-LAN can fire there at all
ci / bun-nix (pull_request) Successful in 27s
ci / web (pull_request) Successful in 1m33s
ci / docs-site (pull_request) Successful in 1m41s
ci / rust-arm64 (pull_request) Successful in 1m58s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m22s
ci / rust (pull_request) Successful in 5m19s
android / android (pull_request) Successful in 7m21s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m43s
Every wake gate in the codebase reads `!host.mac.is_empty()` against the saved
record — `ConnectPlan::wake`, the console's `can_wake`, `punktfunk wake`. That MAC
only ever reached the store through `trust::learn_mac`, and `learn_mac` had exactly
two callers: the GTK hosts page and the WinUI one.

Neither runs on a Steam Deck. Gaming Mode has only the Decky panel (which drives the
headless CLI) and the console home — and those learned the management port alone,
never the MAC. So a Deck's records stayed MAC-less forever, every wake gate stayed
false, and Wake-on-LAN was skipped silently: no packet, no error, nothing to see.
It worked on desktop purely because those two hosts pages learn on each discovery
tick. (#322)

Rather than add the missing call twice, collapse the three per-field learners
(`learn_mac`, `learn_os`, `learn_mgmt_port` — three `pub fn`s, three load/save
cycles) into one `learn_from_advert`, and call it at every site where an advert
meets a saved record: both desktop hosts pages, the console home, and the CLI's
`discover`. Remembering one call is not a thing a front-end can half-do; remembering
three is what produced this. It takes the three fields rather than a `DiscoveredHost`
because there are two of those — core's and the WinUI shell's verbatim port.

`discover` is where the panel-only flow is fixed: it is the one verb the Decky panel
runs that ever sees an advert. It keeps `KnownHosts::read()`, so it still mints no
ids and cannot join the race that comment warns about, and `learn_from_advert` writes
only when an advert genuinely taught the record something — a steady-state panel
refresh touches no disk.

Two things fall out of the same root cause: the console home now persists the OS
chain too, so a Deck host's icon stops vanishing the moment mDNS goes quiet; and
`punktfunk wake`'s "connect to it once while it's awake" is replaced, since a MAC
comes from an advert and never from a connect — that wording sent this diagnosis
looking in the wrong place.

The magic-packet sender itself was never at fault (`punktfunk-core::wol` passes its
7 tests) and neither was the flatpak sandbox (`--share=network`). Nothing reached
them.

Closes #322
2026-08-19 14:16:14 +02:00
enricobuehler 5711fafa38 fix(nix): build gamescope's WSI layer — nixpkgs defaults enableWsi to false
ci / rust-arm64 (pull_request) Successful in 2m10s
ci / bun-nix (pull_request) Successful in 18s
ci / web (pull_request) Successful in 1m56s
ci / docs-site (pull_request) Successful in 2m39s
ci / rust (pull_request) Successful in 9m5s
nix / flake (pull_request) Successful in 14m27s
With the lock bumped, all ten patches apply and the compositor compiles, links
and installs cleanly. It then fails our own postInstall assertion:

    punktfunk-gamescope: this nixpkgs' gamescope built no WSI layer, so no game
                         under the compositor could ever obtain an HDR10 swapchain

nixpkgs takes `enableWsi ? false` and feeds it to
`mesonBool "enable_gamescope_wsi_layer"`, so the plain derivation ships the
compositor and no layer at all; nixpkgs gets its own layer by instantiating a
SECOND copy inside the wrapper. `enableWsi` is a FUNCTION ARGUMENT, so
overrideAttrs cannot reach it — it needs `.override`, applied before
`.overrideAttrs` so the latter is not applied to the derivation being replaced.

The assertion did its job: it caught a compositor that would have installed
under our name and then denied every nested game an HDR10 swapchain, which is
the one outcome the header calls the worst. But it only fires after a full
build (MEASURED: run 19323), which is an expensive way to learn a default.
2026-08-19 11:44:05 +00:00
enricobuehler fa946a16b9 Merge pull request 'Canceling a connect brings the console straight back, instead of sticking on "Canceling…"' (#329) from worktree-console-cancel-connect-stuck into main
apple / swift (push) Successful in 1m58s
ci / rust-arm64 (push) Successful in 3m24s
ci / web (push) Successful in 2m7s
ci / bun-nix (push) Successful in 45s
ci / docs-site (push) Successful in 1m32s
deb / build-publish-gamescope (push) Successful in 47s
ci / rust (push) Successful in 6m56s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 21s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 21s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 10s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 9s
deb / build-publish-client-arm64 (push) Successful in 1m28s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 11s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 10s
arch / build-publish (push) Successful in 8m21s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 23s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 23s
docker / builders-arm64cross (push) Successful in 12s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m17s
docker / deploy-docs (push) Successful in 38s
deb / build-publish (push) Successful in 4m31s
android / android (push) Successful in 12m9s
flatpak / build-publish (push) Successful in 5m11s
apple / distribute (push) Successful in 11m23s
deb / build-publish-host (push) Successful in 9m28s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 6m57s
deb / smoke-install (push) Successful in 2m33s
apple / screenshots (push) Successful in 9m50s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 18m3s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 19m20s
windows-host / package (push) Successful in 13m19s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 19s
Reviewed-on: #329
2026-08-19 11:29:22 +00:00
enricobuehler 9a29eb4a7a Merge pull request 'Every NixOS host build was failing: nixpkgs' gamescope 3.16.24 no longer takes our patches' (#328) from nixpkgs-bump-gamescope-3-16-25 into main
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 20s
ci / bun-nix (push) Successful in 26s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 14s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 15s
ci / web (push) Successful in 1m1s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 15s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 17s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 14s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 15s
ci / docs-site (push) Successful in 1m27s
docker / builders-arm64cross (push) Successful in 17s
ci / rust-arm64 (push) Successful in 2m4s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m34s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 2m6s
docker / deploy-docs (push) Successful in 31s
ci / rust (push) Successful in 5m59s
nix / flake (push) Failing after 13m46s
Reviewed-on: #328
2026-08-19 11:10:40 +00:00
enricobuehler 1b52942bf8 fix(nix): the dispatch opt-ins skipped silently on an API dispatch
ci / bun-nix (pull_request) Successful in 19s
ci / web (pull_request) Successful in 1m9s
ci / docs-site (pull_request) Successful in 1m19s
ci / rust-arm64 (pull_request) Successful in 1m32s
ci / rust (pull_request) Successful in 5m20s
nix / flake (pull_request) Failing after 10m59s
`build-rust` / `build-gamescope` were compared only against the STRING 'true'.
A checkbox from the Gitea UI arrives that way, but an API dispatch can deliver a
real JSON boolean, and the comparison then misses — the step is skipped, the job
still reports success, and the log is indistinguishable from a run that had
nothing to do.

MEASURED 2026-08-19: dispatched with build-gamescope=true to verify the flake.lock
bump actually fixes the gamescope patch set. Run 19320 went green with 'Build the
patched gamescope' SKIPPED — a green that proved nothing about the one package
being fixed, on the exact check the header recommends before merging a lock bump.

Accepts both shapes now. Deliberately still no `inputs.*`: that context is what
Gitea's parser is least reliable about, which is why this file used
github.event.inputs in the first place.
2026-08-19 10:56:41 +00:00
enricobuehler 6bec7c7cc6 fix(nix): bump nixpkgs — its gamescope 3.16.24 no longer takes our patches
ci / bun-nix (pull_request) Successful in 23s
ci / web (pull_request) Successful in 1m12s
ci / docs-site (pull_request) Successful in 1m13s
ci / rust-arm64 (pull_request) Successful in 1m29s
ci / rust (pull_request) Successful in 5m31s
nix / flake (pull_request) Failing after 11m25s
The publish tier went red on punktfunk-gamescope-3.16.24:

    patching file src/steamcompmgr.cpp
    Hunk #1 FAILED at 9321.
    1 out of 1 hunk FAILED -- saving rejects to src/steamcompmgr.cpp.rej

0009 rewrites the pipewire call site so dead capture textures are reaped on the
compositor thread, and its context is upstream's vblank-driven form:

    // Drive on vblank, not the timer: under VRR the timer starves (page flips re-arm it).
    if ( vblank && pipewire_is_streaming() )

MEASURED against three upstream trees: that context is absent from the 3.16.24
tag and present in both 3.16.25 and master. packaging/gamescope/README.md pins
upstream at 5fb8dce4 (3.16.25-11) and gamescope.nix's header says it was checked
against 3.16.25 — but the lock still carried a 2026-07-15 nixpkgs shipping
3.16.24, five weeks behind. The earlier patches were already only just holding
on: 0004 and 0008 applied at offsets of -51, -48, -35, and one hunk at fuzz 2.

This is not a CI-only failure. gamescope.nix patches whatever gamescope the
pinned nixpkgs carries, and host.gamescopeHdr defaults true, so every
`services.punktfunk.host.enable = true` build was failing the same way. The
cache tier is what surfaced it — exactly what nix.yml's header predicted would
happen, and the reason that tier compiles gamescope on every main push.

Only the nixpkgs node moves (verified: 8 inputs compared, 1 changed).

NOTE: this fixes the instance, not the class. The nix channel is the only one
that does not pin gamescope's src — the RPM spec, the PKGBUILD and
build-punktfunk-gamescope.sh all ship 5fb8dce4 — so the next nixpkgs move can
break it again in either direction.
2026-08-19 10:29:13 +00:00
enricobuehler 8f4e71f8dc fix(console-ui): canceling a connect returns the console immediately, and aborts the dial
ci / bun-nix (pull_request) Successful in 30s
ci / docs-site (pull_request) Successful in 1m19s
ci / web (pull_request) Successful in 1m24s
apple / swift (pull_request) Successful in 2m13s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust-arm64 (pull_request) Successful in 3m4s
android / android (pull_request) Successful in 6m35s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m36s
ci / rust (pull_request) Successful in 7m56s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Failing after 14m36s
The connect takeover could only be dismissed by a session phase coming back from the
embedder, and nothing guaranteed one would. Pressing B latched "Canceling…" and waited:

- Android's console shell never sent a phase at all on the canceled path — `launch()`
  returns early when `Dial.cancelled` is set — so the takeover stayed up until the app
  was killed.
- The desktop shell waited for the pump's `Failed`/`Ended`, but the pump was parked
  inside the blocking `NativeClient::connect*`, which had no abort. That is 15 s on a
  normal dial and 185 s on a request-access connect the host holds pending approval.

Two halves, both at the point every caller routes through:

`pf-console-ui` drops the takeover itself on Back. Cancel is the user's decision and
needs no confirmation from the wire; the `CancelConnect` action still goes out, and
every embedder already handles a dial that lands afterwards (quit-close the connector,
route the end back silently). With no waiting state left to render, `Connecting.canceling`
and the "Canceling…" card go with it.

`NativeClient::connect_with_audio_format` takes an optional abort switch, polled while
the call is blocked, and the session pump passes its stop flag — so the embedder's cancel
now reaches a dial that has not landed yet instead of being answered whenever it does.
Taking it is the same give-up as running out of budget (quit close + shutdown), so the
worker stops re-dialing and the host tears down rather than lingering for a reconnect
nobody wants. Deliberately NOT aliased onto the client's own `shutdown`: the pump reads
that to mean "this connection died" and derives the session's end reason from it, which a
caller-set flag would race — a dropped link would have reported no reason at all.
2026-08-19 12:24:25 +02:00
enricobuehler 9ddf802665 fix(plugin-kit): a restart or a Sync-now republishes, instead of answering "no changes"
ci / web (pull_request) Successful in 1m20s
ci / rust-arm64 (pull_request) Successful in 2m18s
ci / bun-nix (pull_request) Successful in 28s
ci / docs-site (pull_request) Successful in 2m15s
ci / rust (pull_request) Successful in 7m2s
android / android (pull_request) Successful in 7m21s
The sync engine's fingerprint says we would compute the same entries again. It does
NOT say the host still holds them — and the host may accept a payload and store less
of it than was sent: an art path outside its allowed roots is stripped and the games
kept (deliberately, a cover must not cost a library), a launcher tile it cannot open
is dropped the same way.

Once that happens the fingerprint is a permanent "no changes". The operator fixes the
host side, nothing republishes, and the only way out is to delete the plugin's cache
file — which is exactly the advice a portable-Playnite library with 70 dropped covers
was given.

So the two triggers with a person behind them always apply: `startup`, the restart
everyone reaches for, and `manual`, the console's Sync-now button and the CLI's
`sync`. Both mean "publish my library NOW", and "no changes" is the wrong answer to
that. The loop reasons keep the short-circuit, which is where it earns its keep —
they are what would otherwise PUT the whole library every few minutes.
2026-08-19 12:20:00 +02:00
enricobuehler b6ca692c13 docs(abi): ex11's summary still stated the pre-2026-08-16 rule its own warning corrects — a format at all sets the hi-res cap
ci / web (pull_request) Successful in 1m53s
ci / rust-arm64 (pull_request) Successful in 2m19s
apple / swift (pull_request) Successful in 2m12s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / bun-nix (pull_request) Successful in 25s
ci / docs-site (pull_request) Successful in 1m20s
android / android (pull_request) Successful in 5m46s
ci / rust (pull_request) Successful in 6m41s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m52s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m49s
2026-08-19 11:54:45 +02:00
enricobuehler f7eb844274 fix(host/library): a portable Playnite's covers survive the art confinement
A Playnite unzipped outside the users base (D:\Apps\Playnite) keeps its whole
library beside the exe, so every cover it exports lives at
`<PlayniteDir>\library\files\…` — outside every default art root. The games
synced and all 70 covers were dropped, with only PUNKTFUNK_LIBRARY_ART_ROOTS
as a way out.

The Playnite install dirs are now art roots too, exactly as Steam's install
root already is, and `playnite_install_dirs` learned to find a portable copy at
all: it registers no uninstall entry and sits under no profile, but it does
register the `playnite://` handler — the very registration this host's launch
path already follows to start a Playnite title. So the same probe also gives a
portable install its Fullscreen launcher tile, which it never had.

The confinement is not loosened: the roots come from the host's own registry
and filesystem probes, never from the plugin lane that supplies the art path,
and the extension, regular-file, magic-byte and config-dir gates all still
apply.
2026-08-19 09:03:57 +02:00
enricobuehler a75ed71428 docs(kde): name the 6.6 change behind the KWin virtual-output failure — the output must now be enabled, not just created 2026-08-19 09:01:12 +02:00
enricobuehler b551f7dae8 fix(host): a translated KWin refusal burned all 8 retries — match our own prefix, not KWin's message
KWin sends the `failed` reason on zkde_screencast localized. The retry
short-circuit matched the English "could not find output", so a pt-BR session
("Não foi possível encontrar saída") fell through to 8 attempts over ~11 s and
then reported "out of retries" — a config fact dressed up as a flaky one.

Match "KWin virtual output failed" instead: our own prefix, never translated.
Every `failed` KWin sends on this path is a backend/config fact (unsupported
compositing type, a backend without createVirtualOutput, an output the
workspace declined to enable), none of which a retry 500 ms later changes.

The message itself now says what KWin's untranslatable reason means, and the
KDE docs gain the KWin 6.6+ shape of it: KWin creates the output, leaves it
disabled, and workspace()->findOutput() returns null — reported identically to
a backend that cannot create one at all.
2026-08-19 08:54:02 +02:00
enricobuehler e5046a2811 Merge pull request 'Android streaming: HDR and SDR colours through the ASC presenter, and the system bars stop parking over the video' (#319) from worktree-android-asc-hdr-dataspace into main
ci / web (push) Successful in 1m30s
ci / docs-site (push) Successful in 2m9s
ci / bun-nix (push) Successful in 1m5s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 11s
ci / rust-arm64 (push) Successful in 5m5s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 11s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 10s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 11s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 12s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 9s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 9s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m26s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m55s
android / android (push) Successful in 10m58s
docker / builders-arm64cross (push) Successful in 11s
docker / deploy-docs (push) Successful in 34s
ci / rust (push) Successful in 13m22s
2026-08-19 06:24:23 +00:00
enricobuehler 19d37c44b3 style(client/android): rustfmt the display import block
ci / web (pull_request) Successful in 1m25s
ci / docs-site (pull_request) Successful in 1m44s
ci / bun-nix (pull_request) Successful in 35s
ci / rust-arm64 (pull_request) Successful in 5m31s
android / android (pull_request) Successful in 7m16s
ci / rust (pull_request) Successful in 17m28s
2026-08-19 08:21:35 +02:00
enricobuehler 5be399a4f6 Merge remote-tracking branch 'origin/main' into worktree-android-asc-hdr-dataspace 2026-08-19 08:21:22 +02:00
enricobuehler 6c32890014 Merge pull request 'The controllers test compiles again: a closure can't name the lifetime its Ctx borrows' (#321) from worktree-console-ui-ctx-lifetime into main
android / android (push) Canceled after 3m56s
ci / rust (push) Canceled after 0s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
deb / build-publish-gamescope (push) Successful in 24s
deb / build-publish-client-arm64 (push) Successful in 2m21s
deb / build-publish (push) Successful in 6m11s
deb / build-publish-host (push) Successful in 6m25s
arch / build-publish (push) Successful in 8m20s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m25s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 21m15s
flatpak / build-publish (push) Successful in 4m54s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m10s
deb / smoke-install (push) Successful in 5m15s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 18m14s
Reviewed-on: #321
2026-08-19 06:18:40 +00:00
enricobuehler 9c33bc9397 Merge pull request '0.31.0' (#320) from worktree-release-next-prep into main
android / android (push) Canceled after 20s
arch / build-publish (push) Canceled after 30s
ci / rust (push) Canceled after 0s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
deb / build-publish (push) Canceled after 0s
deb / build-publish-host (push) Canceled after 0s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
flatpak / build-publish (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 0s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 0s
audit / cargo-audit (push) Failing after 36s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Canceled after 0s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Canceled after 0s
audit / bun-audit (web) (push) Successful in 26s
audit / pnpm-audit (push) Successful in 10s
audit / bun-audit (plugin-kit) (push) Successful in 1m31s
audit / docs-site-audit (push) Successful in 39s
audit / bun-audit (sdk) (push) Successful in 1m29s
apple / swift (push) Successful in 2m5s
audit / license-gate (push) Successful in 4m32s
audit / c-abi-asan (push) Successful in 6m18s
audit / miri (push) Successful in 7m50s
apple / distribute (push) Successful in 12m59s
windows-host / package (push) Successful in 13m48s
windows-host / winget-source (push) Skipped
nix / flake (push) Failing after 21m5s
apple / screenshots (push) Successful in 10m19s
windows-host / canary-manifest (push) Successful in 20s
Reviewed-on: #320
2026-08-19 06:18:19 +00:00
enricobuehler fcdb2a53de fix(console-ui): the controllers test builds its Ctx in a fn, not a closure
ci / bun-nix (pull_request) Successful in 31s
ci / web (pull_request) Successful in 1m7s
ci / docs-site (pull_request) Successful in 1m16s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m36s
ci / rust-arm64 (pull_request) Successful in 4m13s
android / android (pull_request) Successful in 5m49s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m52s
ci / rust (pull_request) Successful in 19m45s
A closure cannot be generic over the lifetime in its return type, so the
`Ctx<'_>` this one built could never be tied to the `&mut Settings` it
borrows — `lifetime may not live long enough`, and the lib test target
failed to compile.

Same shape the add_host and library test modules already use: a plain
`fn ctx<'a>(…) -> Ctx<'a>` where the lifetime is written down once.
2026-08-19 08:17:10 +02:00
enricobuehler 601f040ffe release: 0.31.0 — re-cut on 790db5ed (#318 merged after the first cut)
apple / swift (pull_request) Successful in 2m1s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m58s
ci / rust-arm64 (pull_request) Failing after 1m54s
ci / web (pull_request) Successful in 1m54s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Failing after 3m24s
ci / rust (pull_request) Failing after 2m39s
ci / bun-nix (pull_request) Successful in 34s
ci / docs-site (pull_request) Successful in 1m44s
android / android (pull_request) Successful in 7m6s
nix / flake (pull_request) Successful in 13m47s
90 commits since v0.30.0 (65 non-merge), was 88/64. #318 installed the
Nix cache signing key (public half now pinned in the docs and served by
the cache) and moved its DNS provisioning into unom/infra's OpenTofu; the
CHANGELOG's Nix paragraph says so instead of listing the PR as absent.
The notes needed no change: their NixOS line already pointed at the
install guide and the cache-served key. Version table unaffected — #318
touches docs and the setup wizard only.
2026-08-19 00:20:40 +02:00
enricobuehler eac308412c Merge remote-tracking branch 'origin/main' into worktree-release-next-prep 2026-08-19 00:20:08 +02:00
enricobuehler 65c4b4b17e release: 0.31.0 — version bump, notes, CHANGELOG, Play notes
android / android (pull_request) Canceled after 0s
apple / swift (pull_request) Canceled after 1m46s
apple / distribute (pull_request) Canceled after 0s
apple / screenshots (pull_request) Canceled after 0s
ci / rust (pull_request) Canceled after 0s
ci / rust-arm64 (pull_request) Canceled after 0s
ci / web (pull_request) Canceled after 0s
ci / docs-site (pull_request) Canceled after 0s
ci / bun-nix (pull_request) Canceled after 0s
nix / flake (pull_request) Canceled after 0s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Canceled after 1m47s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 0s
88 commits since v0.30.0 (64 non-merge). Cut from origin/main 8a4eac4c
(PR #317 merged; PR #318, the Nix cache signing-key follow-up, is open
and NOT in this cut).

THE NUMBER: 0.31.0 is a judgement call, not forced. Nothing versioned
moved — WIRE_VERSION 2, C ABI 24 with include/punktfunk_core.h byte-
identical to the v0.30.0 tag, driver protocol 6 / min 3 (pf-driver-proto
has no diff against the tag), gamepad channel 3, plugin index schema 1,
host event schema 1, gamescope +pfhdr8 with no new patch files,
api/openapi.json still stamped 0.29.0 and unchanged, SDK 0.1.4,
plugin-kit 0.4.2. On that table alone this could be 0.30.1. It is a
minor because the cycle is feature-shaped and one commit carries a `!`:
the Android Compose console is deleted outright and pf-console-ui over
Skia/GL becomes the console on all three ABIs (#301, #317); the Android
present path moves to ASurfaceControl by default (#290); the Linux
desktop-audio capture flips to a host-owned null-audio-sink by default
with PUNKTFUNK_STREAM_SINK=stream as a one-release escape (#305);
`topology: exclusive` on Hyprland/sway goes from silently-extend to
genuinely disabling the operator's outputs, which is the default policy
on every auto-detected box (#304, closes #284); a Nix binary cache
ships (#313); and the Linux host package grows three new system files
(udev rule, WirePlumber policy, ALSA UCM drop-in) that the DualSense
audio path depends on (#291, #302, #315). scripts/ci/pf-version.sh
already derives the canary base as latest stable + one minor, so
canaries have sat at 0.31.x since the v0.30.0 tag and move to 0.32.x
after this one.

Version table re-measured on 8a4eac4c, not carried forward. Two rows
carry a warning rather than a change: sdk/ and plugin-kit/ both have
real code changes (the mgmt-endpoint follow in config.ts/runner-cli.ts;
SyncSettings.minInterval in sync-engine.ts) with package.json unbumped.
They version off their own sdk-v*/plugin-kit-v* tags and this commit
does not touch them; the CHANGELOG names sdk-v0.1.5 and
plugin-kit-v0.4.3 as owed so they are cut deliberately.

The release branch also carries one preceding whitespace-only commit:
crates/pf-console-ui/src/screens/controllers.rs and
crates/punktfunk-host/src/audio/linux/pad_card_volume.rs had landed on
main formatted differently from rustfmt 1.96.0 (the pinned toolchain),
so ci.yml's Format step was red on the tip this is cut from. `cargo fmt
--all` and nothing else.

Gates run on this tree (this MacBook, rustc/rustfmt 1.96.0): cargo fmt
--all --check clean; cargo metadata --offline ok; Cargo.lock diff
versions-only (36/36 lines); cargo test -p punktfunk-core unit suite
272 passed; the android.yml Play notes gate run verbatim — 498/500
characters and not byte-identical to any prior release's; notes voice
scan finds no internal names outside the For developers section (the
two hits, `nixpkgs` and Flatpak, are things those users configure by
name); both openapi copies cmp identical and unchanged since the tag;
include/punktfunk_core.h regenerated by the build and git-diff clean.

⚠ NOT run here: the C ABI harness (tests/c_abi.rs) — it links -lopus
and this machine has no libopus (`ld: library 'opus' not found`; the
Mac Studio has it). The header is byte-identical to v0.30.0's, where the
harness passed, and nothing in punktfunk-core's C surface changed; the
CI runner is its first execution for this tag. Named in the CHANGELOG's
Verification status rather than left to be discovered.

No outside contributor is credited by name: every attribution in the
64 bodies is a dated field report or "a reporter", and issue #284 was
filed by the maintainer. The Thanks section thanks the field reports
without naming anyone.
2026-08-19 00:18:08 +02:00
enricobuehler 329df4c1f4 fix(client/android): SDR through ASC presented untagged buffers — SurfaceFlinger's full-range guess elevated the blacks
ci / web (pull_request) Successful in 1m19s
ci / rust-arm64 (pull_request) Failing after 4m45s
ci / docs-site (pull_request) Successful in 1m26s
ci / rust (pull_request) Failing after 6m15s
ci / bun-nix (pull_request) Successful in 1m19s
android / android (pull_request) Successful in 9m32s
The SurfaceView path never tagged SDR because MediaCodec tags its own window
buffers; with AImageReader → ASurfaceControl the transaction is the only
carrier, and dataspace 0 meant setBufferDataSpace was never called. An
untagged limited-range BT.709 buffer read as full range shows black (16) as
gray. SDR now maps to ADATASPACE_BT709 (limited-range video) in
color_dataspace — every ASC buffer is tagged.
2026-08-19 00:17:26 +02:00
enricobuehler 5fc5da3256 fix(client/android): one owner for the system bars — the console's dispose re-showed them over the stream
ci / rust-arm64 (pull_request) Failing after 1m18s
ci / docs-site (pull_request) Successful in 1m27s
android / android (pull_request) Canceled after 3m43s
ci / rust (pull_request) Canceled after 3m26s
ci / web (pull_request) Canceled after 1m45s
ci / bun-nix (pull_request) Canceled after 2s
Console → stream rides an AnimatedContent cross-fade, so the outgoing
console shell stays composed until the fade ends: its
onDispose { show(systemBars()) } fired AFTER StreamScreen's hide, parking
the status bar and the gesture bar over the video for the whole session.

The hide/show now lives once in App.kt, keyed on the resolved intent
(streaming or console fronting = immersive; touch shell = bars back), and
both screens' per-screen bar management is deleted.
2026-08-19 00:04:55 +02:00
enricobuehler a8922b454a fix(client/android): the ASC presenter tagged HDR from the codec's echo, not the negotiated colour
The negotiated ColorInfo is the wire contract's authority on the stream's
colour, but the ASC backend seeded a hardcoded BT2020_ITU_PQ guess and then,
on the first output-format change, overwrote it with whatever the codec
echoed — and a decoder that omits color-transfer (common) echoed None, which
clobbered the dataspace to 0 before the first present. Untagged P010 buffers
composited as sRGB: broken HDR colours. An HLG stream was also mis-seeded PQ.

Now the initial dataspace derives from client.color (PQ vs HLG, range), and
a format change only refines it when the codec actually reports an HDR
transfer — never resets it, matching the SurfaceView path's semantics.
2026-08-19 00:04:49 +02:00
enricobuehler 790db5edbb Merge pull request 'The cache signing key is installed, and its DNS was never a dashboard click' (#318) from worktree-nix-binary-cache into main
ci / web (push) Successful in 1m15s
ci / rust-arm64 (push) Failing after 1m45s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 16s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 8s
ci / docs-site (push) Successful in 1m18s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 9s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 7s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 17s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 17s
ci / bun-nix (push) Successful in 1m35s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 12s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 12s
ci / rust (push) Failing after 4m9s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m25s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 2m35s
docker / builders-arm64cross (push) Successful in 10s
docker / deploy-docs (push) Successful in 32s
nix / flake (push) Failing after 18m59s
Reviewed-on: #318
2026-08-18 22:04:09 +00:00
enricobuehler 82d39011ce style: cargo fmt drift in pf-console-ui controllers screen and pad_card_volume
Two files landed on main formatted differently from rustfmt 1.96.0's
output, so ci.yml's Format step fails on the tip the release is cut
from. Whitespace only; no behaviour change.
2026-08-18 23:59:53 +02:00
enricobuehler 8a4eac4c41 Merge pull request 'The Android console stops losing the pad, owns its Controllers page, and takes the whole phone panel' (#317) from worktree-phone-console-ui into main
ci / rust-arm64 (push) Failing after 1m7s
ci / rust (push) Failing after 3m30s
ci / bun-nix (push) Successful in 30s
ci / docs-site (push) Failing after 1m0s
ci / web (push) Successful in 1m20s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
deb / build-publish-gamescope (push) Successful in 51s
arch / build-publish (push) Successful in 10m22s
deb / build-publish-client-arm64 (push) Successful in 1m41s
android / android (push) Successful in 12m58s
deb / build-publish (push) Successful in 5m12s
deb / build-publish-host (push) Successful in 4m56s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Failing after 3m19s
flatpak / build-publish (push) Successful in 8m35s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m8s
deb / smoke-install (push) Successful in 3m31s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 20m36s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 25m0s
Reviewed-on: #317
2026-08-18 21:50:54 +00:00
enricobuehler 7e4fe80793 feat(nix): install the cache signing key and correct how its ingress is provisioned
ci / bun-nix (pull_request) Successful in 1m20s
ci / web (pull_request) Successful in 2m7s
ci / rust-arm64 (pull_request) Successful in 2m46s
ci / docs-site (pull_request) Successful in 2m43s
ci / rust (pull_request) Successful in 9m54s
nix / flake (pull_request) Successful in 16m31s
Two corrections and one thing actually done.

DNS here is not a dashboard click. unom/infra owns the unom.io zone in OpenTofu
(terraform/cloudflare/records.tf, applied by dns-cutover.yml), and that file's
`local.hostnames` set carries its own invariant: "a name here with no vhost 404s,
a vhost with no name here never cuts over." A record added by hand in Cloudflare
is out-of-band and risks the duplicate-record round-robin the file documents a few
lines further down — the same class of trap as hand-editing ~/caddy/Caddyfile on
the box. The setup steps said "in the unom.io Cloudflare zone" as though it were a
manual change; they now name both files, the workflow that applies them, and the
one-added-record check to expect from `plan`. unom/infra#20 makes the change.

The signing key is generated and `NIX_CACHE_SIGNING_KEY` is installed as a repo
Actions secret, so its public half is no longer a placeholder:

    punktfunk-cache-1:yhOJmHxzg6tzXpxSFzlYn6Pc6r0jHprsWqt8MZC654o=

pinned in both docs. The publish step still writes the same value to
/punktfunk-cache.pub, so the docs can always be checked against the cache itself —
and the wizard now compares the two and warns on a mismatch, because docs that
disagree with the cache mean users reject everything it serves.

The wizard drops to four stages. DNS and the vhost were separate stages when they
looked like separate manual steps; they are one PR against one repo, so they are
one stage. The key stage now detects the installed key, prints it, and refuses to
casually regenerate — a new key invalidates every signature already published and
breaks every user pinning the old one.

Verified: shellcheck + `bash -n` clean, 4 stages against TOTAL_STAGES=4, and the
already-installed path's key extraction tested against the real README.
2026-08-18 23:49:21 +02:00
enricobuehler c4cf53c1fc Merge pull request 'The Nix cache's setup steps pointed at a home-lab proxy that no longer exists' (#316) from worktree-nix-binary-cache into main
ci / web (push) Successful in 1m33s
ci / bun-nix (push) Successful in 28s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 17s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 11s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 11s
ci / rust (push) Failing after 4m42s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 17s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 15s
ci / rust-arm64 (push) Successful in 3m44s
ci / docs-site (push) Successful in 3m23s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 13s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 14s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m31s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m40s
docker / builders-arm64cross (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
nix / flake (push) Canceled after 9m37s
Reviewed-on: #316
2026-08-18 21:32:53 +00:00
enricobuehler d59a1a9606 feat(console-ui): the console takes the whole phone panel, and the library stops spending it
ci / rust-arm64 (pull_request) Failing after 2m26s
ci / web (pull_request) Successful in 1m29s
ci / bun-nix (pull_request) Successful in 43s
ci / rust (pull_request) Failing after 3m41s
ci / docs-site (pull_request) Successful in 2m4s
android / android (pull_request) Successful in 8m55s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m53s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Failing after 3m34s
Four phone-sized fixes, one theme — a small screen was paying for chrome it
never asked about:

- The Android shell hides the system bars while it fronts the app (transient
  by swipe, restored on dispose), the same contract as the stream. This is
  also the safe-area fix: hidden bars report zero insets, so scrolled content
  no longer slices off at the visible gesture-bar line with bare backdrop
  below — only the display cutout remains a real inset.
- The design-unit scale's phone density floor rises 0.6 -> 0.75: on a 460 dpi
  panel the floor is what sets the scale (the couch term only wins on tablets
  and TVs), and 0.6 read a step too small in the hand. Still the documented
  on-glass knob.
- The library's sort/view bar appears only while it holds the pad (up from
  the field / the legend's 'Sort & view'), the Apple client's behaviour; the
  field takes the band's height back as it fades.
- The store/platform subtitle under the focused title is gone — the cover
  badge already says it — and the detail band shrinks 84 -> 64 units, most of
  a grid row on a phone.

Plus a guard the new scale makes necessary: the grid's two-column minimum
shrinks its covers to fit rather than clipping at the edges when a narrow
viewport times a high density leaves less width than two full cells.
2026-08-18 23:27:44 +02:00
enricobuehler 7c411f7ef4 fix(nix): the cache's setup steps described a topology that no longer exists
ci / rust-arm64 (pull_request) Successful in 2m3s
ci / web (pull_request) Successful in 1m1s
ci / bun-nix (pull_request) Successful in 22s
ci / docs-site (pull_request) Successful in 2m16s
ci / rust (pull_request) Successful in 7m17s
nix / flake (pull_request) Failing after 19m10s
The bring-up instructions were copied from packaging/flatpak/README.md, which
still describes an edge proxy on `home-reverse-proxy-1` forwarding to
192.168.50.50. That home-lab topology is gone. packaging/winget/server/
compose.production.yml — the newest of the three and the only one written since
the move — says so outright: "the sibling docs/flatpak compose files still carry
stale comments … the public hostnames resolve straight to the hcloud box and are
served by Caddy there — no local proxy is involved." flatpak.unom.io resolves to
167.233.145.172, which is unom-1 itself, confirming it.

So the steps now match how docs and winget were actually stood up:

  * DNS in the unom.io Cloudflare zone, DNS-only, straight at the hcloud box.
  * The vhost in unom/infra `caddy/Caddyfile`, proxying to localhost:3250 —
    NOT 192.168.50.50, and NOT hand-edited on the box. ~/caddy/Caddyfile there
    looks like the config but is an rsynced copy with no .git to warn you; a
    vhost added only on the box lasts until the next deploy. That is how the
    winget source vanished on 2026-07-26, and it is now called out here too.
  * `caddy_target_ports` + terraform is dropped. It was the home-lab firewall
    allowlist; winget's setup, written post-move, has no such step.

Also adds the SNI diagnostic winget's README hard-won: Caddy 308s every Host on
:80 to https, including names it has never heard of, so probing port 80 proves
nothing — check the certificate by SNI instead.

scripts/setup-nix-cache.sh walks the five steps interactively (built from the
/wizard template): it opens each page, says exactly what to click, and verifies
each stage before moving on, because the failure signatures are easy to confuse
— a TLS handshake failure means the vhost is missing, a 502 means the container
is down, and a 404 means the cache is healthy and empty.

It also closes the loop the first version left open: it generates the signing
key locally (a local nix, or the nixos/nix image — MEASURED: both produce the
`name:base64` line, and convert-secret-to-public round-trips), then writes the
PUBLIC half straight into the two docs that carried a `<fill-in>` placeholder.
Nobody has to wait an hour for the first publish to print a value we can derive
up front. The secret half is shown once for pasting into Gitea and never
touches disk. Re-running detects an installed key and refuses to silently
replace it, since that would invalidate every signature already published.

Verified: shellcheck clean, `bash -n` clean, 5 stages against TOTAL_STAGES=5,
and the doc substitution tested against a real generated key — public keys are
base64 and contain `/`, so the sed uses `|` as its delimiter.
2026-08-18 23:26:06 +02:00
enricobuehler 9e47f746ba Merge pull request 'The DualSense's only playback route was a mono sink games overran, and both ends met the pad at -24 dB' (#315) from worktree-dualsense-handoff into main
apple / swift (push) Successful in 2m8s
ci / rust (push) Failing after 3m7s
ci / web (push) Successful in 2m5s
ci / bun-nix (push) Successful in 29s
ci / docs-site (push) Successful in 1m28s
deb / build-publish-gamescope (push) Successful in 29s
ci / rust-arm64 (push) Canceled after 6m10s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m8s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
decky / build-publish (push) Successful in 46s
deb / build-publish-client-arm64 (push) Successful in 2m22s
android / android (push) Successful in 10m6s
arch / build-publish (push) Successful in 10m46s
flatpak / build-publish (push) Successful in 5m20s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m10s
apple / distribute (push) Successful in 12m10s
deb / build-publish-host (push) Successful in 12m15s
deb / build-publish (push) Successful in 13m24s
apple / screenshots (push) Successful in 9m55s
deb / smoke-install (push) Canceled after 31s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 18m7s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 17m29s
windows-host / package (push) Successful in 17m43s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 25s
Reviewed-on: #315
2026-08-18 21:22:08 +00:00
enricobuehler 13f8a1c5cd Merge remote-tracking branch 'origin/main' into worktree-dualsense-handoff
apple / swift (pull_request) Successful in 2m1s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / bun-nix (pull_request) Successful in 20s
ci / rust-arm64 (pull_request) Successful in 2m26s
ci / web (pull_request) Successful in 1m5s
ci / docs-site (pull_request) Successful in 1m17s
ci / rust (pull_request) Failing after 3m47s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m33s
android / android (pull_request) Successful in 8m11s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m25s
2026-08-18 23:18:07 +02:00
enricobuehler d5f2c63367 Merge pull request 'A moved mgmt port left every plugin and the tray dialing 47990 in silence; the Windows runner task now also writes a log file' (#314) from worktree-windows-runner-log-file into main
audit / bun-audit (sdk) (push) Successful in 25s
audit / bun-audit (plugin-kit) (push) Successful in 26s
audit / bun-audit (web) (push) Successful in 21s
audit / pnpm-audit (push) Successful in 12s
audit / docs-site-audit (push) Successful in 23s
audit / cargo-audit (push) Failing after 1m22s
apple / swift (push) Successful in 2m8s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m10s
android / android (push) Canceled after 4m22s
apple / distribute (push) Canceled after 51s
apple / screenshots (push) Canceled after 0s
arch / build-publish (push) Canceled after 4m30s
ci / rust (push) Canceled after 3m7s
ci / rust-arm64 (push) Canceled after 55s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
deb / build-publish (push) Canceled after 0s
deb / build-publish-host (push) Canceled after 0s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
flatpak / build-publish (push) Canceled after 4s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 5s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 0s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Canceled after 58s
windows-host / package (push) Canceled after 0s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
audit / license-gate (push) Successful in 6m27s
audit / miri (push) Successful in 6m40s
audit / c-abi-asan (push) Successful in 6m40s
nix / flake (push) Canceled after 10m57s
Reviewed-on: #314
2026-08-18 21:16:56 +00:00
enricobuehler 4e03dcc280 Merge pull request 'NixOS users compiled the whole workspace because we published no binaries' (#313) from worktree-nix-binary-cache into main
ci / rust (push) Canceled after 0s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
nix / flake (push) Canceled after 0s
Reviewed-on: #313
2026-08-18 21:15:54 +00:00
enricobuehlerandClaude Opus 5 37813199b5 Merge origin/main — the WirePlumber DualSense policy and the UCM drop-in are complements
Three packaging conflicts, all the same shape: #307 added a
`60-punktfunk-dualsense.conf` install at the exact line this branch added the
ALSA UCM install to. Both sides kept — they act on different layers and neither
subsumes the other:

  * the WirePlumber rules govern how the pad's nodes BEHAVE once they exist
    (`node.always-process` so GE-Proton's raw open cannot race itself,
    `priority.driver = 0` so a pad never clocks somebody else's graph);
  * the UCM drop-in governs WHICH nodes exist at all (a `SpeakerHaptic` device
    at priority 200, so the 1-channel sink games overrun is never minted).

Checked rather than assumed: the drop-in's node-name matchers
(`~alsa_output.usb-Sony_Interactive_Entertainment_DualSense.*`) still match the
sink the UCM change introduces — `…DualSense_Wireless_Controller-00.HiFi__
SpeakerHaptic__sink` — so the policy follows the pad onto the new profile. And
neither touches volume, so the 0 dB pin on this branch is untouched by both.

The Android side of #301 deleted the Compose gamepad mirror, not
`SettingsScreen.kt`, so the "Controller speaker" subtitle survives; the Skia
console that replaced it carries no speaker row of its own (it opens Android's
connected-controllers view instead), so there is no second place to say it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 23:15:17 +02:00
enricobuehler 9cefa0a3ea feat(console-ui): connected controllers is the console's own screen — input stays on the pad
The Controllers row used to raise the D7 platform-screen mechanism: Android drew
the Compose ConsoleControllersScreen over the surface and suspended the console's
input until it closed. Now the page is a shared Skia screen
(screens/controllers.rs) pushed like any other settings sub-screen, so the console
keeps its own navigation, transitions and haptics on it — and a future desktop
build gets it for free (the row itself stays Android-only in row_on).

What genuinely cannot move into Rust stays with the host, asked for by ONE
parameterised command, ConsoleCmd::PadAction { action, pad_key }: the USB and
Bluetooth grant dialogs (sc2_bluetooth / sc2_usb / ds_usb), the rumble pulse on
the real InputDevice, and the DualSense pad-audio self test. SkiaConsoleShell
handles them with the same helpers the touch Controllers screen uses (testRumble,
the grant intents, nativePadAudioSelfTest), reporting through the notice toast, so
the support answer cannot drift between interfaces. PadInfo carries the three
fields the screen needed and the aggregated list already lacked (detail line,
forwarded, rumble), filled by ConsoleJson.pads from the same padInfoOf reader the
touch screen renders from.

PlatformScreen::Controllers is gone; the mechanism itself stays for Licenses,
which still suspends the console's input correctly (the probes gate on platformUp
as before). The Compose console variant and its screenshot scenes are deleted;
the touch ControllersScreen keeps the full page INCLUDING the live input test,
which deliberately did not move — the console only receives the aggregated
MenuSample, nowhere near a per-device axis/trigger readout (ponytail note at the
top of controllers.rs records the upgrade path).
2026-08-18 23:14:23 +02:00
enricobuehler 83f6164027 Merge pull request 'The takeover's own mask was the relogin storm that starved pad input' (#312) from worktree-sddm-relogin-storm-fix into main
ci / rust (push) Canceled after 0s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
android / android (push) Canceled after 1m55s
deb / build-publish-gamescope (push) Successful in 48s
arch / build-publish (push) Canceled after 1m35s
deb / build-publish (push) Canceled after 1m20s
deb / build-publish-host (push) Canceled after 1m17s
deb / build-publish-client-arm64 (push) Canceled after 19s
deb / smoke-install (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 21s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 22s
windows-host / package (push) Canceled after 0s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
Reviewed-on: #312
2026-08-18 21:14:11 +00:00
enricobuehler dd097d1ef2 chore(nix): record disk headroom after the publish build too
nix / flake (pull_request) Successful in 13m31s
ci / rust-arm64 (pull_request) Successful in 1m35s
ci / docs-site (pull_request) Successful in 1m34s
ci / web (pull_request) Successful in 2m17s
ci / bun-nix (pull_request) Successful in 1m39s
ci / rust (pull_request) Successful in 7m54s
This job is now the heaviest on the fleet — a full workspace build plus
gamescope fills the store with tens of GB, and this fleet ran a runner out of
disk on 2026-08-06. The pre-existing Environment step reads df before any of
that happens, which is the less useful of the two moments.
2026-08-18 22:43:47 +02:00
enricobuehlerandClaude Opus 5 01946aa123 fix(pad-audio): a silent pad speaker looked like broken hardware, not a setting
ci / bun-nix (pull_request) Successful in 28s
ci / web (pull_request) Successful in 1m5s
ci / docs-site (pull_request) Successful in 1m23s
ci / rust-arm64 (pull_request) Successful in 2m3s
apple / swift (pull_request) Successful in 2m5s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m56s
ci / rust (pull_request) Failing after 3m27s
android / android (pull_request) Successful in 5m27s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Canceled after 2m57s
A field session spent an evening measuring the HOST — sinks, tone injection,
per-channel peaks — for a pad speaker that was switched off at the other end.
A disabled toggle and dead hardware are indistinguishable from the pad, and
nothing said which one it was.

Two hints, at the two places somebody actually looks:

  * `punktfunk-session --pad-audio-test` now says, before the tone, whether
    `pad_speaker` / `pad_haptics` would stop a real session rendering the very
    thing the tone is about to prove works. The devtest drives the pad DIRECTLY
    and is otherwise blind to the settings, which is exactly what makes "the tone
    plays here but the game is silent" so confusing. It has to be said up front:
    the capability is never advertised when the toggle is off, so no later log
    line can catch it.
  * The Android settings row now states its default in the subtitle. Android is
    the one client that defaults this off, and that is a deliberate form-factor
    choice (a small, easily-startling loudspeaker in the user's hands, unlike
    haptics duplicating audio they already hear) — so the default stands and the
    row stops being silent about it. `pf_client_core`'s `default_pad_speaker` is
    `"pad"` and always has been, so the desktop clients were never the ones
    hiding it.

Worth recording for the next time: the host ALREADY had the signal. `native/
pad_audio.rs` logs `pad audio streaming … haptics=<bool> speaker=<bool>` at
stream start, and a client with the toggle off shows up there as
`speaker=false`. It was being printed on the host that was being measured all
evening.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 22:42:18 +02:00
enricobuehler c0dcac7fa2 fix(sdk,tray): follow the mgmt port the host actually bound — a moved PUNKTFUNK_MGMT_BIND left every plugin and the tray dialing 47990
ci / bun-nix (pull_request) Successful in 27s
ci / rust (pull_request) Failing after 33s
ci / web (pull_request) Successful in 1m10s
ci / docs-site (pull_request) Successful in 1m37s
nix / flake (pull_request) Failing after 1m28s
apple / swift (pull_request) Successful in 2m13s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust-arm64 (pull_request) Successful in 5m33s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m47s
android / android (pull_request) Successful in 7m48s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 3m6s
Field report 2026-08-18, confirmed: the operator had moved the management API off 47990
(`PUNKTFUNK_MGMT_BIND` in host.env — the supported way to share a box with Sunshine/Apollo). The
web console followed, because it reads `<config_dir>/mgmt-endpoint`, the one line the host
publishes on every start with the port it REALLY bound. Nothing else did:

- The plugin runner / SDK resolved `PUNKTFUNK_MGMT_URL` → literal `https://127.0.0.1:47990`.
  The runner is a scheduled task (Windows) / systemd unit that inherits nothing from host.env —
  on Windows it cannot even read it — so every plugin, and the runner's own log shipper, dialed a
  dead port forever. Task Running, plugins never registering, empty library, and "no logs at all".
- The tray defaulted `--mgmt-port` to 47990 and told the operator to edit the autostart command
  line if they moved the bind. Nobody knows to do that; the tray reports a running host as
  unreachable.

One source, two readers, no new file:
- `sdk/src/config.ts::publishedMgmtUrl` reads `mgmt-endpoint`; `resolveConfig` uses it after the
  env override and before the 47990 default. Every plugin `connect()` follows, on every platform,
  with no unit/task changes. `runner-cli.ts` additionally exports it into `PUNKTFUNK_MGMT_URL`
  before any plugin loads, so a plugin still carrying an older vendored `@punktfunk/host` follows
  too (on Windows `reconcileSharedSdk` cannot refresh the read-only tree, so old copies can
  outlive several host upgrades). An explicit PUNKTFUNK_MGMT_URL still wins.
- `pf_paths::published_mgmt_port` (std-only leaf; the tray now depends on it) parses the same
  line. The tray's `mgmt_port` becomes `Option<u16>`: `--mgmt-port` pins, `None` re-reads the file
  on every poll tick, so a host restarted on a new port is picked up without relaunching the tray.

Swept the rest: the web console (`windows::service::spawn_web`, the systemd unit, NixOS module)
already sourced the file; the host CLI, plugin-kit (goes through the SDK), gaming-mode console
and native clients derive the port from discovery / the Welcome — no other literal remained on a
loopback path. The console's web port (47992) is not operator-configurable, so the tray's
literal there is not the same bug.

Verified: SDK 83 tests pass (4 new: absent file → default, published line followed, env wins,
blank = unset), `tsc` clean, biome clean; `pf-paths` unit test; `cargo fmt --check` clean;
`cargo clippy -p pf-paths -D warnings` clean; `cargo check -p punktfunk-tray -p pf-paths` on
Linux (docker rust:1.96) — the tray is cfg-gated off macOS. Not built on Windows from here.
2026-08-18 22:42:13 +02:00
enricobuehlerandClaude Opus 5 654c09d067 fix(pad-audio): WirePlumber met every new pad card at -23.88 dB, and both ends stacked
WirePlumber starts every new card's sink at `device.routes.default-sink-volume`.
That is 0.4, and 0.4 is a CUBED number: what a mixer shows as 40 % is 0.4^3 =
0.064 of linear amplitude, -23.88 dB. The setting is global — it cannot be
scoped to one device from configuration — so there was no config file to ship,
and it fires again on every fresh card, which for a usbip pad is every attach.

Reasonable for a laptop speaker somebody is about to turn up. Wrong here twice:
nobody chose it and nobody would think to look for it (a pad's sink is not a
listening volume anyone reaches for, so it reads as weak hardware), and BOTH
ends of a session mint one. The game's samples cross this sink on the host and
the pad's own sink on the client, so the two multiply: 0.064^2 = -47.8 dB by the
time haptics reach a voice coil, which matches the -48 dB measured in the field.
That is the difference between "the haptics are subtle" and "I am not sure the
haptics are connected".

Both ends now set `channelVolumes` to unity — 1.0, which is unity in the linear
units the pod speaks AND in the cubed scale a mixer displays, the one value that
is unambiguous.

  * Client (`pin_sink_volume`, called from `correlate_pad_sink`): at every pick,
    so a card that re-minted its nodes after a profile change or a replug is
    re-pinned without anything having to notice. Skipped for the `split_parent`
    pick — that is a name lifted off another node's proplist, with no object of
    our own behind it, and pinning the sink that named it would pin the wrong
    node.
  * Host (`audio/linux/pad_card_volume.rs`, started when `PadUsbCapturer::open`
    succeeds): the host half matters because `pad_usb` captures at the pad's
    isochronous OUT endpoint, DOWNSTREAM of this sink — PipeWire applies the
    volume when it mixes into the ALSA device, so what we encode and send is
    already attenuated and no client-side fix can recover it. It retries for 15 s
    rather than firing once: the USB device is live well before its ALSA card is,
    and pinning before WirePlumber has applied the default we are undoing would
    simply be overwritten. Only sinks belonging to a DualSense CARD are touched —
    `device.id` is what keeps it off a host's own minted pad sink, which
    publishes the full DualSense identity on purpose.

Neither end restores on the way out, deliberately: the profile swap next door
overrides a choice the user made, this overrides a default nobody made, and
putting -24 dB back would be restoring the bug. `PUNKTFUNK_PAD_SINK_VOLUME=0`
disables both, for bisecting a box where something else attenuates.

Both pods are unit-tested for the shape that actually matters — one unity float
per channel. PipeWire ignores a `channelVolumes` whose length does not match the
port count, and an ignored pod looks exactly like the pin silently not working,
which is the -23.88 dB back again and just as invisible.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 22:42:06 +02:00
enricobuehlerandClaude Opus 5 ab88a8fb40 fix(pad-audio): the DualSense's only playback route was a mono sink, and games overran it
A wired DualSense on Fedora 44 / Bazzite / Arch presents exactly one playback
sink: the 1-channel `…Default__Speaker__sink`. GE-Proton mints its synthetic
"Sony controller speaker" endpoint from that lone mono sink, and Marvel's
Spider-Man Remastered overruns it — reliably, ~74 s in:

    73.846 render_GetBuffer (…)->(5034, …)   <- GE's mono endpoint
    73.846 EXCEPTION_ACCESS_VIOLATION  info[0]=1 (WRITE)  info[1]=5CB9A000

Not a format mismatch: `GetMixFormat` and the game's `Initialize` both agree on
mono float32 `nBlockAlign 4`, and pulse sized `maxlength: 20136` = 5034 x 4
correctly. At the fault `rsi=rbp=0x13aa` (5034, the frame count) while
`rcx`/`rdx` are 5206/5207 — the copy loop had already run past the count. It is
a game/GE bug on a code path that ONLY EXISTS WHEN THE MONO SINK DOES.

So delete the mono sink rather than chase the overrun. `alsa-ucm-conf` describes
the pad as Speaker / Headphones / Mic / Headset and has never carried a
`SpeakerHaptic` device — the DualSense profile arrived upstream in 1.2.15
(36a111a) already without it, and the Deck's is a Valve downstream patch they
still carry on their own 1.2.16.1. With `SpeakerHaptic` at `PlaybackPriority
200` against `Speaker`'s 100 the card takes `HiFi (Mic, SpeakerHaptic)`, the
sink is the 4-channel one, and the mono sink — with the crash path — never
exists. The voice coils reach their own channels as a bonus.

Shipped WITHOUT replacing a file `alsa-ucm-conf` owns, which is what made this
awkward to package. `USB-Audio/USB-Audio.conf` ends with an unconditional,
optional include of `USB-Audio/conf.d/{vid}-{pid}.conf`, placed after its device
table has chosen `${var:ProfileName}` and before it includes the profile that
name resolves to — so a two-line drop-in keyed by 054c:0ce6 / 054c:0df2 swaps
the profile with no diversion, no `Conflicts`, and no `%config` fight. Verified
against alsa-lib rather than assumed: `ucm_cond.c` makes `Condition` optional
for a syntax-v8 `If` carrying `Append`, and `uc_mgr_evaluate_include` evaluates
each included subtree in place before moving to the next include, so the
`Define` lands before the profile include substitutes the variable. The hook and
the DualSense profile shipped in the SAME release (1.2.15), so every tree that
has the bug has the hook.

Host packages only (rpm — and therefore the Bazzite sysext, which unpacks the
RPMs — deb, Arch). The client already has a working fallback in
`ensure_pro_audio`, and a shared file in two co-installable packages is a file
conflict for a nicety. NixOS is not covered: it has no /usr/share/alsa/ucm2 to
drop into and needs a package override instead.

`scripts/ci/check-dualsense-ucm.sh` runs the whole chain on a real distro tree
with no hardware, via UCM's card-less `conf.virt.d` path with only the four card
built-ins stubbed. Against pristine Fedora 44 alsa-ucm-conf 1.2.16.1: baseline
`Headphones/Headset/Mic/Speaker`; with the drop-in, `SpeakerHaptic` and
`HeadphonesHaptic` too, `PlaybackPriority/SpeakerHaptic=200` over `Speaker`'s
100, `PlaybackPCM/SpeakerHaptic=…dualsense_haptic_out:…,1,1,2,3`. It exists
because this fix hooks another project's dispatcher: an upstream rename would
neuter it silently, and what comes back is the crash, not a quieter pad.
Negative-tested both ways (typo'd ProfileName, hook deleted).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 22:41:46 +02:00
enricobuehler 66249710b9 feat(nix): publish a binary cache so NixOS users stop compiling the workspace
ci / bun-nix (pull_request) Successful in 22s
ci / web (pull_request) Successful in 1m6s
ci / docs-site (pull_request) Successful in 1m21s
ci / rust-arm64 (pull_request) Successful in 1m25s
ci / rust (pull_request) Successful in 5m19s
nix / flake (pull_request) Canceled after 3m6s
Every other channel ships prebuilt binaries; Nix was the exception — `nix build`
meant the whole Rust workspace *and* a gamescope build from source, roughly an
hour, and `host.gamescopeHdr` defaults true so that compositor build is on the
critical path of every `services.punktfunk.host.enable = true`.

nix.yml grows a third tier: on a push to main it builds the Rust packages plus
gamescope, signs them, and publishes to https://nix.unom.io. No new trigger is
needed for releases — a release bumps the workspace version in Cargo.toml, which
is already in the path filter.

Gitea cannot host this: it has 23 package registry types and none is Nix, and the
protocol wants fixed anonymous paths at a URL root (/nix-cache-info,
/<hash>.narinfo, /nar/…) that /api/packages/{owner}/generic/… cannot express.
The RustFS at storage.unom.io would work mechanically — nix speaks
s3://…?endpoint= and the sccache credentials already exist — but it is a local
box on the home uplink with no CDN, so every user download would compete with CI,
and S3 answers 403 for a missing key unless the bucket policy grants anonymous
ListBucket. Nix treats anything other than 404 as a hard error rather than a
cache miss, so that would break users' builds for packages the cache never held.
So it goes on unom-1 beside the flatpak repo, as a caddy:2-alpine container
serving a static tree — which is all a binary cache is.

Three decisions worth keeping:

* Only punktfunk's own store paths are published. The rest of a runtime closure
  is stock nixpkgs, already on cache.nixos.org behind a real CDN; mirroring it
  would spend disk and home-to-cloud bandwidth to serve a worse copy. That is
  ~300 MB per publish instead of several GB. The step asserts every built output
  is matched by the name filter, so a future pname change fails the build rather
  than silently dropping the most expensive package from the cache.
* NARs upload before narinfos, and rsync runs without --delete. A narinfo whose
  NAR has not landed is a hard download failure for whoever fetches it in that
  window; a NAR nothing points at is merely invisible.
* prune.sh from the first publish, not after the box fills. The flatpak repo next
  door reached 3.84 GB publishing this same way with no sweep, on a box that has
  run out of disk before. It ages out narinfos, then sweeps unreferenced NARs —
  that order is the correctness argument, and it carries a self-check.

Verified locally: the Caddyfile serves a fixture cache with 200s on hits, 404 on
misses (the assertion the whole design rests on), and immutable cache headers;
prune.sh passes its self-test on Debian including empty and all-stale caches;
both workflows parse; the new run blocks pass shellcheck and dash -n. `set -eu`
rather than `-euo pipefail` — dash dies on the latter — with the two pipelines
whose left side must be able to fail rewritten as redirects.

Docs: README gains the substituter snippet, a maintainer runbook, and a warning
that inputs.punktfunk.inputs.nixpkgs.follows disables the cache entirely (every
store path changes, so every package rebuilds). The install guide gains the same
in short form.

The public key is a fill-in until the first publish prints it — see the setup
steps in packaging/nix/README.md.
2026-08-18 22:38:17 +02:00
enricobuehler 454531030d fix(android): a console that cannot draw yields to the touch UI instead of a gray screen
Connecting a controller could swap in the console shell over a SurfaceView
nothing would ever paint: the native create failing, the render thread dying,
or a GL context Android reclaimed all left the app on a gray screen for the
rest of the process — Kotlin only logged the Dead event.

SkiaConsole now exposes an observable [healthy] flag (false on create failure
or a Dead event) and App folds it into the gamepad-UI gate, so the touch UI
takes over. On the native side, a run of consecutive GL setup failures
(window surface / Skia wrap) — previously logged and retried forever, a hot
spin with a live surface — now ends the render thread through the same
release order as Quit, which raises Dead and hands the screen back.
2026-08-18 22:34:25 +02:00
enricobuehler a64a22ccfc fix(android): the console's pad probes survive the Controllers/Licenses pages
The MainActivity pad probes were one last-writer-wins slot. The Skia shell
installs its probes once (its effect keys never change); a Compose screen the
console opens over itself (Controllers, Licenses) overwrote that slot, and on
its way out nulled it — the shell never re-installed, so every gamepad press
after closing the page was silently dropped until the process died.

The slot is now a stack: each holder pushes its claim on install and removes
it BY IDENTITY on dispose, and dispatch consults the top. Whatever ordering
Compose produces — cross-fades composing both screens at once, non-LIFO
disposal — a leaving screen takes only its own entry, and the one underneath
resurfaces the moment it pops.
2026-08-18 22:34:10 +02:00
enricobuehlerandClaude Opus 5 3717466594 fix(gamescope): the takeover's own mask was the relogin storm that starved pad input
ci / bun-nix (pull_request) Successful in 21s
ci / rust-arm64 (pull_request) Failing after 32s
ci / docs-site (pull_request) Successful in 1m16s
ci / web (pull_request) Successful in 2m47s
ci / rust (pull_request) Successful in 5m56s
android / android (pull_request) Successful in 6m25s
A managed takeover on the .41 SDDM-autologin box entered a ~4-5 logins/s
relogin storm and every udev consumer drowned in the fallout. It presented
as "my DualSense is not detected in the game, or only with an insane delay":
the pad enumerated perfectly and then delivered input at ~1.4 Hz instead of
250 Hz, because `winebus` re-enumerates udev on every event and therefore
stops reading `hidraw`. An evening went into disproving the pad stack, the
ALSA UCM, PipeWire and GE-Proton before the display manager was suspected.

The storm was ours. Measured on .41 (2026-08-18):

    /usr/share/wayland-sessions/gamescope-session-ogui-steam.desktop
      Exec=gamescope-session-plus ogui-steam
    /usr/share/gamescope-session-plus/gamescope-session-plus, last act:
      systemctl --user --wait start gamescope-session-plus@${CLIENT}.service

so the runtime mask this takeover lays sits *directly in sddm's relogin
path*. Every autologin then fails in milliseconds instead of taking the
seconds a real gamescope + Steam start costs, and sddm's `Relogin=true` has
no backoff: a slow, survivable relogin loop becomes a fork storm. 962 logind
sessions in 3.7 min, `Watching system buttons` re-scanned 5,688 times, a
box-wide udev `change` storm at ~20/s, iio-sensor-proxy crash-looping at ~16
starts/s as a udev-activated amplifier, load 26 on 12 cores.

The 2026-07-31 reading of the same box recorded the storm but concluded the
sddm helper "execs the session script directly, so the masked unit never
enters the picture". It does — one `systemctl` call further down. That is
why masking looked inert, and why it was left as the *degraded* takeover for
SDDM when the DM stop could not be achieved. Masking without the stop is not
a weaker defense. It is the storm's engine.

So the mask no longer substitutes for the DM stop, on any flavor:

* `dm_plan` loses its `mask` input, and with it `dm_survives_masked_unit` —
  the SDDM/plasmalogin split existed only to pick a degraded mode, and there
  is no longer one to pick. A planned DM stop that does not land now fails
  the takeover and the caller degrades to ATTACH, which is a fully working
  stream at the session's own mode. Fighting an autologin we cannot stop is
  strictly worse than not taking over: it costs the user their input plane.
* The mask is laid only after the stop has LANDED. Both failure arms bail,
  so reaching the mask proves no DM is up to relogin through it. That is
  also what keeps mask-fragile flavors safe — a stopped plasmalogin cannot
  trip its own start limit, and every restore path unmasks before restarting.
* `skip` is now `!any_live` on every flavor: killing loaded-but-inactive
  leftovers frees no Steam, and masking them under a running DM is the storm.

Which of the two candidates in the handoff this was is now settled, on the
box: not (b). `pkexec /usr/libexec/punktfunk/pf-dm-helper linger` run from a
sessionless `systemd --user` context — the host's own context — exits 0;
lingering is on, bazzite is in group `punktfunk` (965), helper and polkit
action are installed and correctly annotated. The privileged path works
there. It is (a), and the fix is the invariant above rather than a better
`any_live`, because the DM ending up alive next to our mask is the fault
whatever put it there.

`any_live` is tightened anyway, stated as the negative: systemd has exactly
two not-running ACTIVE states and the other four all mean the unit still
owns Steam. The old list missed `deactivating` (and `reloading`), so a unit
caught mid-teardown read as a dead leftover — a box that IS in gaming mode
sampled as idle, its Steam left holding the single instance our own launch
then collides with. Small window on an idle box, wide open on a churning
one, which is exactly when this is sampled.

Two things the handoff asked for that are about never spending that evening
again:

* `DmHelperError::shape()` — the four shapes need four different fixes
  (package it / install polkit / fix the action / join the group), so they
  ride along as a greppable `shape` field, and a planned-but-unachieved DM
  stop now logs at ERROR naming it instead of vanishing into a WARN.
* `watch_for_relogin_storm()` — logind names its session files after a
  monotonic id in `/run/systemd/sessions`, so the max is a free login
  counter. Two `read_dir`s five seconds apart on a detached thread; above
  1/s it says so at ERROR, and says what it means: no audio, input or
  PipeWire measurement taken during a storm is valid. Detect-and-report
  only — self-mitigation would tear down a live stream on a detector that
  has never been wrong in the field because it has never run there.

Finally, `systemctl_system` captures its stderr and logs it at DEBUG. On an
unprivileged host that verb is *expected* to fail — it is the cheap probe
before the pkexec helper — so systemctl's own "Access denied ... requires
interactive authentication" went to the journal on the normal, successful
path: two of them immediately before `INFO restored the display manager`.
That shape cost two sessions on its own, each spent explaining a failure
that had already succeeded one line later.

Checked in the CI image (linux/amd64): `cargo fmt --check`, `cargo clippy
--all-targets -D warnings`, and `cargo test -p pf-vdisplay --lib gamescope`
— 52 passed, 1 ignored (needs a live `systemd --user` manager).

Refs: punktfunk-planning design/sddm-relogin-storm-starves-input-handoff.md

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 22:29:01 +02:00
enricobuehler c7c9500e89 fix(windows/scripting): the runner task writes a log file, so a runner that can't reach the host is no longer silent
Field report 2026-08-18, Windows host on 0.30: PunktfunkScripting task Running, Playnite and
Steam plugins installed, library empty, and "no logs at all for plugins" — nowhere on the box.

That is by construction, not by accident. The runner's only log door is the log shipper, which
tees console output to `POST /plugins/logs` over the mgmt API; the scheduled task itself had no
console and no file. So every failure that stops the runner reaching the host — LocalService
lost its read grant on plugin-token / native-cert.pem, a moved mgmt bind, a TLS pin miss, a
401 — is exactly the failure the shipper cannot report, and it leaves the same picture:
task Running, plugins never registering, an empty grid, and nothing to send when asked for logs.

`scripting-run.cmd` now redirects the runner's stdout+stderr to
`%ProgramData%\punktfunk\plugin-state\runner.log`, keeping the previous run as `runner.log.1`.
plugin-state is the one directory `plugins enable` makes writable for LocalService, and it
inherits Users-read from the config dir, so the operator can `type` it from any prompt.
Writability is probed with `copy /y nul` first; if the dir is not writable (the task was started
by the installer before `plugins enable` ever ran) the runner starts unlogged as before rather
than not at all. No `goto`: the file is stored LF and cmd's label scan is unreliable there.

The console's empty-Plugins hint (en/de) and the plugin docs now name the file; the log-ship
header no longer claims the task writes no file. Verified by reading only — no Windows box
reachable from here; the cmd semantics used (`copy nul` as a write probe, `if defined` blocks,
leading redirect on `echo`) are the boring ones.
2026-08-18 22:26:08 +02:00
enricobuehler cfbde6aec7 Merge pull request 'Tell the agents where the issues live: AGENTS.md and docs/agents/' (#310) from worktree-agents-md-setup into main
ci / bun-nix (push) Successful in 33s
ci / web (push) Successful in 1m20s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 13s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 13s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 12s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 1m32s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m0s
ci / docs-site (push) Successful in 3m24s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m23s
ci / rust-arm64 (push) Successful in 4m17s
docker / deploy-docs (push) Successful in 38s
ci / rust (push) Successful in 8m17s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Failing after 13m29s
docker / builders-arm64cross (push) Skipped
Reviewed-on: #310
2026-08-18 19:33:35 +00:00
enricobuehler 0eb8f2d0f1 docs(agents): AGENTS.md — where the issues live, what the labels mean, which docs to read first
ci / bun-nix (pull_request) Successful in 36s
ci / docs-site (pull_request) Successful in 1m25s
ci / web (pull_request) Successful in 1m29s
ci / rust-arm64 (pull_request) Successful in 2m18s
ci / rust (pull_request) Successful in 8m53s
The mattpocock engineering skills (/triage, /to-tickets, /to-spec, /wayfinder,
/diagnosing-bugs, /code-review) all assume a per-repo configuration that this
repo never had: they need to know which tracker to talk to, which label strings
carry the five triage roles, and which docs to read before exploring. Without it
each of them guesses, and the guess is GitHub.

Which is wrong here in a way that fails quietly. This repo's remote is
git.unom.io — Gitea. `gh` is installed on the machine and will happily run
against github.com and find nothing; `glab` and `tea` are not installed at all.
So the tracker doc points at the connected `gitea` MCP server instead, and says
so in the first line, because the failure mode is an agent confidently reporting
an empty issue list.

Two traps in that MCP surface are worth the words they take:

  - `issue_write` applies labels by numeric ID and `remove_label` takes a
    `label_id`, while `list_issues` filters by label *name*. Applying a label
    therefore needs a `label_read` lookup first — passing the name silently
    gets you nowhere.

  - unom/punktfunk has no labels defined at all, on the repo or on the org
    (checked both). The first triage run has to create the five before it can
    apply any of them.

Gitea writes are outward-facing — a shared instance that mails on activity — so
the doc encodes the standing rule as a gate: reads are free, every write waits
for a go-ahead, subagents included.

Domain docs are single-context: one CONTEXT.md and one docs/adr/ at the root.
Neither exists yet and neither should be created pre-emptively; /domain-modeling
writes them when a term or a decision actually gets resolved. Twenty-seven
crates and nine client platforms is the shape of a repo that eventually wants a
CONTEXT-MAP.md, so the switch path is written down — but they serve one domain
today, and a glossary split four ways before it has a single entry is just four
empty files.

AGENTS.md rather than CLAUDE.md because neither existed, and the cross-tool
convention costs nothing here.
2026-08-18 21:31:48 +02:00
enricobuehler 59cc234055 Merge pull request 'Clicking a host connects to it again; the library goes back to the card menu' (#309) from worktree-revert-host-card-primary-connect into main
ci / bun-nix (push) Successful in 28s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 14s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 12s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 10s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 17s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 18s
ci / rust-arm64 (push) Successful in 1m26s
ci / web (push) Successful in 1m23s
ci / docs-site (push) Successful in 1m20s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 26s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 34s
apple / swift (push) Successful in 2m11s
docker / builders-arm64cross (push) Successful in 46s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 2m10s
docker / deploy-docs (push) Successful in 36s
ci / rust (push) Successful in 6m16s
apple / distribute (push) Successful in 11m21s
apple / screenshots (push) Successful in 10m18s
Reviewed-on: #309
2026-08-18 19:20:30 +00:00
enricobuehler 242292528c fix(clients/apple): clicking a host connects to it again; the library goes back to the menu
ci / bun-nix (pull_request) Successful in 32s
ci / docs-site (pull_request) Successful in 1m16s
ci / web (pull_request) Successful in 1m20s
ci / rust-arm64 (pull_request) Successful in 1m32s
apple / swift (pull_request) Successful in 2m19s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / rust (pull_request) Successful in 5m10s
Reverts the primary-action swap from 22fdea66: a host card's tap ran
`onBrowseLibrary ?? onConnect`, so on Mac, iPad and Apple TV clicking a paired
machine dropped you on its game shelf and streaming the desktop had moved into
the context menu. That inverted the pattern every other surface still uses.

Back to: tap the card = connect, "Browse Library…" = a context-menu action
(both on the host's own card and on a pinned host+profile card, where its shelf
still launches with that card's profile).

No other client had drifted — the Rust console shell (Linux + the Android Skia
port) keeps A = connect and Y = library, the GTK card's activate emits
`CardOutput::Connect` with "Browse library…" in the overflow menu, Android's
Compose grid taps to connect with the same menu item, and the Apple console
shell's tiles activate into connect. Only the touch/desktop `HostCardView` had
the swap, which is why one fix covers all three Apple platforms.

Everything else the library round-trip landed stays: the wake-on-open retry, the
per-host cached catalog, the Resume badges, the scroll memory.

Verified on the Mac: swift build clean, swift test 375 tests / 0 failures.
2026-08-18 20:09:08 +02:00
enricobuehler 0f7d724154 Merge pull request 'The virtual DualSense wore a placeholder USB serial no real pad has' (#307) from worktree-usbip-dualsense-fix into main
ci / web (push) Successful in 1m49s
ci / rust-arm64 (push) Successful in 2m48s
ci / docs-site (push) Successful in 2m38s
ci / bun-nix (push) Successful in 50s
deb / build-publish-gamescope (push) Successful in 42s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 14s
deb / build-publish-client-arm64 (push) Successful in 1m41s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 14s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 18s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 19s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 12s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 14s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 12s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 12s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 22s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m4s
deb / build-publish-host (push) Successful in 5m31s
docker / builders-arm64cross (push) Successful in 12s
docker / deploy-docs (push) Successful in 39s
deb / build-publish (push) Successful in 6m43s
android / android (push) Successful in 13m24s
windows-host / package (push) Successful in 13m13s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 41s
arch / build-publish (push) Successful in 11m15s
deb / smoke-install (push) Successful in 4m25s
ci / rust (push) Successful in 19m1s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 18m35s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 18m52s
Reviewed-on: #307
2026-08-18 17:50:00 +00:00
enricobuehler 475ff70a2a fix(pad): the virtual DualSense wore a placeholder USB serial no real pad has
ci / bun-nix (pull_request) Successful in 46s
ci / web (pull_request) Successful in 1m17s
ci / docs-site (pull_request) Successful in 1m36s
ci / rust-arm64 (pull_request) Successful in 1m44s
android / android (pull_request) Successful in 5m10s
ci / rust (pull_request) Successful in 7m6s
`UsbDevice::default` in the vendored server fills iSerialNumber with the string
"Serial". A real DualSense reports none — this file's own doc comments assert that
twice — and ALSA bakes the value into the card id, so the pad presented as
`…DualSense_Wireless_Controller_Serial-00` where the hardware gives
`…DualSense_Wireless_Controller-00`. PipeWire then carries the difference into
every node name and into `device.serial`.

Clearing it makes every name a matcher can key on byte-identical to a physical
pad's.

Scope, honestly: this is fidelity, not a fix for anything currently broken. It was
written when the `_Serial` infix was a suspect for the dead haptics; it is not the
cause. GE-Proton's winepulse leg has since been observed matching
`alsa_output.usb-Sony_Interactive_Entertainment_DualSense_Wireless_Controller_Serial-00.Default__Speaker__sink`
with the placeholder present, so nothing depends on this today. It removes a
gratuitous difference from real hardware rather than fixing a symptom.

Also NOT a fix for UCM profile selection, though that was my first reading:
`alsa-ucm-conf` keys on `${CardComponents}` (`USB054c:0ce6`), so `DualSense-PS5.conf`
matched with the placeholder still present. Which profile a card lands on is decided
by verb priority, not by its name. The comment records that so it is not re-derived.

Gated with `cargo clippy -p pf-inject --all-targets -- -D warnings` in
`punktfunk-rust-ci:latest` (linux/amd64): exit 0.
2026-08-18 19:48:13 +02:00
enricobuehler d4db2e3331 Merge pull request 'The RPM %install tried to execute a %files path, so main builds no RPMs' (#306) from worktree-rpm-spec-stray-install into main
ci / bun-nix (push) Successful in 23s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 24s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 18s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 36s
ci / web (push) Successful in 1m29s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 54s
ci / docs-site (push) Successful in 1m31s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 13s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 16s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 14s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 25s
ci / rust-arm64 (push) Successful in 2m5s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 44s
docker / builders-arm64cross (push) Successful in 38s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m58s
docker / deploy-docs (push) Successful in 40s
ci / rust (push) Successful in 7m17s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Successful in 17m28s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Successful in 19m11s
Reviewed-on: #306
2026-08-18 17:18:01 +00:00
enricobuehler c49b648032 fix(packaging/rpm): drop the stray %files path that %install tried to execute
ci / bun-nix (pull_request) Successful in 30s
ci / web (pull_request) Successful in 1m7s
ci / docs-site (pull_request) Successful in 1m23s
ci / rust-arm64 (pull_request) Successful in 1m32s
ci / rust (pull_request) Successful in 6m22s
The WirePlumber DualSense policy landed with its %files line duplicated into
%install, one line above the real install. rpm ran it as a command, and the
%install scriptlet died on 'No such file or directory' before it reached
anything else.
2026-08-18 19:13:59 +02:00
enricobuehler c94dafd4be Merge pull request 'The Linux capture sink drives its own PipeWire group — and says so when something else does' (#305) from worktree-audio-sink-clock-isolation into main
ci / web (push) Successful in 1m12s
ci / bun-nix (push) Successful in 1m21s
ci / docs-site (push) Successful in 1m46s
ci / rust-arm64 (push) Successful in 2m36s
deb / build-publish-gamescope (push) Successful in 39s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 26s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 9s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 13s
deb / build-publish-client-arm64 (push) Successful in 1m26s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 11s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 11s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 10s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 17s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 29s
deb / build-publish (push) Successful in 5m1s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m27s
deb / build-publish-host (push) Successful in 7m10s
android / android (push) Successful in 10m32s
arch / build-publish (push) Successful in 10m56s
docker / builders-arm64cross (push) Successful in 23s
docker / deploy-docs (push) Successful in 41s
windows-host / package (push) Failing after 11m30s
windows-host / canary-manifest (push) Skipped
windows-host / winget-source (push) Skipped
deb / smoke-install (push) Successful in 3m36s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Failing after 14m2s
ci / rust (push) Successful in 22m45s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Failing after 12m44s
Reviewed-on: #305
2026-08-18 16:00:06 +00:00
enricobuehler abb084aac3 Merge pull request 'topology: exclusive was echoed back by the API and dropped on Hyprland and sway' (#304) from worktree-vdisplay-topology-wlroots-hyprland into main
ci / bun-nix (push) Successful in 1m29s
ci / web (push) Successful in 2m6s
ci / docs-site (push) Successful in 2m9s
ci / rust-arm64 (push) Successful in 3m55s
deb / build-publish-gamescope (push) Successful in 48s
android / android (push) Canceled after 5m54s
arch / build-publish (push) Canceled after 3m21s
ci / rust (push) Canceled after 0s
deb / build-publish (push) Canceled after 3m27s
deb / build-publish-host (push) Canceled after 3m13s
deb / build-publish-client-arm64 (push) Canceled after 53s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 1s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 1s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 27s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 24s
windows-host / package (push) Canceled after 5m55s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
Reviewed-on: #304
2026-08-18 15:54:11 +00:00
enricobuehler 3eede724d1 docs(host/audio): say what the driver-id line can and cannot promise
ci / bun-nix (pull_request) Successful in 52s
ci / web (pull_request) Successful in 1m21s
ci / docs-site (pull_request) Successful in 1m31s
ci / rust-arm64 (pull_request) Successful in 2m5s
android / android (pull_request) Successful in 6m1s
ci / rust (pull_request) Successful in 17m38s
The comment claimed the daemon republishes node props "whenever the graph is
recalculated". It does not, quite: pw_impl_node_set_driver writes the key and marks the
props changed, but leaves the flush to the node's next info emission — in practice the
state change that accompanies the same recalculation. Near enough for a diagnostic, and
exactly the kind of near-enough that a later reader deserves to be told about rather than
discover. Also retires four "in stream-sink mode" phrasings that now describe both sink
modes.
2026-08-18 17:49:48 +02:00
enricobuehler 4b5a37dae2 feat(vdisplay): topology: exclusive was echoed back by the API and dropped on Hyprland and sway
ci / bun-nix (pull_request) Successful in 36s
ci / web (pull_request) Successful in 1m18s
ci / docs-site (pull_request) Successful in 1m43s
ci / rust-arm64 (pull_request) Successful in 2m8s
android / android (pull_request) Successful in 7m40s
ci / rust (pull_request) Successful in 8m5s
Both wlr-family backends accepted the topology axis, the management API reported
it as the session's effective topology, and the backend logged a warning and did
nothing (sweep 13.18 shipped the warning, never the behaviour). Because
`resolve_topology` sends `auto` — the default — to `Exclusive` on any host without
a `PUNKTFUNK_COMPOSITOR` pin, and both compositors are auto-detected, the default
policy on every such box was an Exclusive that behaved as Extend. Closes #284.

`exclusive` now disables the operator's heads for the session and restores them
when the display GROUP's last member is torn down, via the same
`take_topology_restore` hand-off KWin uses — so the registry runs the restore
before the last output is reclaimed and the compositor never sees zero enabled
outputs, and a sibling session never has the desk re-enabled under it.

The disable filter is group-aware (design §6.1): enabled, not ours, and not
managed. On Hyprland `managed` is `PF-<pid>-<n>`, which covers a second host's
outputs too; on sway it is the `HEADLESS-` prefix, which also spares a headless
sway's own bootstrap output — the harmless failure, versus blacking out a live
sibling.

`primary` stays treated as extend, which is the honest answer rather than a gap:
Wayland has no primary-output concept and these compositors have only a focused
output, which the streamed head already holds since #283. It now says so
distinctly instead of sharing a warning with `exclusive`.

🛑 The Hyprland restore is `hyprctl reload`, and that is measured, not chosen.
Re-applying the head's own mode/position/scale — what design §5.2 and the issue
both assume — does NOT undo a disable: it answers `ok` and leaves `disabled:
true`. Probed 2026-08-18 against 0.56.2 (hyprlang) and 0.55.4 (Lua); every
targeted form was accepted and changed nothing, including `,enable` (answers
`invalid resolution`), `preferred,auto,1`, `monitorv2 disabled=false`, `keyword
unset monitor`, the Lua `disabled = false`, `dispatch dpms on` and
`forcerendererreload`. A runtime monitor rule is additive and the `disable` keeps
winning; only re-reading the config clears it. The headless output survives the
reload, so the issue's worry about losing it does not hold. Side effects are
documented at the call site and in the docs: other runtime `keyword` overrides are
dropped, and a hyprlang config re-runs its `exec =` lines. It runs only when a
session actually disabled something.

Disable is spelled per config era and confirmed by read-back, mirroring
`set_monitor_rule`: `keyword monitor <n>,disable` under hyprlang, `hl.monitor{
output = "<n>", disabled = true }` under Lua. Both eras reject the other's form at
exit 0, so the read-back — not the exit status, not the `ok` — is what decides.

Also fixes a marker gap that made one of those rejections read as success:
`hyprctl keyword` under the Lua config manager answers "keyword can't work with
non-legacy parsers. Use eval.", and `hyprctl_dispatch` matched "couldn't" but not
"can't". `set_monitor_rule` was covered by its own mode verification; nothing else
was.

⚠ The sway half is NOT exercised on a live sway — no box in the fleet runs one,
the same gap #283's `focus output` shipped with. The argv is sway's documented
surface, both shapes are pinned by tests (this file uses `output <name> <verb>`
AND `focus output <name>`, so getting one backwards is the live risk), and the
read-back turns a wrong guess into a warning naming the outputs rather than a
screen that silently stays dark.

Six new unit tests cover the group-aware filter on both backends, the headless
no-op case, both disable spellings and the marker set. 246 pass on Linux.
2026-08-18 17:49:45 +02:00
enricobuehler f24eb02692 fix(packaging): the DualSense driver-priority guard has to be 0, and cover the capture node
The shipped WirePlumber policy sets `priority.driver = 1` on a DS5's ALSA sink and says it
"keeps the pad from ever driving the graph". Read against PipeWire's own recalc, it does not:
`priority_driver` is unsigned and `pw_context_recalc_graph` skips a driver only when it is
`<= 0`. At 1 the pad is merely LAST in the ordering — and last is still elected whenever
nothing above it qualifies, which on a punktfunk host is the ordinary in-session state,
because claiming our own sink as the default output leaves the box's real card idle. With
`node.always-process` on the same node it is also permanently runnable, i.e. permanently
eligible.

Zero is the value that means excluded. The pad keeps driving the streams actually linked to
it — a driver always drives its own group, priority orders the election and nothing else —
so GE-Proton's haptics are unaffected.

The second rule covers the capture side of the same cards. That node is what clocked a
reporter's desktop audio for a whole session: in the Pro Audio profile it carries
`priority.driver = 2600`, never suspends, and had nothing linked to it at all — its only
function on that machine was to clock other people's graphs. The `alsa_output` matches never
touched it. Only the priority is set there; holding a device open is about the playback node
GE opens raw, and an always-processing microphone is not something this host should ask for.

Both of these are belt to the braces of the host-side fix — a capture group that carries its
own driver cannot be handed one — but they are worth having on their own: they are what stops
a pad from clocking anything else on the box, including a build that predates it.
2026-08-18 17:47:00 +02:00
enricobuehler e053292a80 docs: the host's own audio output, and what to do when another device clocks it
`PUNKTFUNK_STREAM_SINK` has existed since 0.29 and appeared in no documentation at all, which
was tolerable while it had two values and one of them was "don't". It has three now, the
default changed shape, and the change is visible to anyone who opens their audio settings
mid-session: there is a virtual output *and* a recording stream named `punktfunk-audio-…`,
and someone will want to know whether that is a leak. It is not.

Troubleshooting gains the section the 2026-08-14 investigation should have been able to
start from: audio broken up while video is steady, one WARN line naming the node that took
our clock, what that means for the sound (its stalls are now our holes), and the two ways
out — remove the loopback, or turn off the profile of a sound card that is reached over the
network and cannot be clocked at all.
2026-08-18 17:46:38 +02:00
enricobuehler ed075b98dd feat(host/audio): the capture line says which node is clocking it
On 2026-08-14 a reporter's audio stuttered. Answering "what is clocking desktop audio on
that box?" took four field logs, a purpose-built probe script, and finally a pw-top DRIVER
column — and the answer was a DualSense's sound card, attached over the network, that
nothing was linked to.

Every part of that answer was already in the daemon, one bind away. `node.driver-id` on our
own node names the driver of the group we are scheduled in; it is deliberately not in the
registry's announce set, so it needs the node bound and its `info` event read, and the
daemon republishes the props whenever the graph is recalculated.

So bind our node, keep a map of node id to name from the registry, and log the driver by
name whenever it changes. In null-sink mode there is exactly one right answer — our own sink
— so anything else is a WARN that names the culprit and says what it means: the holes in
this stream are that node's scheduling, not ours. The legacy topologies have no driver of
their own and borrow one by design, so there the same fact is an INFO that names it without
judging it.

On change rather than per window, deliberately: the driver moves a handful of times in a
session, and the 30 s capture summary is written from the RT callback while this arrives on
the main loop — a shared field would need cross-thread state for a value that a line of its
own carries better (`grep 'graph driver'`).
2026-08-18 17:43:28 +02:00
enricobuehler ec44079db4 fix(host/audio): the Linux capture sink drives its own graph group
Our desktop-audio sink was a pw_stream wearing media.class=Audio/Sink. A stream is
structurally a follower — it never drives — so the group it forms with the game's output
streams has no driver of its own, and PipeWire's recalc assigns every such group to the
highest-priority *running* driver anywhere on the box.

On a reporter's host that was the DualSense forwarded over VirtualHere: its USB-Audio card
sat in the Pro Audio profile (priority.driver=2600, never suspends), nothing was linked to
it, and it clocked our capture and the game's four streams for a whole 15-minute session.
Its frame counter is a kernel stub — vhci_get_frame_number() logs "not yet implemented" and
returns 0, ~1900 times a second — so snd-usb-audio could not recover a device clock for an
async endpoint arriving over the network. Not xruns: every cycle that happened was healthy
(ERR 11 in 15 min, WAIT never past 111 µs); the loss was in the interval *between* cycles.
3.9 delivery holes a second, worst 142 ms, and 15.4 % of the audio that user heard was
silence this host synthesized over the gaps.

So mint a real sink instead: a support.null-audio-sink adapter, created on our own
connection, captured through its monitor. That node IS a driver — the null sink publishes
node.driver=true and the audio adapter forwards its props — with a timerfd inside the
daemon's realtime data loop, so the group carries its own clock and no hardware (or
network-attached) device can be elected for it. It is the same object pactl load-module
module-null-sink creates, which is the most exercised virtual-sink path on Linux.

Three properties carry the design, and each is a decision rather than a default:

  * node.passive on the monitor tap. A link is passive when the input port is passive and
    the output node can suspend (any Audio/Sink), and a passive link makes neither end
    runnable by itself — so between sessions the group is idle and the null sink's timer
    parks with it. That answers, by construction, the "200 callbacks a second forever on a
    parked host" objection that kept node.always-process off the old stream sink. While a
    game plays, its own non-passive link makes the sink runnable and run_nodes() walks that
    through the monitor to us, so pause/resume accounting keeps today's meaning exactly.

  * node.force-quantum, not node.latency. A driver's quantum is the smallest node.latency
    among its followers, clamped — and then rounded DOWN to a power of two, because
    default.clock.power-of-two-quantum is true by default. That is why our 240-frame ask has
    silently been served as 128 on every stock Linux host since the capture was written: the
    callback runs at 2.67 ms, not the 5 ms it is designed around. force-quantum skips the
    rounding, and because this sink drives only its own group it forces nothing on anyone
    else's device — which is exactly why the same key would have been the wrong answer while
    we were borrowing somebody's hardware clock.

  * node.dont-fallback WITH node.linger, never one alone. WirePlumber 0.5 reads
    dont-fallback on its own as licence to destroy the stream the moment its target is not
    visible ("defined target not found"); linger turns that into "wait for it". Together
    they mean the tap can only ever record our sink — never, not even for the moment before
    ours registers, a hardware sink's monitor.

PUNKTFUNK_STREAM_SINK grows a third value: unset is the new topology, =stream is the 0.30
one (a one-release escape hatch, so a field A/B needs no build), =0 is still the legacy
default-sink-monitor follower. The routing claim, the capture callback, the stats line and
everything downstream are untouched — the sink node changed owner, not the pipeline.

The channel map now has one source and two views (pod and audio.position string), because a
created node is configured by properties while a stream is configured by a format pod, and a
map that disagreed with itself between them would swap channels silently.

Gated in punktfunk-rust-ci amd64: fmt, clippy --all-targets -D warnings (non-vacuous —
"Checking punktfunk-host" present), 607 tests. On-glass validation is still owed and is what
the plan gates the merge on: pw-top must show our sink at the top of its own group with the
game's streams and our tap under it, and 5 min of loud audio at delivered_pct=100 gaps=0 on
a box where a hardware sink is also running.
2026-08-18 17:40:35 +02:00
enricobuehler b81aee6821 Merge pull request 'Audio follow-ups: the jitter ring deepens by inserting instead of de-priming, client audio threads get real priority, fs-change syncs are rate-capped' (#303) from worktree-audio-followups into main
audit / bun-audit (sdk) (push) Successful in 41s
apple / swift (push) Successful in 2m13s
audit / bun-audit (plugin-kit) (push) Successful in 43s
audit / cargo-audit (push) Failing after 46s
audit / pnpm-audit (push) Successful in 14s
audit / bun-audit (web) (push) Successful in 37s
audit / docs-site-audit (push) Successful in 36s
audit / license-gate (push) Successful in 5m21s
ci / web (push) Successful in 1m12s
ci / bun-nix (push) Successful in 22s
ci / docs-site (push) Successful in 1m16s
audit / c-abi-asan (push) Successful in 6m46s
audit / miri (push) Successful in 7m17s
deb / build-publish-gamescope (push) Successful in 44s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Successful in 48s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Successful in 17s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Successful in 10s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Successful in 3m21s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Successful in 10s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Successful in 11s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Successful in 10s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Successful in 9s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Successful in 13s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Successful in 1m1s
ci / rust-arm64 (push) Successful in 7m51s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Successful in 1m18s
deb / build-publish-client-arm64 (push) Successful in 3m45s
apple / distribute (push) Successful in 11m56s
deb / build-publish-host (push) Successful in 8m3s
deb / build-publish (push) Successful in 8m19s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Successful in 7m5s
flatpak / build-publish (push) Successful in 7m12s
apple / screenshots (push) Successful in 10m44s
android / android (push) Successful in 10m27s
docker / builders-arm64cross (push) Successful in 18s
docker / deploy-docs (push) Successful in 1m34s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Failing after 17m54s
nix / flake (push) Successful in 17m59s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Failing after 17m40s
windows-host / package (push) Successful in 13m51s
windows-host / winget-source (push) Skipped
windows-host / canary-manifest (push) Successful in 44s
arch / build-publish (push) Successful in 13m32s
deb / smoke-install (push) Successful in 5m48s
ci / rust (push) Canceled after 19m8s
Reviewed-on: #303
2026-08-18 15:05:19 +00:00
enricobuehler 412991f6a3 Merge pull request 'DualSense haptics + speaker work in-game: four fixes between the game and the pad' (#302) from worktree-pad-audio-fidelity into main
android / android (push) Canceled after 0s
arch / build-publish (push) Canceled after 0s
ci / rust (push) Canceled after 1s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
deb / build-publish (push) Canceled after 0s
deb / build-publish-host (push) Canceled after 0s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
nix / flake (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 0s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 0s
windows-host / package (push) Canceled after 0s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
Reviewed-on: #302
2026-08-18 15:02:16 +00:00
enricobuehler e43d67c721 Merge pull request 'The Android client adopts the Skia console — one gamepad UI on three platforms, the Compose mirror deleted' (#301) from worktree-android-skia-console into main
android / android (push) Canceled after 17s
arch / build-publish (push) Canceled after 0s
ci / rust (push) Canceled after 0s
ci / rust-arm64 (push) Canceled after 0s
ci / web (push) Canceled after 0s
ci / docs-site (push) Canceled after 0s
ci / bun-nix (push) Canceled after 0s
deb / build-publish (push) Canceled after 0s
deb / build-publish-host (push) Canceled after 0s
deb / build-publish-gamescope (push) Canceled after 0s
deb / build-publish-client-arm64 (push) Canceled after 0s
deb / smoke-install (push) Canceled after 0s
docker / builders (--build-arg FEDORA_VERSION=44, ci/fedora-rpm.Dockerfile, punktfunk-fedora44-rpm, -f44) (push) Canceled after 0s
audit / bun-audit (plugin-kit) (push) Successful in 21s
docker / builders (ci/android-ci.Dockerfile, punktfunk-android-ci) (push) Canceled after 0s
docker / builders (ci/arch-ci.Dockerfile, punktfunk-arch-ci) (push) Canceled after 0s
docker / builders (ci/fedora-rpm.Dockerfile, punktfunk-fedora-rpm) (push) Canceled after 0s
docker / builders (ci/flatpak-ci.Dockerfile, punktfunk-flatpak-ci) (push) Canceled after 0s
docker / builders (ci/gamescope-trixie.Dockerfile, punktfunk-gamescope-trixie) (push) Canceled after 0s
docker / builders (ci/rust-ci-noble.Dockerfile, punktfunk-rust-ci-noble) (push) Canceled after 0s
docker / builders (ci/rust-ci.Dockerfile, punktfunk-rust-ci) (push) Canceled after 0s
docker / builders-arm64cross (push) Canceled after 0s
docker / apps (., web/Dockerfile, punktfunk-web) (push) Canceled after 0s
docker / apps (docs-site, docs-site/Dockerfile, punktfunk-docs) (push) Canceled after 0s
docker / deploy-docs (push) Canceled after 0s
nix / flake (push) Canceled after 0s
rpm / build-publish (43, bazzite, punktfunk-fedora-rpm) (push) Canceled after 0s
rpm / build-publish (44, fedora-44, punktfunk-fedora44-rpm) (push) Canceled after 0s
audit / cargo-audit (push) Failing after 56s
audit / bun-audit (sdk) (push) Successful in 27s
windows-host / package (push) Canceled after 0s
windows-host / canary-manifest (push) Canceled after 0s
windows-host / winget-source (push) Canceled after 0s
audit / bun-audit (web) (push) Successful in 26s
audit / docs-site-audit (push) Successful in 20s
audit / pnpm-audit (push) Successful in 18s
apple / swift (push) Successful in 2m9s
apple / distribute (push) Canceled after 0s
apple / screenshots (push) Canceled after 0s
audit / license-gate (push) Canceled after 1m50s
audit / miri (push) Canceled after 1m30s
audit / c-abi-asan (push) Canceled after 1m16s
flatpak / build-publish (push) Canceled after 0s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (push) Canceled after 0s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (push) Canceled after 0s
Reviewed-on: #301
2026-08-18 15:01:49 +00:00
enricobuehler 0a6a49a9aa feat(packaging): a WirePlumber policy holds a DualSense's sound card for GE-Proton
ci / rust-arm64 (pull_request) Successful in 2m34s
ci / web (pull_request) Successful in 2m38s
android / android (pull_request) Successful in 5m32s
ci / docs-site (pull_request) Successful in 1m26s
ci / bun-nix (pull_request) Successful in 52s
ci / rust (pull_request) Successful in 8m25s
nix / flake (pull_request) Failing after 14m42s
GE-Proton's DS5 haptic router opens the pad sink's backing hw: device RAW whenever it is
free — then its own path re-probe EBUSYs against its own handle, invalidates the stream,
and spins a 100 Hz "device generation" refresh loop: haptics dead, speaker dead, and in
one game a buffer race in the same machinery crashed the title outright. On SteamOS,
where that code was developed, PipeWire always holds the device, so GE lands on its
well-tested Pulse-routing fallback immediately and none of this fires.

Ship the SteamOS-shaped environment: node.always-process + no suspend keeps PipeWire
holding the device from the moment the card appears, and priority.driver = 1 keeps the
pad — whose USB audio clock (virtual or physical) is nobody's idea of a house clock —
from ever driving the graph. Installed by rpm/deb/arch/nix into
/usr/share/wireplumber/wireplumber.conf.d/. Matches both DS5 product-string spellings;
covers physically plugged pads on a headless host identically.
2026-08-18 16:42:33 +02:00
enricobuehler e356e354f2 fix(pad-audio): the speaker lane gets the music coder, the haptics lane keeps LowDelay
Both 0xD1 lanes encoded with Application::LowDelay at 64 kbps CBR — right for voice-coil
rumble (felt latency, band-limited content), audibly wrong for the pad speaker, which
carries real programme audio: on glass it "sounded insanely compressed". The speaker lane
now uses the full Application::Audio coder at 96 kbps (~120 bytes per 10 ms frame, still
far under one MTU); its few ms of extra algorithmic delay are inaudible on a speaker.
Haptics unchanged.
2026-08-18 16:42:31 +02:00
enricobuehler f737414949 fix(usbip): pace ISO completions against an absolute deadline, not relative sleeps
The simulator slept `service_interval × packets` per URB, measured from "now" at handling
time — so tokio timer slop, socket I/O and handler lock waits all added ON TOP of the
nominal period, every URB. The virtual pad's audio clock ran measurably slow under load
(~26 %: hw_ptr advanced ~35.7k frames/s against a 48 kHz stream), the PCM backed up into
xruns, and — because snd-usb-audio's clock IS URB completion — anything clocked off the
device dragged with it. On the test box the pad sink became the PipeWire graph driver and
pulled the desktop capture down to 50 % delivery ("insanely distorted" stream audio).

Pace against a per-endpoint absolute deadline ledger instead: each URB advances the
endpoint's deadline by exactly its nominal duration and sleeps until that instant, so
overhead eats into the next sleep rather than accumulating. A stall beyond 20 ms
re-anchors to now instead of fast-forwarding a burst. Measured after: 48005 frames/s.
Two paused-clock tests pin the exact rate and the re-anchor.
2026-08-18 16:42:29 +02:00
enricobuehler dff2769ba9 fix(pad): the usbip capture forwarded the pad's hardware quad as the wire's speaker pair
The isochronous endpoint carries the DualSense's own channel map — ch0 = headphone LEFT,
ch1 = headphone RIGHT and the built-in mono speaker, ch2/3 = the voice coils — because
everything a game writes has already been folded to hardware channels by the host's UCM
split (or written there directly) before it reaches the endpoint. The 0xD1 wire contract
instead puts the *speaker pair* on ch0/1. Forwarding the quad verbatim shipped headphone-
left (silence) as wire speaker-left and the actual speaker as wire speaker-right, which
the client renders onto the one split-sink channel that current PipeWire never wires to
the physical speaker. Field-diagnosed on glass end-to-end: haptics felt, speaker dead,
a test tone measured on exactly one channel at each hop.

Duplicate the hardware speaker channel across the wire's speaker pair; pass the coils
through; drop headphone-left deliberately (a remote pad's jack is not a wire surface).
The stream-sink capture path (uhid pads) already emits the logical layout and is
unchanged.
2026-08-18 16:42:27 +02:00
enricobuehler 20f766799c feat(plugin-kit): cap fs-change syncs to one per interval — a debounce cannot bound a launcher that never stops writing
apple / swift (pull_request) Successful in 2m4s
apple / distribute (pull_request) Skipped
apple / screenshots (pull_request) Skipped
ci / web (pull_request) Successful in 1m21s
ci / bun-nix (pull_request) Successful in 51s
ci / docs-site (pull_request) Successful in 1m33s
windows-client / client (arm64, --no-default-features, aarch64-pc-windows-msvc, C:\t-a64) (pull_request) Successful in 2m59s
ci / rust-arm64 (pull_request) Successful in 7m52s
windows-client / client (x64, , x86_64-pc-windows-msvc, C:\t) (pull_request) Successful in 6m45s
android / android (pull_request) Successful in 8m39s
ci / rust (pull_request) Successful in 19m10s
nix / flake (pull_request) Failing after 16m14s
The Skynet field log carried `plugin:steam sync (fs-change): reconciled
16 entries` 102 times in 27 minutes: Steam writes to its dirs the whole
time a game runs, and every write re-walked the library. The 3 s
`Stream.debounce` collapses a BURST, but a debounce extends on every
event and so cannot bound the RATE under sustained churn.

`SyncSettings.minInterval` (default `DEFAULT_FS_CHANGE_MIN_INTERVAL` =
30 s; `LibraryPluginDef.minInterval` to override) sits on top of the
debounce: debounced events land in a sliding queue of one, and a drain
loop syncs, then holds for the interval. Changes inside the hold coalesce
into exactly one trailing sync, so nothing is lost and a launcher in a
writing frenzy costs one re-walk per interval instead of one per quiet
gap. Optional on `SyncSettings`, so plugins built against the older kit
keep compiling.

Test drives real `fs.watch` on a temp dir: 28 writes at 25 ms clear a 20 ms
debounce every time and would be ~28 syncs; with a 400 ms interval they
are three, at +32 / +433 / +835 ms.

Not here: narrowing the Steam plugin's watch set (`steamapps/` +
`libraryfolders.vdf`, not `userdata/`/`logs/`) lives in the steam plugin
repo; and the host-side reconcile coalescing during a session is optional
— the kit cap is the lever.
2026-08-18 14:15:41 +02:00
enricobuehler 62119e553a feat(client): give the audio decode, pad-audio and WASAPI threads real priority — the Realtime portal in a flatpak, rtkit outside, MMCSS on Windows
The device callbacks already run where the OS puts realtime audio (the
PipeWire playback callback on the graph's data loop since #292, WASAPI's
event-driven loop woken by the engine). The threads that FEED them were
plain: the decode leg (`punktfunk-audio-rx`), the pad-audio renderer and
its PipeWire loop, the Linux mic loop, and on Windows the render and mic
loops themselves. On a Steam Deck the same four cores decode 1440p120 and
present it, and a decode thread descheduled past the ring depth is a
drought the callback then has to conceal. #292's `setpriority(-10)` was
a no-op there: the user's RLIMIT_NICE is 0.

New `audio_rt` module, one call at the top of each of those threads:

- Linux: `setpriority` where RLIMIT_NICE allows; else, INSIDE A FLATPAK,
  the xdg-desktop-portal Realtime portal (`org.freedesktop.portal.Realtime`
  on the session bus); else rtkit (`MakeThreadHighPriorityWithPID` on the
  system bus). The split is PipeWire `module-rt`'s, and it is not
  optional: verified on the Deck (rtkit 0.14) that rtkit-daemon has NO
  PID-namespace translation — it looks up `/proc/<pid>/task/<tid>/stat`
  with the numbers it is given — so a direct call from a sandbox is
  answered with ENOENT (and there is no `busctl` in the GNOME 50 runtime
  either, which rules out the shell-out). The portal maps the sandboxed
  pid/tid and calls rtkit on the app's behalf, and portals need no
  `--talk-name`. polkit gates both with the TARGET process as subject:
  verified on the Deck by renicing a live active-session thread and a
  `steam` user-service thread (what a Steam-launched client is) through
  both rungs, and restoring them; only remote (ssh) sessions are refused.
  Via zbus, exactly as `pf_frame::thread_qos` does on the host (same
  version, features and backend — one lock line). Never setcap/SCHED_RR:
  the cap_sys_nice route is the one that killed KDE sessions in the field.
- Windows: MMCSS "Pro Audio" + THREAD_PRIORITY_HIGHEST, raw `extern
  "system"` declarations as `pf_frame::session_tuning` spells them; the
  MMCSS handle is leaked (thread-lifetime, the OS reverts it).

Every rung is best-effort and logs at debug what it got (`audio thread
priority raised via=…` / `refused why=…`); a refusal leaves the thread
exactly as it was. Acceptance on the Deck: `ps -eLo cls,rtprio,ni,comm |
grep punktfunk` shows the decode thread at nice −10 after connect.
2026-08-18 14:15:00 +02:00
enricobuehler 5aebb1ace4 fix(client/apple): port the jitter ring's insert — a sync request for more depth deepens the ring instead of de-priming it
The Swift mirror of core's `JitterPolicy` change, line for line: `underRun`
and `insertOneFrame()` next to `overRun` and `shedOneFrame()`, `hollow`
judged against the ADAPTIVE target (`adaptiveTarget(lift:)`, never the
sync-inflated one), `syncWantsMore` arming the insert, and the same
constants (`insertSustainMS = shedSustainMS`, `insertMarginMS =
AvSync.deadbandMS / 2`). `Stats` gains `inserts` and the 1 Hz `audio:`
line logs `drift_inserts=` next to `drift_sheds=`.

`insertFront` is index-based where core's is a `VecDeque`: the copy lands
in the slots just before `readIdx` (free exactly when the ring has that
much spare capacity) and `readIdx` steps back over it; both offsets are
shifted forward by one capacity first when `readIdx` is too small, so
neither can go negative into `%`.

`dropFront` gets the same seam fix as core's `crossfade_drop`: the
fade-out source is now the head of the discarded region — the
continuation of the sample just played — not its tail. Driven through the
hard-cap trim, the old fade stepped by 2 688 samples on a ramp where the
new one stays under 17.

`AudioRingDriftTests` carries the same vectors as core (`…NeverDeprimes`,
`…DeepensWithoutADeprimeOnACleanLink`, the insert seam heard end to end,
the drop seam against the sample played before it); both regression tests
were run against the backed-out fixes and fail there. 42/42 on macOS.
2026-08-18 14:00:52 +02:00
enricobuehler d5462d6d3d feat(client): apply the jitter policy's insert on the PipeWire, WASAPI and AAudio rings, and log it as drift_inserts
The three `VecDeque<f32>` rings apply `JitterStep::insert_front` with
`crossfade_insert` right where they apply `drop_front` today. The PipeWire
callback runs on the graph's realtime loop; the insert stays inside the
ring's reserve (hard cap plus 64 frames) because the policy only inserts
below its target. Same on AAudio (`hard_cap_max + RING_CHUNKS × frame`).

Concealment must stay visible in both directions: `PlaybackVitals` gains
`inserts`, the 10 s `audio playback` line gains `drift_inserts=` next to
`drift_sheds=`, and the Android 10 s line gets the same field. On glass
the tell that this works is `underruns` no longer stepping in lockstep
with `av_offset` swings while `drift_inserts` climbs instead.
2026-08-18 13:52:44 +02:00
enricobuehler 8cff5bda6b fix(core/audio): the jitter ring could only get deeper by de-priming, so a sync request for more depth was a silence gap
`JitterPolicy` could lower its depth gently — one crossfaded frame per
sustain window — but could only RAISE it by de-priming: a full
`target − depth` of inserted silence plus the priming wait. `hollow` was
judged against the sync-inflated effective target, so the moment the A/V
sync loop asked for ≥ 10 ms more depth (audio early against a picture
whose latency wandered — a 53–74 fps KWin source, an ABR retarget, a
keyframe burst) the ring read as hollow on the very next callback, and
the next single late packet cost a 15–60 ms gap. Every client runs this
policy; it is the "started at 0.24/0.25" shape.

Now the ring moves toward its target in BOTH directions with the same
instrument:

- `JitterStep::insert_front` mirrors `drop_front`: when the sync loop
  wants more than the adaptive target and the depth EWMA has sat more
  than `INSERT_MARGIN_MS` below the request for `INSERT_SUSTAIN_MS` of
  consumed audio, duplicate ONE frame at the front, crossfaded. Sync-only
  (an un-wired ring is bit-identical to before), primed-only, and
  below-target-only, so it can never fight the trim.
- `hollow` is judged against the ADAPTIVE target — the one underrun
  evidence proved — never the sync request. Growth that was never banked
  still re-primes on the click it already paid; sync never de-primes.
- `crossfade_insert` is the RT-safe twin of `crossfade_drop` (push_front
  inside reserved capacity, seam blended in place).

The margin is HALF the sync loop's ±10 ms deadband, not the shed's
`shed_excess_ms`: the loop only speaks once the offset has left the
deadband, so a margin at or above it would leave every request it is
allowed to make permanently unanswered.

Also fixes `crossfade_drop`'s seam, found while mirroring it: the
fade-out source was the LAST `fade` discarded samples, which is adjacent
to the survivors — but the sample the device had just played was
adjacent to `ring[0]`, so the seam still opened with a step of
`drop − fade` samples of waveform (3 ms of a 5 ms shed). The old test
only bounded steps INSIDE the faded region. Both helpers now fade out
from the continuation of what was just played, and the tests check the
seam against that sample.

Simulated (the bunching harness now applies inserts and counts
re-primes): a clean link asked for +20 ms deepens in 6 s with 3 inserts,
zero audible, zero re-primes; a −50 ppm host clock over ten minutes is
absorbed by 9 inserts instead of a re-anchor click; the bunching link
asked for +25 ms lands at 4 audible / 0 in the tail / 1 re-prime where
the unsynced run pays 7 / 2 / 4. The two existing convergence tests keep
their bounds. No new `pub const` (cbindgen); the C header is unchanged.
2026-08-18 13:50:36 +02:00
292 changed files with 18522 additions and 5733 deletions
+6
View File
@@ -0,0 +1,6 @@
<!-- What and why — the diff says how. -->
**User-facing fact changed?** (an install step, a knob, a port, what a feature does, a limit)
→ the docs-site page that owns it is updated in this PR, or this is n/a. Install/repo/port facts
live in `data/platforms.json`. (CONTRIBUTING.md "Where facts live"; `docs-drift` in CI only
catches the mechanical half.)
+3 -1
View File
@@ -248,7 +248,9 @@ jobs:
if: steps.webconsole.outputs.cache-hit != 'true'
run: |
cd web
bun install --frozen-lockfile --ignore-scripts
# Retried: bun's download-and-extract is single-shot, and a truncated tarball reads as
# `Fail extracting tarball` (ci.yml's web job has the measurement).
bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
bun run build
- name: The console must exist (cache hit or fresh build)
+52 -2
View File
@@ -175,6 +175,19 @@ jobs:
- name: Test (unit + loopback + proptest + C ABI harness)
run: cargo test --workspace --locked
# The deep half of the docs-drift gates (the `docs-drift` job checks the docs-site copy
# and the textual rest): the committed spec must match what the binary actually serves.
# Build already compiled punktfunk-host with default features, so this re-links at worst.
# Byte diff on purpose — the generator is deterministic, and if that ever stops being
# true it deserves to surface here.
- name: OpenAPI spec drift gate
run: |
cargo run -p punktfunk-host --locked -- openapi > /tmp/openapi.regen.json
diff -u api/openapi.json /tmp/openapi.regen.json >/dev/null || {
echo "::error::api/openapi.json is stale — regenerate: cargo run -p punktfunk-host -- openapi > api/openapi.json && cp api/openapi.json docs-site/public/openapi.json"
exit 1
}
# The GPU encode backends are OFF by default, so every step above compiles ~none of them:
# `nvenc` gates enc/linux/nvenc_cuda.rs (+ nvenc_core/nvenc_status) and `vulkan-encode` gates
# enc/linux/vulkan_video.rs (+ the vendored vk_av1_encode/vk_valve_rgb bindings) — ~8,150
@@ -326,8 +339,19 @@ jobs:
working-directory: /
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git nodejs
- uses: actions/checkout@v4
# RETRIED, like every other single-shot network call in CI (scripts/ci/retry.sh's header
# has the why: this box runs many jobs in parallel and drops packets under that load).
# `bun install` streams download-and-extract, so a tarball truncated mid-stream surfaces
# as `error: Fail extracting tarball for "<pkg>"` — which reads like a corrupt package and
# is not one. Measured 2026-08-20: run 19630's docs-site died that way on
# @rolldown/binding-linux-x64-gnu (8.3 MB) while the web job installed the same registry
# in the same run, and run 19632 installed the identical lockfile seven minutes later. The
# tarball's sha512 matches the lockfile and both bun 1.3.13 and 1.3.14 extract it from
# disk, so there was never anything wrong with the package. 3 attempts (10s+20s backoff),
# not retry.sh's usual 5: a genuinely stale lockfile fails deterministically here, and
# 30s is enough to ride out a load burst without making that wait a minute and a half.
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
run: bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
# Build first: it generates the orval API client + paraglide messages that
# typechecking imports.
- name: Build
@@ -355,8 +379,9 @@ jobs:
working-directory: /
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates git
- uses: actions/checkout@v4
# Retried — see the web job above; this is the job the flake was measured on.
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
run: bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
# Build first: fumadocs-mdx emits the .source typegen the typecheck imports.
- name: Build
run: bun run build
@@ -390,3 +415,28 @@ jobs:
# schema stability across bun2nix releases). Fix with: scripts/ci/check-bun-nix.sh --fix
- name: bun.nix drift gate
run: sh scripts/ci/check-bun-nix.sh
# Docs drift gates — pure git-grep textual checks, no cargo, no bun install (the deep half,
# regenerating the OpenAPI spec from the built host, rides in the `rust` job above). Same
# reasoning as bun-nix for being UNFILTERED: docs drift arrives through commits that look
# unrelated to docs — a renamed env var, a removed subcommand, a moved page.
docs-drift:
runs-on: ubuntu-24.04
container:
image: oven/bun:1
timeout-minutes: 15
steps:
# oven/bun ships neither git nor a real node, and the slim base has no CA bundle —
# actions/checkout needs all three (see the web job).
- name: Install git + node + CA certs
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git nodejs
- uses: actions/checkout@v4
# OpenAPI snapshot in sync, PUNKTFUNK_* vars in docs still exist, undocumented-var
# ratchet (baseline: scripts/ci/docs-undocumented-env-baseline.txt), host-cli.md commands
# still exist, data/platforms.json parses.
- name: Docs drift gates
run: sh scripts/ci/check-docs-drift.sh
# Internal links only: /docs/* page links in docs-site content, relative file links in
# the repo's markdown. External URLs and #anchors are deliberately not checked.
- name: Docs link check
run: sh scripts/ci/check-docs-links.sh
+3 -1
View File
@@ -231,7 +231,9 @@ jobs:
# scripts, and web's `postinstall` is `bun2nix -o bun.nix` — a Nix codegen step this job
# neither consumes nor commits, whose only effect here is to make the install depend on
# bun2nix resolving. `build` re-runs its own `prebuild` codegen regardless.
bun install --frozen-lockfile --ignore-scripts
# Retried: bun's download-and-extract is single-shot, and a truncated tarball reads as
# `Fail extracting tarball` (ci.yml's web job has the measurement).
bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
bun run build
if ! grep -q 'Bun\.serve' .output/server/index.mjs; then
echo "ERROR: web build is not a bun bundle — need the 'bun' preset + custom entry"; exit 1
+59 -13
View File
@@ -1,17 +1,23 @@
# Deploy-only: bring up the two unom-1 pieces that live in THIS repo but whose normal
# deploys are coupled to heavy build workflows — docs to docker.yml's 5-image matrix,
# the flatpak server to flatpak.yml's full flatpak-builder run. This workflow does
# NEITHER build: it just (re)places the compose files and pulls the already-published
# images, so unom/infra's deploy-all can bring a fresh unom-1 fully up in a single
# dispatch without triggering those rebuilds.
# Deploy-only: bring up the unom-1 pieces that live in THIS repo but whose normal deploys
# are coupled to heavy build workflows — docs to docker.yml's 5-image matrix, the flatpak
# server to flatpak.yml's full flatpak-builder run, the nix cache to nix.yml's full Rust
# build. This workflow does NONE of those builds: it just (re)places the compose files and
# pulls the already-published images, so unom/infra's deploy-all can bring a fresh unom-1
# fully up in a single dispatch without triggering those rebuilds.
#
# docs -> pulls git.unom.io/unom/punktfunk-docs:latest (built by docker.yml) and
# brings it up on :3220.
# flatpak -> brings up the caddy:2-alpine static server on :3230. The OSTree repo
# CONTENT (./site) is NOT shipped here — it is regenerated by flatpak.yml
# on the next client build, or restored from the unom-1 backup
# (unom/infra scripts/restore-unom-1.sh, `files` tag). A fresh box serves
# an empty repo until then; that is expected.
# docs -> pulls git.unom.io/unom/punktfunk-docs:latest (built by docker.yml) and
# brings it up on :3220.
# flatpak -> brings up the caddy:2-alpine static server on :3230. The OSTree repo
# CONTENT (./site) is NOT shipped here — it is regenerated by flatpak.yml
# on the next client build, or restored from the unom-1 backup
# (unom/infra scripts/restore-unom-1.sh, `files` tag). A fresh box serves
# an empty repo until then; that is expected.
# nix-cache -> brings up the caddy:2-alpine Nix binary cache on :3250. Same content/config
# split: the cache CONTENT is republished by nix.yml on the next main push
# that moves the flake. An empty cache is harmless — every path 404s and
# users build from source, which is the pre-cache status quo.
# winget -> brings up the winget REST source on :3240; catalogue shipped by
# windows-host.yml on stable tags.
#
# Dispatched by unom/infra scripts/deploy-all.sh: `dispatch-and-wait.sh punktfunk
# deploy-services.yml`. Uses the same secret set docker.yml/flatpak.yml already rely on:
@@ -100,6 +106,46 @@ jobs:
cd ~/unom-flatpak
docker compose -f compose.production.yml up -d
nix-cache:
runs-on: ubuntu-24.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Sync nix cache compose + server
uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
with:
host: ${{ inputs.deploy_host || secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
port: ${{ secrets.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
# Land all three flat in ~/unom-nix-cache/ (drop the packaging/nix/server/ prefix).
source: "packaging/nix/server/compose.production.yml,packaging/nix/server/Caddyfile,packaging/nix/server/prune.sh"
target: "~/unom-nix-cache"
strip_components: 3
overwrite: true
- name: Start nix binary cache server
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5
with:
host: ${{ inputs.deploy_host || secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
port: ${{ secrets.DEPLOY_PORT }}
key: ${{ secrets.DEPLOY_SSH_KEY }}
script: |
set -euo pipefail
# ./site (the cache CONTENT) is NOT shipped here — nix.yml rsyncs it on each main push
# that moves the flake, same content/config split as the flatpak repo and the winget
# catalogue. Ensure the bind-mount source exists so caddy starts; an empty cache is
# harmless, it just 404s every path and users build from source as they do today.
mkdir -p ~/unom-nix-cache/site/nar
cd ~/unom-nix-cache
docker compose -f compose.production.yml up -d
# A cache that 404s a miss is healthy; one that cannot answer at all is not.
sleep 3
curl -fsS http://127.0.0.1:3250/nix-cache-info \
|| echo "NOTE: no cache content yet - push to main with the flake touched to populate it"
winget:
runs-on: ubuntu-24.04
timeout-minutes: 10
+69
View File
@@ -0,0 +1,69 @@
# Smoke test for the guided installer (scripts/install.sh, docs-and-onboarding overhaul WP4).
# Runs the script unattended inside a clean container per package family against the REAL
# package registry — the one path a textual gate can't cover: does the repo line, the key import
# and the install actually work today on a fresh box. `--no-start` because a container has no
# user systemd; the script degrades to printing the enable command, which is also under test.
#
# Path-filtered on purpose: it pulls ~100 MB of packages per family, so it runs when the script
# or its fact source changes, not on every push (check-docs-drift.sh gate 6 covers the cheap
# half — the install lines in the script must match data/platforms.json verbatim — on every push).
name: installer-smoke
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
on:
push:
branches: [main]
paths:
- scripts/install.sh
- data/platforms.json
- .gitea/workflows/installer-smoke.yml
pull_request:
paths:
- scripts/install.sh
- data/platforms.json
- .gitea/workflows/installer-smoke.yml
jobs:
smoke:
name: smoke (${{ matrix.family }})
runs-on: ubuntu-24.04
timeout-minutes: 25
strategy:
fail-fast: false
matrix:
include:
# actions/checkout needs git + node + CA certs in the container; curl is the
# script's own prerequisite (it says so and stops without it).
- family: debian-13
image: debian:trixie
prep: apt-get update -qq && apt-get install -y -qq --no-install-recommends ca-certificates curl git nodejs
- family: fedora-44
image: fedora:44
prep: dnf install -y -q curl git nodejs
- family: arch
image: archlinux:base
prep: pacman -Sy --noconfirm --needed curl git nodejs && (pacman-key --init >/dev/null 2>&1 || true)
container:
image: ${{ matrix.image }}
steps:
- name: Prepare the container (${{ matrix.family }})
run: ${{ matrix.prep }}
- uses: actions/checkout@v4
# No tty → the script runs as --yes; --no-start because there is no user systemd here.
# Root without sudo → the script's sudo shim, another path under test.
- name: Run the installer unattended
run: sh scripts/install.sh --yes --no-start
- name: The host is installed and conflict-free
run: |
punktfunk-host --version
punktfunk-host detect-conflicts
- name: Re-running is a no-op install
run: sh scripts/install.sh --yes --no-start | grep -q 'already installed'
- name: --uninstall takes the packages and the repo off again
run: |
sh scripts/install.sh --yes --uninstall
! command -v punktfunk-host
! test -e /etc/apt/sources.list.d/punktfunk.list -o -e /etc/yum.repos.d/punktfunk.repo
! grep -q '^\[punktfunk\]' /etc/pacman.conf 2>/dev/null
@@ -111,3 +111,20 @@ jobs:
name: punktfunk-linux-client-screenshots
path: clients/linux/screenshots
retention-days: 30
# The artifact above is browser-only (Gitea's API doesn't serve v3 artifacts), which
# blocked reusing these shots for the docs. Publish them to the generic package registry
# too — fixed version `ci`, delete-then-PUT so each run overwrites, anonymous GET on a
# public repo:
# https://git.unom.io/api/packages/unom/generic/punktfunk-linux-client-screenshots/ci/<scene>.png
- name: Publish screenshots to the package registry
env:
TOKEN: ${{ secrets.REGISTRY_TOKEN }}
run: |
BASE="https://git.unom.io/api/packages/unom/generic/punktfunk-linux-client-screenshots/ci"
for f in clients/linux/screenshots/*.png; do
name=$(basename "$f")
curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" -X DELETE "$BASE/$name" || true
curl -fsS -o /dev/null --user "enricobuehler:$TOKEN" --upload-file "$f" "$BASE/$name"
echo "published $BASE/$name"
done
+187 -19
View File
@@ -4,8 +4,9 @@
# `nix build .#punktfunk-web` was broken for 553 commits before anyone noticed (see the bun-nix job
# in ci.yml for that story).
#
# Two tiers, because a full `nix flake check` builds the whole Rust workspace with crane and would
# run for an hour on every push:
# Three tiers, because a full `nix flake check` builds the whole Rust workspace with crane and would
# run for an hour on every push — so the two cheap tiers gate every PR and the expensive one runs
# only where its cost buys something (a published cache):
#
# * eval — `nix flake check --no-build`: instantiates every package, app, check and devShell
# without building them. Catches the failures that actually happen to this flake — a
@@ -32,15 +33,28 @@
# covers what the ci.yml drift gate cannot, e.g. a tarball the registry no longer
# serves, or the codegen going quietly message-less (see packages.nix's inlang note).
#
# The Rust packages (punktfunk-host, punktfunk-client) and punktfunk-gamescope are NOT built here.
# They are the expensive ones and their inputs are already gated by the `rust` job in ci.yml; build
# them by hand on a Nix box, or with the `build-rust` dispatch input below.
# * cache — PUSH TO MAIN ONLY. Builds the Rust packages + gamescope for real and publishes every
# punktfunk store path to the binary cache at https://nix.unom.io, so a NixOS user gets
# prebuilt binaries instead of an hour of rustc and a gamescope compile. This is the
# expensive tier and it is why the job timeout is 180 rather than 90.
#
# ⚠ punktfunk-gamescope deserves the dispatch run more than it looks: `host.gamescopeHdr` DEFAULTS
# TRUE, so it is on the critical path of every `services.punktfunk.host.enable = true` build, while
# being the one package nothing here compiles. It patches whatever gamescope the pinned nixpkgs
# carries, so a nixpkgs bump — not a change of ours — is what breaks it, and the first person to
# find out would be an operator whose system rebuild fails. Run the dispatch after a flake.lock bump.
# It needs NO extra trigger for releases: a release bumps the workspace version in
# Cargo.toml, which is already in the path filter below, so the tag's content is
# published by the version-bump commit on main.
#
# Only OUR paths are published — see the step for why that is both correct and the
# difference between ~300 MB and several GB per publish.
#
# The Rust packages and punktfunk-gamescope are still not built on PRs: they are the expensive ones
# and their inputs are already gated by the `rust` job in ci.yml. Build them on a PR by hand on a
# Nix box, or with the `build-rust` / `build-gamescope` dispatch inputs below.
#
# ⚠ punktfunk-gamescope matters more than it looks: `host.gamescopeHdr` DEFAULTS TRUE, so it is on
# the critical path of every `services.punktfunk.host.enable = true` build. It patches whatever
# gamescope the pinned nixpkgs carries, so a nixpkgs bump — not a change of ours — is what breaks
# it, and the first person to find out would be an operator whose system rebuild fails. The `cache`
# tier now compiles it on every main push, so a flake.lock bump that breaks it goes red HERE; the
# dispatch input below is for checking it on a branch before merging.
#
# ⚠ pull_request is deliberately present. flatpak.yml shipped with push-only triggers and manifest
# breakage reached main invisibly for weeks — do not "simplify" this workflow by dropping it.
@@ -107,8 +121,15 @@ jobs:
# real node (so actions/checkout works with no pre-checkout install dance), and audit.yml
# already pulls it on this fleet, so it is proven to resolve here. Nix is installed below.
image: node:22-bookworm
timeout-minutes: 90
# 180, not 90: the `cache` tier on a main push compiles the whole Rust workspace AND gamescope
# from source inside the nix sandbox, where the sccache every other Rust job leans on cannot
# reach (no network in a derivation, and RUSTC_WRAPPER is not set inside one).
timeout-minutes: 180
env:
# Where the published cache lives on unom-1, and the URL users substitute from. Kept next to
# the flatpak repo (3230) and winget source (3240) — see packaging/nix/server/.
DEPLOY_DIR: unom-nix-cache
CACHE_URL: https://nix.unom.io
# The flake needs both experimental features. Also baked into the installer's --extra-conf
# below; this covers any step that shells out before that config is read.
NIX_CONFIG: "experimental-features = nix-command flakes"
@@ -126,11 +147,12 @@ jobs:
steps:
- uses: actions/checkout@v4
# The Determinate installer needs curl + xz; git so nix can read the flake from the checkout.
# (node:22-bookworm is the full image and already has all three — this is belt-and-braces
# against a future slim-image swap, and costs one cached apt call.)
# The Determinate installer needs curl + xz; git so nix can read the flake from the checkout;
# rsync + ssh to ship the built cache to unom-1. (node:22-bookworm is the full image and
# already has all but rsync — this is belt-and-braces against a future slim-image swap, and
# costs one cached apt call.)
- name: Installer prerequisites
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils git
run: apt-get update && apt-get install -y --no-install-recommends ca-certificates curl xz-utils git rsync openssh-client
# `--init none` is the container mode: no systemd, no daemon. Running as root, nix then talks
# to the store directly. Determinate Nix is also what the Nix box (.21) runs, so CI and the
@@ -151,7 +173,19 @@ jobs:
# with "no space left on device" mid-`bun install`), and a Nix build is the heaviest thing
# here — so record the headroom, or a future failure is a guess.
- name: Environment
run: df -h / /nix /tmp || true
# Disk AND memory. This job's recurring failure is an OOM kill, and `df` cannot explain
# one — a run that dies at exit 137 with only disk numbers in the log is a guess.
run: |
df -h / /nix /tmp || true
free -h 2>/dev/null || grep -E '^(MemTotal|MemAvailable|SwapTotal)' /proc/meminfo || true
nproc 2>/dev/null || true
# THE number for this job's recurring exit 137. `free` and /proc/meminfo report the HOST
# inside a container, so they showed 125Gi total / 48Gi available on a run that then got
# bun SIGKILLed (19444) — a cgroup cap is invisible to them and is the only remaining
# explanation. cgroup v2 first, then v1; "max" means uncapped.
cat /sys/fs/cgroup/memory.max 2>/dev/null \
|| cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>/dev/null \
|| echo "no cgroup memory limit readable"
# Evaluates + instantiates every flake output without building any of it.
- name: nix flake check (eval only)
@@ -183,10 +217,144 @@ jobs:
|| { echo "installed console is not a bun bundle" >&2; exit 1; }
echo "bun packages OK: $web $scripting"
# ── binary cache (push to main only) ───────────────────────────────────────────────────────
#
# Decided against a bucket on storage.unom.io even though sccache already uses it and the
# credentials already exist: it is local RustFS on the home uplink with no CDN in front, so
# every NixOS user's download would come off the same pipe every CI runner uses — and S3
# answers 403, not 404, for a missing key, which nix treats as a hard error rather than a
# cache miss (see packaging/nix/server/Caddyfile). unom-1 already serves the flatpak repo
# this way from a cloud IP; a Nix cache is the same static-files-behind-caddy shape.
#
# Gitea itself cannot host this at all: it has 23 package registry types and none is Nix, and
# the binary cache protocol wants fixed anonymous paths at a URL root (/nix-cache-info,
# /<hash>.narinfo, /nar/<hash>.nar.xz) that /api/packages/{owner}/generic/… cannot express.
- name: Cache publish preflight
id: cachecfg
if: ${{ github.event_name == 'push' }}
env:
NIX_CACHE_SIGNING_KEY: ${{ secrets.NIX_CACHE_SIGNING_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
# Guard BEFORE the build, not before the upload: an unconfigured cache must not cost an
# hour of rustc first. No-ops cleanly until the secret exists, exactly as flatpak.yml's
# repo deploy does, so this workflow stays green through setup.
run: |
set -eu
if [ -n "${NIX_CACHE_SIGNING_KEY:-}" ] && [ -n "${DEPLOY_HOST:-}" ]; then
echo "go=true" >> "$GITHUB_OUTPUT"
else
echo "go=false" >> "$GITHUB_OUTPUT"
echo "::warning::NIX_CACHE_SIGNING_KEY/DEPLOY_HOST not set — skipping the binary cache publish (see packaging/nix/README.md)."
fi
- name: Build the publishable packages
if: ${{ steps.cachecfg.outputs.go == 'true' }}
# Everything a user can install. punktfunk-gamescope earns its place here more than any
# other: host.gamescopeHdr DEFAULTS TRUE, so without it in the cache every
# `services.punktfunk.host.enable = true` still compiles a compositor from source.
run: |
"$NIX" build --print-build-logs \
.#punktfunk-host .#punktfunk-client .#punktfunk-tray \
.#punktfunk-web .#punktfunk-scripting .#punktfunk-gamescope
# This is now the heaviest job on the fleet — a full workspace build plus gamescope fills
# the store with tens of GB, and this fleet ran a runner out of disk on 2026-08-06. Record
# the headroom AFTER the build too, or a future "no space left on device" is a guess.
df -h / /nix /tmp || true
- name: Sign + publish to nix.unom.io
if: ${{ steps.cachecfg.outputs.go == 'true' }}
env:
NIX_CACHE_SIGNING_KEY: ${{ secrets.NIX_CACHE_SIGNING_KEY }}
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
run: |
# `set -eu`, NOT `set -euo pipefail`: act_runner may execute a step's `run:` under dash in
# these containers (see scripts/ci/ensure-sccache.sh), and dash dies on `-o pipefail` with
# "Illegal option". The two places below where a pipeline's LEFT side must be able to fail
# the step are written as redirects instead, so nothing depends on pipefail.
set -eu
PKGS=".#punktfunk-host .#punktfunk-client .#punktfunk-tray .#punktfunk-web .#punktfunk-scripting .#punktfunk-gamescope"
# 1) Pick what to publish. PUBLISH ONLY OUR OWN PATHS — this is the difference between
# ~300 MB and several GB per run, and it is not a corner cut: a runtime closure here
# is our binaries plus stock nixpkgs (ffmpeg, gtk4, glibc, …), and every stock path is
# already on cache.nixos.org, served by a real CDN. Mirroring them onto unom-1 would
# cost disk and home-to-cloud bandwidth to serve a WORSE copy of what users already
# have. Nothing in nixpkgs is named punktfunk, so the name filter is exact.
paths="$("$NIX" path-info -r $PKGS | grep -- '-punktfunk' || true)"
[ -n "$paths" ] || { echo "::error::no punktfunk store paths in the closure — the name filter is broken"; exit 1; }
echo "$paths"
# The filter is a string match, so it would fail SILENTLY if a pname ever changed — and
# the package most likely to drift is gamescope, the most expensive one to lose. Assert
# every built output is actually covered rather than discovering it as a user rebuild.
for out in $("$NIX" build --print-out-paths $PKGS); do
printf '%s\n' "$paths" | grep -qxF "$out" \
|| { echo "::error::$out is not matched by the '-punktfunk' filter — publish would silently omit it"; exit 1; }
done
# 2) Sign into a local binary cache. The secret is the whole `name:base64` line from
# `nix key generate-secret`; the matching public key is what users pin (README).
KEYDIR="$(mktemp -d)"; chmod 700 "$KEYDIR"
printf '%s' "$NIX_CACHE_SIGNING_KEY" > "$KEYDIR/key"; chmod 600 "$KEYDIR/key"
printf '%s\n' "$paths" | xargs "$NIX" copy --to "file://$PWD/nix-cache?secret-key=$KEYDIR/key"
# Publish the PUBLIC half beside the cache and echo it here. Users must pin this key, so
# it needs to be fetchable from the cache itself rather than only from a doc that can
# drift — and on the first run this log line is where the value for README.md comes from.
# Redirect, not `| tee`: without pipefail a failing nix would be masked by tee's success
# and publish an EMPTY public key, which every user would then pin.
"$NIX" key convert-secret-to-public < "$KEYDIR/key" > nix-cache/punktfunk-cache.pub
cat nix-cache/punktfunk-cache.pub
rm -rf "$KEYDIR"
echo "publishing $(find nix-cache -name '*.narinfo' | wc -l) paths, $(du -sh nix-cache | cut -f1)"
# 3) Ship it. Same deploy key and retry discipline as flatpak.yml — this runner's link to
# unom-1 drops TCP dials under load.
install -d -m700 ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/deploy; chmod 600 ~/.ssh/deploy
SSH="ssh -i $HOME/.ssh/deploy -p ${DEPLOY_PORT:-22} -o StrictHostKeyChecking=accept-new"
DEST="${DEPLOY_USER}@${DEPLOY_HOST}"
bash scripts/ci/retry.sh 5 $SSH "$DEST" "mkdir -p ~/$DEPLOY_DIR/site/nar"
# ⚠ ORDER IS LOAD-BEARING: NARs first, narinfos second. A narinfo whose NAR has not landed
# yet is a HARD download failure for whoever fetches it in that window; a NAR nothing
# points at yet is simply invisible. rsync renames each file into place atomically, so a
# cancelled run (this workflow has cancel-in-progress) can only ever under-publish.
# No --delete: superseded paths are aged out by prune.sh below instead, so a client
# mid-download is never pulled out from under.
bash scripts/ci/retry.sh 5 rsync -az --info=stats1 -e "$SSH" nix-cache/nar/ "$DEST:$DEPLOY_DIR/site/nar/"
bash scripts/ci/retry.sh 5 rsync -az -e "$SSH" nix-cache/nix-cache-info nix-cache/punktfunk-cache.pub nix-cache/*.narinfo "$DEST:$DEPLOY_DIR/site/"
bash scripts/ci/retry.sh 5 rsync -az -e "$SSH" \
packaging/nix/server/compose.production.yml packaging/nix/server/Caddyfile packaging/nix/server/prune.sh \
"$DEST:$DEPLOY_DIR/"
bash scripts/ci/retry.sh 5 $SSH "$DEST" "cd ~/$DEPLOY_DIR && docker compose -f compose.production.yml up -d"
# 4) Bound it. The flatpak repo next door reached 3.84 GB publishing this same way with
# no sweep, on a box that has run out of disk before; this one gets the sweep from the
# first publish. Never allowed to fail the job — the cache is already live by now, and
# a growing disk is a slower problem than a red main.
bash scripts/ci/retry.sh 3 $SSH "$DEST" "sh ~/$DEPLOY_DIR/prune.sh ~/$DEPLOY_DIR/site 180" \
|| echo "::warning::cache prune failed — published cache may be growing unbounded"
# 5) Prove the published cache actually answers, rather than assuming the rsync landed.
# A substituter that 200s on nix-cache-info but 403s on a miss is the failure mode that
# breaks users' builds, so check both.
bash scripts/ci/retry.sh 5 curl -fsS "$CACHE_URL/nix-cache-info"
miss="$(curl -sS -o /dev/null -w '%{http_code}' "$CACHE_URL/0000000000000000000000000000000000.narinfo")"
[ "$miss" = 404 ] || { echo "::error::cache returns $miss for an absent path; nix needs 404 or every user build fails"; exit 1; }
echo "published → $CACHE_URL"
# Opt-in only: the full Rust workspace through crane, which is the hour-long leg.
# `github.event.inputs.*` (string) rather than `inputs.*` — the portable spelling.
# Accept BOTH shapes. A checkbox dispatched from the Gitea UI arrives as the STRING
# "true", but an API dispatch (scripts, cross-repo automation) can deliver a real JSON
# boolean, and `== 'true'` silently misses it — the step is skipped, the run goes green,
# and the log looks identical to a run that genuinely had nothing to do. MEASURED
# 2026-08-19: dispatched with build-gamescope while verifying a flake.lock bump, and this
# step skipped while the job reported success — a green that proved nothing about the
# very package being fixed. Still no `inputs.*`: that context is the thing Gitea's parser
# is least reliable about, which is why this file used github.event.inputs to begin with.
- name: Build the Rust packages (dispatch opt-in)
if: ${{ github.event.inputs.build-rust == 'true' }}
if: ${{ github.event.inputs.build-rust == 'true' || github.event.inputs.build-rust == true }}
run: |
"$NIX" build --print-build-logs .#punktfunk-host .#punktfunk-client
@@ -196,6 +364,6 @@ jobs:
# longer exposes a patchable derivation, a `+pfhdr` grep in installCheckPhase) — but only if
# something actually builds it.
- name: Build the patched gamescope (dispatch opt-in)
if: ${{ github.event.inputs.build-gamescope == 'true' }}
if: ${{ github.event.inputs.build-gamescope == 'true' || github.event.inputs.build-gamescope == true }}
run: |
"$NIX" build --print-build-logs .#punktfunk-gamescope
+5 -2
View File
@@ -37,15 +37,18 @@ jobs:
- uses: actions/checkout@v4
# Both installs retried: bun's download-and-extract is single-shot, and a truncated tarball
# reads as `Fail extracting tarball` (ci.yml's web job has the measurement). A publish job
# is the worst place to lose to a dropped packet — the tag is already pushed.
- name: Build the SDK (file:../sdk dependency source)
working-directory: sdk
run: |
bun install --frozen-lockfile --ignore-scripts
bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
bun run build
- name: Install dependencies
working-directory: plugin-kit
run: bun install --frozen-lockfile --ignore-scripts
run: bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
# bun 1.3 installs a `file:` dependency by copying its DIRECTORIES but symlinking each
# top-level FILE to itself — `node_modules/@punktfunk/host/package.json -> package.json`, a
+13 -1
View File
@@ -35,6 +35,7 @@ on:
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'scripts/ci/**'
- 'scripts/alsa-ucm2/**'
- '.gitea/workflows/rpm.yml'
# Single project version: a `vX.Y.Z` tag is THE release. main publishes to the `*-canary` rpm
# groups, tags to the base groups (`bazzite`/`fedora-44`) — separate repos, so the old
@@ -175,7 +176,9 @@ jobs:
if: steps.webconsole.outputs.cache-hit != 'true'
run: |
cd web
bun install --frozen-lockfile --ignore-scripts
# Retried: bun's download-and-extract is single-shot, and a truncated tarball reads as
# `Fail extracting tarball` (ci.yml's web job has the measurement).
bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
bun run build
# Same mandatory assertion as deb.yml — a missing or wrong-preset bundle must fail here, not
@@ -221,6 +224,15 @@ jobs:
# never the board"; this is that. Host must carry NOTHING; the worker must carry exactly
# cap_sys_nice=ep. `--self-test` first, so a guard that has quietly stopped being able to
# fail takes the job down instead of waving the release through.
- name: The DualSense UCM drop-in must still bite
# scripts/alsa-ucm2/ hooks into alsa-ucm-conf's own dispatcher, so an upstream rename or
# reorder can neuter it with no error anywhere — and what comes back is the Spider-Man
# EXCEPTION_ACCESS_VIOLATION, not a quieter pad. This is the only leg that runs on a real
# Fedora tree, hence the two packages. Skips itself on any box without them.
run: |
dnf -y install alsa-ucm alsa-ucm-utils
sh scripts/ci/check-dualsense-ucm.sh
- name: Assert the capability matrix (rpm)
run: |
bash scripts/ci/assert-cap-matrix.sh --self-test
+4 -1
View File
@@ -39,8 +39,11 @@ jobs:
- uses: actions/checkout@v4
# Retried: bun's download-and-extract is single-shot, and a truncated tarball reads as
# `Fail extracting tarball` (ci.yml's web job has the measurement). A publish job is the
# worst place to lose to a dropped packet — the tag is already pushed.
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
run: bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
- name: Typecheck
run: bun run typecheck
+3 -1
View File
@@ -40,8 +40,10 @@ jobs:
- uses: actions/checkout@v4
# --ignore-scripts skips the prepare→codegen hook (mirrors ci.yml); run codegen
# explicitly since build-storybook has no prebuild hook of its own.
# Retried: bun's download-and-extract is single-shot, and a truncated tarball reads as
# `Fail extracting tarball` (ci.yml's web job has the measurement).
- name: Install dependencies
run: bun install --frozen-lockfile --ignore-scripts
run: bash ../scripts/ci/retry.sh 3 bun install --frozen-lockfile --ignore-scripts
- name: Generate API client + i18n messages
run: bun run codegen
# Pulls the matching Chromium build + the apt libs it needs (root in-container).
+38 -8
View File
@@ -56,8 +56,12 @@
#
# ── Packaging (the `Pack + sign MSIX` step onward; skipped on pull requests) ──────────────────────
#
# Publishes signed MSIX packages (x64 + ARM64) to Gitea's generic package registry, so Windows boxes
# can install a real package (Start tile, clean install/uninstall) instead of a loose exe.
# Publishes THREE artifacts per arch (x64 + ARM64) to Gitea's generic package registry, all packed
# from one assembled layout:
# punktfunk-client-setup_<arch>.exe — Inno Setup per-user installer, the DEFAULT download
# (stable path Steam can launch: overlay + Big Picture work)
# punktfunk-client-windows_<arch>-portable.zip — the same file set, no installer
# punktfunk-client-windows_<arch>.msix — kept for Microsoft Store compatibility
#
# Registry (public, unom org): https://git.unom.io/unom/-/packages (generic group)
# Packaging internals: clients/windows/packaging/README.md.
@@ -283,6 +287,28 @@ jobs:
-Version $env:MSIX_VERSION -Arch ${{ matrix.arch }} `
-TargetDir ${{ matrix.td }}\${{ matrix.target }}\release -OutDir ${{ matrix.td }}\msix
# The DEFAULT download: a per-user Inno Setup exe + a portable zip, packed from the layout
# the MSIX step just assembled. The MSIX shape (WindowsApps ACLs, alias-only activation)
# breaks Steam's non-Steam-game picker, the Steam overlay injection and Big Picture launch;
# the installer's stable %LOCALAPPDATA%\Programs\Punktfunk path is the fix. The MSIX stays
# published for Microsoft Store compatibility. Same signing env as the MSIX step above.
- name: Pack + sign installer + portable zip
if: github.event_name != 'pull_request'
shell: pwsh
env:
AZURE_CODESIGNING_ENDPOINT: https://neu.codesigning.azure.net/
AZURE_CODESIGNING_ACCOUNT: unomsigning
AZURE_CODESIGNING_PROFILE: unom-io
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
MSIX_CERT_PFX_B64: ${{ secrets.MSIX_CERT_PFX_B64 }}
MSIX_CERT_PASSWORD: ${{ secrets.MSIX_CERT_PASSWORD }}
run: |
& clients/windows/packaging/pack-client-installer.ps1 `
-Version $env:MSIX_VERSION -Arch ${{ matrix.arch }} `
-LayoutDir ${{ matrix.td }}\msix\layout -OutDir ${{ matrix.td }}\installer
- name: Publish to Gitea generic registry
if: github.event_name != 'pull_request'
shell: pwsh
@@ -301,7 +327,10 @@ jobs:
# on that accident, so removing the quotes can't silently reintroduce it.
$aliasNames = @{ "$($env:MSIX_PATH)" = "$($env:PKG)_${{ matrix.arch }}.msix" }
if ($env:MSIX_CER_PATH) { $aliasNames[$env:MSIX_CER_PATH] = "$($env:PKG)_${{ matrix.arch }}.cer" }
$files = @($env:MSIX_PATH, $env:MSIX_CER_PATH) | Where-Object { $_ -and (Test-Path $_) }
# The installer + portable zip (the default download; docs point at these alias URLs).
if ($env:CLIENT_SETUP_PATH) { $aliasNames[$env:CLIENT_SETUP_PATH] = "punktfunk-client-setup_${{ matrix.arch }}.exe" }
if ($env:CLIENT_ZIP_PATH) { $aliasNames[$env:CLIENT_ZIP_PATH] = "$($env:PKG)_${{ matrix.arch }}-portable.zip" }
$files = @($env:MSIX_PATH, $env:MSIX_CER_PATH, $env:CLIENT_SETUP_PATH, $env:CLIENT_ZIP_PATH) | Where-Object { $_ -and (Test-Path $_) }
if (-not $files) { throw "pack produced no artifacts to publish" }
function Put($f, $url) {
# The generic registry makes a versioned path immutable and 409s a re-upload, so a tag
@@ -324,10 +353,11 @@ jobs:
Put $f "$base/$alias/$an"
}
# On a real release, also attach the MSIX (+ its .cer) to the unified Gitea Release. Both
# arch legs attach to the same release concurrently — the helper's create-or-fetch handles
# the race, and x64/arm64 filenames differ so the assets don't collide.
- name: Attach MSIX to the Gitea release (stable tags only)
# On a real release, also attach the installer + portable zip + MSIX (+ its .cer) to the
# unified Gitea Release. Both arch legs attach to the same release concurrently — the
# helper's create-or-fetch handles the race, and x64/arm64 filenames differ so the assets
# don't collide.
- name: Attach client artifacts to the Gitea release (stable tags only)
if: startsWith(gitea.ref, 'refs/tags/v')
shell: pwsh
env:
@@ -335,6 +365,6 @@ jobs:
run: |
. scripts/ci/gitea-release.ps1
$rid = Ensure-GiteaRelease -Tag $env:GITHUB_REF_NAME -Name $env:GITHUB_REF_NAME -Prerelease 'auto'
foreach ($f in @($env:MSIX_PATH, $env:MSIX_CER_PATH)) {
foreach ($f in @($env:CLIENT_SETUP_PATH, $env:CLIENT_ZIP_PATH, $env:MSIX_PATH, $env:MSIX_CER_PATH)) {
if ($f -and (Test-Path $f)) { Upsert-GiteaAsset -ReleaseId $rid -File $f }
}
+22
View File
@@ -0,0 +1,22 @@
# AGENTS.md
Guidance for coding agents working in this repository.
## Agent skills
### Issue tracker
Issues live as Gitea issues in `unom/punktfunk` on `git.unom.io`, driven by the `gitea` MCP server
(`gh`/`glab`/`tea` do not work here), and every write needs the user's go-ahead first.
See `docs/agents/issue-tracker.md`.
### Triage labels
The five canonical roles, each label string equal to its name — `needs-triage`, `needs-info`,
`ready-for-agent`, `ready-for-human`, `wontfix` — none of which exist in the tracker yet.
See `docs/agents/triage-labels.md`.
### Domain docs
Single-context: one `CONTEXT.md` and one `docs/adr/` at the repo root, covering the whole
workspace. See `docs/agents/domain.md`.
+752
View File
@@ -12,6 +12,758 @@ with the version table of the release you are moving to, then read **Breaking ch
---
## v0.31.0
170 commits since v0.30.0 (113 non-merge), counted at the tip this was cut from.
One versioned surface moves, additively: the **C ABI goes 24 → 25**, a single new symbol
(`punktfunk_set_log_callback`) that lets an embedder hear the core's own log lines. Nothing else
does — `WIRE_VERSION` stays **2**, the driver protocol, gamepad channel and plugin index schema are
unchanged, and no `trust::Settings` field, capability bit or control-message type byte was added.
No existing C function changed its signature or behaviour and no `#[repr(C)]` struct grew a field,
so an embedder that adopts nothing rebuilds against the new header and is done. Every 0.30.x host,
client, driver and plugin keeps interoperating in both directions, with no re-pairing.
Beneath the versioned surfaces, four things are worth a packager's or embedder's attention: the
**Windows client's default download changes** to a per-user installer plus a portable zip, with the
MSIX kept for the Store; the Linux host package installs **three new system files** (a udev rule, a
WirePlumber policy and an ALSA UCM drop-in) that the DualSense audio path depends on; the Linux
desktop-audio capture **flipped topology by default** (`PUNKTFUNK_STREAM_SINK` unset now means a
host-owned `null-audio-sink`, with `=stream` a one-release escape hatch to the 0.30 shape); and the
Android app's Compose console is **deleted**`pf-console-ui` over Skia/GL is now the console on all
three ABIs, which removes the Compose screenshot scenes.
### Versions
| | v0.30.0 | v0.31.0 | Notes |
|---|---|---|---|
| Wire protocol | 2 | **2** | unchanged |
| C ABI | 24 | **25** | one additive step: v25 adds `punktfunk_set_log_callback` and the `PunktfunkLogCb` typedef (below). No existing declaration moved and no struct grew a field. Also new in `punktfunk-core`, Rust-only: three RT-safe DSP helpers (`crossfade_insert`, `pcm::raised_cosine_tail`, `pcm::raised_cosine_head`) |
| Rust edition | 2024 | **2024** | unchanged |
| MSRV (`rust-version`) | 1.85 | **1.85** | unchanged |
| Workspace crate dirs | 27 | **27** | unchanged (39 `[workspace] members`, also unchanged) |
| Virtual-display driver protocol | 6 | **6** | unchanged (minimum accepted still 3); `pf-driver-proto` shows no diff against the v0.30.0 tag |
| Windows virtual-gamepad channel | 3 | **3** | unchanged |
| Plugin index schema | 1 | **1** | unchanged |
| Host event schema | 1 | **1** | unchanged (`punktfunk-host/src/events.rs`) |
| `api/openapi.json` | 0.29.0 | **0.31.0** | **the stamp only** — no management-API surface moved this cycle. The file had been left at 0.29.0 while the crate was already 0.31.0; #337's regenerate-and-diff caught it and it was regenerated, which is a one-line change to both copies. `api/` and `docs-site/public/` are byte-identical to each other |
| gamescope patch level (`+pfhdrN`) | 8 | **8** | unchanged; no new patch files. ⚠ `packaging/gamescope/PKGBUILD` still says `pfhdr7` — pre-existing at v0.30.0, not a regression this cycle, but the Arch package builds a binary the host's `>= 8` probe rejects for the keymap path |
| `@punktfunk/host` (SDK) | 0.1.4 | **0.1.5** | cut — `sdk/src/config.ts` and `runner-cli.ts` carry the `mgmt-endpoint` fix below, and plugins resolve the SDK from the registry, so it could not reach them until it shipped |
| `@punktfunk/plugin-kit` | 0.4.2 | **0.4.3** | cut, for the two `sync-engine.ts` changes that cannot reach a plugin any other way: `minInterval` (below) and the always-apply sync reasons (`startup`/`manual` publish even when the fingerprint matches, so a host-side art drop is recoverable by restarting rather than by deleting the plugin's cache). Note the registry skips 0.4.2: `plugin-kit-v0.4.2` was tagged but its publish never landed, and the tag is left where it is rather than moved |
⚠ The SDK and plugin-kit version independently of the app (`sdk-v*` / `plugin-kit-v*` tags,
`sdk-publish.yml` / `plugin-kit-publish.yml`), so their rows record what the registry holds, not
what this tag ships. Both were cut during this cycle rather than left owed — a plugin resolves them
from the registry, so a fix that never ships there never reaches one.
### ⚠ Breaking changes
**None that break a build.** No wire change, no driver-protocol change, no plugin-contract change.
The C ABI moves 24 → 25 by **addition only**:
- **v25 — `punktfunk_set_log_callback(max_level, cb, user)`.** The core logs through `tracing`; an
embedder that installs no Rust subscriber hears none of it — transport warnings, connection events,
handshake notes — and a client log bundle carries the shell's half alone, which is exactly what an
Apple TV field report turned out to be. The call registers a `log::Log` backend behind a C callback
(`PunktfunkLogCb`: level, target, message, user), gated by `log::set_max_level` so anything above
the ceiling costs no formatting; `NULL` detaches, and it answers `Unsupported` when another log
backend already owns the process (`android_logger`). Both strings are borrowed for the call only,
and an interior NUL drops the line rather than truncating it. `punktfunk-core` now declares
`tracing`'s `log` feature explicitly — it had been on transitively via quinn, which an ABI promise
must not rest on. An embedder that never calls it is byte-compatible with v24; see
`docs/embedding-the-c-abi.md` §2.6.
- **One header comment was wrong and is corrected, with no signature change:**
`punktfunk_connect_ex10`'s summary still stated the pre-2026-08-16 rule that only a format other
than 48000/16 requests the lossless plane. Any non-zero format at all does, 48000/16 included —
which is what its own warning already said and what the code always did. Embedders reading the
summary were reading the old rule.
Five more things are worth attention; none breaks a build:
- **`refactor(android)!` — the Compose console is deleted.** `pf-console-ui` (the Skia shell the
desktop session binary draws) is now Android's console on arm64-v8a, x86_64 **and** armeabi-v7a;
the gate is simply "does the native host exist", and where it does not a controller drives the
touch UI through focus. ~6.5 kLOC of `GamepadHome`, `GamepadSettingsScreen`,
`GamepadAddHostScreen`, `GamepadDialogs`, `HomeTiles`, the console halves of `LibraryScreen`,
`ConnectOverlay`/`ConnectTakeover`, the `gamepadUi` branches of `ConnectScreen`/`ConnectPrompts`/
`AdaptiveDialogs`, `App.kt`'s `GamepadShell`/`GamepadScreen` and their tests are gone. The `!` is
for the **store-screenshot surface**: the Compose console's marketing scenes cannot be rendered by
Roborazzi any more (the shell draws over native GL); its shots come from the desktop screenshot dump
or a device capture. Sysprop `debug.punktfunk.console_backend=compose` is meaningless; `=none`
still forces the touch UI on glass.
- **Linux desktop-audio capture topology flipped by default** — see the audio section. `=stream`
restores 0.30 for **one release only**.
- **Hyprland / sway: `topology: exclusive` now does what it says.** Both backends accepted it,
echoed it as the session's effective topology, and dropped it with a warning; because `auto`
resolves to Exclusive on any unpinned host, the *default* policy on every auto-detected Hyprland
or sway box was an Exclusive that behaved as Extend. Operators who relied on that get their
monitors disabled for the session now (closes #284).
- **Three new system files in the Linux host package** — the DualSense audio path does not work
without them. Downstream repackagers: see the packaging section.
- **The Windows client's default download is a per-user installer, not the MSIX.** The MSIX stays,
for the Store; the installer and a portable zip are what the download page now offers, and the
release carries `punktfunk-client-setup_<arch>.exe` and `..._<arch>-portable.zip` alongside it.
Anyone scripting against the MSIX asset name is unaffected; anyone scripting against "the Windows
client download" gets a different artifact. See the Windows client section.
### DualSense audio and haptics on Linux: five faults, and the files they needed
The whole in-game path — GE-Proton's haptic router → the pad's ALSA card → the voice coils — had
never once worked against our virtual pad. In wire order:
- **`usbip`: the calibration feature report was 42 bytes; `hid-playstation` asks for 41.** On a USB
backend an over-long reply is not truncated: the kernel treats it as hostile and tears down the
connection, not the transfer — the pad vanished ~400 ms after enumerating, and the dmesg order made
the teardown look like the cause. Three changes so the trap is not left set: the constant is 41 and
all three feature-report sizes are pinned by test; `clamp_reply` clamps every reply to the requested
length in the transport and drops any payload a handler returns on an OUT (the kernel never reads
one; those bytes would misframe every following PDU); `DualSenseUsbip::open` waits for the kernel
to actually bind a HID driver before reporting success (vhci attach succeeds immediately and
enumerates asynchronously), so bring-up faults return `Err` and the uhid fallback catches them.
New `PUNKTFUNK_USBIP_TRACE` (both socket directions to disk) and `scripts/usbip-trace-analyse.py`.
- **`usbip`: every non-ISO OUT was answered with an empty buffer, i.e. `actual_length = 0`.** vhci
copies that field verbatim into the URB's actual length; the driver returned 0 as the write's byte
count; Wine's bus driver reads 0 as failure and prints the thread's *stale* errno — so the ENOENT /
EINVAL / EAGAIN in the GE logs were never kernel verdicts. New
`UsbIpResponse::usbip_ret_submit_out_success(header, accepted)`; the debug assertion now pins
"OUT carries no buffer", not "OUT claims 0"; two wire-byte tests pin both directions. **The Steam
Controller 2 shares this handler.** `usbip-trace-analyse.py` had flagged *any* nonzero OUT
actual_length as a desync — the rule that would have hidden this bug — and now flags an OUT reply
claiming more than it was sent, or 0 against a non-empty write.
- **`usbip`: ISO completions were paced by relative sleeps**, so timer slop, socket I/O and lock waits
accumulated per transfer: the pad's clock ran ~26 % slow (~35,700 frames/s against 48 kHz), its PCM
backed up into dropouts, and because completion *is* the pad's audio clock, on the test box the pad
sink became the graph driver and pulled desktop capture to 50 % delivery. Now a per-endpoint
absolute deadline ledger (a stall > 20 ms re-anchors instead of fast-forwarding a burst); measured
after: 48,005 frames/s. Two paused-clock tests pin the rate and the re-anchor.
- **`usbip`: the capture forwarded the pad's hardware quad as the wire's speaker pair.** Hardware
is HP-L, HP-R+mono-speaker, coil-L, coil-R; the wire puts the speaker pair first. Now: the speaker
channel duplicated across the wire's speaker pair, coils passed through, HP-L dropped. The
stream-sink (uhid) capture path already emitted the logical layout and is unchanged.
- **`usbip`: `iSerialNumber` was the literal `"Serial"`.** A real DualSense reports none, ALSA bakes it
into the card id (`…Wireless_Controller_Serial-00` vs `…Wireless_Controller-00`) and PipeWire
carried it into every node name and `device.serial`. Cleared. Explicitly *not* a fix for anything
observed broken — GE's winepulse leg matched the placeholder — and *not* a UCM-selection fix
(alsa-ucm-conf keys on `${CardComponents}`, `USB054c:0ce6`).
- **The pad's ALSA card was root-only.** It is created mid-session-bringup with no seat session
active, so logind's ACL never materialises; WirePlumber's probe got EACCES and the card never
appeared in PipeWire at all. `scripts/60-punktfunk.rules` gains two `SUBSYSTEM=="sound"` rules for
`054c:0ce6` / `054c:0df2` (`GROUP="input" MODE="0660" TAG+="uaccess"`), matching physical pads too.
Verified live on Bazzite f44.
- **The DualSense's only playback route was a 1-channel `Default__Speaker__sink`**, from which
GE-Proton mints its synthetic endpoint, and *Marvel's Spider-Man Remastered* overruns it ~74 s in
(`EXCEPTION_ACCESS_VIOLATION`, write; the copy loop past the frame count, 5206/5207 vs 5034 — a
game/GE bug on a code path that only exists when the mono sink does). Fix: delete the sink. New
ALSA UCM drop-in `scripts/alsa-ucm2/USB-Audio/conf.d/{054c-0ce6,054c-0df2}.conf` +
`scripts/alsa-ucm2/USB-Audio/Punktfunk/DualSense-PS5-Haptic{,-HiFi}.conf` raises a `SpeakerHaptic`
device at playback priority 200 against `Speaker`'s 100, so the card takes the 4-channel HiFi
profile and the mono sink never exists. Shipped **without** replacing a file `alsa-ucm-conf` owns:
`USB-Audio.conf` ends with an unconditional optional include of `conf.d/{vid}-{pid}.conf`
(verified against alsa-lib source; hook and DualSense profile both since 1.2.15). New CI guard
`scripts/ci/check-dualsense-ucm.sh` runs the chain on a real distro tree via UCM's card-less
`conf.virt.d`, negative-tested both ways. **NixOS is not covered** (no `/usr/share/alsa/ucm2` to
drop into).
- **WirePlumber met every new pad card at `default-sink-volume` 0.4 — cubed, i.e. 23.88 dB — and
both ends minted one**, so haptics reached the coils at 0.064² = 47.8 dB (field-measured 48).
Client: `pin_sink_volume` from `correlate_pad_sink` at every pick (skipped for the `split_parent`
pick). Host: new `audio/linux/pad_card_volume.rs`, started when `PadUsbCapturer::open` succeeds
(the host half matters because `pad_usb` captures at the ISO OUT endpoint, downstream of this
sink), retrying 15 s because the USB device is live before its ALSA card is; only sinks of a
DualSense **card** are touched (`device.id` keeps it off the host's own minted pad sink). Neither
end restores on exit, deliberately. New `PUNKTFUNK_PAD_SINK_VOLUME=0` disables both ends for
bisecting. Both pins unit-tested for one unity float per channel — PipeWire silently ignores a
`channelVolumes` whose length mismatches the port count.
- **`scripts/60-punktfunk-dualsense.conf`** — a new WirePlumber policy installed to
`/usr/share/wireplumber/wireplumber.conf.d/` by rpm/deb/arch/nix: `node.always-process` + no
suspend on the pad's `alsa_output` (GE opens the backing device raw when it is free, then hits
"busy" against its own handle and spins a 100 Hz refresh loop — SteamOS never shows this because
PipeWire always holds the device there), and `priority.driver = 0`. **Zero, not one**: the field is
unsigned and a driver is skipped only when `<= 0`; at 1 the pad was merely *last*, and last is still
elected whenever nothing above it qualifies — the ordinary in-session state on a host that has
claimed its own sink as default and idled the real card. A second rule sets `priority.driver = 0`
on the same cards' `alsa_input` (in the Pro Audio profile that node carries 2600 and clocked a
reporter's whole desktop session with nothing linked to it). The rule's first landing duplicated
its `%files` line into `%install`, which killed every RPM build on main for a few hours (fixed same
day, no release affected).
- **`0xD1` lane split:** speaker = Opus `Application::Audio` @ 96 kbps (~120 B / 10 ms frame),
haptics = `Application::LowDelay` @ 64 kbps CBR, unchanged.
- **`punktfunk-session --pad-audio-test`** now prints the effective `pad_speaker` / `pad_haptics`
before the tone (the capability is never advertised when the toggle is off, so no later log line can
catch it); the Android settings row states its default. Android is the one client defaulting pad
speaker **off**; `pf_client_core`'s `default_pad_speaker` is `"pad"` and always was.
### The Linux desktop-audio capture drives its own graph group
The stream sink was a `pw_stream` wearing `media.class = Audio/Sink`. A stream is structurally a
follower, so its group had no clock and PipeWire assigned it to the highest-priority *running*
driver on the box. On a reporter's host that was a DualSense forwarded over VirtualHere in the Pro
Audio profile — never suspended, nothing linked, its frame counter a kernel stub logging "not yet
implemented" and returning 0 ~1900×/s. Not xruns: 11 errors in 15 min, wait never past 111 µs; the
loss was *between* cycles — 3.9 delivery holes/s, worst 142 ms, **15.4 % synthesized silence** over
a 15-minute session.
Now a `support.null-audio-sink` adapter created on our own connection, captured through its monitor
(the same object `pactl load-module module-null-sink` creates). Three load-bearing properties:
`node.passive` on the monitor tap (idle between sessions, so the null sink's timer parks — the
objection that kept `node.always-process` off the old stream sink); `node.force-quantum`, not
`node.latency` (a driver's quantum is the smallest follower latency rounded **down** to a power of
two under the default `default.clock.power-of-two-quantum`, which is why the 240-frame ask has been
served as **128** — 2.67 ms callbacks, not the 5 ms it is designed around — on every stock Linux host
since the capture was written; force-quantum skips the rounding and forces nothing on anyone else,
since this sink drives only its own group); and `node.dont-fallback` **with** `node.linger`, never
one alone (WirePlumber 0.5 reads dont-fallback alone as licence to destroy the stream when its target
is not visible). Routing claim, capture callback, stats line and everything downstream untouched.
`PUNKTFUNK_STREAM_SINK`: unset = new topology, `stream` = 0.30's (one release), `0` = the legacy
default-sink-monitor follower. Documented at last in `configuration.md`, with a new troubleshooting
section on the `punktfunk-audio-…` recording stream and on another device clocking your capture.
Around it, from the same 2026-08-14/17 field logs:
- The host binds its own node and reads `node.driver-id` from its `info` event (a node-id→name map
from the registry): on change, `audio capture graph driver` names the clocking node — WARN in the
null-sink mode (exactly one right answer), INFO in the legacy topologies (they borrow a clock by
design).
- `CaptureStats::observe_gap` is now the one accounting behind both feeds (Linux callback cadence and
the Windows discontinuity flag) and buckets holes at <20 / <50 / <100 / ≥100 ms — the client
concealment edges. Both capture lines print `gap_hist=a/b/c/d missing_ms=`; the sum closes the
arithmetic against `delivered_pct`. The Windows loopback **reader** thread now takes
`boost_thread_priority(true)` like the paced sender it feeds.
- **The pacer's schedule was wall clock; the source was not.** A missed 2.7 ms cycle is below the gap
counter's floor and the infill threshold, so the schedule kept the debt and repaid the next ≥ 10 ms
hole as a burst of (lag + 10)/5 silence frames (field: 3372 % departures late, worst 99 ms,
re-anchors 0). The infill decision now sees schedule lag; `after()` follows the real quantum
(`InfillPolicy::note_quantum`) — one chunk plus one frame, never under two frames; a slot whose
backlog exceeds one chunk plus one frame sends a second frame in the same slot (at most two), since
a fast source clock could otherwise only grow the backlog — 5 ms of host latency per 50 s at
100 ppm. Holes fade out over 1 ms (`pcm::raised_cosine_tail`) and the first real frame after fades
in (`raised_cosine_head`).
### The client jitter ring can now grow without de-priming
`JitterStep::insert_front` mirrors `drop_front`: when the sync loop wants more than the adaptive
target and the depth EWMA has sat > `INSERT_MARGIN_MS` below the request for `INSERT_SUSTAIN_MS` of
consumed audio, duplicate one frame at the front, crossfaded (`crossfade_insert`, the RT-safe twin
of `crossfade_drop`). Sync-only, primed-only, below-target-only. `hollow` is judged against the
**adaptive** target, never the sync request — the bug was that a ≥ 10 ms sync request read as hollow
on the next callback and the next late packet cost 1560 ms of silence, since ~0.24/0.25. Margin is
half the sync loop's ±10 ms deadband (a margin at or above it would leave every request it is allowed
to make unanswered). Also fixes `crossfade_drop`'s seam: the fade-out source is now the continuation
of the sample the device just played, not the tail of the discarded region — a hard-cap trim stepped
2,688 samples where it now stays under 17. Wired into the PipeWire, WASAPI and AAudio rings
(`PlaybackVitals.inserts`, `drift_inserts=` on the 10 s lines) and ported line for line to the Swift
ring (`insertOneFrame()`, `AudioRingDriftTests` carrying the same vectors). No new `pub const`; the
C header is unchanged.
Beside it: the Linux desktop client's playback stream now connects with `RT_PROCESS` (it ran on the
main-loop thread at nice 0, and when late PipeWire rendered silence for our node and moved on — an
underrun no counter saw); the ring is pre-reserved so `extend` never reallocates on the RT loop; new
`audio_vitals::PlaybackVitals` printed from the decode thread on wall clock. New `audio_rt` module
raises the decode, pad-audio, PipeWire-loop and Linux mic threads: `setpriority` where `RLIMIT_NICE`
allows → inside a Flatpak the `org.freedesktop.portal.Realtime` portal → else rtkit
`MakeThreadHighPriorityWithPID`. The split is `module-rt`'s and not optional: rtkit-daemon has no
PID-namespace translation (verified on the Deck, rtkit 0.14), so a direct call from a sandbox is
ENOENT; the portal maps pid/tid. Never setcap / `SCHED_RR`. Windows: MMCSS "Pro Audio" +
`THREAD_PRIORITY_HIGHEST` on the render and mic loops. Acceptance on the Deck: `ps -eLo
cls,rtprio,ni,comm` shows the decode thread at nice 10 after connect.
The client log ring drops DEBUG/TRACE from `cros_codecs` (its WARN+ still lands) and normalizes
`log`-bridge events to their real target: a dozen DPB lines per frame at 120 fps last three seconds
in a 4,096-line ring — a 2026-08-17 Deck bundle read "2,037,456 older lines evicted". `Cargo.lock`
gains two direct deps already in the graph.
### Android: `pf-console-ui` is the console, presented through `ASurfaceControl`
- **`pf-client-core` un-gated for Android** (trust::Settings, known-hosts store, profiles model,
deep links, the library *model*; the ureq fetches stay desktop), with `audio_format`,
`decoder_pref`, `menu_nav` (`MenuEvent`/`MenuNav`/`PadInfo`) and `console` (`OverlayAction`,
`PointerInput`, `SessionPhase`) split out and re-exported. `pf-console-ui`: Vulkan overlay + SDL
event path behind the default `vulkan-overlay` feature (clients/session unchanged); a `Key` enum
replaces SDL scancodes; a `SettingsStore` seam (desktop = the file, `SnapshotStore` across a
language boundary); `Viewport{width,height,insets,scale}`; `Platform` filters the settings rows;
`ConsoleOptions`; a portable `Console` driver. skia-safe features are target-specific: desktop
`jpegd-jpege-pdf-textlayout-vulkan` (the flatpak pin), Android `gl-jpegd-jpege-pdf-textlayout`.
Model types derive serde — the wire IS the model. `MenuNav` gains the stick hysteresis
(`MENU_RELEASE = 0.3`) both the Apple and Android shells had grown on glass.
- **`clients/android/native/src/console/`**: hand-declared EGL binding, Skia GL `DirectContext` over
FBO 0, one render thread paced by `eglSwapBuffers`, ~28 `nativeConsole*` JNI seams; a run of GL
setup failures ends the render thread through the normal release path, which raises the
`SkiaConsole.healthy` handover to the touch UI. `SkiaConsoleShell` (SurfaceView + lifecycle,
insets = systemBars displayCutout in surface px, system bars hidden transiently while the console
is up, phone density floor **0.6 → 0.75**, pad probes into the shared `MenuNav`, remote D-pad,
hardware keys, Back as B, touch as pointer). Pad-listener slot is a **stack** with removal by
identity (a leaving Controllers/Licences page used to null the console's claim). Android-only
settings rows ride `Settings::extra` `android.*` keys; `row_on()` keeps them off the desktop list.
New `ConsoleCmd::PadAction { action, pad_key }` (`sc2_bluetooth`, `sc2_usb`, `ds_usb`, rumble,
pad-audio self test); `PlatformScreen::Controllers` removed (the mechanism stays for Licences);
`PadInfo` gains detail line / forwarded / rumble. Detail band 84 → 64 units; the grid's two-column
minimum shrinks covers instead of clipping.
- **Skia prebuilts** for all three ABIs come from `unom/skia-binaries` release **0.99.0** on
git.unom.io (R2-backed), mirroring rust-skia's `{tag}/{key}` layout; the armv7 archive
(`a25a0fdb7d90429aa2d1-armv7-linux-androideabi-gl-jpegd-jpege-pdf-textlayout`, sha256
`4867856b…`) is built by us since rust-skia publishes none. GitHub is out of the Android build path;
`-PskiaBinariesUrl` / `SKIA_BINARIES_URL` remain as overrides.
- **Present path:** the codec renders into an `AImageReader`; frames are composited onto an
`ASurfaceControl` layer via a transaction carrying a desired present time, and completion reports
the real latch time and the previous buffer's release fence — so the panel period is learned from
real latches (Android down-rates a game process's vsync callbacks; the old presenter could learn 60
on a 120 Hz panel) and the frame budget is bounded by real completions. `ASurfaceControl` /
`ASurfaceTransaction` are not in ndk-sys 0.6, so `surface_control.rs` hand-declares them and
resolves via `dlsym` from `libandroid.so` (all API 29, above minSdk 28), same pattern as `adpf.rs` /
`vsync.rs`. Memory safety does not rest on the fences (an `AImage` keeps its buffer alive through
SurfaceFlinger's own reference; a mishandled fence is at worst a tear). **Default**; auto-fallback
to the SurfaceView presenter, byte-for-byte unchanged, on API < 29 or any init failure; escape hatch
`debug.punktfunk.present_backend=surfaceview`. The layer is sized to the view's on-screen pixels,
not the window buffer (which is reported in a rotated/scaled space — 1260×567 for a 2800×1260
stream, drawing into the top-left 45 %). The present-time grid uses the mode table's seed period
for spacing and the last real latch only for phase (learning the period from latches was
self-fulfilling and locked the panel at 60). On glass at 2800×1260@120: e2e p50 30 → ~18 ms,
skipped 4050/s → 0. Whether the panel *holds* 120 is the OEM's LTPO governor — measured: no
app-side API (`preferredDisplayModeId`, `preferredRefreshRate`, the layer rate vote,
`frameRatePowerSavingsBalanced`) raises the render-range floor — so the ineffective pins were
removed again and `pf.present` gained the cadence loop's late-permille / jitter / cushion /
re-anchors / qDepth.
- **Colour tagging, which the SurfaceView path never had to do.** MediaCodec tags its own window
buffers; with `AImageReader``ASurfaceControl` the transaction is the only carrier, and a
dataspace of 0 means `setBufferDataSpace` is never called. Two consequences, both fixed inside the
cycle: **HDR** was seeded from a hardcoded `BT2020_ITU_PQ` guess and then overwritten by whatever
the codec echoed on the first output-format change — a decoder that omits color-transfer (common)
echoes None, clobbering the dataspace to 0 before the first present, so P010 buffers composited as
sRGB, and an HLG stream was mis-seeded PQ. The initial dataspace now derives from `client.color`
(PQ vs HLG, range) and a format change only *refines* it when the codec actually reports an HDR
transfer, never resets it — the SurfaceView path's semantics. And **SDR** was untagged entirely:
a limited-range BT.709 buffer read as full range shows black (16) as grey, so SDR now maps to
`ADATASPACE_BT709` and every ASC buffer is tagged.
- **One owner for the system bars.** Console → stream rides an `AnimatedContent` cross-fade, so the
outgoing console shell stays composed until the fade ends and its
`onDispose { show(systemBars()) }` fired *after* `StreamScreen`'s hide — parking the status and
gesture bars over the video for the whole session. Hide/show now lives once in `App.kt`, keyed on
the resolved intent (streaming or console fronting = immersive, touch shell = bars back), and both
screens' per-screen bar management is deleted.
- **Idle gates** (from the console-ui sweep): the reachability sweep only probes while the console is
attached, and the render thread drops to half rate after 60 s without input.
### Hyprland / sway: `topology: exclusive` (closes #284)
`exclusive` disables the operator's outputs for the session and restores them when the display
group's last member is torn down, through the same registry hand-off KWin uses (the compositor never
sees zero enabled outputs; a sibling session's desk is never re-enabled under it). The disable filter
is group-aware — enabled, not ours (`PF-<pid>-<n>` on Hyprland, the `HEADLESS-` prefix on sway), not
managed. **The Hyprland restore is `hyprctl reload`, and that is measured, not chosen**: re-applying
the head's own mode/position/scale does not undo a disable (probed 2026-08-18 against 0.56.2
hyprlang and 0.55.4 Lua — every targeted form was accepted at exit 0 and changed nothing, including
`,enable`, `preferred,auto,1`, `monitorv2 disabled=false`, `keyword unset monitor`, the Lua
`disabled = false`, `dispatch dpms on`, `forcerendererreload`); a runtime rule is additive and the
disable keeps winning. Disable is spelled per config era (`keyword monitor <n>,disable` under
hyprlang; `hl.monitor{ output = "<n>", disabled = true }` under Lua) and confirmed by **read-back**,
not exit status. `hyprctl_dispatch` now also matches "can't" (the Lua manager's "keyword can't work
with non-legacy parsers"). `primary` stays extend and warns distinctly. ⚠ **The sway half is not
exercised on a live sway** — no box in the fleet runs one; both argv shapes are pinned by tests and
the read-back turns a wrong guess into a warning naming the outputs. Six new unit tests.
### Gaming Mode takeover: it no longer touches the display manager at all
This landed in two steps within the cycle, and the second retired the first — read the end state.
**The storm.** On an SDDM-autologin box the runtime mask the takeover laid sat in SDDM's relogin
path, so every autologin failed in milliseconds and `Relogin=true` has no backoff: 962 logind
sessions in 3.7 min, system buttons re-scanned 5,688×, udev `change` at ~20/s, iio-sensor-proxy
crash-looping ~16 starts/s, load 26 on 12 cores — and Wine's bus driver, re-enumerating udev per
event, read the pad at ~1.4 Hz. Masking without stopping the display manager is not a weaker
defence; it is the storm's engine.
**Then stopping the DM proved wrong too.** With no display manager there is nothing on the box able
to start a desktop session, so Steam's own "Switch to Desktop" sat on its modal until a reboot
(field report 2026-08-18, `.41`). It could not even be detected and worked around: on a
steamos-manager box every trace of that switch is written by the component we had just stopped —
the `~/.config/steamos-session-select` sentinel is never written (that is the ChimeraOS/Nobara
layout), `/var/lib/sddm/state.conf` only advances when sddm actually *starts* a session,
`get-default-login-mode` stays `game` for a non-persistent switch, and `graphical-session.target`
going inactive fires at takeover time as well.
**End state: idle the autologin, leave the display manager alone.** The takeover drops a unit
override over the `gamescope-session-plus@` template replacing `ExecStart` with a process that
sleeps. The autologin still *succeeds*, so there is no failed unit to relogin against; the session
runs nothing, so Steam is free; and the DM is alive, so the box can service its own session switch.
No privilege, no DM-flavour matrix, no detection. Measured on `.41` in both directions: takeover
leaves `steam` down, `sddm` active, the unit `active (running)` with `NRestarts=0`; the switch that
used to hang brings Plasma up in ~10 s; the restore puts Steam back within 5 s. The drop-in lives
under `$XDG_RUNTIME_DIR` (a copy outliving the host would be a box whose Game Mode silently does
nothing), is swept unconditionally at startup, and its removal sits above every early return in the
restore — the desktop-active return is exactly the path that would leak it. The restore *restarts*
rather than starts, because `start` on an active-but-idle unit is a no-op that would log success
over it.
With nothing stopping a display manager any more, the whole chain built to survive doing so is
deleted: `try_stop_display_manager`, `ensure_host_survives_dm_stop`, `host_is_under_user_manager`,
`cgroup_under_user_manager`, `linger_enabled` and `dm_plan`'s mask input — 142 lines out, 17 in.
**Two shipped facts became false and are corrected:** the takeover no longer has to stop the display
manager, and it no longer needs the `punktfunk` group (the docs and the shipped Bazzite `host.env`
both said it did). That group still gates the usbip nodes the virtual Steam Deck pad attaches
through, which is what the advice now narrows to. Kept from the first step: `any_live` counts
`deactivating` and `reloading` (a unit mid-teardown used to read as a dead leftover, so a box that
*is* in gaming mode sampled as idle); `DmHelperError::shape()`; `watch_for_relogin_storm()` (two
`read_dir`s of `/run/systemd/sessions` 5 s apart, ERROR above 1/s, detect-only, and it states that
no audio, input or PipeWire measurement taken during a storm is valid); and `systemctl_system`
capturing stderr at DEBUG, since that verb is *expected* to fail on an unprivileged host and its
"requires interactive authentication" line was going to the journal on the successful path.
### KWin 6.6 creates our virtual output disabled, and refuses to stream it
On KWin ≥ 6.6 `streamVirtualOutput` creates the output on the backend and then hands
`workspace()->findOutput(output)` to the stream — null for an output the workspace does not manage
(`wantsToManage` = `isEnabled() && !isNonDesktop()`). An output KWin creates **disabled** is
therefore refused with "Could not find output", translated into the session's language and logged
nowhere, because disabling an output is a perfectly valid configuration that applies successfully.
6.4/6.5 passed the backend output straight through and streamed it either way. It repeats forever:
the host asks for a *stable* per-client output name precisely so KWin persists that client's scale
and mode against it, so a stored configuration naming it `enabled: false` is reapplied to every
future session for that client — and the user cannot fix it in System Settings, because the output
only exists for the few milliseconds the request is alive. The host now enables the output and
retries. Related, from the same investigation: a **translated** KWin refusal used to burn all 8
retries because the match was against KWin's message rather than our own prefix.
### Windows client: a per-user installer and a portable zip, because Steam must spawn the exe
A user report — launching through Big Picture does not work and the Steam overlay never appears —
turned out to be nothing to do with the app being UWP (it is full-trust Win32 under MSIX too) and
everything to do with the MSIX install **shape**: the exe lives under the ACL'd `WindowsApps`
directory that Steam's non-Steam-game picker cannot browse, and alias / `shell:AppsFolder`
activation defeats the overlay's injection. Steam has to spawn the exe itself, from a normal path.
- **`punktfunk-client.iss`** — a per-user Inno Setup install (no UAC) to
`%LOCALAPPDATA%\Programs\Punktfunk`, re-creating in `HKCU` what the MSIX manifest granted: the
`punktfunk://` scheme, the Start entries, and `{app}` on the user PATH for the `punktfunk` CLI. It
fetches the Windows App Runtime when missing.
- **`pack-client-installer.ps1`** consumes `pack-msix.ps1`'s layout (one assembly, three artifacts),
signs the four exes individually and emits `setup.exe` plus a portable zip — same signing backends
and fail-closed-on-tags rule as its siblings, and no `.cer`, because an exe runs untrusted.
- **`windows-client.yml`** packs after the MSIX and publishes/attaches the new artifacts;
canary/latest aliases are `punktfunk-client-setup_<arch>.exe` and `..._<arch>-portable.zip`.
- **`deeplink.rs`**: `write_shortcut` targets the app-execution alias only under package identity —
an unpackaged install has no alias but does have a stable path, so it targets `current_exe()`.
`has_package_identity()` is now shared with `main.rs`'s AppUserModelID probe.
- Uninstall is `Settings → Apps → Installed apps` (per-user, no admin prompt) or
`unins000.exe /VERYSILENT`; a portable unzip registers nothing and is deleted by hand. Documented
in install-client (with a "Launching through Steam" section), channels, clients, uninstall, and
both copies of `platforms.json`.
### Windows host: two session-killers
- **`untune_process` logged from a TLS destructor.** By then `tracing`'s own thread-local state can be
gone; the log call panicked, and a panic escaping a TLS destructor aborts. The panic hook then hid
the evidence — it logged through the same framework and panicked the same way, and a panic inside
the hook is a case where std deliberately does not format the message (the field log: a location, a
blank line, "thread panicked while processing panic. aborting."). The service manager restarted the
host ~6 s later, so it read as a reconnect. `untune_process` no longer logs (still atomic under the
refcount lock); the panic hook writes straight to the `LogRing` (`OnceLock` + `Mutex`, TLS-free;
`thread::current()` and `Backtrace::force_capture()` verified safe during TLS destruction).
Reproduced standalone on 1.96.0, byte-identical to the field log.
- **A Windows launch is a hand-off, and 0.30 read its exit as the game's.** `explorer.exe
"playnite://…"`, `Steam.exe "steam://…"` and shell app-folder links spawn a forwarder that quits a
second later (launcher already running) or *becomes* the launcher (it was not); the shim window that
guards this was skipped for hint-less titles — the one shape that needs it — so the lease reported
running, then the forwarder's exit closed the connection. The forwarder was also a termination
target. `WinRecipe::owns_game` records which recipe lines start the game (only `gog`, `command` and
a plugin's own recipe) and which forward; a forwarder's pid is dropped; the shim window applies to a
bare child or pid whatever the spec holds; giving up on tracking lands on `GameState::Untracked`
instead of `launching` forever. Fixture in `a_pid_only_launch_reports_its_exit` widened 4 → 8 s
(it passed only because of the bug); new ignored test drives the field report.
### `scripts/install.sh`: a guided Linux host install (preview)
Plain POSIX `sh`, dash-clean, `curl -fsSL https://punktfunk.unom.io/install.sh | sh`. Detect the
distro from os-release (apt / dnf / pacman / rpm-ostree→sysext; NixOS, SteamOS, Windows and unknown
distros get a one-line pointer and stop; Debian 12 / Ubuntu 24.04 / Mint 22 / Fedora 45 hit the
documented floors with the right docs link) → install using the `data/platforms.json` lines
**verbatim** (channel and the Fedora group are edited into the string at run time) → run
`punktfunk-host detect-conflicts` (exit 1 = an active Sunshine-family host) → offer to keep both by
moving the management API port (`PUNKTFUNK_MGMT_BIND`, default 47991, which the firewall step then
opens) → input group (`ujust` on Bazzite) → optional `punktfunk` group, GameStream compat and shared
clipboard, all defaulting to no → firewalld/ufw profiles → enable host + console (+ the plugin
runner where it is not) → optional linger → verify (unit active, UDP 9777 bound) and print the
console URL, the password command and the pairing steps.
`--dry-run` prints every command and changes nothing; `--uninstall` reverses the install and the
service enable per family (user units off first, then only the punktfunk packages actually
installed, then the repo — config, groups and firewall stay, as `/docs/uninstall` states). Every
prompt has a `PUNKTFUNK_INSTALL_*` environment twin so `--yes` (or no terminal) runs unattended, and
stdin is never read, because under `curl | sh` stdin *is* the script. Re-running is safe. The
end-of-run check catches the two NVIDIA silent failures on every family — no driver at all, and a
module the kernel refused to load under Secure Boot — via an `nvidia-smi` probe pointing at the
troubleshooting anchor.
It is labelled **PREVIEW** on purpose: the per-distro docs pages remain the documented default until
it has mileage. CI runs it: a new `installer-smoke.yml` exercises install and `--uninstall` per
package family, and `check-docs-drift.sh` gate 7 runs the 16-file os-release detection matrix
through the real script under `--dry-run` on every push. One bug fixed by the first smoke run: the
`/dev/tty` probe used `-r`/`-w`, which answer yes in a container that has the node but no
controlling terminal, so the redirect failed — it opens the device instead now.
### One home per fact: `data/platforms.json`, and CI gates against drift
Install commands, repo URLs and port numbers had drifted across four surfaces. They now live in
`data/platforms.json` and nowhere else: the docs-site install pages quote it through an
`<Install platform="…"/>` MDX component reading a byte-identical snapshot at
`docs-site/src/data/platforms.json` (the Docker build context is `docs-site/` alone, the same
arrangement `openapi.json` uses), `<Ports/>` renders the port table from it, the website download
page vendors it, and `install.sh` runs it. `scripts/ci/check-docs-drift.sh` gates the parse, the
snapshot sync, undocumented `PUNKTFUNK_*` knobs (against a checked-in baseline) and the detection
matrix; `check-docs-links.sh` covers dead links.
**Two consequences for whoever cuts this release.** The website vendors `platforms.json` and only
refreshes when someone runs `bun run sync-platforms` in punktfunk-website and commits — the release
flow in `docs/releases/README.md` gained that step, and `platforms.json` **did** change this cycle
(the Windows client download). And the `.gitea/PULL_REQUEST_TEMPLATE.md` now asks the one question
CI cannot: did a user-facing fact change, and is the page that owns it updated in the same PR.
### Clients can send their logs to the host, on every platform that has a console
0.30 shipped "Send logs to host" on the Gaming Mode console alone and named the Apple and Android
legs as follow-ups. Both landed here.
- **Apple** — a `ClientLog` drop-in for `Logger(subsystem: "io.unom.punktfunk", category:)` with the
same call shape, writing os_log *and* a process-global ring bounded at 4096 lines / 768 KiB (under
the host's 1 MiB cap), stamped wall-clock ISO-8601 so a bundle lines up with the host log;
`.debug` stays out of the ring, which is the Steam Deck DPB lesson applied in advance. 13 `Logger`
declarations swapped. `MgmtTransport`/`MgmtConnection` POST a length-framed body on the same
pooled, pinned mTLS connection; `SendLogs.toHost` requires identity and pinned fingerprint, the
same gates as the library. Reachable from the host card's context menu and the gamepad host
options. Paired with ABI v25 above, the Swift client finally hears the core's own lines too
(`core.<crate>`, info ceiling by default, `PUNKTFUNK_CORE_LOG_LEVEL` raises it).
- **Android**`pf-client-core`'s logring RING half (note/render/wallclock, std-only) is
Android-enabled, with `send_to_host` still desktop-gated alongside the ureq fetches; `wallclock`
moves in from the session's ring layer so every feeder stamps lines identically. `JNI_OnLoad`
installs a `RingTee`, so every `log` record goes to logcat **and** into the ring in the desktop
ring layer's line shape; `nativeRenderLogs(header)` hands Kotlin the rendered bundle, and the
upload rides the client's own mTLS.
### A provider plugin can report which of its titles are **running**
New: `PUT /api/v1/library/provider/{provider}/running`, body
`{"running":[{"external_id":"…","pid":1234}]}` — the **live** counterpart to the static `detect`
hints a reconcile carries. `detect` says *how to recognize* a title's process; this says *it is
running now*, and carries the pid where the provider knows one. Additive: no existing route,
payload or behaviour changes, and a host with no reporting plugin behaves exactly as before.
It exists because one class of title could never be tracked at all. The host derives liveness by
scanning (`procscan` + `DetectSpec`), which needs something recognizable on disk — an install
directory, an executable, a Steam reaper. A Playnite-launched emulated game, a manually added one,
or a library plugin that records no install directory has none of that, and its launch is a
`playnite://` hand-off, so the host holds no process either: the lease went `Untracked`, its exit
was never noticed, `session_on_game_exit` could not fire, and `POST /game/end` had nothing to aim
at. Playnite knew the whole time — it starts the game, tracks it in the mode the person configured,
and fires an event on both edges carrying the pid. That was being thrown away.
- **Declarative and idempotent**, like the reconcile beside it: the body is the provider's
**complete** running set, so a missed event, a plugin restart or an install mid-game self-correct
on the next report instead of drifting. Absent from the set = stopped.
- **Reports expire** (`crate::runstate::REPORT_TTL`, 90 s; the answer carries `ttl_s`). This is what
makes it safe for a live provider to hold a streaming session open for a game the host cannot
see: a plugin that dies with a game running stops counting shortly after and the host falls back
to scanning. Reporters must restate well inside the window.
- **New `gamelease::LeaseKind::Reported`** — a lease with no process signal of its own, tracked by
what its provider says. `open` reaches it when the spec is empty and a provider speaks for the id;
the shim-reclassification paths (every Windows launch is a hand-off by construction) fall back to
it too, where they previously fell to `Untracked`. Phase 1 accepts "running" as the game
appearing; phase 2 treats "stopped" as the exit, and — unlike `procscan::running_hint`, which may
only ever *delay* an exit because Steam's registry flag survives an unclean exit — a fresh
provider report is decisive in both directions. A reported pid joins the termination ladders on
the same terms as a spawned one (re-resolved and start-time-pinned at the moment of use).
- **Route authority**: the plugin lane, like the reconcile (`mgmt::auth::plugin_may_access`, and its
exhaustive classification table). No new authority — the host maps `external_id` through the
catalog, so a provider can only ever speak about entries it published; an unknown id is *counted*,
not refused, because a report legitimately races its own reconcile and 400-ing the batch would
throw away the liveness of every other running title.
- **`@punktfunk/plugin-kit`: `ProviderClient.reportRunning(providerId, running)`**, returning
`{matched, unknown, ttlS}`; a 404 from an older host means "this host tracks games by scanning".
Version bumped to **0.4.4** — **unpublished, `plugin-kit-v0.4.4` owed.**
The Playnite half lives in `punktfunk-plugin-playnite` (**0.4.5**, exporter **0.4.0**): the C#
exporter hooks Playnite's `OnGameStarted`/`OnGameStopped`/`OnGameStartupCancelled` and writes a
small `punktfunk-running.json` beside the library export, re-stamped every 30 s and *deleted* when
Playnite closes; the plugin polls it and restates the set to this route. It calls the route through
the kit's untyped host seam rather than `reportRunning`, deliberately — depending on the method
would make that repo unbuildable until the kit publishes, for the same request. Needs a host
carrying this route; an older one 404s and the plugin carries on without it.
### Everything else an integrator might notice
- **`mgmt-endpoint` is followed everywhere.** `PUNKTFUNK_MGMT_BIND` moved off 47990 left every plugin,
the runner's log shipper and the tray dialing a dead port (task Running, plugins never registering,
empty library, "no logs at all"). `sdk/src/config.ts::publishedMgmtUrl` reads
`<config_dir>/mgmt-endpoint`; `resolveConfig` uses it after `PUNKTFUNK_MGMT_URL` and before the
default; `runner-cli.ts` exports it into `PUNKTFUNK_MGMT_URL` before any plugin loads (older
vendored SDK copies follow too). New `pf_paths::published_mgmt_port`; `punktfunk-tray` depends on
`pf-paths` and its `mgmt_port` is `Option<u16>``None` re-reads the file every poll. SDK 83 tests
(4 new). **Unpublished — `sdk-v0.1.5` owed.**
- **`scripts/windows/scripting-run.cmd`** redirects the runner's stdout+stderr to
`%ProgramData%\punktfunk\plugin-state\runner.log` (previous run rotated to `.1`; writability probed
with `copy /y nul`; no `goto`, the file is LF). Verified by reading only.
- **`@punktfunk/plugin-kit`: `SyncSettings.minInterval`** (optional; `LibraryPluginDef.minInterval`
overrides), default `DEFAULT_FS_CHANGE_MIN_INTERVAL` = 30 s — a floor on top of the 3 s debounce,
which cannot bound the *rate* under sustained churn (`plugin:steam sync (fs-change)` 102× in
27 min). Changes inside the hold coalesce into one trailing sync. **Unpublished — `plugin-kit-v0.4.3`
owed.** Narrowing the Steam plugin's watch set lives in the steam plugin repo.
- **Nix binary cache at `https://nix.unom.io`** (`nix.yml` third tier: build Rust packages +
gamescope, sign, publish on every main push; a release needs no new trigger since `Cargo.toml` is
in the path filter). Only punktfunk's own store paths (~300 MB per publish); the step asserts every
output matches the name filter; NARs before narinfos, rsync without `--delete`. New
`packaging/nix/server/{Caddyfile,compose.production.yml,prune.sh}` (a `caddy:2-alpine` static tree
on unom-1 beside the flatpak repo) and `scripts/setup-nix-cache.sh` (five stages; the secret key is
shown once and never written to disk; four stages after #318, which also made it detect an
installed key and refuse to casually regenerate one). The signing key is generated and installed as
the `NIX_CACHE_SIGNING_KEY` Actions secret; its public half,
`punktfunk-cache-1:yhOJmHxzg6tzXpxSFzlYn6Pc6r0jHprsWqt8MZC654o=`, is pinned in `install.md` and
`packaging/nix/README.md` and served by the cache at `/punktfunk-cache.pub` (the wizard compares the
two and warns on mismatch). DNS for `nix.unom.io` is provisioned through `unom/infra`'s OpenTofu
(`terraform/cloudflare/records.tf`, applied by `dns-cutover.yml`) — not a dashboard click.
`inputs.punktfunk.inputs.nixpkgs.follows` defeats the cache entirely. Rejected: Gitea's package
registry (no Nix type), storage.unom.io (home uplink, and S3 answers 403 not 404 for a missing key,
which nix treats as fatal).
- **Apple console-UI parity** (Swift, PunktfunkKit/PunktfunkShared): `LibraryCollation` ports
`pf-console-ui`'s `collate.rs` (the desktop's eight tests by name; both read
`clients/shared/library-collate-vectors.json`, new — desktop is the source of truth and regenerates
it); `GameEntry.platform` (sent in `GameMeta` all along, dropped by `Codable`); `LibraryPlaceStack`,
`CollectionsHandover.decide`, `LibraryGridCursor` (port of `GridShape`/`grid_step`/`grid_col_hint`,
nine grid tests by name), `GridGeometry` (the grid owns its scroll offset — no trackpad wheel on the
grid, a named trade); `ConsoleContract.swift` pins `ConsoleMotion` to the shared vectors'
`motion_spring` (response 0.42, damping 0.88, slide 36, scales 0.985/0.96, reveal 0.4,
interruptible; the v1 `$deprecated` note now names Android as the last v1 reader — and Android
moved to the shared shell in this same release). Device keys `librarySort` / `libraryView` /
`libraryCollections` / `libraryGroupBy` — presentation only, never in a profile. `PosterImage`
decodes at the drawn size (`CGImageSourceCreateThumbnailAtIndex`). `HostCardView`'s primary action
reverted to connect (`22fdea66` reverted; `swift test` 375/0). New dev hooks
`PUNKTFUNK_FAKE_LIBRARY=<file.json>`, `PUNKTFUNK_SHOT_EDITING=<field>`, `PUNKTFUNK_SHOT_INTERACTIVE=1`
(screenshot harness only).
- **New environment variables:** `PUNKTFUNK_PAD_SINK_VOLUME` (`=0` skips both pad-sink pins),
`PUNKTFUNK_DUALSENSE_USBIP_GRACE_MS` (pad-arrival grace), `PUNKTFUNK_USBIP_TRACE` (byte-level
USB/IP trace prefix, off by default), `PUNKTFUNK_CORE_LOG_LEVEL` (Apple: raises the ABI v25 log
sink's ceiling above its info default), the three Apple screenshot-harness hooks above, and nine
`PUNKTFUNK_INSTALL_*` twins for `install.sh`'s prompts (`_YES`, `_CHANNEL`, `_GAMESTREAM`,
`_CLIPBOARD`, `_PUNKTFUNK_GROUP`, `_LINGER`, `_MGMT_PORT`, `_DRY_RUN`, `_OS_RELEASE`).
`PUNKTFUNK_STREAM_SINK` gained the `stream` value and is documented for the first time.
- **A Steam Deck never learned a host's wake MAC, so Wake-on-LAN was skipped there in silence.**
Every wake gate reads `!host.mac.is_empty()`, and the MAC only ever reached the store through
`trust::learn_mac`, whose two callers were the GTK and WinUI hosts pages — neither of which runs
in Gaming Mode. Rather than add the missing call twice, the three per-field learners (`learn_mac`,
`learn_os`, `learn_mgmt_port`) collapse into one `learn_from_advert`, called wherever an advert
meets a saved record: both desktop hosts pages, the console home, and the CLI's `discover`.
Remembering one call is not something a front-end can half-do; remembering three is what produced
this (#322).
- **`HostRow` gains `clipboard_sync`** (`#[serde(default)]`) and `ConsoleCmd` two variants,
`BindProfile` and `SetClipboard` — additive and default-tolerant. From the 2026-08-19 console-ui
sweep, which also brought touch deferred-tap and drag-to-scroll to the console (a swipe across the
settings list used to cycle whatever value it landed on, because `MenuList` presses focus *and*
activate), Controller haptics/speaker rows, and two Android idle gates (the reachability sweep
only probes while the console is attached, and the render thread halves its rate after 60 s
without input).
- **Cancelling a connect returns the console immediately.** The takeover could only be dismissed by
a session phase coming back from the embedder and nothing guaranteed one would: Android's shell
sent no phase at all on the cancelled path, and the desktop shell waited on a pump parked inside
the blocking `NativeClient::connect*`, which had no abort — 15 s on a normal dial, **185 s** on a
request-access connect the host holds pending approval. The private `connect_*` inner fn takes a
trailing `cancel: Option<Arc<AtomicBool>>`; not exported through the C ABI.
- **A portable Playnite's covers survive the art confinement.** A Playnite unzipped outside the
users base keeps its library beside the exe, so every cover it exports sits outside every default
art root: the games synced and all **70** covers were dropped, with `PUNKTFUNK_LIBRARY_ART_ROOTS`
the only way out. The Playnite install dirs are art roots now, exactly as Steam's install root
already was, and `playnite_install_dirs` learned to find a portable copy at all — it registers no
uninstall entry and sits under no profile, but it does register the `playnite://` handler, which
is the very registration the launch path already follows. So a portable install also gets its
Fullscreen launcher tile, which it never had. The confinement is not loosened: roots come from the
host's own registry and filesystem probes, never from the plugin lane that supplies the art path.
Paired with the plugin-kit fix below, a fixed host no longer needs a cache file deleted.
- **`plugin-kit`: `startup` and `manual` sync reasons always publish.** The fingerprint says the
plugin would compute the same entries again; it does *not* say the host still holds them — and the
host may accept a payload and store less of it (an art path outside its roots is stripped and the
games kept, deliberately, because a cover must not cost a library). Once that happened the
fingerprint was a permanent "no changes", and the only way out was deleting the plugin's cache
file, which is exactly the advice a portable-Playnite library with 70 dropped covers was given.
The two triggers with a person behind them now always apply.
- **Nix:** nixpkgs bumped because its gamescope 3.16.24 no longer took our patch 0009 (the publish
tier was red on every build); `enableWsi` is a nixpkgs *function argument* defaulting to false, so
the plain derivation shipped a compositor with **no WSI layer at all** and nothing under it could
obtain an HDR10 swapchain — our own postInstall assertion caught it. Also: the prune makes `$out`
writable first (reshade installs read-only), the bun builds are serialised and the OOM is measured
against the real 7 GiB cgroup cap rather than guessed at, and a dispatch opt-in compared against
the string `"true"` silently skipped when the API delivered a real JSON boolean — the step was
skipped and the job still reported success.
- **New packaging payload (Linux host, rpm/deb/arch; nix where noted):** `scripts/60-punktfunk.rules`
(+2 sound rules), `scripts/60-punktfunk-dualsense.conf` (WirePlumber, also nix),
`scripts/alsa-ucm2/…` (UCM drop-in, **not** nix). Bazzite sysext inherits all three from the RPMs.
- **Docs:** `AGENTS.md` + `docs/agents/` (issue tracker is Gitea via the `gitea` MCP server; the
five triage labels; single-context domain docs). A host audio-source comment corrected
(`pw_impl_node_set_driver` marks props changed but leaves the flush to the next info emission).
- **CI:** the Nix publish job records `df` after the build as well as before; the
`linux-client-screenshots` run publishes its PNGs to the generic package registry as well as the
v3 artifact store (which is browser-only, so nothing could reuse the shots for the docs — that is
how the get-started track got its fifth screenshot, a client's host list); and **every Linux
`bun install` is now wrapped in `scripts/ci/retry.sh`**. That last one is a real failure, not
tidying: `bun install` streams download-and-extract, so a tarball truncated by the runner's
packet loss under parallel load surfaces as `error: Fail extracting tarball for "<pkg>"` and
names a package that is perfectly intact — measured on run 19630, where docs-site died on
`@rolldown/binding-linux-x64-gnu` while the web job installed the same registry in the same run
and run 19632 installed the identical lockfile seven minutes later. The tarball's sha512 matches
the lockfile and bun 1.3.13 and 1.3.14 both extract it from disk, so neither the package nor the
floating `oven/bun:1` bump was ever at fault. `retry.sh`'s header had already diagnosed this
class and said to wrap every single-shot network command; `bun install` was the one still
unwrapped. Three attempts rather than the usual five, so a genuinely stale lockfile still fails
fast under `--frozen-lockfile`.
- **The web console's Virtual displays page** put the Streamed-screen and session-lifetime cards
below the tab shell, so both rendered on both tabs; they are policy surfaces and now sit inside
the Configuration tab, leaving the Live tab as the live list plus arrangement.
### Verification status
Gates run on the release tree (this MacBook, rustc/rustfmt 1.96.0 per `rust-toolchain.toml`):
`cargo fmt --all --check` clean; `cargo metadata --offline` ok with the `Cargo.lock` diff
versions-only (36/36 lines); `cargo test -p punktfunk-core --lib` **273 passed**; the android.yml
Play notes gate run verbatim — 456/500 characters and not byte-identical to any prior release's;
both openapi copies `cmp` identical, both stamped 0.31.0; notes voice scan clean outside the
For developers section.
**This release was cut more than once.** The first cut (`601f040f`, merged as #320) was never
tagged, and 41 more non-merge commits landed on top of it — the Windows client installer, the
guided Linux installer, the docs overhaul, ABI v25, the KWin 6.6 repair and the takeover's final
shape among them; a handful more (the Virtual displays tab fix, the fifth get-started screenshot)
arrived while the second cut was being written. This section, the version table and the notes are
all re-measured on the latest tip; where the cuts disagreed, the earlier text was **rewritten
rather than appended to**, because none of
the intervening work ever shipped. Specifically: the "C ABI unchanged / header byte-identical"
claim is gone (it is 25 now), the openapi row moved off 0.29.0, the SDK and plugin-kit rows record
cuts that have happened rather than cuts that were owed, and the Gaming Mode takeover section
describes idling the autologin rather than stopping the display manager — a within-cycle correction
no user could have seen.
**The C ABI harness (`tests/c_abi.rs`) did not run on this cut**, and this time the header *did*
change: it links the staticlib with `-lopus` and this machine has no libopus (`ld: library 'opus'
not found`), which is an environment gap, not a code fault. `punktfunk_set_log_callback` is
therefore compiled by cbindgen and by the Rust unit tests here, but the generated header has not
been compiled by a C compiler on this cut — the CI runner is its first. Worth naming because ABI 25
is the one versioned surface that moved.
**Verified by reading only** — compiled nowhere available to the cutting host: the Windows client
installer and portable zip (`punktfunk-client.iss`, `pack-client-installer.ps1` — the pack step is a
Windows runner's), the Windows runner log redirect (`scripting-run.cmd`), the tray's `Option<u16>`
port on Windows, and the sway half of `topology: exclusive` (no live sway in the fleet, as with
#283).
**Not verified on hardware by this cut**, named rather than left to be discovered: the null-sink
capture topology's on-glass validation (pw-top showing our sink at the top of its own group, 5 min
of loud audio at `delivered_pct=100 gaps=0` on a box where a hardware sink also runs) was still owed
when it landed; the 96 kbps speaker lane was judged on glass by ear only; the Android
`ASurfaceControl` path was verified on one device (Nothing Phone 3), with the fallback presenter
byte-for-byte the 0.30 one; the Mac Accessibility intercept (the tap ahead of Spotlight, inside the
sandbox) needs a granted Accessibility switch the dev machine does not have; and `install.sh` is
smoke-tested per package family in CI containers but is shipped **preview** precisely because it has
no real-box mileage, Bazzite above all.
**Owed outside this repository:** `data/platforms.json` changed this cycle (the Windows client
download), and the website's download page vendors a copy that only refreshes when someone runs
`bun run sync-platforms` in punktfunk-website and commits — step 1 of `docs/releases/README.md`.
---
## v0.30.0
175 commits since v0.29.0 (131 non-merge).
+29 -3
View File
@@ -83,15 +83,41 @@ Two more gates that only apply to some changes:
instead of waiting for the CI job that compiles it.
Generated artifacts are checked in. `include/punktfunk_core.h` (cbindgen) is regenerated by the build
and CI fails if the committed copy drifts. `api/openapi.json` is **not** gated — nothing in CI
regenerates or diffs it, so regenerate and commit it yourself whenever you touch the management API,
and copy the snapshot the docs site serves:
and CI fails if the committed copy drifts. `api/openapi.json` is gated the same way: the `rust` job
regenerates the spec and diffs it against the committed file, and the `docs-drift` job checks that
`docs-site/public/openapi.json` — the snapshot the docs site serves — is a byte-for-byte copy of it.
Touch the management API and CI stays red until you regenerate and re-copy:
```sh
cargo run -p punktfunk-host -- openapi > api/openapi.json
cp api/openapi.json docs-site/public/openapi.json
```
## Where facts live (docs vs READMEs vs website)
Every user-facing fact has exactly one canonical home; everything else links to it. Duplicated
walkthroughs are how the docs drifted before — don't add new ones.
| Surface | Owns | Never contains |
|---|---|---|
| [docs-site](https://docs.punktfunk.unom.io) (`docs-site/content/`) | All user-facing facts: install, config, features, troubleshooting | Design rationale |
| READMEs (root, `packaging/*`, `scripts/*`) | Dev/packager rationale and pointers into the docs | User walkthroughs duplicated from docs-site |
| [punktfunk.unom.io](https://punktfunk.unom.io) (separate repo) | Marketing, downloads, blog | Instructions — it deep-links the docs instead |
| punktfunk-planning (private) | Design rationale, RFCs, plans | Anything user-facing |
Docs pages are written for one of two audiences, not both at once: the **get-started track**
(quickstart, install, pairing — short, one task per page, happy path only) assumes no Linux
expertise; the **reference track** (configuration, CLI, API, per-compositor pages) is allowed to be
dense. When a change touches a user-facing fact, update the docs-site page that owns it in the same
PR.
CI enforces the cheap half of this (`scripts/ci/check-docs-drift.sh` and `check-docs-links.sh`):
the OpenAPI snapshot must match `api/openapi.json`, the docs-site copy of `data/platforms.json` must
match the canonical one, `scripts/install.sh` must carry the file's install lines verbatim, every `PUNKTFUNK_*` variable the docs mention
must still exist in the tree, the counts of undocumented `PUNKTFUNK_*` variables and undocumented
`punktfunk-host` subcommands may never grow (document the new knob, or consciously raise the
baseline in the script), and internal docs links must resolve.
Match the surrounding code's comment density and naming. Commit messages end with the
`Co-Authored-By` trailer (see `git log`).
Generated
+39 -36
View File
@@ -1090,7 +1090,7 @@ dependencies = [
[[package]]
name = "cursor-probe"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"pf-capture",
@@ -1222,7 +1222,7 @@ dependencies = [
[[package]]
name = "display-disturb"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"pf-win-display",
"windows 0.62.2 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2343,7 +2343,7 @@ dependencies = [
[[package]]
name = "latency-probe"
version = "0.30.0"
version = "0.31.0"
[[package]]
name = "lazy_static"
@@ -2446,7 +2446,7 @@ dependencies = [
[[package]]
name = "libvpl-sys"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"bindgen",
"cmake",
@@ -2475,7 +2475,7 @@ checksum = "0ceec5bc11778974d1bcb055b18002eba7f4b3518b6a0081b3af5f21666da9ad"
[[package]]
name = "loss-harness"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"punktfunk-core",
]
@@ -2967,7 +2967,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "pf-bitstream"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"cros-codecs",
"tracing",
@@ -2975,7 +2975,7 @@ dependencies = [
[[package]]
name = "pf-capture"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ashpd",
@@ -2996,7 +2996,7 @@ dependencies = [
[[package]]
name = "pf-client-core"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ash",
@@ -3027,11 +3027,12 @@ dependencies = [
"windows 0.62.2 (git+https://github.com/microsoft/windows-rs?rev=acb5a1a7441033d9312b16842af02eb0c2b403dc)",
"winreg",
"x11rb",
"zbus",
]
[[package]]
name = "pf-clipboard"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ashpd",
@@ -3049,7 +3050,7 @@ dependencies = [
[[package]]
name = "pf-console-ui"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ash",
@@ -3072,7 +3073,7 @@ dependencies = [
[[package]]
name = "pf-dxvadec"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"cros-codecs",
"pf-bitstream",
@@ -3082,7 +3083,7 @@ dependencies = [
[[package]]
name = "pf-encode"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ash",
@@ -3108,7 +3109,7 @@ dependencies = [
[[package]]
name = "pf-frame"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"libc",
@@ -3121,7 +3122,7 @@ dependencies = [
[[package]]
name = "pf-gpu"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"pf-host-config",
@@ -3135,11 +3136,11 @@ dependencies = [
[[package]]
name = "pf-host-config"
version = "0.30.0"
version = "0.31.0"
[[package]]
name = "pf-inject"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ashpd",
@@ -3168,14 +3169,14 @@ dependencies = [
[[package]]
name = "pf-paths"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"tracing",
]
[[package]]
name = "pf-presenter"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ash",
@@ -3190,7 +3191,7 @@ dependencies = [
[[package]]
name = "pf-update"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"serde",
"serde_json",
@@ -3198,7 +3199,7 @@ dependencies = [
[[package]]
name = "pf-update-check"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"aws-lc-rs",
@@ -3210,7 +3211,7 @@ dependencies = [
[[package]]
name = "pf-vaadec"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"cros-codecs",
"pf-bitstream",
@@ -3219,7 +3220,7 @@ dependencies = [
[[package]]
name = "pf-vdisplay"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ashpd",
@@ -3252,7 +3253,7 @@ dependencies = [
[[package]]
name = "pf-vkdecode"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"ash",
"cros-codecs",
@@ -3263,7 +3264,7 @@ dependencies = [
[[package]]
name = "pf-win-display"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"pf-paths",
"punktfunk-core",
@@ -3274,7 +3275,7 @@ dependencies = [
[[package]]
name = "pf-zerocopy"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ash",
@@ -3486,7 +3487,7 @@ dependencies = [
[[package]]
name = "punktfunk-cli"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"pf-client-core",
"punktfunk-core",
@@ -3496,7 +3497,7 @@ dependencies = [
[[package]]
name = "punktfunk-client-android"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"android_logger",
"anyhow",
@@ -3520,7 +3521,7 @@ dependencies = [
[[package]]
name = "punktfunk-client-linux"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"async-channel",
@@ -3537,7 +3538,7 @@ dependencies = [
[[package]]
name = "punktfunk-client-session"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"log",
"pf-client-core",
@@ -3553,7 +3554,7 @@ dependencies = [
[[package]]
name = "punktfunk-client-windows"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"async-channel",
"mdns-sd",
@@ -3571,7 +3572,7 @@ dependencies = [
[[package]]
name = "punktfunk-core"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"aes-gcm",
"cbindgen",
@@ -3581,6 +3582,7 @@ dependencies = [
"hmac 0.13.0",
"if-addrs",
"libc",
"log",
"opus",
"proptest",
"quinn",
@@ -3603,7 +3605,7 @@ dependencies = [
[[package]]
name = "punktfunk-encode-worker"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"pf-encode",
"tracing",
@@ -3612,7 +3614,7 @@ dependencies = [
[[package]]
name = "punktfunk-host"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"aes",
"aes-gcm",
@@ -3682,7 +3684,7 @@ dependencies = [
[[package]]
name = "punktfunk-probe"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"mdns-sd",
@@ -3696,11 +3698,12 @@ dependencies = [
[[package]]
name = "punktfunk-tray"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"anyhow",
"ksni",
"libc",
"pf-paths",
"punktfunk-core",
"rustls",
"serde",
@@ -3719,7 +3722,7 @@ checksum = "d55d956fa96f5ec02be2e13af0e20391a5aa83d6a074e3ad368959d0fab299ea"
[[package]]
name = "pyrowave-sys"
version = "0.30.0"
version = "0.31.0"
dependencies = [
"bindgen",
"cmake",
+1 -1
View File
@@ -65,7 +65,7 @@ exclude = [
ndk = { path = "clients/android/native/vendor/ndk" }
[workspace.package]
version = "0.30.0"
version = "0.31.0"
edition = "2024"
rust-version = "1.85"
license = "MIT OR Apache-2.0"
+4 -29
View File
@@ -109,36 +109,11 @@ installer (all-vendor: NVIDIA, AMD, Intel).
`punktfunk-host` is the streaming host; `punktfunk-web` is the browser console (pairing + status).
**Linux:** every package ships systemd **user** units, so you don't launch the host by hand. The
host unit won't start until `~/.config/punktfunk/host.env` exists, so copy the template your package
installed first:
```sh
mkdir -p ~/.config/punktfunk
# /usr/share/punktfunk/ on Fedora/Arch/Bazzite, /usr/share/punktfunk-host/ on Debian/Ubuntu
# (on Bazzite take host.env.bazzite instead)
cp /usr/share/punktfunk/host.env.example ~/.config/punktfunk/host.env
systemctl --user enable --now punktfunk-host # the streaming host
systemctl --user enable --now punktfunk-web # the web console (Arch: install punktfunk-web first)
```
The shipped host unit runs `serve --gamestream` — the native `punktfunk/1` plane **plus** the
GameStream/Moonlight-compat planes, which belong on a trusted LAN only; for a native-only host drop
the flag with a `systemctl --user edit punktfunk-host` drop-in (which needs an empty `ExecStart=`
line before the replacement — the install guide has the snippet). Then open
`https://<host-ip>:47992` and pair.
How the virtual display and input are wired up depends on your desktop — see
[KDE](https://docs.punktfunk.unom.io/docs/kde) · [GNOME](https://docs.punktfunk.unom.io/docs/gnome) ·
The per-platform guide walks you through the rest — first run, the web console, pairing, and the
desktop-specific wiring ([KDE](https://docs.punktfunk.unom.io/docs/kde) ·
[GNOME](https://docs.punktfunk.unom.io/docs/gnome) ·
[Steam / gamescope](https://docs.punktfunk.unom.io/docs/gamescope) ·
[Sway](https://docs.punktfunk.unom.io/docs/sway).
**Windows:** the installer registers and starts the host as a `LocalSystem` service, so there is
nothing to run by hand — open the web console and pair. Use
`punktfunk-host service start|stop|restart|status` if you need to control it. Upgrades happen in
place — the console's **Updates** card, `winget upgrade unom.PunktfunkHost`, or the newer
`setup.exe` over the old install; uninstall from Add/Remove Programs.
[Sway](https://docs.punktfunk.unom.io/docs/sway)).
Full instructions: **[docs.punktfunk.unom.io/docs/install](https://docs.punktfunk.unom.io/docs/install)**.
+126 -1
View File
@@ -10,7 +10,7 @@
"name": "MIT OR Apache-2.0",
"identifier": "MIT OR Apache-2.0"
},
"version": "0.29.0"
"version": "0.31.0"
},
"paths": {
"/api/v1/client-logs": {
@@ -1860,6 +1860,69 @@
}
}
},
"/api/v1/library/provider/{provider}/running": {
"put": {
"tags": [
"library"
],
"summary": "Report which of a provider's titles are running",
"description": "The **live** counterpart to the `detect` hints in a reconcile payload: that one says *how to\nrecognize* a title's process, this one says *it is running now* (design §9,\n[`crate::runstate`]). For a provider that starts games itself and knows when they stop —\nPlaynite tracks every launch and fires an event on both edges — this is a fact the host would\notherwise have to re-derive by scanning, and for a title with nothing to scan for (an emulated\ngame, a manually added one) could not derive at all.\n\nDeclarative and idempotent, like the reconcile: the body is the provider's **complete** running\nset, so a missed event, a plugin restart or an install mid-game all self-correct on the next\nreport rather than drifting.\n\nThe report **expires** after `ttl_s` (90s) unless restated, which is what makes it safe for a\nlive provider to keep a streaming session open for a game the host cannot see: a plugin that\ndies with a game running stops counting shortly after, and the host falls back to process\nscanning exactly as it does without one. Re-report on every change **and** on a timer well\ninside the window.\n\nTitles the provider does not currently publish are ignored (counted in `unknown`), not an error:\na report may legitimately race its own reconcile.",
"operationId": "reportProviderRunning",
"parameters": [
{
"name": "provider",
"in": "path",
"description": "The provider id ([a-z0-9._-], `manual` reserved)",
"required": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProviderRunningInput"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "The report was accepted",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProviderRunningAccepted"
}
}
}
},
"400": {
"description": "Invalid provider id or payload",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
},
"401": {
"description": "Missing or invalid bearer token",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ApiError"
}
}
}
}
}
}
},
"/api/v1/library/scanners": {
"get": {
"tags": [
@@ -7792,6 +7855,46 @@
}
}
},
"ProviderRunningAccepted": {
"type": "object",
"description": "The result of a liveness report.",
"required": [
"matched",
"unknown",
"ttl_s"
],
"properties": {
"matched": {
"type": "integer",
"description": "How many reported titles matched an entry this provider currently publishes.",
"minimum": 0
},
"ttl_s": {
"type": "integer",
"format": "int64",
"description": "Seconds this report stays authoritative without being restated — re-report inside it while\nanything is running.",
"minimum": 0
},
"unknown": {
"type": "integer",
"description": "How many were ignored because no such entry exists (a report that raced a reconcile).",
"minimum": 0
}
}
},
"ProviderRunningInput": {
"type": "object",
"description": "Request body for `reportProviderRunning`.",
"properties": {
"running": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RunningTitle"
},
"description": "Every title of this provider's that is running **right now**. The full set, not a delta:\nanything absent from it is reported as stopped."
}
}
},
"ReleaseDisplayRequest": {
"type": "object",
"description": "Request body for `releaseDisplay`.",
@@ -7846,6 +7949,28 @@
}
}
},
"RunningTitle": {
"type": "object",
"description": "One running title in a provider's liveness report.",
"required": [
"external_id"
],
"properties": {
"external_id": {
"type": "string",
"description": "The provider's own stable id for the title — the same key its reconcile payload uses."
},
"pid": {
"type": [
"integer",
"null"
],
"format": "int32",
"description": "The process id the provider started for it, when it knows one. Optional, and never trusted\nas a bare number: the host re-resolves it and pins it to its start time before it is ever\nsignalled, so a stale or recycled pid simply contributes nothing.",
"minimum": 0
}
}
},
"RuntimeRequest": {
"type": "object",
"required": [
@@ -49,6 +49,9 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.dp
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import android.widget.Toast
import io.unom.punktfunk.kit.link.DeepLinkResult
import io.unom.punktfunk.kit.link.DeepLinks
@@ -94,10 +97,33 @@ fun App(forceGamepadUi: Boolean = false) {
// `debug.punktfunk.console_backend=none` forces the touch UI for on-glass triage). Without a
// console to draw, a controller drives the touch UI through Compose's own focus.
val skiaConsole = remember { SkiaConsole.wanted() }
val gamepadUi = skiaConsole && gamepadUiActive(
// …AND it actually came up: a console whose native create failed or whose render thread died
// ([SkiaConsole.healthy], observable) would front a SurfaceView nothing ever paints — a gray
// screen with a working pad probe, which is worse than the touch UI it replaced.
val gamepadUi = skiaConsole && SkiaConsole.healthy && gamepadUiActive(
settings.gamepadUiEnabled, settings.gamepadUiMode, controllerConnected, tv, forceGamepadUi,
)
// System bars have ONE owner: this effect. The stream and the console shell both want the
// whole panel (bars hidden, a swipe shows them transiently); the touch shell wants them back.
// It cannot live inside the screens themselves: `AnimatedContent` below keeps the outgoing
// screen composed until its fade ends, so a per-screen `onDispose { show(...) }` fired AFTER
// the incoming screen's hide — console → stream left the status and gesture bars parked over
// the video. Keyed on the resolved intent, not the screens.
val immersive = session != null || gamepadUi
DisposableEffect(immersive) {
val window = activity?.window ?: return@DisposableEffect onDispose {}
val controller = WindowCompat.getInsetsController(window, window.decorView)
if (immersive) {
controller.systemBarsBehavior =
WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
controller.hide(WindowInsetsCompat.Type.systemBars())
} else {
controller.show(WindowInsetsCompat.Type.systemBars())
}
onDispose {}
}
// Publish the live session process-wide, so a `punktfunk://` link that arrives as a SECOND
// activity instance (the normal case under `launchMode = standard`) can refuse it before that
// instance is ever resumed — see MainActivity.onCreate. Cleared on dispose, so an activity
@@ -1,7 +1,6 @@
package io.unom.punktfunk
import android.content.Context
import android.content.res.Configuration
import android.hardware.input.InputManager
import android.os.Build
import android.os.CombinedVibration
@@ -14,7 +13,6 @@ import android.view.MotionEvent
import androidx.activity.compose.BackHandler
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@@ -49,11 +47,8 @@ import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.dp
import dev.chrisbanes.haze.HazeState
import dev.chrisbanes.haze.hazeSource
import io.unom.punktfunk.kit.DsDevice
import io.unom.punktfunk.kit.Gamepad
import io.unom.punktfunk.kit.Sc2BleLink
@@ -61,158 +56,34 @@ import io.unom.punktfunk.kit.Sc2Capture
import kotlinx.coroutines.delay
/**
* Connected-controllers debug view (Settings → Host → Connected controllers): everything the app
* can see about attached input devices, plus a live input test. This exists for exactly the support
* case where a pad "doesn't work" adapters and BT-to-USB dongles often enumerate with a different
* identity than the physical pad, or not as a gamepad at all, and punktfunk only forwards devices
* Android classifies as gamepad/joystick. This screen makes that visible on the device itself.
* Connected-controllers debug view (Settings -> Controller -> Connected controllers): everything
* the app can see about attached input devices, plus a live input test. This exists for exactly
* the support case where a pad "doesn't work" - adapters and BT-to-USB dongles often enumerate
* with a different identity than the physical pad, or not as a gamepad at all, and punktfunk only
* forwards devices Android classifies as gamepad/joystick. This screen makes that visible on the
* device itself.
*
* This is the TOUCH entry point; [ConsoleControllersScreen] shows the same body on the console's
* field. Both drive [ControllersBody] — the screen exists once, and the support answer it gives has
* to be the same one whichever interface asked.
* The TOUCH presentation, and since 2026-08 the only one: the console reaches the same answer
* through its own Skia screen (`crates/pf-console-ui/src/screens/controllers.rs`), which keeps the
* console's input on the page instead of suspending it behind a Compose takeover. What this screen
* still owns alone is the live input test - the console receives only the aggregated navigation
* sample, which is nowhere near a per-device axis/trigger readout. Everything the console DOES
* need from here it asks for as a `ConsoleCmd::PadAction` (see [SkiaConsoleShell]), which is why
* [padInfoOf] and [testRumble] are internal rather than private.
*/
@Composable
internal fun ControllersScreen(gamepadSetting: Int, onBack: () -> Unit, padsOverride: List<PadInfo>? = null) {
BackHandler(onBack = onBack)
var testing by remember { mutableStateOf(false) }
ControllersBody(
gamepadSetting = gamepadSetting,
scroll = rememberScrollState(),
testing = testing,
onTestingChange = { testing = it },
padsOverride = padsOverride,
// The touch screen holds the probes for its whole life: events are OBSERVED (not consumed)
// while the test is off, which is what keeps the "Last input" line live while browsing.
// Nothing else here wants the pad, so there is no one to hand them to.
observeInput = true,
contentPadding = PaddingValues(horizontal = 20.dp, vertical = 24.dp),
) {
Text("Controllers", style = MaterialTheme.typography.headlineMedium)
}
}
/**
* The same screen on the console's field — the couch route to it, which a TV box has no other way to
* reach (there is no touch interface to fall back to there, which is exactly why this matters).
*
* Navigation, and how the pad is shared with the test:
* * up/down scrolls, the shoulders page — the body is cards and prose with no focusable rows, and
* Compose only scrolls to keep a FOCUSED child visible (see [rememberConsoleScroller]);
* * A starts the input test, which is the one thing on this screen a controller can act on;
* * while the test runs it OWNS the pad — that is the whole point of it — so this screen's nav
* drops out of the probe slots and B is a HOLD (below). Everything reverts the moment it ends.
*/
@Composable
internal fun ConsoleControllersScreen(
internal fun ControllersScreen(
gamepadSetting: Int,
onBack: () -> Unit,
navActive: Boolean = true,
padsOverride: List<PadInfo>? = null,
) {
BackHandler(onBack = onBack)
val landscape = LocalConfiguration.current.orientation == Configuration.ORIENTATION_LANDSCAPE
val hazeState = remember { HazeState() }
val scroll = rememberScrollState()
val scrollBy = rememberConsoleScroller(scroll)
// Events are OBSERVED (not consumed) while the test is off, which is what keeps the
// "Last input" line live while browsing. Nothing else here wants the pad.
var testing by remember { mutableStateOf(false) }
val padIsGamepad = (LocalContext.current as? MainActivity)?.lastPadIsGamepad ?: true
GamepadNavEffect2D(
// Off while the test runs: both want the same single probe slot, and the test is the one
// the user just asked for. The identity check in each teardown (here and in the body) is
// what makes the handover safe in either direction.
active = navActive && !testing,
onDirection = { dir ->
when (dir) {
NavDir.UP -> scrollBy(-1, false)
NavDir.DOWN -> scrollBy(1, false)
// Nothing on this screen steps sideways; paging is the shoulders' job.
NavDir.LEFT, NavDir.RIGHT -> {}
}
},
onActivate = { testing = true },
onShoulder = { delta -> scrollBy(delta, true) },
)
Box(Modifier.fillMaxSize()) {
Box(Modifier.fillMaxSize().hazeSource(hazeState)) {
// The calm backdrop, full-bleed under the bars and the cutout: this is a screen to READ,
// and the aurora is ambience. Only the content takes the safe area.
GamepadFormBackground(Modifier.fillMaxSize())
// The body is written against the touch theme; on the console field it has to be inked
// from the palette or it is grey-on-pastel over the six pale palettes.
ConsoleInkedTheme {
Column(Modifier.fillMaxSize().consoleSafeArea()) {
ControllersBody(
gamepadSetting = gamepadSetting,
scroll = scroll,
testing = testing,
onTestingChange = { testing = it },
padsOverride = padsOverride,
// Only while testing: the rest of the time the screen's own nav holds the
// probes, so the "Last input" line is a test-time readout here rather than
// an always-on one. A pad that reaches this screen at all has already
// proved it is seen — by moving the cursor here.
observeInput = testing,
contentPadding = PaddingValues(
start = ConsoleEdgeInset,
end = ConsoleEdgeInset,
// Clears the floating legend zone, like every other console list.
bottom = ConsoleLegendClearance,
),
) {
ConsoleHeader("Connected controllers", horizontalInset = false)
}
}
}
}
Box(
Modifier
.align(Alignment.BottomStart)
.consoleLegendInsets(landscape)
.padding(ConsoleLegendInset),
) {
GamepadHintBar(
if (testing) {
// The rule, stated at the moment it applies: while the test runs, B is a BUTTON
// UNDER TEST like any other — it lights its own chip — so only a hold ends the
// test, after which B is the universal Back again. Tappable as the touch hatch.
listOf(PadGlyph.hint('B', "Hold to finish") { testing = false })
} else {
listOfNotNull(
GamepadHint('↕', PadGlyph.Arrow, "Scroll"),
// Advertised only where they exist — a TV remote has no shoulders, and
// claiming otherwise is both a lie and the reason a narrow legend overflows.
GamepadHint('⇄', PadGlyph.Arrow, "Page").takeIf { padIsGamepad },
PadGlyph.hint('A', "Test inputs") { testing = true },
PadGlyph.hint('B', "Done", onClick = onBack),
)
},
hazeState = hazeState,
)
}
}
}
/**
* The screen itself, shared by both interfaces. [contentPadding] and [heading] are where they
* differ: the touch screen pads for a thumb and titles with the Material headline, the console pads
* to the shared edge inset, clears its floating legend, and titles with [ConsoleHeader].
*
* [observeInput] decides whether this body installs the shared MainActivity probes at all — see the
* two call sites, and [ConsoleControllersScreen] for why they cannot both be on at once.
*/
@Composable
private fun ControllersBody(
gamepadSetting: Int,
scroll: ScrollState,
testing: Boolean,
onTestingChange: (Boolean) -> Unit,
observeInput: Boolean,
contentPadding: PaddingValues,
padsOverride: List<PadInfo>? = null,
heading: @Composable () -> Unit,
) {
val onTestingChange: (Boolean) -> Unit = { testing = it }
val contentPadding = PaddingValues(horizontal = 20.dp, vertical = 24.dp)
val context = LocalContext.current
val activity = context as? MainActivity
@@ -225,7 +96,11 @@ private fun ControllersBody(
InputDevice.getDeviceIds()
.toList()
.mapNotNull { InputDevice.getDevice(it) }
.filter { !it.isVirtual && !Gamepad.isPad(it) }
// Everything real that is NOT counted as a controller — including a device that claims
// a pad source with no pad hardware behind it, which the Gamepads list above now
// rejects. One list or the other, never neither: this screen is where someone looks
// when the client's idea of "a pad is attached" disagrees with the room.
.filter { !it.isVirtual && !Gamepad.looksLikeController(it) }
}
DisposableEffect(Unit) {
val im = context.getSystemService(InputManager::class.java)
@@ -247,32 +122,37 @@ private fun ControllersBody(
var bHeld by remember { mutableStateOf(false) }
// The hold has lasted long enough; the test ends when B is let go (see the probe).
var holdSatisfied by remember { mutableStateOf(false) }
// The probes below are built ONCE per `observeInput` and then read these for the life of that
// installation. `testing` and the callback arrive as parameters now, so capturing them plainly
// would freeze the values they had when the probe was made — the test would consume nothing.
// The probes below are built ONCE and then read these for the life of the screen, so
// capturing `testing` plainly would freeze the value it had when the probe was made — the
// test would consume nothing.
val consuming by rememberUpdatedState(testing)
// The console's refusal thud, on whatever actuator the driving pad or this device has.
val haptics by rememberUpdatedState(rememberConsoleHaptics())
DisposableEffect(observeInput) {
// Stable probe refs, and a teardown that releases the slot only if WE still hold it — the
// rule GamepadNavEffect2D follows. Without it this screen's dispose nulls whatever is in the
// slot: during the console shell's push/pop BOTH screens are briefly composed, so leaving
// here would kill the pad navigation the arriving screen had just installed. The same
// teardown also runs when this screen hands the pad to its own input test and back.
DisposableEffect(Unit) {
// One entry on the MainActivity probe stack, removed by identity on the way out — the rule
// GamepadNavEffect2D follows. During the console shell's push/pop BOTH screens are briefly
// composed, and only the identity removal keeps this screen's teardown from taking the
// arriving screen's claim with it. The same teardown also runs when this screen hands the
// pad to its own input test and back.
val keyProbe: (KeyEvent) -> Boolean = probe@{ event ->
if (!Gamepad.isPad(event.device)) return@probe false
// Read ONCE, up front: the test can end inside this very event, and the release that
// ended it still has to be swallowed here — see the B branch below.
val consume = consuming
// The CORRECTED keycode, so this screen shows the button the stream will send and not
// the one Android guessed for a pad it has no key layout for — the two differ on every
// controller [Gamepad.padKeyCode] exists for, and a tester that disagrees with the
// stream is worse than no tester. The raw pair is still reported in "Last input".
val code = Gamepad.padKeyCode(event)
when (event.action) {
KeyEvent.ACTION_DOWN -> {
held[event.keyCode] = true
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B) bHeld = true
held[code] = true
if (code == KeyEvent.KEYCODE_BUTTON_B) bHeld = true
}
KeyEvent.ACTION_UP -> {
held[event.keyCode] = false
if (event.keyCode == KeyEvent.KEYCODE_BUTTON_B) {
held[code] = false
if (code == KeyEvent.KEYCODE_BUTTON_B) {
bHeld = false
if (consume) {
if (event.eventTime - event.downTime >= HOLD_TO_FINISH_MS) {
@@ -296,37 +176,50 @@ private fun ControllersBody(
}
}
}
lastInput = "${event.device?.name}: ${KeyEvent.keyCodeToString(event.keyCode)}"
// Raw scancode AND keycode, plus the correction when one fired: this line is what a
// field report needs to pin an unmapped pad's report order without the device in hand.
val raw = KeyEvent.keyCodeToString(event.keyCode).removePrefix("KEYCODE_")
val fixed = KeyEvent.keyCodeToString(code).removePrefix("KEYCODE_")
lastInput = "${event.device?.name}: scan 0x%X · %s%s".format(
event.scanCode,
raw,
if (code != event.keyCode) "$fixed" else "",
)
consume
}
val motionProbe: (MotionEvent) -> Boolean = probe@{ event ->
if (!Gamepad.isPad(event.device)) return@probe false
// Through the device's resolved map, exactly as `Gamepad.AxisMapper` reads it while
// streaming — on a pad Android has no key layout for, the right stick and the triggers
// are not on the axes their names suggest.
val map = Gamepad.padMap(event.device)
axes["LX"] = event.getAxisValue(MotionEvent.AXIS_X)
axes["LY"] = event.getAxisValue(MotionEvent.AXIS_Y)
axes["RX"] = event.getAxisValue(MotionEvent.AXIS_Z)
axes["RY"] = event.getAxisValue(MotionEvent.AXIS_RZ)
axes["LT"] = maxOf(
event.getAxisValue(MotionEvent.AXIS_LTRIGGER),
event.getAxisValue(MotionEvent.AXIS_BRAKE),
)
axes["RT"] = maxOf(
event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
event.getAxisValue(MotionEvent.AXIS_GAS),
)
axes["RX"] = event.getAxisValue(map.rightStickX)
axes["RY"] = event.getAxisValue(map.rightStickY)
axes["LT"] = if (map.leftTrigger == Gamepad.AXIS_NONE) {
maxOf(
event.getAxisValue(MotionEvent.AXIS_LTRIGGER),
event.getAxisValue(MotionEvent.AXIS_BRAKE),
)
} else {
map.level(event.getAxisValue(map.leftTrigger))
}
axes["RT"] = if (map.rightTrigger == Gamepad.AXIS_NONE) {
maxOf(
event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
event.getAxisValue(MotionEvent.AXIS_GAS),
)
} else {
map.level(event.getAxisValue(map.rightTrigger))
}
axes["HX"] = event.getAxisValue(MotionEvent.AXIS_HAT_X)
axes["HY"] = event.getAxisValue(MotionEvent.AXIS_HAT_Y)
consuming
}
if (observeInput) {
activity?.padKeyProbe = keyProbe
activity?.padMotionProbe = motionProbe
}
onDispose {
activity?.let { a ->
if (a.padKeyProbe === keyProbe) a.padKeyProbe = null
if (a.padMotionProbe === motionProbe) a.padMotionProbe = null
}
}
val probes = MainActivity.PadProbes(keyProbe, motionProbe)
activity?.pushPadProbes(probes)
onDispose { activity?.removePadProbes(probes) }
}
// Hold-B-to-exit: with events consumed, the pad can't reach the Switch — a 1.2 s hold ends the
// test instead (touch still works). This half only ANSWERS the hold once it is long enough; the
@@ -351,7 +244,7 @@ private fun ControllersBody(
.padding(contentPadding),
verticalArrangement = Arrangement.spacedBy(24.dp),
) {
heading()
Text("Controllers", style = MaterialTheme.typography.headlineMedium)
// Capture-side detection, re-checked on USB hot-plug. The SC2 is never an InputDevice
// (lizard mode is kb/mouse; the capture claims even those away) so it's enumerated from
@@ -825,6 +718,16 @@ private fun PadRow(info: PadInfo, gamepadSetting: Int) {
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
// Only when a correction is actually in force: on a pad Android has a key layout for
// there is nothing to say, and a line that says "normal" on every device teaches
// nobody anything. Named rather than merely flagged, so a field report can quote it.
padButtonsNote(info.buttons)?.let {
Text(
it,
style = MaterialTheme.typography.bodySmall,
color = MaterialTheme.colorScheme.onSurfaceVariant,
)
}
if (info.canRumble) {
OutlinedButton(onClick = { info.dev?.let(::testRumble) }) { Text("Test rumble") }
} else {
@@ -920,6 +823,12 @@ internal data class PadInfo(
val controllerNumber: Int,
val resolvedPref: Int,
val canRumble: Boolean,
/**
* The report order this pad's buttons were resolved to ([Gamepad.padButtons]). Defaults to
* the pad Android already knows, which is what a screenshot scene wants and what the note
* under the card stays silent about.
*/
val buttons: Gamepad.PadButtons = Gamepad.PadButtons.NATIVE,
val dev: InputDevice? = null,
)
@@ -929,6 +838,7 @@ internal fun padInfoOf(dev: InputDevice): PadInfo = PadInfo(
forwarded = isForwarded(dev),
controllerNumber = dev.controllerNumber,
resolvedPref = Gamepad.prefFor(dev),
buttons = Gamepad.padMap(dev).buttons, // via padMap so the list refresh reuses the cache
canRumble = deviceHasVibrator(dev),
dev = dev,
)
@@ -942,7 +852,8 @@ private fun deviceHasVibrator(dev: InputDevice): Boolean =
dev.vibrator.hasVibrator()
}
private fun testRumble(dev: InputDevice) {
/** A short pulse on the pad's own motor. Also the console's `PadAction::Rumble`. */
internal fun testRumble(dev: InputDevice) {
runCatching {
if (Build.VERSION.SDK_INT >= 31) {
val vm = dev.vibratorManager
@@ -958,6 +869,20 @@ private fun testRumble(dev: InputDevice) {
}
/** Identity line: VID:PID + the source classes Android assigned. */
/**
* What to say about a pad whose buttons had to be resolved from their scancodes because Android
* has no key layout for it — null for a pad it does know, which needs no explanation.
*/
private fun padButtonsNote(buttons: Gamepad.PadButtons): String? = when (buttons) {
Gamepad.PadButtons.NATIVE -> null
Gamepad.PadButtons.GENERIC_SONY ->
"Android has no button layout for this controller — read as a PlayStation pad"
Gamepad.PadButtons.GENERIC_XBOX ->
"Android has no button layout for this controller — read as an Xbox pad"
Gamepad.PadButtons.SONY_MODERN ->
"Android has no button layout for this controller — face buttons corrected"
}
private fun deviceDetail(dev: InputDevice): String =
"%04X:%04X · %s".format(dev.vendorId, dev.productId, sourcesLabel(dev.sources))
@@ -11,6 +11,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.platform.LocalContext
import io.unom.punktfunk.kit.Gamepad
import kotlin.math.abs
import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
@@ -82,8 +83,9 @@ fun GamepadNavEffect(
val currentOnOptions by rememberUpdatedState(onOptions)
DisposableEffect(active) {
// Stable probe refs (see GamepadNavEffect2D) so onDispose only releases the slot if we still
// own it — a cross-fading-out screen mustn't null the incoming screen's probes.
// One entry on the MainActivity probe stack (see GamepadNavEffect2D), removed by identity on
// dispose — a cross-fading-out screen must take only its OWN claim, never the incoming
// screen's, and never the console shell's underneath.
val motionProbe: (MotionEvent) -> Boolean = probe@{ ev ->
if (ev.isFromSource(InputDevice.SOURCE_JOYSTICK) && ev.actionMasked == MotionEvent.ACTION_MOVE) {
state.stickX = ev.getAxisValue(MotionEvent.AXIS_X)
@@ -95,7 +97,7 @@ fun GamepadNavEffect(
val keyProbe: (KeyEvent) -> Boolean = probe@{ ev ->
val down = ev.action == KeyEvent.ACTION_DOWN
val edge = down && ev.repeatCount == 0
when (ev.keyCode) {
when (Gamepad.padKeyCode(ev)) {
KeyEvent.KEYCODE_DPAD_LEFT -> { state.dpadX = if (down) -1 else 0; true }
KeyEvent.KEYCODE_DPAD_RIGHT -> { state.dpadX = if (down) 1 else 0; true }
// TV remote (no face buttons): Up → Settings, Down → a saved host's Options.
@@ -113,13 +115,10 @@ fun GamepadNavEffect(
else -> false // B / shoulders / etc. → MainActivity handles (B remaps to BACK)
}
}
if (active) {
activity.padMotionProbe = motionProbe
activity.padKeyProbe = keyProbe
}
val probes = if (active) MainActivity.PadProbes(keyProbe, motionProbe) else null
probes?.let { activity.pushPadProbes(it) }
onDispose {
if (activity.padMotionProbe === motionProbe) activity.padMotionProbe = null
if (activity.padKeyProbe === keyProbe) activity.padKeyProbe = null
probes?.let { activity.removePadProbes(it) }
state.reset()
}
}
@@ -186,9 +185,11 @@ fun GamepadNavEffect2D(
val currentOnShoulder by rememberUpdatedState(onShoulder)
DisposableEffect(active) {
// Stable probe refs so onDispose only releases the slot if WE still own it — during a
// One entry on the MainActivity probe stack, removed by identity on dispose — during a
// cross-fade both the outgoing and incoming screen are briefly composed, and the outgoing's
// teardown must not null out the incoming screen's just-installed probes.
// teardown must take only its own claim. On the console this effect sits OVER the Skia
// shell's probes: pushing (not overwriting) is what lets the shell's pad input resurface
// the moment this screen pops, instead of dying with a nulled slot.
val motionProbe: (MotionEvent) -> Boolean = probe@{ ev ->
if (ev.isFromSource(InputDevice.SOURCE_JOYSTICK) && ev.actionMasked == MotionEvent.ACTION_MOVE) {
state.stickX = ev.getAxisValue(MotionEvent.AXIS_X)
@@ -202,7 +203,7 @@ fun GamepadNavEffect2D(
val keyProbe: (KeyEvent) -> Boolean = probe@{ ev ->
val down = ev.action == KeyEvent.ACTION_DOWN
val edge = down && ev.repeatCount == 0
when (ev.keyCode) {
when (Gamepad.padKeyCode(ev)) {
KeyEvent.KEYCODE_DPAD_LEFT -> { state.dpadX = if (down) -1 else 0; true }
KeyEvent.KEYCODE_DPAD_RIGHT -> { state.dpadX = if (down) 1 else 0; true }
KeyEvent.KEYCODE_DPAD_UP -> { state.dpadY = if (down) -1 else 0; true }
@@ -220,13 +221,10 @@ fun GamepadNavEffect2D(
else -> false // B → MainActivity (remapped to BACK → BackHandler)
}
}
if (active) {
activity.padMotionProbe = motionProbe
activity.padKeyProbe = keyProbe
}
val probes = if (active) MainActivity.PadProbes(keyProbe, motionProbe) else null
probes?.let { activity.pushPadProbes(it) }
onDispose {
if (activity.padMotionProbe === motionProbe) activity.padMotionProbe = null
if (activity.padKeyProbe === keyProbe) activity.padKeyProbe = null
probes?.let { activity.removePadProbes(it) }
state.reset()
}
}
@@ -109,12 +109,29 @@ class MainActivity : ComponentActivity() {
var gamepadRouter: GamepadRouter? = null
/**
* Input observers for the Controllers debug screen (set while it is shown, like [streamHandle]).
* Called for every key/motion event while not streaming; a `true` return consumes the event
* the screen's "test inputs" mode uses that to keep pad input from also driving focus navigation.
* One screen's claim on the pad while not streaming: its key/motion observers, consulted for
* every event before the focus-navigation fallbacks below; a `true` return consumes the event.
* Holders are the Skia console shell, [GamepadNavEffect2D] on the Compose screens the console
* opens over itself, and the Controllers screen's input test.
*/
var padKeyProbe: ((KeyEvent) -> Boolean)? = null
var padMotionProbe: ((MotionEvent) -> Boolean)? = null
class PadProbes(val key: (KeyEvent) -> Boolean, val motion: (MotionEvent) -> Boolean)
/**
* The pad-probe claims, a STACK — only the top entry sees events. A single last-writer-wins
* slot is how the console shell used to lose the pad for good: a screen composed over it
* (Controllers/Licenses) overwrote the slot, then nulled it on its way out, and the shell —
* whose install effect had no reason to re-run — never got it back. Pushing on install and
* removing BY IDENTITY on dispose survives every ordering Compose produces (cross-fades
* compose both screens at once, and dispose is not always LIFO): whatever leaves takes only
* its own entry, and whatever is left on top resumes seeing the pad.
*/
private val padProbes = mutableListOf<PadProbes>()
fun pushPadProbes(p: PadProbes) { padProbes += p }
fun removePadProbes(p: PadProbes) { padProbes.remove(p) }
private val padKeyProbe: ((KeyEvent) -> Boolean)? get() = padProbes.lastOrNull()?.key
private val padMotionProbe: ((MotionEvent) -> Boolean)? get() = padProbes.lastOrNull()?.motion
/**
* Physical-mouse forwarder for the active session (built/released by StreamScreen, like
@@ -599,7 +616,7 @@ class MainActivity : ComponentActivity() {
// no BUTTON_SELECT scancode delivers its Select: see [Gamepad.padButtonBit], which is
// why this asks it rather than `buttonBit`).
if (event.isFromSource(InputDevice.SOURCE_GAMEPAD)) {
val bit = Gamepad.padButtonBit(event.keyCode, event.flags)
val bit = Gamepad.padButtonBit(Gamepad.padKeyCode(event), event.flags)
if (bit != 0) {
// The router forwards the bit on this device's own wire pad index and tracks held
// state per pad. The emergency-exit chord (Select + Start + L1 + R1) is handled
@@ -691,8 +708,10 @@ class MainActivity : ComponentActivity() {
if (event.isFromSource(InputDevice.SOURCE_GAMEPAD)) {
// Not streaming: a game controller drives the Compose UI (TV + phone). Map the face
// buttons to the navigation the focus system / back stack understand; D-pad *keys*
// already move focus on their own, so they fall through to super untouched.
when (event.keyCode) {
// already move focus on their own, so they fall through to super untouched. Read
// through [Gamepad.padKeyCode] so a pad Android has no key layout for reaches the
// menus on the right buttons too, not only the stream.
when (Gamepad.padKeyCode(event)) {
// B → back. Drive the OnBackPressedDispatcher directly rather than synthesising a
// BACK KeyEvent: a synthetic event isn't "tracking", so the framework's default
// onKeyUp(BACK) never calls onBackPressed() and Compose BackHandlers wouldn't fire.
@@ -962,9 +962,14 @@ private fun ControllerSettings(s: Settings, update: (Settings) -> Unit, onOpenCo
enabled = s.gamepadForwarding && s.dsCapture,
onCheckedChange = { on -> update(s.copy(padHaptics = on)) },
)
// The one row here that is OFF by default (see Settings.padSpeaker for why), which
// makes a silent pad speaker look exactly like broken hardware — the failure this
// subtitle exists to pre-empt, after it cost a full evening of host-side measuring.
// Say the default out loud rather than describing only what "on" does.
ToggleRow(
title = "Controller speaker",
subtitle = "Play audio the game sends to the controller's own speaker",
subtitle = "Play audio the game sends to the controller's own speaker" +
"off by default, so the pad's speaker stays silent until you turn this on",
checked = s.padSpeaker,
enabled = s.gamepadForwarding && s.dsCapture,
onCheckedChange = { on -> update(s.copy(padSpeaker = on)) },
@@ -58,7 +58,6 @@ import androidx.compose.ui.viewinterop.AndroidView
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat
import androidx.core.view.WindowInsetsControllerCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.LifecycleOwner
@@ -420,10 +419,8 @@ fun StreamScreen(session: ActiveSession, onSessionEnded: (SessionEndReason) -> U
if (lowLatencyMode && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window?.setPreferMinimalPostProcessing(true)
}
controller?.let {
it.systemBarsBehavior = WindowInsetsControllerCompat.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE
it.hide(WindowInsetsCompat.Type.systemBars())
}
// System bars: NOT hidden here — App.kt owns hide/show (one owner; the AnimatedContent
// handoff broke per-screen ownership, see the `immersive` effect there).
// The soft keyboard (three-finger swipe up → KeyCaptureView below) must OVERLAY the
// stream, never pan/resize it — the video is a fixed-mode surface, not a document.
// Scoped to the stream; the app's other screens keep the default for their text fields.
@@ -817,7 +814,6 @@ fun StreamScreen(session: ActiveSession, onSessionEnded: (SessionEndReason) -> U
w.attributes = w.attributes.apply { layoutInDisplayCutoutMode = priorCutout }
}
}
controller?.show(WindowInsetsCompat.Type.systemBars())
window?.clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
if (lowLatencyMode && Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
window?.setPreferMinimalPostProcessing(false)
@@ -944,6 +940,17 @@ fun StreamScreen(session: ActiveSession, onSessionEnded: (SessionEndReason) -> U
}
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
// The view's CURRENT pixel size, for the ASurfaceControl layer's
// destination rect. It is reported here and not only at
// surfaceCreated because the view grows a frame or two after the
// stream screen appears — hiding the system bars and switching on
// cutout drawing both resize it, and neither recreates the surface.
// A layer left on the start-up rect paints the picture small, in the
// top-left corner. The view's own size, not the buffer geometry in
// `width`/`height`: the layer composites in the view's space.
NativeBridge.nativeVideoSurfaceSize(
handle, this@apply.width, this@apply.height,
)
// Re-assert the frame-rate vote: a buffer-geometry change can reset
// the surface's frame-rate setting on some OEM builds, silently
// dropping the 120 Hz pin mid-stream. Mirrors the native hint's
@@ -11,6 +11,7 @@ import io.unom.punktfunk.kit.discovery.DiscoveredHost
import io.unom.punktfunk.kit.library.DEFAULT_MGMT_PORT
import io.unom.punktfunk.kit.library.GameEntry
import io.unom.punktfunk.kit.security.KnownHost
import io.unom.punktfunk.padInfoOf
import org.json.JSONArray
import org.json.JSONObject
@@ -64,6 +65,7 @@ internal object ConsoleJson {
.put("online", online)
.put("mgmt_port", advert?.mgmtPort ?: h.mgmtPort ?: DEFAULT_MGMT_PORT)
.put("can_wake", !online && h.mac.isNotEmpty())
.put("clipboard_sync", h.clipboardSync)
.put("last_used", JSONObject.NULL)
.put("os", advert?.os?.takeIf { it.isNotEmpty() } ?: h.os)
.put("pin", JSONObject.NULL)
@@ -105,6 +107,7 @@ internal object ConsoleJson {
.put("online", true)
.put("mgmt_port", d.mgmtPort ?: DEFAULT_MGMT_PORT)
.put("can_wake", false)
.put("clipboard_sync", false)
.put("last_used", JSONObject.NULL)
.put("os", d.os)
.put("pin", JSONObject.NULL)
@@ -128,6 +131,7 @@ internal object ConsoleJson {
.put("online", true)
.put("mgmt_port", h.mgmtPort ?: DEFAULT_MGMT_PORT)
.put("can_wake", false)
.put("clipboard_sync", h.clipboardSync)
.put("last_used", JSONObject.NULL)
.put("os", h.os)
.put("pin", pin?.let(::profileChip) ?: JSONObject.NULL)
@@ -229,16 +233,25 @@ internal object ConsoleJson {
/**
* `{"label", "pref", "pads": [...]}` the controller chip's text (the driving pad's name),
* the glyph style's pref byte, and one entry per connected pad for the settings rows.
* the glyph style's pref byte, and one entry per connected pad for the settings rows and the
* console's Connected-controllers screen.
*
* `detail`/`forwarded`/`rumble` come straight from [padInfoOf], the same reader the touch
* Controllers screen renders from: the support answer a user gets must not depend on which
* interface asked, and two readers of `InputDevice` would be two answers waiting to drift.
*/
fun pads(pads: List<InputDevice>, driving: InputDevice?): String {
val arr = JSONArray()
for (d in pads) {
val info = padInfoOf(d)
val entry = JSONObject()
.put("name", d.name)
.put("key", "${d.vendorId}:${d.productId}:${d.name}")
.put("pref", Gamepad.prefFor(d))
.put("steam_virtual", false)
.put("detail", info.detail)
.put("forwarded", info.forwarded)
.put("rumble", info.canRumble)
val battery = if (android.os.Build.VERSION.SDK_INT >= 31) {
val b = d.batteryState
if (b.isPresent && b.capacity >= 0f) {
@@ -312,6 +325,7 @@ internal object ConsoleJson {
extra.put("android.sc2_capture", s.sc2Capture)
extra.put("android.ds_capture", s.dsCapture)
extra.put("android.gamepad_ui_mode", s.gamepadUiMode)
extra.put("android.gamepad_ui_enabled", s.gamepadUiEnabled)
j.put("extra", extra)
return j
}
@@ -366,6 +380,7 @@ internal object ConsoleJson {
dsCapture = extra.optBoolean("android.ds_capture", s.dsCapture),
gamepadUiMode = extra.optString("android.gamepad_ui_mode", s.gamepadUiMode)
.ifEmpty { s.gamepadUiMode },
gamepadUiEnabled = extra.optBoolean("android.gamepad_ui_enabled", s.gamepadUiEnabled),
)
}
}
@@ -8,6 +8,9 @@ import android.os.Handler
import android.os.Looper
import android.util.Log
import android.view.InputDevice
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import io.unom.punktfunk.CONNECT_TIMEOUT_MS
import io.unom.punktfunk.ConnectErrors
import io.unom.punktfunk.ProfileStore
@@ -34,8 +37,10 @@ import io.unom.punktfunk.models.ActiveSession
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicBoolean
import java.util.concurrent.atomic.AtomicLong
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody.Companion.toRequestBody
import org.json.JSONArray
import org.json.JSONObject
@@ -67,6 +72,17 @@ object SkiaConsole {
private const val PREFS = "punktfunk_console_settings"
private var handle = 0L
/**
* False once the console has proven it cannot draw the native create failed, or the render
* thread died (a GL context that never came up, or one Android reclaimed and that would not
* come back). Compose observes it: `App` folds it into the gamepad-UI gate, so the answer to a
* dead console is the touch UI not the gray, never-painted `SurfaceView` the shell would
* otherwise sit on for the rest of the process.
*/
var healthy by mutableStateOf(true)
private set
private var appContext: Context? = null
private val main = Handler(Looper.getMainLooper())
private val ioPool = Executors.newCachedThreadPool { r -> Thread(r, "pf-console-io").apply { isDaemon = true } }
@@ -90,6 +106,7 @@ object SkiaConsole {
private var onSettingsChange: ((Settings) -> Unit)? = null
private var onQuit: (() -> Unit)? = null
private var onPlatformScreen: ((String) -> Unit)? = null
private var onPadAction: ((String, String) -> Unit)? = null
private var onPulse: ((String) -> Unit)? = null
/** The connect in flight, if any — cancelable through `OverlayAction::CancelConnect`. */
@@ -142,6 +159,9 @@ object SkiaConsole {
val opts = JSONObject()
.put("device_name", deviceName(app))
.put("gpu_cache_bytes", gpuCacheBytes(app))
// The touch shell exists as a fallback on phones/tablets but not on a TV —
// gates the console's own "Controller-optimized UI" off switch.
.put("fallback_ui", !io.unom.punktfunk.isTvDevice(app))
.put("settings", ConsoleJson.settings(initial, base))
.put("profiles", JSONArray(ConsoleJson.profiles(profiles)))
.put("known_hosts", JSONObject(ConsoleJson.knownHosts(knownHostStore.all())))
@@ -149,6 +169,7 @@ object SkiaConsole {
handle = runCatching { NativeBridge.nativeConsoleCreate(opts.toString()) }.getOrDefault(0L)
if (handle == 0L) {
Log.e(TAG, "console: native create failed")
healthy = false // see [healthy] — the touch UI fronts everything from here
return 0L
}
Log.i(TAG, "console: created (gpu cache ${gpuCacheBytes(app) shr 20} MB)")
@@ -197,6 +218,14 @@ object SkiaConsole {
main.post(object : Runnable {
override fun run() {
if (handle == 0L) return
// Only while the console is ON SCREEN (attached): parked behind the touch UI
// or a stream there is nobody to show the presence pips to — and mid-stream
// the radio belongs to the session, which is exactly why discovery stops for
// it. The timer keeps ticking so probes resume within a cadence of re-attach.
if (onConnected == null) {
main.postDelayed(this, 12_000)
return
}
val targets = knownHostStore.all().filter { kh -> discovered.none { kh.matches(it) } }
ioPool.execute {
val up = targets.filter { NativeBridge.nativeProbe(it.address, it.port, 3_000) }
@@ -236,12 +265,14 @@ object SkiaConsole {
onSettingsChange: (Settings) -> Unit,
onQuit: () -> Unit,
onPlatformScreen: (String) -> Unit,
onPadAction: (String, String) -> Unit,
onPulse: (String) -> Unit,
) {
this.onConnected = onConnected
this.onSettingsChange = onSettingsChange
this.onQuit = onQuit
this.onPlatformScreen = onPlatformScreen
this.onPadAction = onPadAction
this.onPulse = onPulse
discovery?.restart()
// The touch UI may have paired/forgotten/edited hosts or profiles while we were away.
@@ -255,6 +286,7 @@ object SkiaConsole {
onSettingsChange = null
onQuit = null
onPlatformScreen = null
onPadAction = null
onPulse = null
}
@@ -373,7 +405,7 @@ object SkiaConsole {
NativeBridge.nativeConsoleSetKnownHosts(handle, ConsoleJson.knownHosts(knownHostStore.all()))
}
private fun notice(text: String) {
internal fun notice(text: String) {
if (handle != 0L) NativeBridge.nativeConsoleNotice(handle, text)
}
@@ -386,7 +418,10 @@ object SkiaConsole {
ev.has("editing") -> {} // the shell draws its own keyboard; nothing to raise here
ev.has("settings") -> onSettingsSaved(ev.getJSONObject("settings"))
ev.has("gles") -> Log.i(TAG, "console: GLES ${ev.optInt("gles")}")
ev.has("dead") -> Log.e(TAG, "console: render thread died: ${ev.optString("dead")}")
ev.has("dead") -> {
Log.e(TAG, "console: render thread died: ${ev.optString("dead")}")
healthy = false // the touch UI takes over; only a process restart tries again
}
}
}
@@ -514,13 +549,16 @@ object SkiaConsole {
c.optJSONObject("FetchLibrary")?.let { fetchLibrary(it, refreshOnly = false) }
c.optJSONObject("RefreshRunning")?.let { fetchLibrary(it, refreshOnly = true) }
c.optJSONObject("Pair")?.let(::pair)
c.optJSONObject("SendLogs")?.let { notice("Sending logs isn't available on this device yet") }
c.optJSONObject("SendLogs")?.let(::sendLogs)
c.optJSONObject("SaveHost")?.let(::saveHost)
c.optJSONObject("UpdateHost")?.let(::updateHost)
c.optJSONObject("ForgetHost")?.let(::forgetHost)
c.optJSONObject("Wake")?.let(::wake)
c.optJSONObject("SetPin")?.let(::setPin)
c.optJSONObject("BindProfile")?.let(::bindProfile)
c.optJSONObject("SetClipboard")?.let(::setClipboard)
c.optJSONObject("OpenPlatformScreen")?.let { onPlatformScreen?.invoke(it.optString("id")) }
c.optJSONObject("PadAction")?.let { onPadAction?.invoke(it.optString("action"), it.optString("pad_key")) }
c.optString("OpenPlatformScreen").takeIf { c.has("OpenPlatformScreen") && c.opt("OpenPlatformScreen") is String }
?.let { onPlatformScreen?.invoke(it) }
}
@@ -559,6 +597,22 @@ object SkiaConsole {
pushHosts(); pushKnownHosts()
}
/** `ConsoleCmd::BindProfile` — the host's default binding (`KnownHost.profileId`); null clears. */
private fun bindProfile(c: JSONObject) {
val kh = hostForKey(c.optString("key")) ?: return
val pid = c.optString("profile_id")
.takeIf { c.has("profile_id") && !c.isNull("profile_id") && it.isNotEmpty() }
knownHostStore.save(kh.copy(profileId = pid))
pushHosts(); pushKnownHosts()
}
/** `ConsoleCmd::SetClipboard` — the per-host clipboard trust toggle. */
private fun setClipboard(c: JSONObject) {
val kh = hostForKey(c.optString("key")) ?: return
knownHostStore.save(kh.copy(clipboardSync = c.optBoolean("on")))
pushHosts(); pushKnownHosts()
}
private fun setPin(c: JSONObject) {
val kh = hostForKey(c.optString("key")) ?: return
val pid = c.optString("profile_id"); val pin = c.optBoolean("pin")
@@ -568,6 +622,52 @@ object SkiaConsole {
pushHosts(); pushKnownHosts()
}
/**
* `ConsoleCmd::SendLogs` the native log ring (`nativeRenderLogs`) posted to this
* paired host's `POST /api/v1/client-logs` over the same mTLS client the library fetch
* uses; the result comes back as a notice, in the desktop console's wording. The header
* mirrors the desktop's identity line (`punktfunk-session <ver> (<os> <arch>) client
* log bundle`).
*/
private fun sendLogs(c: JSONObject) {
val addr = c.optString("addr"); val mgmt = c.optInt("mgmt"); val fp = c.optString("fp_hex")
val hostName = c.optString("host_name").ifEmpty { addr }
val id = identity
if (id == null) {
notice("Identity not ready yet — try again in a moment")
return
}
val version = appContext?.let { app ->
runCatching { app.packageManager.getPackageInfo(app.packageName, 0).versionName }.getOrNull()
} ?: "?"
val header = "punktfunk-android $version (android ${android.os.Build.VERSION.RELEASE}; " +
"${android.os.Build.SUPPORTED_ABIS.firstOrNull() ?: "?"}) — client log bundle"
ioPool.execute {
val err = runCatching {
val body = NativeBridge.nativeRenderLogs(header)
val client = io.unom.punktfunk.kit.library.mtlsHttpClient(
id.certPem, id.privateKeyPem, addr, fp,
)
val req = Request.Builder()
.url("https://$addr:$mgmt/api/v1/client-logs")
.post(body.toRequestBody("text/plain; charset=utf-8".toMediaType()))
.build()
client.newCall(req).execute().use { resp ->
if (resp.code == 200) "" else "host answered HTTP ${resp.code}"
}
}.getOrElse { it.message ?: "upload failed" }
main.post {
notice(
if (err.isEmpty()) {
"Logs sent to $hostName — download them from its web console's Logs page"
} else {
"Couldn't send logs — $err"
},
)
}
}
}
private fun pair(c: JSONObject) {
val addr = c.optString("addr"); val port = c.optInt("port")
val pin = c.optString("pin"); val name = c.optString("device_name")
@@ -1,5 +1,9 @@
package io.unom.punktfunk.console
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.hardware.usb.UsbManager
import android.view.InputDevice
import android.view.KeyEvent
import android.view.MotionEvent
@@ -26,15 +30,20 @@ import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.platform.LocalLayoutDirection
import androidx.compose.ui.viewinterop.AndroidView
import io.unom.punktfunk.ConsoleControllersScreen
import androidx.core.app.ActivityCompat
import io.unom.punktfunk.ConsoleLicensesScreen
import io.unom.punktfunk.DS_USB_PERMISSION_ACTION
import io.unom.punktfunk.MainActivity
import io.unom.punktfunk.Settings
import io.unom.punktfunk.SettingsStore
import io.unom.punktfunk.kit.DsDevice
import io.unom.punktfunk.kit.Gamepad
import io.unom.punktfunk.kit.NativeBridge
import io.unom.punktfunk.models.ActiveSession
import io.unom.punktfunk.models.LibraryReturn
import io.unom.punktfunk.kit.Sc2BleLink
import io.unom.punktfunk.rememberConsoleHaptics
import io.unom.punktfunk.testRumble
import kotlin.math.roundToInt
/**
@@ -44,9 +53,9 @@ import kotlin.math.roundToInt
*
* What lives here is only what needs a composition: the surface lifecycle, the safe-area insets,
* the pad probes (raw pad the shared menu synthesizer, over JNI), the system Back, the
* platform-native sub-screens the console can open (Controllers, Licences Compose, drawn over the
* surface), and the two intents the app hands over on the way in (a deep link, "come back to this
* shelf").
* platform-native sub-screen the console can open (Licences Compose, drawn over the surface;
* Connected controllers is the console's own Skia screen now), and the two intents the app hands
* over on the way in (a deep link, "come back to this shelf").
*/
@Composable
fun SkiaConsoleShell(
@@ -74,6 +83,7 @@ fun SkiaConsoleShell(
onSettingsChange = { currentOnSettingsChange(it) },
onQuit = { activity?.moveTaskToBack(true) },
onPlatformScreen = { platformScreen = it },
onPadAction = { action, key -> padAction(activity, action, key) },
onPulse = { pulse ->
when (pulse) {
"move" -> haptics.tick()
@@ -102,8 +112,16 @@ fun SkiaConsoleShell(
SkiaConsole.handleDeepLink(url)
}
// The console owns the whole panel while it fronts the app, exactly like the stream: the
// status bar and the gesture bar are hidden (a swipe shows them transiently). This is both the
// space win AND the safe-area fix — hidden bars report zero insets, so the scroll clips that
// used to end at the visible gesture-bar line now run to the panel edge. Only the display
// cutout stays a real inset. The hide/show itself lives in App.kt (one owner; a per-screen
// `onDispose { show }` fired after the stream's hide during the AnimatedContent cross-fade).
// The safe area, in surface pixels: system bars display cutout — the NP3's landscape punch
// is a SIDE inset, and the console's chrome must stay clear of it (its backdrop need not).
// With the bars hidden above, this is normally just the cutout.
val density = LocalDensity.current
val ld = LocalLayoutDirection.current
val insets = WindowInsets.systemBars.union(WindowInsets.displayCutout)
@@ -115,12 +133,14 @@ fun SkiaConsoleShell(
// the same 800-unit field as a Deck); a phone or tablet in the hand gets a density FLOOR
// under that formula, so type never shrinks below what the touch UI draws at the same
// density (design D5 — a bare height/800 on a 460 dpi phone lands ~26 % smaller than a Deck).
// The 0.6 is the on-glass tuning knob.
// The 0.75 is the on-glass tuning knob — raised from 0.6 after a 460 dpi phone (Nothing
// Phone) still read a step too small in the hand: the floor is what sets the phone scale
// (the couch term only wins on tablets and TVs), so this is a phones-only bump.
val tv = remember { io.unom.punktfunk.isTvDevice(context) }
val scale = if (tv) 0f else {
val dm = context.resources.displayMetrics
val couch = minOf(dm.widthPixels, dm.heightPixels) / 800f
maxOf(couch, density.density * 0.6f).coerceIn(0.75f, 3f)
maxOf(couch, density.density * 0.75f).coerceIn(0.75f, 3f)
}
LaunchedEffect(handle, left, top, right, bottom, scale) {
if (handle != 0L) NativeBridge.nativeConsoleSetViewport(handle, left, top, right, bottom, scale)
@@ -139,7 +159,12 @@ fun SkiaConsoleShell(
if (ev.action != KeyEvent.ACTION_DOWN && ev.action != KeyEvent.ACTION_UP) return@probe false
val fromPad = ev.isFromSource(InputDevice.SOURCE_GAMEPAD)
if (fromPad) {
val bit = when (ev.keyCode) {
// The CORRECTED keycode: a pad Android has no key layout for delivers its buttons
// under other buttons' names, so read raw this console answered ✕ with whatever
// sat in BUTTON_A's scancode slot. Same resolution the stream uses — the console
// and the game must not disagree about which button a user pressed.
val code = Gamepad.padKeyCode(ev)
val bit = when (code) {
KeyEvent.KEYCODE_BUTTON_A -> 0
KeyEvent.KEYCODE_BUTTON_B -> 1
KeyEvent.KEYCODE_BUTTON_X -> 2
@@ -159,7 +184,7 @@ fun SkiaConsoleShell(
}
return@probe true
}
val dbit = when (ev.keyCode) {
val dbit = when (code) {
KeyEvent.KEYCODE_DPAD_UP -> 0
KeyEvent.KEYCODE_DPAD_DOWN -> 1
KeyEvent.KEYCODE_DPAD_LEFT -> 2
@@ -171,7 +196,7 @@ fun SkiaConsoleShell(
padState.push(handle)
return@probe true
}
if (ev.keyCode == KeyEvent.KEYCODE_BUTTON_SELECT && down && ev.repeatCount == 0) {
if (code == KeyEvent.KEYCODE_BUTTON_SELECT && down && ev.repeatCount == 0) {
NativeBridge.nativeConsoleMenu(handle, 0) // ▲ opens the tile's options on Home
return@probe true
}
@@ -228,13 +253,13 @@ fun SkiaConsoleShell(
padState.push(handle)
true
}
activity.padKeyProbe = keyProbe
activity.padMotionProbe = motionProbe
val probes = MainActivity.PadProbes(keyProbe, motionProbe)
activity.pushPadProbes(probes)
SkiaConsole.padsChanged(Gamepad.firstPad())
onDispose {
// Only clear what is still ours: a screen composed after us must not lose its probes.
if (activity.padKeyProbe === keyProbe) activity.padKeyProbe = null
if (activity.padMotionProbe === motionProbe) activity.padMotionProbe = null
// Remove OUR claim only — a platform screen pushed over us keeps its own, and when it
// pops, this one resurfaces (the stack is what fixed the pad dying after Controllers).
activity.removePadProbes(probes)
padState.reset()
if (handle != 0L) padState.push(handle)
}
@@ -267,10 +292,14 @@ fun SkiaConsoleShell(
})
// Touch → the console's pointer (surface pixels): the escape hatch when no
// pad is attached, and the natural way to press a legend hint on a phone.
// A finger's down is kind 6 (the shell defers it so a swipe scrolls); a
// mouse — which Android delivers through this same listener — keeps kind 1
// and acts on the press, as a mouse should.
setOnTouchListener { v, ev ->
if (handle == 0L) return@setOnTouchListener false
val kind = when (ev.actionMasked) {
MotionEvent.ACTION_DOWN -> 1
MotionEvent.ACTION_DOWN ->
if (ev.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) 1 else 6
MotionEvent.ACTION_MOVE -> 0
MotionEvent.ACTION_UP -> 2
MotionEvent.ACTION_CANCEL -> 5
@@ -293,16 +322,101 @@ fun SkiaConsoleShell(
},
)
when (platformScreen) {
"controllers" -> ConsoleControllersScreen(
gamepadSetting = settings.gamepad,
onBack = { platformScreen = null },
navActive = true,
)
"licenses" -> ConsoleLicensesScreen(onBack = { platformScreen = null }, navActive = true)
}
}
}
/**
* A `ConsoleCmd::PadAction` from the console's Connected-controllers screen the handful of
* things only the platform can do: a rumble pulse on the real [InputDevice], the USB/Bluetooth
* grant dialogs, the DualSense pad-audio self test. The touch Controllers screen keeps its own
* buttons for the same actions; both routes end in the same helpers ([testRumble], the grant
* intents, `nativePadAudioSelfTest`), so the support answer cannot drift between interfaces.
* Runs on the main thread (the command drain lives there); results ride [SkiaConsole.notice].
*/
private fun padAction(activity: MainActivity?, action: String, padKey: String) {
if (activity == null) return
val settings = SettingsStore(activity).load()
val usb = activity.getSystemService(Context.USB_SERVICE) as UsbManager
when (action) {
"rumble" ->
Gamepad.pads()
.firstOrNull { "${it.vendorId}:${it.productId}:${it.name}" == padKey }
?.let(::testRumble)
"sc2_bluetooth" -> when {
!settings.sc2Capture ->
SkiaConsole.notice("Enable \"Steam Controller 2 passthrough\" in Settings first.")
Sc2BleLink.permissionGranted(activity) ->
SkiaConsole.notice("Bluetooth access is already granted.")
// The system dialog pauses the activity; onResume re-probes and engages the capture,
// the same way the menu-time auto-ask completes.
else -> Sc2BleLink.CONNECT_PERMISSION?.let {
ActivityCompat.requestPermissions(activity, arrayOf(it), 5)
}
}
"sc2_usb" ->
if (!settings.sc2Capture) {
SkiaConsole.notice("Enable \"Steam Controller 2 passthrough\" in Settings first.")
} else {
// Asks for the USB grant when one is missing and engages the capture on it.
activity.startSc2MenuNav(forceAsk = true)
}
"ds_usb" -> {
val dev = usb.deviceList.values.firstOrNull {
it.vendorId == DsDevice.VID_SONY && it.productId in DsDevice.USB_PIDS
}
when {
!settings.dsCapture ->
SkiaConsole.notice(
"Enable \"DualSense / DualShock passthrough (USB)\" in Settings first.",
)
dev == null -> SkiaConsole.notice("No wired DualSense or DualShock 4 detected.")
usb.hasPermission(dev) -> SkiaConsole.notice("USB access is already granted.")
else -> usb.requestPermission(
dev,
PendingIntent.getBroadcast(
activity, 3, // requestCode 3 — shared with the touch card's button
Intent(DS_USB_PERMISSION_ACTION).setPackage(activity.packageName),
// MUTABLE: the USB stack appends the grant extras to this intent.
PendingIntent.FLAG_MUTABLE,
),
)
}
}
"ds_haptics" -> {
val dev = usb.deviceList.values.firstOrNull {
it.vendorId == DsDevice.VID_SONY && it.productId in DsDevice.USB_PIDS
}
when {
dev == null -> SkiaConsole.notice("No wired DualSense detected.")
DsDevice.modelFor(dev.productId) == DsDevice.Model.DUALSHOCK4 ->
SkiaConsole.notice("The DualShock 4 has no haptics audio device.")
!usb.hasPermission(dev) -> SkiaConsole.notice("Grant USB access first.")
else -> Thread({
// Its OWN connection: the renderer's descriptor must never be shared with
// another transfer engine, and that applies to this test as much as to the
// real path (same rule as the touch card's test).
val conn = runCatching { usb.openDevice(dev) }.getOrNull()
val fd = conn?.fileDescriptor ?: -1
val r = if (fd >= 0) NativeBridge.nativePadAudioSelfTest(fd, 3, 60) else -1
conn?.close()
SkiaConsole.notice(
when {
r > 0 -> "Haptics test passed — $r frames to the pad."
r == -1 ->
"Could not open the pad's audio interface. Some kernels " +
"refuse it; the pad still works normally."
r == -2 -> "The audio stream stopped part-way."
else -> "The stream opened but no audio reached the pad."
},
)
}, "pf-pad-selftest-console").start()
}
}
}
}
/** The raw pad as one `MenuSample`, pushed whenever any part of it changes. */
private class PadState {
var deviceId = -1
@@ -127,9 +127,9 @@ class ScreenshotTest {
WakeTimedOutScene()
}
// The two screens the console reached for the first time in WP8.3. Each is shot on a dark AND a
// pale palette, because the console draws them through a ColorScheme derived from the palette's
// ink — and the pale one is the only place a grey-on-pastel slip can show up.
// The licences view — the one screen the console still opens as a Compose takeover. Shot on a
// dark AND a pale palette, because the console draws it through a ColorScheme derived from the
// palette's ink — and the pale one is the only place a grey-on-pastel slip can show up.
@Test
fun consoleLicenses() = shootRoot("console-licenses", statusBar = false) { ConsoleLicensesScene() }
@@ -137,9 +137,6 @@ class ScreenshotTest {
fun consoleLicensesLight() =
shootRoot("console-licenses-light", statusBar = false) { ConsoleLicensesScene(paletteId = "holo") }
@Test
fun consoleControllers() = shootRoot("console-controllers", statusBar = false) { ConsoleControllersScene() }
/**
* The touch presentation, pads connected landscape, like every store frame: the app is
* built for horizontal use, and a portrait capture shows a layout nobody streams in.
@@ -148,12 +145,6 @@ class ScreenshotTest {
@Config(sdk = [36], qualifiers = "w800dp-h360dp-xxhdpi")
fun controllers() = shootRoot("controllers") { ControllersScene() }
/** The console presentation at the same landscape geometry — the store's FEEL THE GAME frame. */
@Test
@Config(sdk = [36], qualifiers = "w800dp-h360dp-xxhdpi")
fun consoleControllersLandscape() =
shootRoot("console-controllers-landscape", statusBar = false) { ConsoleControllersScene() }
/**
* The same shelf as the TOUCH grid the presentation a finger gets from a host card's
* "Browse library…". Portrait (the default qualifiers), because that is the orientation a
@@ -162,10 +153,6 @@ class ScreenshotTest {
@Test
fun libraryTouch() = shootRoot("library-touch") { TouchLibraryScene() }
@Test
fun consoleControllersLight() =
shootRoot("console-controllers-light", statusBar = false) { ConsoleControllersScene(paletteId = "holo") }
@Test
fun trust() = shootScreen("trust") {
HostsScene()
@@ -62,7 +62,6 @@ import coil.test.FakeImageLoaderEngine
import dev.chrisbanes.haze.HazeState
import dev.chrisbanes.haze.hazeSource
import io.unom.punktfunk.AddHostSheet
import io.unom.punktfunk.ConsoleControllersScreen
import io.unom.punktfunk.ConsoleHeader
import io.unom.punktfunk.ConsoleLegendInset
import io.unom.punktfunk.ConsoleLicensesScreen
@@ -559,36 +558,24 @@ private fun ConsolePalette(paletteId: String, content: @Composable () -> Unit) {
}
/**
* The two screens the console could not reach at all until WP8.3 the open-source notices and the
* connected-controllers view in their console presentation.
* The one Compose screen the console still opens over itself the open-source notices in its
* console presentation. (Connected controllers used to be its sibling here; it is the console's
* own Skia screen now, covered by pf-console-ui's tests.)
*
* Worth a shot each, and worth a PALE one: both are ordinary Material screens underneath, and the
* console shows them through a `ColorScheme` derived from the palette's ink. That derivation is the
* whole risk. Their touch presentation is inked by the app theme, which is always dark, so nothing
* Worth a shot, and worth a PALE one: it is an ordinary Material screen underneath, and the
* console shows it through a `ColorScheme` derived from the palette's ink. That derivation is the
* whole risk. Its touch presentation is inked by the app theme, which is always dark, so nothing
* before this could catch light-grey body text stranded on a pastel field.
*
* Robolectric enumerates no input devices, so the controllers scenes inject [shotPads] the
* deterministic connected-pads state the store listing needs.
*/
@Composable
internal fun ConsoleLicensesScene(paletteId: String = "violet") =
ConsolePalette(paletteId) { ConsoleLicensesScreen(onBack = {}, navActive = false) }
@Composable
internal fun ConsoleControllersScene(paletteId: String = "violet") =
ConsolePalette(paletteId) {
// Robolectric enumerates no input devices, so the shot injects the two pads the store
// listing talks about — the empty "no controller detected" state proves the palette but
// sells nothing.
ConsoleControllersScreen(
gamepadSetting = 0, onBack = {}, navActive = false, padsOverride = shotPads(),
)
}
/**
* The touch presentation of the same screen, with the same injected pads. Wrapped in a background
* [Surface]: the activity provides the dark ground in the app, and without one here the content
* color falls back to black-on-white while the cards stay dark.
* The controllers screen with [shotPads] injected Robolectric enumerates no input devices, and
* the connected-pad card is the point of the shot. Wrapped in a background [Surface]: the
* activity provides the dark ground in the app, and without one here the content color falls
* back to black-on-white while the cards stay dark.
*/
@Composable
internal fun ControllersScene() =
@@ -40,7 +40,4 @@ class TvScreenshotTest {
@Test
fun streamDetailed() =
shootRoot("stream-detailed") { StreamScene(io.unom.punktfunk.StatsVerbosity.DETAILED) }
@Test
fun consoleControllers() = shootRoot("console-controllers") { ConsoleControllersScene() }
}
@@ -3,6 +3,7 @@ package io.unom.punktfunk.kit
import android.view.InputDevice
import android.view.KeyEvent
import android.view.MotionEvent
import java.util.concurrent.ConcurrentHashMap
import kotlin.math.roundToInt
/**
@@ -127,8 +128,12 @@ object Gamepad {
// Microsoft Xbox One / Series product ids (wired + the common Bluetooth/dongle revisions). All
// behave like Xbox 360 on the host minus the glyph identity, so they share one pref byte.
// The Bluetooth revisions (0x02E0/0x02FD Xbox One S, 0x0B05/0x0B22 Elite Series 2 and its
// Core) are here for the same reason as the wired ones: they are the pads a couch actually
// pairs to a TV box, and without them an Elite streams under the Xbox 360 identity.
private val PID_XBOXONE = setOf(
0x02D1, 0x02DD, 0x02E3, 0x02EA, 0x0B00, 0x0B12, 0x0B13, 0x0B20,
0x02D1, 0x02DD, 0x02E0, 0x02E3, 0x02EA, 0x02FD,
0x0B00, 0x0B05, 0x0B12, 0x0B13, 0x0B20, 0x0B22,
)
/**
@@ -188,9 +193,53 @@ object Gamepad {
s and InputDevice.SOURCE_JOYSTICK == InputDevice.SOURCE_JOYSTICK
}
/** All connected gamepad/joystick [InputDevice]s, in system enumeration order. */
fun pads(): List<InputDevice> =
InputDevice.getDeviceIds().toList().mapNotNull { InputDevice.getDevice(it) }.filter { isPad(it) }
/**
* True when [dev] is a controller someone can actually hold: a pad source ([isPad]) that is a
* REAL device carrying real pad hardware a stick, a HAT, or the A/B face buttons.
*
* [isPad] alone answers "did this event come from a pad source", which is the right question
* for ROUTING an event and the wrong one for "is a controller attached". Devices publish
* inputs that claim `SOURCE_GAMEPAD`/`SOURCE_JOYSTICK` while being no such thing OEM
* game-mode overlays and the gaming-phone shoulder triggers among them and one of those is
* enough to pin the console UI on forever: a pad that was never there cannot disconnect, so
* "With a controller" has no way back to the touch UI.
*
* The capability probe is what separates them: a source class is a claim, a stick or a face
* button is hardware. It is not a complete defence an OEM device that declares `BTN_GAMEPAD`
* and a pair of axes is indistinguishable from a pad at this layer so the master switch stays
* the guaranteed way out. `isVirtual` only means "device id < 0" (the platform's own synthetic
* device), which is worth excluding but catches none of the above.
*/
fun looksLikeController(dev: InputDevice?): Boolean {
val d = dev ?: return false
return looksLikeController(
padSource = isPad(d),
virtual = d.isVirtual,
hasStick = d.getMotionRange(MotionEvent.AXIS_X, InputDevice.SOURCE_JOYSTICK) != null ||
d.getMotionRange(MotionEvent.AXIS_HAT_X, InputDevice.SOURCE_JOYSTICK) != null,
// `hasKeys` answers for the DEVICE, so a pad with no sticks at all (an arcade stick,
// a d-pad-only pad) still counts.
hasFaceButtons = d.hasKeys(KeyEvent.KEYCODE_BUTTON_A, KeyEvent.KEYCODE_BUTTON_B)
.any { it },
)
}
/** [looksLikeController]'s decision, over plain facts the seam its truth table is tested at
* (an [InputDevice] cannot be built off a device). */
fun looksLikeController(
padSource: Boolean,
virtual: Boolean,
hasStick: Boolean,
hasFaceButtons: Boolean,
): Boolean = padSource && !virtual && (hasStick || hasFaceButtons)
/**
* All connected controllers, in system enumeration order the devices that answer "is a pad
* attached", so the filter is [looksLikeController] rather than the looser [isPad].
*/
fun pads(): List<InputDevice> = InputDevice.getDeviceIds().toList()
.mapNotNull { InputDevice.getDevice(it) }
.filter { looksLikeController(it) }
/** First connected gamepad/joystick [InputDevice], or null when none is attached. */
fun firstPad(): InputDevice? = pads().firstOrNull()
@@ -293,6 +342,334 @@ object Gamepad {
else -> BTN_BACK
}
// ---------------------------------------------------------------------------------------
// Controllers Android has no key layout for
//
// Android turns a pad's raw evdev scancode into a `KeyEvent.keyCode` through a KEY LAYOUT
// file matched on USB VID/PID (`Vendor_054c_Product_0ce6.kl` & co.). A pad with no matching
// file falls back to AOSP's `Generic.kl`, which assigns keycodes by SCANCODE POSITION —
// `0x130`→BUTTON_A, `0x131`→BUTTON_B, `0x132`→BUTTON_C, and so on up. That is only right if
// the pad's buttons happen to sit at the positions the file assumes, and a HID gamepad with
// no kernel driver behind it numbers its buttons 1..n straight through IN ITS OWN REPORT
// ORDER — so every keycode after the first divergence is somebody else's button.
//
// Reported from a Fire TV Stick 4K Max (2026-08-20): a DualSense and an Xbox Elite Series 2,
// both over Bluetooth, both identified correctly but with buttons landing on the wrong
// actions ("L1 being L2"). Neither has a layout there — AOSP ships none for the Elite
// Series 2 over Bluetooth (`045e:0b05`) on ANY version, and the DualSense's
// (`054c:0ce6`) both postdates Fire OS and carries `requires_kernel_config
// CONFIG_HID_PLAYSTATION`, which a Fire TV kernel does not have. A DualSense reporting
// straight through puts L2 on `0x136`, which `Generic.kl` calls BUTTON_L1: the reported
// symptom exactly.
//
// The fix is to resolve buttons from the SCANCODE, which is the pad's own report position and
// is immune to the layout file — the same reason [Keymap.toVk] reads `scanCode` for keyboards.
// Two things keep it from breaking a pad that already works:
//
// 1. Nothing is corrected on a pad that names its triggers ([padButtons]). A descriptor
// well-formed enough to call them Accelerator/Brake puts its buttons at the standard
// positions too, and that is the fact — not the model — that separates the two firmwares
// of the SAME Xbox pad, only the older of which needs any of this.
// 2. Past that gate the correction still applies ONLY where the delivered keycode is what
// `Generic.kl` would have said ([genericKeyCode]). A different keycode means a
// device-specific layout IS in force and knows this pad better than we do.
//
// Moonlight carries the same two tables AND the same gate (`ControllerHandler`'s
// `isNonStandardDualShock4` / `isNonStandardXboxBtController`, the latter on `gasRange == null`),
// which is why both pads work there on the same box.
//
// The first cut of this asked `hasKeys(BUTTON_C, BUTTON_Z)` on its own, on the reasoning that a
// pad numbering straight through reaches keycodes no controller has a button for. It does — but
// so does every pad that merely DECLARES six buttons, because `hid-input` allocates `BTN_A + n`
// straight through for the whole descriptor whether or not the pad ever presses them. That fired
// the correction on pads Android was already reading correctly (2026-08-21: an Xbox pad
// answering X with Y, Y with LB, and both shoulders with a menu button), and it could not have
// done otherwise: the signal is identical on the firmware that needs correcting and the one that
// does not. Declaration is not report order. Only the axes tell them apart.
/** [MotionEvent] axis id meaning "this pad has no such axis" — see [PadMap]. */
const val AXIS_NONE = -1
/**
* The report order a controller's buttons are numbered in, and with it which scancode carries
* which physical button. Resolved once per device by [padButtons] from what the device
* declares; [correct] then maps one scancode to the keycode it should have produced.
*/
enum class PadButtons {
/**
* The keycode Android delivered is already right a device-specific key layout is in
* force, or the generic one happens to agree. [correct] changes nothing.
*/
NATIVE,
/**
* A Sony pad numbering straight through with no kernel driver behind it: L1 R1
* L2 R2 Create Options L3 R3 PS, i.e. `0x130`..`0x13c` in that order. The analog trigger
* value rides `AXIS_RX`/`AXIS_RY` on such a pad, so the digital L2/R2 fold to keycodes
* [buttonBit] deliberately drops the wire carries the axis, never both.
*/
GENERIC_SONY,
/**
* An Xbox-layout pad numbering straight through: A B X Y LB RB View Menu LS RS, i.e.
* `0x130`..`0x139`. Also the fallback for an unbranded pad, which near-universally
* clones the Xbox layout the same assumption [styleFor] makes for its glyphs.
*/
GENERIC_XBOX,
/**
* A Sony pad WITH a kernel driver (`hid-playstation` / `hid-sony`) but still no key
* layout the combination an Android 11 box on a 5.10 kernel lands in. Such a driver
* emits the modern Linux gamepad codes, where `0x133` is BTN_NORTH () and `0x134` is
* BTN_WEST (); `Generic.kl` reads those two as BUTTON_X and BUTTON_Y, so exactly the
* face pair comes out swapped and nothing else is wrong.
*/
SONY_MODERN,
;
/**
* The keycode scancode [scan] should have produced, given Android delivered [keyCode].
*
* Returns [keyCode] untouched unless it is precisely what [genericKeyCode] would have
* said for [scan] anything else is a device-specific layout's answer, which outranks
* this table. That guard is what makes the correction idempotent and safe to run on
* every pad: it can only ever fire where Android was guessing in the first place.
*/
fun correct(scan: Int, keyCode: Int): Int {
if (this == NATIVE) return keyCode
if (keyCode != genericKeyCode(scan)) return keyCode
val fixed = when (this) {
GENERIC_SONY -> when (scan) {
0x130 -> KeyEvent.KEYCODE_BUTTON_X // □
0x131 -> KeyEvent.KEYCODE_BUTTON_A // ✕
0x132 -> KeyEvent.KEYCODE_BUTTON_B // ○
0x133 -> KeyEvent.KEYCODE_BUTTON_Y // △
0x134 -> KeyEvent.KEYCODE_BUTTON_L1
0x135 -> KeyEvent.KEYCODE_BUTTON_R1
0x136 -> KeyEvent.KEYCODE_BUTTON_L2 // analog: AXIS_RX
0x137 -> KeyEvent.KEYCODE_BUTTON_R2 // analog: AXIS_RY
0x138 -> KeyEvent.KEYCODE_BUTTON_SELECT // Create / Share
0x139 -> KeyEvent.KEYCODE_BUTTON_START // Options
0x13a -> KeyEvent.KEYCODE_BUTTON_THUMBL
0x13b -> KeyEvent.KEYCODE_BUTTON_THUMBR
0x13c -> KeyEvent.KEYCODE_BUTTON_MODE // PS
// 0x13d touchpad click / 0x13e mute: no wire button, dropped as before.
else -> KeyEvent.KEYCODE_UNKNOWN
}
GENERIC_XBOX -> when (scan) {
0x132 -> KeyEvent.KEYCODE_BUTTON_X
0x133 -> KeyEvent.KEYCODE_BUTTON_Y
0x134 -> KeyEvent.KEYCODE_BUTTON_L1
0x135 -> KeyEvent.KEYCODE_BUTTON_R1
0x136 -> KeyEvent.KEYCODE_BUTTON_SELECT // View
0x137 -> KeyEvent.KEYCODE_BUTTON_START // Menu
0x138 -> KeyEvent.KEYCODE_BUTTON_THUMBL
0x139 -> KeyEvent.KEYCODE_BUTTON_THUMBR
else -> keyCode // 0x130 A / 0x131 B already agree
}
// Only the face pair; every other row of Generic.kl is right for these codes.
SONY_MODERN -> when (scan) {
0x133 -> KeyEvent.KEYCODE_BUTTON_Y // BTN_NORTH = △
0x134 -> KeyEvent.KEYCODE_BUTTON_X // BTN_WEST = □
else -> keyCode
}
NATIVE -> keyCode
}
return fixed
}
}
/**
* AOSP `Generic.kl`'s gamepad rows the layout Android falls back to when no device-specific
* key layout matches the pad's VID/PID. Scancodes outside it answer [KeyEvent.KEYCODE_UNKNOWN],
* which never equals a real delivered keycode, so [PadButtons.correct]'s guard leaves those
* events alone.
*/
fun genericKeyCode(scan: Int): Int = when (scan) {
0x130 -> KeyEvent.KEYCODE_BUTTON_A
0x131 -> KeyEvent.KEYCODE_BUTTON_B
0x132 -> KeyEvent.KEYCODE_BUTTON_C
0x133 -> KeyEvent.KEYCODE_BUTTON_X
0x134 -> KeyEvent.KEYCODE_BUTTON_Y
0x135 -> KeyEvent.KEYCODE_BUTTON_Z
0x136 -> KeyEvent.KEYCODE_BUTTON_L1
0x137 -> KeyEvent.KEYCODE_BUTTON_R1
0x138 -> KeyEvent.KEYCODE_BUTTON_L2
0x139 -> KeyEvent.KEYCODE_BUTTON_R2
0x13a -> KeyEvent.KEYCODE_BUTTON_SELECT
0x13b -> KeyEvent.KEYCODE_BUTTON_START
0x13c -> KeyEvent.KEYCODE_BUTTON_MODE
0x13d -> KeyEvent.KEYCODE_BUTTON_THUMBL
0x13e -> KeyEvent.KEYCODE_BUTTON_THUMBR
else -> KeyEvent.KEYCODE_UNKNOWN
}
/**
* How one controller must be read: its button report order plus the axes its right stick and
* analog triggers actually arrive on. Resolved once per device by [padMap].
*/
class PadMap(
val buttons: PadButtons,
val rightStickX: Int = MotionEvent.AXIS_Z,
val rightStickY: Int = MotionEvent.AXIS_RZ,
/**
* The trigger axes, or [AXIS_NONE] for a pad Android already names them on that case
* keeps folding LTRIGGER with BRAKE and RTRIGGER with GAS by max, which is what pads that
* report one pair, the other, or both have always needed.
*/
val leftTrigger: Int = AXIS_NONE,
val rightTrigger: Int = AXIS_NONE,
/** Those trigger axes rest at 1 rather than 0, measured off the device's own range. */
val triggersSigned: Boolean = false,
) {
/** One resolved trigger axis value, folded to the 0..1 the wire scale expects. */
fun level(v: Float): Float = if (triggersSigned) (v + 1f) / 2f else v
}
/** The map every pad with a key layout uses: Android's own names, unchanged. */
private val NATIVE_MAP = PadMap(PadButtons.NATIVE)
/**
* Resolved [PadMap]s, keyed by [InputDevice.getDescriptor] the device's stable identity
* hash, so a pad that reconnects is recognised and a model resolves once for the process.
* Nothing here depends on a live connection, so entries never need evicting.
*/
private val padMaps = ConcurrentHashMap<String, PadMap>()
/**
* Which report order [dev]'s buttons follow [namedTriggers] is whether the pad reports its
* triggers under a name Android knows (see [padMap]), and [declaresCZ] whether it declares
* BUTTON_C and BUTTON_Z.
*
* `namedTriggers` decides it, and a pad that has them is [PadButtons.NATIVE] whatever else it
* says. A HID gamepad describes its triggers either as the Accelerator/Brake usages, which
* become `ABS_GAS`/`ABS_BRAKE` and axis names Android has words for, or as two more generic
* axes on `ABS_Z`/`ABS_RZ`, which it does not and a report descriptor well-formed enough to
* name its triggers puts its buttons at the standard positions too, the ones `Generic.kl`
* already reads correctly. It is the same fact Moonlight decides this on (`gasRange == null`
* beside the `"Xbox Wireless Controller"` name), and it is the one that separates the two
* firmwares of the SAME pad: an Xbox Wireless Controller over Bluetooth reports GAS/BRAKE
* after its firmware update and Z/Rz before it, and only the older one needs correcting.
*
* `declaresCZ` cannot make that call and must never be asked to. `hasKeys` answers for what a
* device DECLARES, not what it reports: `hid-input` allocates `BTN_A + n` straight through for
* every button in the descriptor, so BTN_C (`0x132`) and BTN_Z (`0x135`) are set on any pad
* declaring six or more a standard-layout pad that never presses either included. Read alone
* it fired the correction on pads whose buttons were already right, which is how an Xbox pad
* came to answer X with Y and Y with LB (field reports, 2026-08-21). It stays as the narrower
* question it can answer WHICH straight-through order, once `namedTriggers` has established
* there is one where a false positive costs nothing.
*/
fun padButtons(dev: InputDevice, namedTriggers: Boolean): PadButtons {
val has = dev.hasKeys(KeyEvent.KEYCODE_BUTTON_C, KeyEvent.KEYCODE_BUTTON_Z, 0)
return padButtons(namedTriggers, dev.vendorId == VID_SONY, declaresCZ = has[0] && has[1])
}
/** [padButtons]'s choice over plain facts the seam its truth table is tested at (an
* [InputDevice] cannot be built off a device). */
fun padButtons(namedTriggers: Boolean, sony: Boolean, declaresCZ: Boolean): PadButtons = when {
namedTriggers -> PadButtons.NATIVE
declaresCZ && sony -> PadButtons.GENERIC_SONY
declaresCZ -> PadButtons.GENERIC_XBOX
sony -> PadButtons.SONY_MODERN
else -> PadButtons.NATIVE
}
/**
* The [PadMap] for [dev] its button report order and the axes its right stick and triggers
* arrive on, resolved once per device model and cached.
*
* Axes get the same treatment as buttons: a pad Android has a layout for names its triggers
* LTRIGGER/RTRIGGER (or BRAKE/GAS, or BRAKE/THROTTLE) and is left exactly as it was. A pad
* with NONE of those names is one Android never mapped, and its triggers are sitting on two
* raw axes under the names the HID report gave them. Which two depends on the same report
* order the buttons did:
*
* - a Sony pad reporting straight through lays out X, Y, Z, Rz, Rx, Ry = left stick, right
* stick, then the triggers so the right stick is already right and only the triggers
* (`AXIS_RX`/`AXIS_RY`) are missed;
* - every other such pad puts the right stick on Rx/Ry and the triggers on Z/Rz, which is
* the shape that makes pulling a trigger swing the right stick.
*
* Whether those axes idle at 1 is MEASURED from the device's own range rather than assumed,
* so a pad that reports an honest 0..1 is not rescaled to a permanent half-pull.
*/
fun padMap(dev: InputDevice?): PadMap {
if (dev == null) return NATIVE_MAP
padMaps[dev.descriptor]?.let { return it }
fun has(a: Int) = axis(dev, a) != null
val named = (has(MotionEvent.AXIS_LTRIGGER) && has(MotionEvent.AXIS_RTRIGGER)) ||
(has(MotionEvent.AXIS_BRAKE) && has(MotionEvent.AXIS_GAS)) ||
(has(MotionEvent.AXIS_BRAKE) && has(MotionEvent.AXIS_THROTTLE))
val buttons = padButtons(dev, namedTriggers = named)
val rx = axis(dev, MotionEvent.AXIS_RX)
val hasRxRy = rx != null && has(MotionEvent.AXIS_RY)
// Whichever pair the fallback is about to pick, ask THAT one where it rests.
val restsNegative = if (buttons == PadButtons.GENERIC_SONY) {
(rx?.min ?: 0f) < -0.5f
} else {
(axis(dev, MotionEvent.AXIS_Z)?.min ?: 0f) < -0.5f
}
val map = padMap(buttons, namedTriggers = named, hasRxRy = hasRxRy, restsNegative = restsNegative)
padMaps[dev.descriptor] = map
return map
}
/**
* The axis half of [padMap], decided from four facts about the device so it can be pinned
* without one see `PadButtonsTest`. [namedTriggers] is whether the pad calls its triggers
* anything Android knows (LTRIGGER/RTRIGGER, BRAKE/GAS, BRAKE/THROTTLE); if it does, nothing
* here applies and the pad is read exactly as it always was. [restsNegative] is measured off
* whichever axis pair the fallback picks, never assumed.
*/
fun padMap(
buttons: PadButtons,
namedTriggers: Boolean,
hasRxRy: Boolean,
restsNegative: Boolean,
): PadMap = when {
namedTriggers || !hasRxRy -> PadMap(buttons)
// X, Y, Z, Rz, Rx, Ry = left stick, right stick, triggers. The sticks already read right.
buttons == PadButtons.GENERIC_SONY -> PadMap(
buttons,
leftTrigger = MotionEvent.AXIS_RX,
rightTrigger = MotionEvent.AXIS_RY,
triggersSigned = restsNegative,
)
// Right stick on Rx/Ry and triggers on Z/Rz — the shape in which reading Z/Rz as the
// right stick makes pulling a trigger swing it.
else -> PadMap(
buttons,
rightStickX = MotionEvent.AXIS_RX,
rightStickY = MotionEvent.AXIS_RY,
leftTrigger = MotionEvent.AXIS_Z,
rightTrigger = MotionEvent.AXIS_RZ,
triggersSigned = restsNegative,
)
}
/** [dev]'s range for one joystick [axis], under either source class a pad reports on. */
private fun axis(dev: InputDevice, axis: Int): InputDevice.MotionRange? =
dev.getMotionRange(axis, InputDevice.SOURCE_JOYSTICK)
?: dev.getMotionRange(axis, InputDevice.SOURCE_GAMEPAD)
/**
* The keycode [event] should have carried, given the controller it came from [event]'s own
* keycode for every pad Android has a key layout for, and the scancode's true button for one
* it does not (see the block comment above [PadButtons]).
*
* A drop-in for `event.keyCode` at every gamepad reader: the console UI's navigation, the
* Controllers screen's tester, and the streaming branch all route through it, so a mis-mapped
* pad is fixed in the menus and in the game at once. Events from anything that is not a
* controller, and events with no scancode (soft keyboards, synthetic events), pass through
* untouched.
*/
fun padKeyCode(event: KeyEvent): Int {
val dev = event.device ?: return event.keyCode
if (event.scanCode == 0 || !isPad(dev)) return event.keyCode
return padMap(dev).buttons.correct(event.scanCode, event.keyCode)
}
/**
* Maps one controller's joystick MotionEvents to axis (+ HATdpad) sends on wire pad index [pad],
* **on change only**. Holds the previous axis/hat state so an unchanged frame emits nothing. One
@@ -306,7 +683,12 @@ object Gamepad {
* node (DualSense/DS4 motion sensors), which reports every pad axis as 0. [onMotion] therefore
* folds the event straight in without re-qualifying it.
*/
class AxisMapper(private val handle: Long, private val pad: Int) {
class AxisMapper(
private val handle: Long,
private val pad: Int,
/** Which axes this controller's right stick and triggers arrive on — see [padMap]. */
private val map: PadMap = NATIVE_MAP,
) {
// Sentinel so the first real value (incl. 0) always sends once after attach (Linux parity).
private val last = IntArray(6) { Int.MIN_VALUE }
private var hatX = 0 // -1 / 0 / +1
@@ -317,30 +699,18 @@ object Gamepad {
// Sticks: Android floats 1..1, +y = down → ±32767, negate Y for the wire's +y = up.
sendAxis(AXIS_LS_X, stick(event.getAxisValue(MotionEvent.AXIS_X)))
sendAxis(AXIS_LS_Y, stick(-event.getAxisValue(MotionEvent.AXIS_Y)))
sendAxis(AXIS_RS_X, stick(event.getAxisValue(MotionEvent.AXIS_Z)))
sendAxis(AXIS_RS_Y, stick(-event.getAxisValue(MotionEvent.AXIS_RZ)))
sendAxis(AXIS_RS_X, stick(event.getAxisValue(map.rightStickX)))
sendAxis(AXIS_RS_Y, stick(-event.getAxisValue(map.rightStickY)))
// Triggers: pads report LTRIGGER/RTRIGGER or BRAKE/GAS (some mirror both) — merge
// with max, the same fold as the Controllers screen probe, so a pad that reports
// only one pair and a pad that reports both behave identically; 0..1 → 0..255.
sendAxis(
AXIS_LT,
trigger(
maxOf(
event.getAxisValue(MotionEvent.AXIS_LTRIGGER),
event.getAxisValue(MotionEvent.AXIS_BRAKE),
),
),
)
sendAxis(
AXIS_RT,
trigger(
maxOf(
event.getAxisValue(MotionEvent.AXIS_RTRIGGER),
event.getAxisValue(MotionEvent.AXIS_GAS),
),
),
)
// only one pair and a pad that reports both behave identically; 0..1 → 0..255. A pad
// reporting NONE of those names is one Android has no key layout for, and [map]
// carries the raw axes its triggers really landed on instead.
val lt = resolved(event, map.leftTrigger, MotionEvent.AXIS_LTRIGGER, MotionEvent.AXIS_BRAKE)
val rt = resolved(event, map.rightTrigger, MotionEvent.AXIS_RTRIGGER, MotionEvent.AXIS_GAS)
sendAxis(AXIS_LT, trigger(lt))
sendAxis(AXIS_RT, trigger(rt))
// HAT → dpad button transitions. Android BATCHES joystick ACTION_MOVEs, so a rapid d-pad
// tap (press+release inside one batch window) lives only in the historical samples — the
@@ -383,6 +753,17 @@ object Gamepad {
hatY = 0
}
/**
* One trigger's 0..1 value: [resolvedAxis] when this pad needed one resolved for it,
* else the max of the two names Android gives a trigger it does know.
*/
private fun resolved(event: MotionEvent, resolvedAxis: Int, named: Int, alias: Int): Float =
if (resolvedAxis == AXIS_NONE) {
maxOf(event.getAxisValue(named), event.getAxisValue(alias))
} else {
map.level(event.getAxisValue(resolvedAxis))
}
private fun sendAxis(id: Int, v: Int) {
if (last[id] == v) return
last[id] = v
@@ -605,7 +605,7 @@ class GamepadRouter(
// for the slot's life; the sensor path reads it on every sample.
val slot = Slot(
index,
Gamepad.AxisMapper(handle, index),
Gamepad.AxisMapper(handle, index, Gamepad.padMap(dev)),
NativeBridge.nativePadMotionReaches(handle, pref),
)
slots[dev.id] = slot
@@ -146,6 +146,14 @@ object NativeBridge {
name: String,
): String
/**
* The native client's recent log ring rendered as one text bundle, oldest first,
* prefixed by [header] (this app's identity line) the body for "Send logs to host"
* (`POST /api/v1/client-logs` over the same mTLS client the library fetch uses).
* Never empty; cheap (string copy, no I/O).
*/
external fun nativeRenderLogs(header: String): String
/**
* The machine token of the most recent failed [nativeConnect]/[nativePair], cleared on read
* (`""` when none) call right after a `0` handle / `""` fingerprint. A typed host rejection
@@ -290,6 +298,18 @@ object NativeBridge {
surfaceH: Int,
)
/**
* Re-report the video SurfaceView's on-screen pixel size call it from every `surfaceChanged`.
*
* The ASurfaceControl present backend composites the picture into exactly this rectangle, and
* the view grows AFTER [nativeStartVideo] has run: the stream screen hides the system bars and
* switches the window to draw into the display cutout a frame or two later, and neither
* recreates the surface. Without this the layer keeps painting at its start-up size in the
* corner of a now-bigger surface. Non-positive values are ignored. No-op on a `0` handle;
* cheap (one atomic store), UI-safe.
*/
external fun nativeVideoSurfaceSize(handle: Long, width: Int, height: Int)
/** Stop + join the decode thread without closing the session. No-op on `0`. */
external fun nativeStopVideo(handle: Long)
@@ -0,0 +1,254 @@
package io.unom.punktfunk.kit
import android.view.KeyEvent
import android.view.MotionEvent
import org.junit.Assert.assertEquals
import org.junit.Test
/**
* Pure JVM test of [Gamepad.PadButtons.correct] the scancode resolution for controllers Android
* has no key layout for. Only `KeyEvent`'s compile-time-inlined keycode constants are involved, so
* no Android runtime is needed. Run: `./gradlew :kit:testDebugUnitTest`.
*
* The regression it pins is a field report from a Fire TV Stick 4K Max (2026-08-20): a DualSense
* and an Xbox Elite Series 2, both over Bluetooth, both identified correctly but with buttons
* landing on the wrong actions "L1 being L2". Neither pad has a key layout on that box (AOSP
* ships none for `045e:0b05` at all, and the DualSense's requires `CONFIG_HID_PLAYSTATION`), so
* both fall back to `Generic.kl`, which names keycodes by scancode POSITION. A pad with no kernel
* driver numbers its HID buttons 1..n straight through in its own report order, so every keycode
* after the first divergence belongs to a different button.
*
* The table below is the pad's physical button on the left and where `Generic.kl` put it on the
* right; the assertions read it back the other way.
*/
class PadButtonsTest {
private fun sony(scan: Int) =
Gamepad.PadButtons.GENERIC_SONY.correct(scan, Gamepad.genericKeyCode(scan))
private fun xbox(scan: Int) =
Gamepad.PadButtons.GENERIC_XBOX.correct(scan, Gamepad.genericKeyCode(scan))
/**
* The exact report: a DualSense's L2 sits at scancode `0x136`, which `Generic.kl` calls
* BUTTON_L1 so pulling L2 read as a shoulder press, and L1 (at `0x134`, read as BUTTON_Y)
* read as a face button.
*/
@Test
fun `a DualSense's shoulders stop being each other's buttons`() {
assertEquals(KeyEvent.KEYCODE_BUTTON_L1, sony(0x134)) // L1, delivered as BUTTON_Y
assertEquals(KeyEvent.KEYCODE_BUTTON_R1, sony(0x135)) // R1, delivered as BUTTON_Z
assertEquals(KeyEvent.KEYCODE_BUTTON_L2, sony(0x136)) // L2, delivered as BUTTON_L1
assertEquals(KeyEvent.KEYCODE_BUTTON_R2, sony(0x137)) // R2, delivered as BUTTON_R1
}
/** ✕ is the bottom button — the one A means everywhere else — and □ is the left one. */
@Test
fun `a DualSense's face buttons land on their Xbox positions`() {
assertEquals(KeyEvent.KEYCODE_BUTTON_X, sony(0x130)) // □
assertEquals(KeyEvent.KEYCODE_BUTTON_A, sony(0x131)) // ✕
assertEquals(KeyEvent.KEYCODE_BUTTON_B, sony(0x132)) // ○
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, sony(0x133)) // △
}
/**
* Create/Options/L3/R3/PS. Select in particular: without this it arrived as BUTTON_THUMBL,
* which took the exit, mic and stats chords with it every one of them is built on Select.
*/
@Test
fun `a DualSense's menu buttons and stick clicks are themselves`() {
assertEquals(KeyEvent.KEYCODE_BUTTON_SELECT, sony(0x138)) // Create
assertEquals(KeyEvent.KEYCODE_BUTTON_START, sony(0x139)) // Options
assertEquals(KeyEvent.KEYCODE_BUTTON_THUMBL, sony(0x13a)) // L3
assertEquals(KeyEvent.KEYCODE_BUTTON_THUMBR, sony(0x13b)) // R3
assertEquals(KeyEvent.KEYCODE_BUTTON_MODE, sony(0x13c)) // PS
}
/** The touchpad click and mute have no wire button; they must resolve to nothing, not to R3. */
@Test
fun `a DualSense's touchpad and mute are dropped rather than mistaken`() {
assertEquals(KeyEvent.KEYCODE_UNKNOWN, sony(0x13d))
assertEquals(KeyEvent.KEYCODE_UNKNOWN, sony(0x13e))
assertEquals(0, Gamepad.buttonBit(sony(0x13d)))
}
/** An Xbox-layout pad numbering straight through: A B X Y LB RB View Menu LS RS. */
@Test
fun `an Xbox pad numbering straight through keeps its own layout`() {
assertEquals(KeyEvent.KEYCODE_BUTTON_A, xbox(0x130))
assertEquals(KeyEvent.KEYCODE_BUTTON_B, xbox(0x131))
assertEquals(KeyEvent.KEYCODE_BUTTON_X, xbox(0x132))
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, xbox(0x133))
assertEquals(KeyEvent.KEYCODE_BUTTON_L1, xbox(0x134))
assertEquals(KeyEvent.KEYCODE_BUTTON_R1, xbox(0x135))
assertEquals(KeyEvent.KEYCODE_BUTTON_SELECT, xbox(0x136)) // View
assertEquals(KeyEvent.KEYCODE_BUTTON_START, xbox(0x137)) // Menu
assertEquals(KeyEvent.KEYCODE_BUTTON_THUMBL, xbox(0x138))
assertEquals(KeyEvent.KEYCODE_BUTTON_THUMBR, xbox(0x139))
}
/** `hid-playstation` emits the modern Linux codes, where only the face pair reads swapped. */
@Test
fun `a driver-backed Sony pad has only its face pair corrected`() {
val m = Gamepad.PadButtons.SONY_MODERN
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, m.correct(0x133, KeyEvent.KEYCODE_BUTTON_X)) // △
assertEquals(KeyEvent.KEYCODE_BUTTON_X, m.correct(0x134, KeyEvent.KEYCODE_BUTTON_Y)) // □
for (scan in listOf(0x130, 0x131, 0x136, 0x137, 0x13a, 0x13b, 0x13c)) {
assertEquals(Gamepad.genericKeyCode(scan), m.correct(scan, Gamepad.genericKeyCode(scan)))
}
}
/**
* The guard that makes all of this safe to run on every pad: a keycode that is NOT what
* `Generic.kl` would have said came from a device-specific key layout, which knows this
* controller better than any table here. Correcting it would break a pad that works.
*/
@Test
fun `a keycode a device layout already resolved is never second-guessed`() {
// AOSP's DualSense layout puts △ on BUTTON_Y itself. Every profile must leave it be.
for (p in Gamepad.PadButtons.entries) {
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, p.correct(0x133, KeyEvent.KEYCODE_BUTTON_Y))
}
// Same for a scancode outside the generic gamepad block entirely — a pad's Back key.
assertEquals(
KeyEvent.KEYCODE_BACK,
Gamepad.PadButtons.GENERIC_SONY.correct(158, KeyEvent.KEYCODE_BACK),
)
}
/** Correcting twice is correcting once — the output is never itself a generic-layout answer. */
@Test
fun `correction is idempotent`() {
for (p in Gamepad.PadButtons.entries) {
for (scan in 0x130..0x13e) {
val once = p.correct(scan, Gamepad.genericKeyCode(scan))
assertEquals(once, p.correct(scan, once))
}
}
}
/**
* The axis half. A pad that names its triggers something Android knows is read exactly as it
* always was this is the branch that must NOT fire on the pads that already work.
*/
@Test
fun `a pad that names its triggers is read unchanged`() {
for (p in Gamepad.PadButtons.entries) {
val map = Gamepad.padMap(p, namedTriggers = true, hasRxRy = true, restsNegative = true)
assertEquals(MotionEvent.AXIS_Z, map.rightStickX)
assertEquals(MotionEvent.AXIS_RZ, map.rightStickY)
assertEquals(Gamepad.AXIS_NONE, map.leftTrigger)
assertEquals(Gamepad.AXIS_NONE, map.rightTrigger)
}
// Same when there is no Rx/Ry to fall back to in the first place.
val none = Gamepad.padMap(Gamepad.PadButtons.GENERIC_SONY, false, hasRxRy = false, restsNegative = false)
assertEquals(Gamepad.AXIS_NONE, none.leftTrigger)
}
/**
* A Sony pad reporting straight through lays out X, Y, Z, Rz, Rx, Ry left stick, right
* stick, then the triggers. Only the triggers were being missed; the sticks already read
* right and must be left alone.
*/
@Test
fun `an unmapped Sony pad keeps its sticks and gains its triggers`() {
val map = Gamepad.padMap(Gamepad.PadButtons.GENERIC_SONY, false, hasRxRy = true, restsNegative = false)
assertEquals(MotionEvent.AXIS_Z, map.rightStickX)
assertEquals(MotionEvent.AXIS_RZ, map.rightStickY)
assertEquals(MotionEvent.AXIS_RX, map.leftTrigger)
assertEquals(MotionEvent.AXIS_RY, map.rightTrigger)
}
/**
* Every other unmapped pad is the opposite way round: right stick on Rx/Ry, triggers on Z/Rz.
* Reading Z/Rz as the right stick there is what makes pulling a trigger swing it so the two
* pairs must never be mixed up, which is the whole point of pinning them.
*/
@Test
fun `an unmapped Xbox-layout pad has its stick and triggers the other way round`() {
for (p in listOf(Gamepad.PadButtons.GENERIC_XBOX, Gamepad.PadButtons.SONY_MODERN)) {
val map = Gamepad.padMap(p, namedTriggers = false, hasRxRy = true, restsNegative = false)
assertEquals(MotionEvent.AXIS_RX, map.rightStickX)
assertEquals(MotionEvent.AXIS_RY, map.rightStickY)
assertEquals(MotionEvent.AXIS_Z, map.leftTrigger)
assertEquals(MotionEvent.AXIS_RZ, map.rightTrigger)
}
}
/**
* A trigger axis that idles at 1 is rescaled; one that idles at 0 must NOT be, or it would
* read as a permanent half-pull. Which it is gets measured off the device, never assumed
* both the DualSense's raw RX/RY and the Xbox pad's Z/Rz report an honest 0..1.
*/
@Test
fun `only a trigger that idles negative is rescaled`() {
val signed = Gamepad.padMap(Gamepad.PadButtons.GENERIC_SONY, false, hasRxRy = true, restsNegative = true)
assertEquals(0f, signed.level(-1f), 1e-6f)
assertEquals(0.5f, signed.level(0f), 1e-6f)
assertEquals(1f, signed.level(1f), 1e-6f)
val unsigned = Gamepad.padMap(Gamepad.PadButtons.GENERIC_SONY, false, hasRxRy = true, restsNegative = false)
assertEquals(0f, unsigned.level(0f), 1e-6f)
assertEquals(1f, unsigned.level(1f), 1e-6f)
}
/** A pad Android does know is untouched, which is most of them. */
@Test
fun `a pad with a key layout is left alone`() {
for (scan in 0x130..0x13e) {
val generic = Gamepad.genericKeyCode(scan)
assertEquals(generic, Gamepad.PadButtons.NATIVE.correct(scan, generic))
}
}
/**
* The regression that made this gate necessary (field reports, 2026-08-21): an Xbox Wireless
* Controller and a GameSir G8+, both with their buttons at the standard positions and both
* corrected anyway, because `hasKeys` says BUTTON_C and BUTTON_Z for any pad that DECLARES six
* buttons `hid-input` allocates the whole descriptor `BTN_A + n` straight through whether the
* pad ever presses them or not. Naming the triggers is what tells the two apart.
*/
@Test
fun `a pad that names its triggers is never corrected, whatever it declares`() {
for (sony in listOf(false, true)) {
for (declaresCZ in listOf(false, true)) {
assertEquals(
Gamepad.PadButtons.NATIVE,
Gamepad.padButtons(namedTriggers = true, sony = sony, declaresCZ = declaresCZ),
)
}
}
}
/**
* The four buttons the field reports named, on a pad whose report order is already standard:
* X answering Y, Y answering LB, and both shoulders answering a menu button. NATIVE is what
* keeps them themselves the correction tables are right for the pads they are for, and this
* is about not reaching one of them.
*/
@Test
fun `an Xbox pad at the standard positions keeps X, Y and its shoulders`() {
val native = Gamepad.PadButtons.NATIVE
assertEquals(KeyEvent.KEYCODE_BUTTON_X, native.correct(0x133, KeyEvent.KEYCODE_BUTTON_X))
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, native.correct(0x134, KeyEvent.KEYCODE_BUTTON_Y))
assertEquals(KeyEvent.KEYCODE_BUTTON_L1, native.correct(0x136, KeyEvent.KEYCODE_BUTTON_L1))
assertEquals(KeyEvent.KEYCODE_BUTTON_R1, native.correct(0x137, KeyEvent.KEYCODE_BUTTON_R1))
// What the old heuristic did to each of them, kept here so the difference stays visible.
val wrong = Gamepad.PadButtons.GENERIC_XBOX
assertEquals(KeyEvent.KEYCODE_BUTTON_Y, wrong.correct(0x133, KeyEvent.KEYCODE_BUTTON_X))
assertEquals(KeyEvent.KEYCODE_BUTTON_L1, wrong.correct(0x134, KeyEvent.KEYCODE_BUTTON_Y))
assertEquals(KeyEvent.KEYCODE_BUTTON_SELECT, wrong.correct(0x136, KeyEvent.KEYCODE_BUTTON_L1))
assertEquals(KeyEvent.KEYCODE_BUTTON_START, wrong.correct(0x137, KeyEvent.KEYCODE_BUTTON_R1))
}
/** Past the gate, which straight-through order to read is still the question it always was. */
@Test
fun `an unnamed-trigger pad still resolves its report order`() {
fun order(sony: Boolean, declaresCZ: Boolean) =
Gamepad.padButtons(namedTriggers = false, sony = sony, declaresCZ = declaresCZ)
assertEquals(Gamepad.PadButtons.GENERIC_SONY, order(sony = true, declaresCZ = true))
assertEquals(Gamepad.PadButtons.GENERIC_XBOX, order(sony = false, declaresCZ = true))
assertEquals(Gamepad.PadButtons.SONY_MODERN, order(sony = true, declaresCZ = false))
assertEquals(Gamepad.PadButtons.NATIVE, order(sony = false, declaresCZ = false))
}
}
@@ -0,0 +1,67 @@
package io.unom.punktfunk.kit
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
/**
* The truth table behind "is a controller attached" the question the console UI's
* "With a controller" mode is answered by. A false positive here is not cosmetic: it pins the
* console UI on with no pad in the room, and no setting short of turning the whole thing off can
* dismiss it, because the phantom pad never disconnects.
*/
class PadPresenceTest {
/** A real pad: the source class plus hardware behind it, in either of the two shapes. */
@Test
fun realPadsCount() {
assertTrue(
Gamepad.looksLikeController(
padSource = true, virtual = false, hasStick = true, hasFaceButtons = true,
),
)
// An arcade stick / d-pad-only pad — buttons, no analog stick.
assertTrue(
Gamepad.looksLikeController(
padSource = true, virtual = false, hasStick = false, hasFaceButtons = true,
),
)
// A wheel or flight stick — axes, no A/B.
assertTrue(
Gamepad.looksLikeController(
padSource = true, virtual = false, hasStick = true, hasFaceButtons = false,
),
)
}
/** The gaming-phone shoulder triggers and OEM game-mode overlays: a virtual device wearing the
* gamepad source class. This is the field report the console UI that could not be dismissed. */
@Test
fun virtualDevicesAreNotControllers() {
assertFalse(
Gamepad.looksLikeController(
padSource = true, virtual = true, hasStick = true, hasFaceButtons = true,
),
)
}
/** A device that claims a pad source with nothing behind it is not a pad either. */
@Test
fun aSourceClaimWithoutHardwareIsNotAController() {
assertFalse(
Gamepad.looksLikeController(
padSource = true, virtual = false, hasStick = false, hasFaceButtons = false,
),
)
}
/** And a keyboard/mouse with sticks it never reports on the joystick source stays out. */
@Test
fun nonPadSourcesNeverCount() {
assertFalse(
Gamepad.looksLikeController(
padSource = false, virtual = false, hasStick = true, hasFaceButtons = true,
),
)
}
}
+14 -1
View File
@@ -336,6 +336,10 @@ struct Counters {
pcm_written: AtomicU64, // PCM frames copied out to AAudio (device clock is pulling)
underruns: AtomicU64, // callbacks that emitted silence (ring not primed / drained)
target_ms: AtomicU64, // the policy's LIVE target depth (it grows on this device's underruns)
/// Sync-driven inserts: one duplicated, crossfaded frame each (`JitterStep::insert_front`).
/// Concealment must be visible next to the underruns it prevents — a ring that is quietly
/// being deepened is a link whose picture keeps moving away from its audio.
inserts: AtomicU64,
/// Data callbacks since the process started, primed or not. Distinct from `pcm_written`
/// (which only counts SERVED reads) because that is exactly the distinction the start
/// watchdog needs: a device that is pulling but un-primed still ticks this, a stream that
@@ -1046,6 +1050,14 @@ fn try_open(rung: OpenRung, ctx: &OpenCtx) -> ndk::audio::Result<LiveStream> {
if step.drop_front > 0 {
punktfunk_core::audio::crossfade_drop(&mut ring, step.drop_front, step.crossfade);
}
// The mirror: the sync loop asked for a DEEPER ring, answered with one duplicated,
// crossfaded frame instead of a de-prime (see `JitterStep::insert_front`). Stays inside
// the ring's reserve on this RT thread — `with_capacity` above leaves `RING_CHUNKS`
// frames past the hard cap, and the policy only inserts BELOW its target.
if step.insert_front > 0 {
punktfunk_core::audio::crossfade_insert(&mut ring, step.insert_front, step.crossfade);
cb_counters.inserts.fetch_add(1, Ordering::Relaxed);
}
let mut ran_short = false;
if !step.silence {
for slot in out.iter_mut() {
@@ -1355,7 +1367,7 @@ fn decode_loop(
// `underruns` bought with a climbing `plc_ms` is a link in trouble,
// not a link that is fine.
log::info!(
"audio: {}={count} pcm_frames={} underruns={} buffer_ms={} target_ms={} av_ms={} plc_ms={} peak={window_peak:.3}",
"audio: {}={count} pcm_frames={} underruns={} buffer_ms={} target_ms={} av_ms={} plc_ms={} drift_inserts={} peak={window_peak:.3}",
plane_counter_key(fmt),
counters.pcm_written.load(Ordering::Relaxed),
counters.underruns.load(Ordering::Relaxed),
@@ -1363,6 +1375,7 @@ fn decode_loop(
counters.target_ms.load(Ordering::Relaxed),
av.offset_ms(),
drought.total_ms(),
counters.inserts.load(Ordering::Relaxed),
);
window_peak = 0.0;
}
+55 -5
View File
@@ -11,7 +11,7 @@
use super::egl::{EglContext, EglSurface, GlesVersion};
use super::gpu::Gpu;
use anyhow::Result;
use anyhow::{bail, Result};
use ndk::native_window::NativeWindow;
use pf_client_core::console::{OverlayAction, PointerInput, SessionPhase};
use pf_client_core::menu_nav::{MenuEvent, MenuNav, MenuPulse, MenuSample, PadInfo};
@@ -249,6 +249,13 @@ impl ConsoleHost {
}
}
/// No input for this long = the console is being looked at, not used — halve the redraw
/// rate (`IDLE_FRAME_STEP` slept between swaps). 60 s keeps every interaction and its
/// afterglow at full smoothness and only calms a genuinely parked screen.
const IDLE_AFTER: Duration = Duration::from_secs(60);
/// One extra ~vsync period per frame while idle: 60 Hz → ~30, 120 Hz → ~40.
const IDLE_FRAME_STEP: Duration = Duration::from_millis(16);
/// The render thread. Owns EGL + Skia + the console; runs until `Cmd::Quit`.
fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotStore>) -> Result<()> {
let egl = EglContext::new()?;
@@ -267,6 +274,15 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
let mut was_editing = console.editing();
let mut saved_gen = store.saved_gen();
let mut menu_out: Vec<MenuEvent> = Vec::new();
// When the last input arrived — the idle throttle's clock (see the draw site below).
let mut last_input = Instant::now();
// Consecutive GL setup failures (window surface / Skia wrap). One is a transient (a window
// torn down mid-create); a run of them is a context that is not coming back — most likely
// reclaimed by Android while the app was backgrounded. Only exiting reports that: each
// failure alone is logged, the loop retries, and the screen stays a gray never-painted
// SurfaceView forever. Dying raises `Dead`, and Kotlin answers with the touch UI.
let mut gl_failures = 0u32;
const GL_FAILURE_LIMIT: u32 = 3;
loop {
// Take everything queued. With no surface up, block until something arrives.
@@ -297,21 +313,28 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
return Ok(());
}
Cmd::Menu(ev) => {
last_input = Instant::now();
if let Some(p) = console.menu(ev) {
shared.emit(HostEvent::Pulse(p));
}
}
Cmd::PadSample(s) => {
last_input = Instant::now();
sample = s;
poll_now = true;
}
Cmd::Pointer(p) => {
last_input = Instant::now();
console.pointer(p);
}
Cmd::Key { key, shift, repeat } => {
last_input = Instant::now();
console.key(key, shift, repeat);
}
Cmd::Text(t) => console.text(&t),
Cmd::Text(t) => {
last_input = Instant::now();
console.text(&t);
}
Cmd::Phase(ph) => {
match &ph {
Phase::Connecting => console.session_phase(SessionPhase::Connecting),
@@ -347,11 +370,15 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
}
surface = Some(s);
window = Some(w);
gl_failures = 0;
// A fresh surface is a fresh entry: snapshot the pad so a button
// still held from before does not fire into the first frame.
nav.reset();
}
Err(e) => log::error!("console: window surface: {e:#}"),
Err(e) => {
log::error!("console: window surface: {e:#}");
gl_failures += 1;
}
}
}
Cmd::SurfaceChanged => {
@@ -402,6 +429,13 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
}
// Draw, if there is somewhere to draw.
// ponytail: half-rate after 60 s without input — one extra frame period between
// swaps, so an idle carousel stops redrawing a phone's panel at its full rate
// (the aurora still breathes, at half tempo). Any input restores full rate on
// its own frame; damage-driven rendering if a TV box ever needs more.
if last_input.elapsed() >= IDLE_AFTER {
std::thread::sleep(IDLE_FRAME_STEP);
}
if let (Some(s), Some(g)) = (surface.as_mut(), gpu.as_mut()) {
let (w, h) = (s.width, s.height);
let need_wrap = match &skia {
@@ -411,8 +445,14 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
if need_wrap {
skia = None;
match g.wrap_window(&egl, w, h) {
Ok(surf) => skia = Some((surf, w, h)),
Err(e) => log::error!("console: {e:#}"),
Ok(surf) => {
skia = Some((surf, w, h));
gl_failures = 0;
}
Err(e) => {
log::error!("console: {e:#}");
gl_failures += 1;
}
}
}
if let Some((surf, _, _)) = skia.as_mut() {
@@ -441,6 +481,16 @@ fn render_loop(mut console: Console, shared: Arc<Shared>, store: Arc<SnapshotSto
}
}
if gl_failures >= GL_FAILURE_LIMIT {
// Same release order as `Cmd::Quit`: the Skia surface, the current binding, then (on
// return) the EGL surface + window + context drop.
drop(skia.take());
if surface.is_some() {
egl.release_current();
}
bail!("GL surface failed {gl_failures} times in a row — giving the screen back");
}
// Publish what the console raised.
while let Some(a) = console.take_action() {
shared.emit(HostEvent::Action(a));
+29 -4
View File
@@ -45,6 +45,10 @@ struct CreateOptions {
device_name: String,
/// Skia's resource budget, bytes (Kotlin sizes it from `ActivityManager.memoryClass`).
gpu_cache_bytes: usize,
/// Whether the touch shell exists as a fallback (phones/tablets; false on a TV) —
/// gates the console-off settings row. Default false: absent means don't offer it.
#[serde(default)]
fallback_ui: bool,
/// The settings snapshot the shell starts from (`pf_client_core::trust::Settings` JSON).
settings: pf_client_core::trust::Settings,
/// The profile catalog as `[[id, name], …]`.
@@ -83,6 +87,13 @@ struct PadJson {
steam_virtual: bool,
#[serde(default)]
battery: Option<BatteryJson>,
/// `VID:PID · gamepad · dpad` — what the controllers screen prints under the name.
#[serde(default)]
detail: String,
#[serde(default)]
forwarded: bool,
#[serde(default)]
rumble: bool,
}
#[derive(serde::Deserialize)]
@@ -143,6 +154,7 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsoleCrea
let console_opts = ConsoleOptions {
device_name: opts.device_name,
deck: false,
fallback_ui: opts.fallback_ui,
store: Some(store.clone()),
platform: Platform::Android,
gpu_cache_bytes: opts.gpu_cache_bytes.max(16 << 20),
@@ -316,8 +328,9 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsoleMenu
}
/// `NativeBridge.nativeConsolePointer(handle, kind, x, y, dy)` — touch/mouse in surface pixels:
/// kind 0 move, 1 primary down, 2 primary up, 3 secondary down (= Back), 4 wheel (`dy` steps,
/// + = up), 5 cancel.
/// kind 0 move, 1 primary down (a mouse — acts immediately), 2 primary up, 3 secondary down
/// (= Back), 4 wheel (`dy` steps, + = up), 5 cancel, 6 primary down from a finger/stylus on
/// the glass — the shell defers it so a swipe scrolls instead of acting on contact.
#[unsafe(no_mangle)]
pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsolePointer(
_env: EnvUnowned,
@@ -334,6 +347,7 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsolePoin
x,
y,
button: PointerButton::Primary,
touch: false,
},
2 => PointerInput::Up {
x,
@@ -344,9 +358,16 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsolePoin
x,
y,
button: PointerButton::Secondary,
touch: false,
},
4 => PointerInput::Wheel { x, y, dy },
5 => PointerInput::Cancel,
6 => PointerInput::Down {
x,
y,
button: PointerButton::Primary,
touch: true,
},
_ => return,
};
if let Some(h) = host(handle) {
@@ -454,8 +475,9 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsoleNavi
}
/// `NativeBridge.nativeConsoleSetPads(handle, padsJson)` — the connected controllers for the
/// chip + settings rows: `{"label": "DualSense", "pref": 1, "pads": [{name, key, pref,
/// steam_virtual, battery: {percent, charging} | null}]}`.
/// chip, the settings rows and the controllers screen: `{"label": "DualSense", "pref": 1,
/// "pads": [{name, key, pref, steam_virtual, battery: {percent, charging} | null, detail,
/// forwarded, rumble}]}`.
#[unsafe(no_mangle)]
pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsoleSetPads(
mut env: EnvUnowned,
@@ -479,6 +501,9 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConsoleSetP
percent: b.percent.min(100),
charging: b.charging,
}),
detail: j.detail,
forwarded: j.forwarded,
rumble: j.rumble,
})
.collect();
h.shared.send(Cmd::Pads {
@@ -115,7 +115,7 @@ pub(super) struct AscBackend {
/// Fixed for the session; the mode table is authoritative for the panel's fastest refresh.
panel_seed_ns: i64,
last_latch_ns: i64,
/// HDR `ADataSpace` for the transaction (`0` = SDR / leave default).
/// `ADataSpace` for the transaction (BT709 for SDR — never untagged; see `color_dataspace`).
dataspace: i32,
/// Layer frame-rate vote (source Hz), applied once.
frame_rate: f32,
@@ -142,21 +142,21 @@ pub(super) struct AscBackend {
impl AscBackend {
/// Create the reader + compositor layer, or `None` on API < 29 / init failure (the caller then
/// runs the SurfaceView presenter). `window` is the SurfaceView's `ANativeWindow`; `src_w/h` the
/// negotiated decode size; `panel_hz` the mode-table panel rate (seeds the learner);
/// `dataspace` the HDR `ADataSpace` (`0` = SDR); `source_hz` the negotiated stream rate.
/// negotiated decode size; `surface_size` the LIVE view size the layer composites into;
/// `panel_hz` the mode-table panel rate (seeds the learner);
/// `dataspace` the `ADataSpace` from the negotiated colour; `source_hz` the negotiated stream rate.
#[allow(clippy::too_many_arguments)]
pub(super) fn create(
window: &NativeWindow,
src_w: i32,
src_h: i32,
surface_w: i32,
surface_h: i32,
surface_size: std::sync::Arc<std::sync::atomic::AtomicU64>,
panel_hz: i32,
dataspace: i32,
source_hz: u32,
priority: PresentPriority,
) -> Option<AscBackend> {
let layer = Layer::create(window, surface_w, surface_h)?;
let layer = Layer::create(window, surface_size)?;
let usage = ndk::hardware_buffer::HardwareBufferUsage::GPU_SAMPLED_IMAGE
| ndk::hardware_buffer::HardwareBufferUsage::COMPOSER_OVERLAY;
let reader = match ImageReader::new_with_usage(
@@ -571,9 +571,9 @@ impl AscBackend {
}
impl AscBackend {
/// Update the HDR `ADataSpace` applied to every subsequent transaction (from the codec's
/// output format once it is known — the analogue of the SurfaceView path's
/// `apply_hdr_dataspace`). `0` leaves the surface SDR.
/// Update the `ADataSpace` applied to every subsequent transaction (a refinement from the
/// codec's output format — the analogue of the SurfaceView path's `apply_hdr_dataspace`; the
/// negotiated colour set the initial value at create).
pub(super) fn set_dataspace(&mut self, dataspace: i32) {
if self.dataspace != dataspace {
self.dataspace = dataspace;
+13 -12
View File
@@ -15,8 +15,8 @@ use std::time::{Duration, Instant};
use super::asc_presenter::{asc_backend_selected, AscBackend};
use super::display::{
apply_hdr_dataspace, hdr_dataspace, install_render_callback, release_render_callback,
DisplayTracker,
apply_hdr_dataspace, color_dataspace, hdr_dataspace, install_render_callback,
release_render_callback, DisplayTracker,
};
use super::latency::{note_decoded_pts, now_realtime_ns, take_flags, take_stamp};
use super::presenter::{presenter_disabled_by_sysprop, PresentMeter, PresentPriority, Presenter};
@@ -96,8 +96,7 @@ pub(super) fn run_async(
present_priority,
smooth_buffer,
panel_hz,
surface_w,
surface_h,
surface_size,
} = opts;
boost_thread_priority();
let mode = client.mode();
@@ -192,17 +191,14 @@ pub(super) fn run_async(
// below is the fallback for API < 29, an ASC init failure, or the `present_backend=surfaceview`
// sysprop. A non-null `asc` means the codec renders into the reader, not the SurfaceView window.
let mut asc = if asc_backend_selected() {
let initial_ds = if client.color.is_hdr() {
i32::from(ndk::data_space::DataSpace::Bt2020ItuPq)
} else {
0
};
// The negotiated colour is authoritative (PQ vs HLG, range) — not a guess the codec's
// output format later corrects; many decoders never echo `color-transfer` at all.
let initial_ds = color_dataspace(&client.color);
AscBackend::create(
&window,
mode.width as i32,
mode.height as i32,
surface_w,
surface_h,
surface_size,
panel_hz,
initial_ds,
mode.refresh_hz,
@@ -449,7 +445,12 @@ pub(super) fn run_async(
if fmt_dirty {
if let Some(a) = asc.as_mut() {
// ASC carries the HDR signal on the transaction, not the SurfaceView window.
a.set_dataspace(hdr_dataspace(&codec).map_or(0, i32::from));
// Refine only when the codec actually reports an HDR transfer — a `None` echo
// (decoders commonly omit `color-transfer`) must not clobber the negotiated
// dataspace back to SDR before the first present.
if let Some(ds) = hdr_dataspace(&codec) {
a.set_dataspace(i32::from(ds));
}
} else {
apply_hdr_dataspace(&codec, &window, &mut applied_ds);
}
@@ -274,3 +274,26 @@ pub(super) fn hdr_dataspace(codec: &MediaCodec) -> Option<DataSpace> {
_ => None, // SDR (BT.709 / SDR_VIDEO) or unspecified
}
}
/// Map the *negotiated* session colour ([`ColorInfo`], carried on Welcome) to the `ADataSpace`
/// the presenter should tag buffers with. This is the authoritative source — the wire contract
/// says clients configure the presenter from these code points, not from what the decoder happens
/// to echo back (many decoders omit `color-transfer` from the output format).
///
/// SDR maps to `BT709` (limited-range video), never `0`/untagged: an untagged buffer on an
/// ASurfaceControl transaction leaves SurfaceFlinger to guess, and a full-range guess shows
/// limited-range black (16) as gray — the elevated-blacks bug.
// ponytail: full-range SDR would need hand-composed dataspace bits (no named constant); the host
// only encodes limited-range SDR today (ColorInfo::SDR_BT709), so BT709 covers every SDR session.
pub(super) fn color_dataspace(color: &punktfunk_core::quic::ColorInfo) -> i32 {
use punktfunk_core::quic::ColorInfo;
let full = color.full_range != 0;
let ds = match color.transfer {
ColorInfo::TRC_PQ if full => DataSpace::Bt2020Pq,
ColorInfo::TRC_PQ => DataSpace::Bt2020ItuPq,
ColorInfo::TRC_HLG if full => DataSpace::Bt2020Hlg,
ColorInfo::TRC_HLG => DataSpace::Bt2020ItuHlg,
_ => DataSpace::Bt709, // SDR — limited-range BT.709 video
};
i32::from(ds)
}
+14 -7
View File
@@ -91,7 +91,14 @@ const NO_VIDEO_PATIENCE: std::time::Duration = std::time::Duration::from_millis(
/// Re-ask cadence once [`NO_VIDEO_PATIENCE`] has elapsed with still nothing received. Slow, because
/// this state is either self-healing on the first ask or not ours to heal — and each pass logs.
const NO_VIDEO_RETRY: std::time::Duration = std::time::Duration::from_millis(2000);
///
/// ⚠ Taken from core, NOT a local number. `FLUSH_COOLDOWN` (the jump-to-live rate limit) is 2000 ms,
/// and the host classifies a keyframe-recovery cadence by matching a cooldown's period ±10 % to
/// decide WHICH client failure it is looking at. The two are opposites — "I have received nothing"
/// versus "I am drowning in frames I cannot drain" — so while this was also 2000 ms the host
/// confidently reported the wrong one, and a black-screen field case was diagnosed as a slow decoder
/// for days (2026-08-20). Keeping the value in core is what stops the two drifting back together.
const NO_VIDEO_RETRY: std::time::Duration = punktfunk_core::client::NO_VIDEO_RETRY;
/// Whether low-latency mode uses the event-driven async decode loop (default) or the synchronous
/// poll loop. Flip to `false` to A/B the two on the HUD (`design/…`); the async loop presents a
@@ -133,12 +140,12 @@ pub(crate) struct DecodeOptions {
/// named here is not necessarily the one the panel ends up in. The measured timeline spacing
/// corrects it in both directions ([`punktfunk_core::phase::PanelGrid`]).
pub panel_hz: i32,
/// The video `SurfaceView`'s on-screen pixel size (the aspect-fitted display footprint), from
/// Kotlin at `surfaceCreated`. The ASurfaceControl backend composites its layer in this
/// coordinate space — NOT the window's buffer geometry, which is rotated/scaled. `0` = Kotlin
/// couldn't read it yet, and the backend falls back to the window buffer size.
pub surface_w: i32,
pub surface_h: i32,
/// The video `SurfaceView`'s LIVE on-screen pixel size (the aspect-fitted display footprint),
/// packed by [`crate::session::pack_surface_size`] and re-reported by Kotlin on every
/// `surfaceChanged`. The ASurfaceControl backend composites its layer in this coordinate space
/// — NOT the window's buffer geometry, which is rotated/scaled. `0` = Kotlin couldn't read it
/// yet, and the backend falls back to the window buffer size.
pub surface_size: std::sync::Arc<std::sync::atomic::AtomicU64>,
}
/// The decode entry point on the `pf-decode` thread: dispatches to the async or synchronous loop.
@@ -24,6 +24,7 @@ use ndk::hardware_buffer::HardwareBuffer;
use ndk::native_window::NativeWindow;
use std::ffi::c_void;
use std::os::fd::{FromRawFd, OwnedFd, RawFd};
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{mpsc, Arc};
use super::async_loop::DecodeEvent;
@@ -276,9 +277,14 @@ unsafe extern "C" fn on_complete(context: *mut c_void, stats: *mut ASurfaceTrans
pub(super) struct Layer {
api: Api,
sc: Arc<ScHandle>,
/// Destination rectangle (the SurfaceView's pixel size) — the buffer is scaled to fill it.
dest_w: i32,
dest_h: i32,
/// The SurfaceView's LIVE pixel size, packed by `pack_surface_size` and re-read before every
/// present — the destination rectangle the buffer is scaled to fill. Live rather than captured
/// because the view resizes under a surface that is never recreated (see `dest`).
surface_size: Arc<AtomicU64>,
/// Fallback destination for as long as `surface_size` is still `0` (Kotlin hadn't measured the
/// view when video started): the window's own buffer geometry, the best remaining guess.
fallback_w: i32,
fallback_h: i32,
/// `true` once the first transaction has made the layer visible + set its z-order + frame rate.
configured: bool,
}
@@ -287,13 +293,16 @@ impl Layer {
/// Create the compositor layer over `window` (the SurfaceView's `ANativeWindow`), or `None` on
/// API < 29 / a null layer — the caller then uses the SurfaceView presenter.
///
/// `dest_w/h` are the SurfaceView's **on-screen pixel size** — the coordinate space the child
/// layer is composited into, which is the display footprint of the (aspect-fitted) video view,
/// NOT the window's buffer size. `ANativeWindow_getWidth/Height` return the buffer geometry in a
/// rotated/scaled space (observed 1260×567 for a 2800×1260 full-bleed stream) — using it shrank
/// the picture to the top-left corner. A non-positive `dest_w/h` (Kotlin couldn't read the view
/// yet) falls back to that buffer size as the best remaining guess.
pub(super) fn create(window: &NativeWindow, dest_w: i32, dest_h: i32) -> Option<Layer> {
/// `surface_size` carries the SurfaceView's **on-screen pixel size** — the coordinate space the
/// child layer is composited into, which is the display footprint of the (aspect-fitted) video
/// view, NOT the window's buffer size. `ANativeWindow_getWidth/Height` return the buffer
/// geometry in a rotated/scaled space (observed 1260×567 for a 2800×1260 full-bleed stream) —
/// using it shrank the picture to the top-left corner. It is read fresh on every present
/// because that view RESIZES mid-stream under a surface that is never recreated: the stream
/// screen hides the system bars and switches on cutout drawing a frame or two after
/// `surfaceCreated`, and each one grows it. An empty `surface_size` (Kotlin hadn't measured the
/// view yet) falls back to the buffer size as the best remaining guess.
pub(super) fn create(window: &NativeWindow, surface_size: Arc<AtomicU64>) -> Option<Layer> {
let api = Api::resolve()?;
// SAFETY: `window.ptr()` is the live `ANativeWindow` the decode thread owns; the name is a
// static NUL-terminated string; the call returns null on failure (checked).
@@ -303,20 +312,11 @@ impl Layer {
log::warn!("asc: createFromWindow returned null — falling back to SurfaceView");
return None;
}
let dest_w = if dest_w > 0 {
dest_w
} else {
window.width().max(1)
};
let dest_h = if dest_h > 0 {
dest_h
} else {
window.height().max(1)
};
let fallback_w = window.width().max(1);
let fallback_h = window.height().max(1);
log::info!(
"asc: layer created, dest {dest_w}x{dest_h} (window buffer {}x{})",
window.width(),
window.height(),
"asc: layer created, dest {:?} (window buffer {fallback_w}x{fallback_h})",
crate::session::unpack_surface_size(surface_size.load(Ordering::Relaxed)),
);
Some(Layer {
sc: Arc::new(ScHandle {
@@ -324,16 +324,25 @@ impl Layer {
release: api.ac_release,
}),
api,
dest_w,
dest_h,
surface_size,
fallback_w,
fallback_h,
configured: false,
})
}
/// The destination rectangle for this present: the live view size, or the window's buffer
/// geometry while Kotlin has reported nothing.
fn dest(&self) -> (i32, i32) {
crate::session::unpack_surface_size(self.surface_size.load(Ordering::Relaxed))
.unwrap_or((self.fallback_w, self.fallback_h))
}
/// Present one decoded buffer at `desired_present_ns` (`CLOCK_MONOTONIC`; `0` = ASAP). Consumes
/// `acquire_fence` (ownership passes to SurfaceFlinger via `setBuffer`). Registers a one-shot
/// completion that reports the real latch + the previous buffer's release fence on `ev_tx`,
/// tagged with `seq`. `dataspace` is the HDR `ADataSpace` value (`0` = leave default/SDR).
/// tagged with `seq`. `dataspace` is the `ADataSpace` value (`0` = leave the layer default
/// only the `setBufferDataSpace`-less API-29 fallback ever presents untagged).
/// `frame_rate` votes the layer's rate once (`0.0` skips). Returns `false` if the transaction
/// could not be created (the caller then frees the buffer itself).
#[allow(clippy::too_many_arguments)]
@@ -369,11 +378,12 @@ impl Layer {
right: src_w.max(1),
bottom: src_h.max(1),
};
let (dest_w, dest_h) = self.dest();
let dst = ARect {
left: 0,
top: 0,
right: self.dest_w,
bottom: self.dest_h,
right: dest_w,
bottom: dest_h,
};
(self.api.txn_set_geometry)(txn, sc, &src, &dst, TRANSFORM_IDENTITY);
if dataspace != 0 {
@@ -50,8 +50,7 @@ pub(super) fn run_sync(
panel_hz: _,
// The ASurfaceControl backend is async-loop only; the sync loop renders straight to the
// SurfaceView, so it never needs the view's on-screen size.
surface_w: _,
surface_h: _,
surface_size: _,
} = opts;
boost_thread_priority();
let mode = client.mode();
+45 -6
View File
@@ -34,6 +34,9 @@ mod audio;
// shell over EGL/GLES, on every ABI (the armv7 Skia archive is self-hosted — see Cargo.toml).
#[cfg(target_os = "android")]
mod console;
// "Send logs to host": the log-ring upload (`pf-client-core` is Android-target-only here).
#[cfg(target_os = "android")]
mod logs;
// The RESOLVED audio format + its ms ⇄ sample arithmetic, split out of `audio` and — unlike it —
// ungated, because that arithmetic is what a rate the ladder does not divide gets wrong (44 100 Hz
// used to come out 2.3 % off in every direction at once) and it must be provable without a phone.
@@ -60,22 +63,58 @@ mod wol;
// it off the main thread to light saved-host "online" pips independently of mDNS.
mod probe;
/// Initialize `android_logger` once when the JVM loads the library. Logs land in logcat under the
/// `punktfunk` tag. Core `tracing` events (transport warnings: socket-buffer clamp, QoS failures)
/// arrive here too: tracing's "log" feature — declared explicitly in Cargo.toml rather than relied
/// on via quinn's defaults — forwards them as `log` records since no tracing subscriber is ever
/// installed. Android-only — there is no JVM (and no logcat) on the host build.
/// Every `log` record, teed: to logcat (via [`android_logger::AndroidLogger`]) AND into
/// `pf_client_core::logring` — the source for the console's "Send logs to host" action
/// ([`logs`]). The ring line mirrors the desktop `ring_layer`'s shape (wallclock, level,
/// target, message) so a bundle reads the same on the host's Logs page whichever client
/// sent it. Both sinks share the crate's Info ceiling — the field ring gets exactly what
/// logcat gets, which also keeps per-frame DEBUG chatter out of it by construction.
#[cfg(target_os = "android")]
struct RingTee(android_logger::AndroidLogger);
#[cfg(target_os = "android")]
impl log::Log for RingTee {
fn enabled(&self, metadata: &log::Metadata) -> bool {
self.0.enabled(metadata)
}
fn log(&self, record: &log::Record) {
self.0.log(record);
pf_client_core::logring::note(format!(
"{} {:5} {} {}",
pf_client_core::logring::wallclock(),
record.level().as_str(),
record.target(),
record.args()
));
}
fn flush(&self) {
self.0.flush();
}
}
/// Initialize logging once when the JVM loads the library: logcat under the `punktfunk` tag,
/// teed into the client log ring (see [`RingTee`]). Core `tracing` events (transport warnings:
/// socket-buffer clamp, QoS failures) arrive here too: tracing's "log" feature — declared
/// explicitly in Cargo.toml rather than relied on via quinn's defaults — forwards them as
/// `log` records since no tracing subscriber is ever installed. Android-only — there is no
/// JVM (and no logcat) on the host build.
#[cfg(target_os = "android")]
#[unsafe(no_mangle)]
pub extern "system" fn JNI_OnLoad(
_vm: *mut jni::sys::JavaVM,
_reserved: *mut std::ffi::c_void,
) -> jint {
android_logger::init_once(
let logcat = android_logger::AndroidLogger::new(
android_logger::Config::default()
.with_max_level(log::LevelFilter::Info)
.with_tag("punktfunk"),
);
// `set_boxed_logger` (unlike `init_once`) does not set the max level itself.
if log::set_boxed_logger(Box::new(RingTee(logcat))).is_ok() {
log::set_max_level(log::LevelFilter::Info);
}
log::info!(
"punktfunk_android loaded (core ABI v{})",
punktfunk_core::ABI_VERSION
+27
View File
@@ -0,0 +1,27 @@
//! JNI seam for "Send logs to host": hand Kotlin the client's recent log ring (fed by the
//! [`crate::RingTee`] logcat tee) rendered as one text bundle. The UPLOAD stays on the
//! Kotlin side — its mTLS OkHttp client (`mtlsHttpClient`, the library/art path) already
//! owns HTTPS-to-the-pinned-host on this platform, and `logring::send_to_host`'s ureq
//! agent is deliberately desktop-only. Android-gated (unlike [`crate::wol`]/[`crate::probe`])
//! because `pf-client-core` is an Android-target dependency of this crate.
use jni::errors::LogErrorAndDefault;
use jni::objects::{JObject, JString};
use jni::EnvUnowned;
/// `NativeBridge.nativeRenderLogs(header): String` — the ring as one text bundle, oldest
/// first, prefixed by `header` (the Kotlin side's identity line) and an eviction note when
/// the ring wrapped. Never empty (the header line is always present); cheap enough for any
/// thread, though the caller is about to do network anyway.
#[unsafe(no_mangle)]
pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeRenderLogs<'local>(
mut env: EnvUnowned<'local>,
_this: JObject<'local>,
header: JString<'local>,
) -> JString<'local> {
env.with_env(|env| {
let header: String = header.try_to_string(env)?;
env.new_string(pf_client_core::logring::render(&header))
})
.resolve::<LogErrorAndDefault>()
}
@@ -451,6 +451,10 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConnect<'lo
// Handshake budget from Kotlin: ~10 s for a normal connect, ~185 s for "request access"
// (the host parks the connection until the operator approves the device — see ConnectScreen).
Duration::from_millis(timeout_ms.max(0) as u64),
// The Kotlin side cancels by dropping the result (`Dial.cancelled`), not by aborting
// the dial — its connect runs on a pool thread, so a parked one costs a thread, not a
// stuck UI. Wire a flag through here if that ever stops being true.
None,
) {
Ok(client) => {
let handle = SessionHandle {
@@ -466,6 +470,8 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeConnect<'lo
// A fresh session is never muted (mute is per-session UI state, not a setting).
mic_muted: Arc::new(std::sync::atomic::AtomicBool::new(false)),
access_seq: std::sync::atomic::AtomicU32::new(0),
// Reported by Kotlin at `surfaceCreated` and on every resize after it.
surface_size: Arc::new(std::sync::atomic::AtomicU64::new(0)),
};
Box::into_raw(Box::new(handle)) as jlong
}
+58 -1
View File
@@ -26,7 +26,7 @@ mod probe;
use punktfunk_core::client::NativeClient;
use std::panic::AssertUnwindSafe;
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU64, Ordering};
use std::sync::{Arc, Mutex};
use std::thread::JoinHandle;
@@ -87,6 +87,37 @@ pub(crate) struct SessionHandle {
/// `nativeAccessState` poll ([`access`]) — how the Kotlin poller tells a fresh update
/// (the host's expiry warnings) arrived without holding a blocking event thread.
pub(crate) access_seq: AtomicU32,
/// The video `SurfaceView`'s LIVE on-screen pixel size ([`pack_surface_size`]), written by
/// `nativeStartVideo` and by every `nativeVideoSurfaceSize` the `surfaceChanged` callback
/// sends, read by the ASurfaceControl presenter before each present.
///
/// Shared and live rather than a start-time parameter because the view RESIZES under a surface
/// that is never recreated: hiding the system bars and switching the window to
/// `LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS` both happen a frame or two AFTER `surfaceCreated`,
/// and each one grows the video view. A destination rect captured once at creation then keeps
/// compositing the picture at its old, smaller size anchored at the layer's origin — the
/// "stream in the top-left corner" field report. `0` = nothing reported yet, and the layer
/// falls back to the window's buffer geometry.
pub surface_size: Arc<AtomicU64>,
}
/// Pack a surface's pixel size into one `u64` — so the presenter reads width and height as a
/// single atomic load and can never see a torn pair (a new width against an old height).
/// Non-positive values pack as `0`, the "not reported yet" sentinel.
pub(crate) fn pack_surface_size(w: i32, h: i32) -> u64 {
if w <= 0 || h <= 0 {
return 0;
}
((w as u64) << 32) | (h as u64 & 0xffff_ffff)
}
/// The inverse of [`pack_surface_size`]: `None` for the `0` sentinel.
#[cfg_attr(not(target_os = "android"), allow(dead_code))]
pub(crate) fn unpack_surface_size(packed: u64) -> Option<(i32, i32)> {
if packed == 0 {
return None;
}
Some((((packed >> 32) as u32) as i32, (packed as u32) as i32))
}
struct VideoThread {
@@ -160,3 +191,29 @@ fn parse_hex32(s: &str) -> Option<[u8; 32]> {
}
Some(out)
}
#[cfg(test)]
mod tests {
use super::{pack_surface_size, unpack_surface_size};
/// The pair the presenter reads as one atomic load must survive the round trip — including a
/// size wider than a signed 16-bit value, which every panel this runs on now is.
#[test]
fn surface_size_round_trips() {
assert_eq!(
unpack_surface_size(pack_surface_size(2800, 1260)),
Some((2800, 1260))
);
assert_eq!(unpack_surface_size(pack_surface_size(1, 1)), Some((1, 1)));
}
/// "Not reported yet" — and anything nonsensical — is the one sentinel, so the layer falls back
/// to the window's buffer geometry rather than composing into an empty rectangle.
#[test]
fn non_positive_sizes_are_the_sentinel() {
assert_eq!(pack_surface_size(0, 0), 0);
assert_eq!(pack_surface_size(1920, 0), 0);
assert_eq!(pack_surface_size(-1, 1080), 0);
assert_eq!(unpack_surface_size(0), None);
}
}
+39 -2
View File
@@ -72,6 +72,13 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeStartVideo(
let client = h.client.clone();
let sd = shutdown.clone();
let st = h.stats.clone(); // session-lifetime stats (gate survives surface recreate)
// Seed the live view size with what the view measures right now; `surfaceChanged` keeps it
// current from here on (the bars hide and the cutout mode changes AFTER this call).
h.surface_size.store(
super::pack_surface_size(surface_w, surface_h),
std::sync::atomic::Ordering::Relaxed,
);
let opts = crate::decode::DecodeOptions {
decoder_name: decoder,
ll_feature,
@@ -80,8 +87,7 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeStartVideo(
present_priority,
smooth_buffer,
panel_hz: panel_fps,
surface_w,
surface_h,
surface_size: h.surface_size.clone(),
};
let join = std::thread::Builder::new()
.name("pf-decode".into())
@@ -93,6 +99,37 @@ pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeStartVideo(
.resolve::<LogErrorAndDefault>()
}
/// `NativeBridge.nativeVideoSurfaceSize(handle, width, height)` — the video `SurfaceView`'s
/// on-screen pixel size, re-reported on every `surfaceChanged`.
///
/// The ASurfaceControl presenter composites its child layer into exactly this rectangle, and the
/// view resizes UNDER a surface that is never recreated: the stream screen hides the system bars
/// and asks to draw into the display cutout a frame or two after `surfaceCreated`, both of which
/// grow it. Without this the layer would keep painting the picture at its start-up size, in the
/// corner of a bigger surface. Non-positive values are ignored (they'd blank the picture).
/// No-op on a `0` handle. Stored whether or not video is running — the next `nativeStartVideo`
/// then starts from a measured view rather than the window's guess. Not android-gated: pure `jni`
/// + an atomic store, so it links on the host build too.
#[unsafe(no_mangle)]
pub extern "system" fn Java_io_unom_punktfunk_kit_NativeBridge_nativeVideoSurfaceSize(
_env: EnvUnowned,
_this: JObject,
handle: jlong,
width: jni::sys::jint,
height: jni::sys::jint,
) {
jni_guard((), || {
let packed = super::pack_surface_size(width, height);
if handle == 0 || packed == 0 {
return;
}
// SAFETY: live handle per the nativeConnect/nativeClose contract.
let h = unsafe { &*(handle as *const SessionHandle) };
h.surface_size
.store(packed, std::sync::atomic::Ordering::Relaxed);
})
}
/// `NativeBridge.nativeVideoMime(handle): String` — the MediaCodec MIME for the codec the host
/// resolved (`"video/hevc"` / `"video/avc"` / `"video/av01"`), so Kotlin can rank `MediaCodecList`
/// decoders for it before calling [`Java_io_unom_punktfunk_kit_NativeBridge_nativeStartVideo`].
+4
View File
@@ -31,6 +31,10 @@ Opus audio, cert pinning — lives in the shared Rust **`punktfunk-core`** (stat
Keychain-stored identity.
- **Tune the stream** — a fps / Mb·s / **latency** HUD (skew-corrected across machines), a bitrate
control, a per-host **network speed test** with a recommended bitrate, and a host-compositor picker.
- **Send logs to host** — the app keeps its recent log in a bounded in-memory ring (`ClientLog`, a
drop-in for `os.Logger` that also writes the unified log); a host card's menu (or the gamepad
UI's host options) posts it to the paired host's `/api/v1/client-logs`, where the web console's
Logs page shows it next to the host's own — the same action the Gaming Mode console has.
Runs from one shared codebase across **macOS, iOS, iPadOS, and tvOS**.
@@ -654,6 +654,7 @@ struct GamepadHomeView: View {
guard let profile = target.profile else { return }
store.setPinned(host.id, profileID: profile.id, pinned: false)
},
onSendLogs: host.pinnedSHA256 != nil ? { await SendLogs.toHost(host) } : nil,
close: { if !transitioning { hostOptionsTarget = nil } },
controllerActive: active)
}
@@ -64,6 +64,9 @@ struct GamepadHostOptionsView: View {
/// Delete the saved record outright.
let onRemove: () -> Void
let onUnpin: () -> Void
/// Upload this device's recent log to the host; answers with what to tell the user. nil on an
/// unpaired host the upload rides the pairing, so there is nothing to offer before it.
var onSendLogs: (() async -> (ok: Bool, message: String))?
var close: (() -> Void)?
var controllerActive = true
@@ -81,13 +84,21 @@ struct GamepadHostOptionsView: View {
/// strict as it is, and none at all to be looser.
@State private var armed = false
@State private var copied = false
/// The send-logs row's own state: its label and the detail band report the outcome in place,
/// the same way Copy link says "Copied" this surface has no toast.
@State private var sendLogs: SendLogsState = .idle
@State private var focusID: String?
private enum SendLogsState: Equatable {
case idle, sending, done(ok: Bool, message: String)
}
private enum Action: String {
case wake
case copyLink
case edit
case forgetPairing
case sendLogs
case remove
case unpin
case cancel
@@ -195,6 +206,15 @@ struct GamepadHostOptionsView: View {
}
list.append(Row(action: .copyLink, label: copied ? "Copied" : "Copy link", icon: "link"))
list.append(Row(action: .edit, label: "Edit\u{2026}", icon: "pencil"))
if onSendLogs != nil {
let label: String
switch sendLogs {
case .idle: label = "Send logs to host"
case .sending: label = "Sending logs\u{2026}"
case .done(let ok, _): label = ok ? "Logs sent" : "Couldn't send logs"
}
list.append(Row(action: .sendLogs, label: label, icon: "doc.text"))
}
// Only a paired host has a pairing to drop.
if host.pinnedSHA256 != nil {
list.append(Row(
@@ -221,6 +241,9 @@ struct GamepadHostOptionsView: View {
case .forgetPairing:
return "Drop the stored fingerprint. The host stays saved and the next connect "
+ "pairs again."
case .sendLogs:
if case .done(_, let message) = sendLogs { return message }
return "Upload this device's recent log to the host, for its web console's Logs page."
case .remove:
return armed
? "Press again to remove — this cannot be undone."
@@ -263,6 +286,15 @@ struct GamepadHostOptionsView: View {
case .forgetPairing:
onForgetPairing()
performClose()
case .sendLogs:
guard let onSendLogs, sendLogs != .sending else { return }
withAnimation(.smooth(duration: 0.2)) { sendLogs = .sending }
Task {
let outcome = await onSendLogs()
withAnimation(.smooth(duration: 0.2)) {
sendLogs = .done(ok: outcome.ok, message: outcome.message)
}
}
case .remove:
guard armed else {
withAnimation(.smooth(duration: 0.2)) { armed = true }
@@ -45,6 +45,8 @@ struct HomeView: View {
@AppStorage(DefaultsKey.libraryEnabled) private var libraryEnabled = true
/// The host being edited (name / address / port / Wake-on-LAN MAC) drives the edit sheet.
@State private var editTarget: StoredHost?
/// The outcome of the last "Send Logs to Host" drives its alert.
@State private var sendLogsResult: (ok: Bool, message: String)?
// How this device shows its own list. `.added` is the default because it is what the grid
// did before it could sort at all an update should not rearrange anyone's hosts.
@AppStorage(DefaultsKey.hostSort) private var sortRaw = HostSort.added.rawValue
@@ -194,6 +196,16 @@ struct HomeView: View {
}
#endif
}
.alert(
sendLogsResult?.ok == true ? "Logs Sent" : "Couldn't Send Logs",
isPresented: Binding(
get: { sendLogsResult != nil },
set: { if !$0 { sendLogsResult = nil } })
) {
Button("OK", role: .cancel) {}
} message: {
Text(sendLogsResult?.message ?? "")
}
#if os(macOS)
.frame(minWidth: 480, minHeight: 360)
#endif
@@ -292,6 +304,8 @@ struct HomeView: View {
onBrowseLibrary: onBrowseLibrary,
onWake: { wake(host) },
onEdit: { editTarget = host },
onSendLogs: host.pinnedSHA256 != nil
? { Task { sendLogsResult = await SendLogs.toHost(host) } } : nil,
profileMenu: profileMenu(for: host),
pinnedProfile: pinned)
}
@@ -126,19 +126,20 @@ struct HostCardView: View {
let onSpeedTest: () -> Void
let onForget: () -> Void
let onRemove: () -> Void
/// Open this host's game library. `nil` no library affordance at all when the setting is
/// off or the host is unpaired (the library plane needs the pinned identity).
/// Open this host's game library a MENU action. `nil` no library affordance at all when
/// the setting is off or the host is unpaired (the library plane needs the pinned identity).
///
/// When present this is the card's **primary** action: tapping a machine you play games on
/// should offer the games, not drop you on its desktop. Streaming the desktop is still one tap
/// away, in the menu, and remains primary for a host with no library. Field note, 2026-08-16:
/// "clicking the PC opening the library directly".
/// Never the card's primary tap: tapping a host connects to it, on every surface. Browsing is
/// one step further in, exactly where the console shell keeps it (Y on a tile).
var onBrowseLibrary: (() -> Void)? = nil
/// Send a Wake-on-LAN magic packet. Shown only when the host is offline and we have a stored
/// MAC to target (a tap-to-connect already auto-wakes; this is the explicit "just wake it").
var onWake: (() -> Void)? = nil
/// Open the edit sheet (name / address / port / Wake-on-LAN MAC).
var onEdit: (() -> Void)? = nil
/// Upload this device's recent log to the host (`SendLogs`). `nil` when the host is unpaired
/// the upload is authenticated by the pairing, so there is nothing to offer before it.
var onSendLogs: (() -> Void)? = nil
/// This card's profile affordances nil on surfaces that don't offer them.
var profileMenu: HostProfileMenu? = nil
/// Set on a PINNED card: the profile this card connects with. nil = the host's primary card,
@@ -152,13 +153,9 @@ struct HostCardView: View {
}
}
/// What tapping the card does: open the library where the host has one, else connect. The
/// menu carries whichever of the two this isn't, so neither is ever more than one press away.
private var primaryAction: () -> Void { onBrowseLibrary ?? onConnect }
var body: some View {
let m = CardMetrics.current
return Button(action: primaryAction) {
return Button(action: onConnect) {
HStack(spacing: m.spacing) {
monogramTile(monogram(host.displayName), osChain: host.osChain,
m: m, connecting: isConnecting, filled: true)
@@ -230,12 +227,11 @@ struct HostCardView: View {
// the host's default binding.
connectWithMenu(menu)
// Browsing IS a connect-shaped action it is this card's connect with a title picked
// first and it is now what TAPPING the card does, so the menu carries the other
// half instead: streaming the machine itself. (Pair / speed test / wake / forget stay
// on the host's card: those are about the machine, and a shortcut has no business
// claiming them.)
if onBrowseLibrary != nil {
Button("Stream the Desktop", systemImage: "display", action: onConnect)
// first so a pinned card offers it and opens its own shelf, whose launches carry the
// pinned profile. (Pair / speed test / wake / forget stay on the host's card: those
// are about the machine, and a shortcut has no business claiming them.)
if let onBrowseLibrary {
Button("Browse Library…", action: onBrowseLibrary)
}
if LinkClipboard.isAvailable {
Button("Copy Link") { menu.copyLink(pinned.id) }
@@ -256,11 +252,11 @@ struct HostCardView: View {
}
Button("Pair with PIN…", action: onPair)
Button("Test Network Speed…", action: onSpeedTest)
// The inverse of the card's primary tap see `onBrowseLibrary`. Absent for a host
// with no library, where connecting IS the primary tap and a menu row for it would
// just be the same action twice.
if onBrowseLibrary != nil {
Button("Stream the Desktop", systemImage: "display", action: onConnect)
if let onBrowseLibrary {
Button("Browse Library…", action: onBrowseLibrary)
}
if let onSendLogs {
Button("Send Logs to Host", action: onSendLogs)
}
if !isOnline, !host.wakeMacs.isEmpty, PunktfunkConnection.wakeOnLANAvailable, let onWake {
Button("Wake Host", systemImage: "power", action: onWake)
@@ -4,6 +4,7 @@
#if os(macOS)
import AppKit
#endif
import PunktfunkKit
import SwiftUI
@main
@@ -13,6 +14,9 @@ struct PunktfunkClientApp: App {
#endif
init() {
// Before anything touches the core, so its first lines (identity load, the first connect's
// transport setup) land in the log ring "Send logs to host" uploads.
CoreLog.install()
#if os(iOS)
// Put Geist on the navigation titles before any bar is built.
BrandTheme.apply()
@@ -19,7 +19,11 @@ import SwiftUI
/// on-screen HUD (Console.app, wirelessly on an iPad/Apple TV). The HUD is not a neutral
/// instrument: any visible overlay forces the metal layer through the compositor, which costs a
/// refresh period on the vsync-latched platforms this is how to measure with it off.
private let statsLog = Logger(subsystem: "io.unom.punktfunk", category: "stats")
private let statsLog = ClientLog(category: "stats")
/// The session's lifecycle connect asked/landed/refused, how it ended. Until this existed a
/// client log bundle had a 1 Hz stats line and no sentence saying which host it was streaming
/// from, with what, or why it stopped; the host's own log has always said all three.
private let sessionLog = ClientLog(category: "session")
/// Mirror the 1 Hz vitals line to STDOUT as well as the unified log.
///
/// Exists for **tvOS, where the unified log is unreachable**: `log stream --device` is gone from
@@ -448,6 +452,11 @@ final class SessionModel: ObservableObject {
// default (PUNKTFUNK_444, default on), so this toggle is the one real switch; the
// hardware-decode probe below still gates what can actually be advertised.
let want444 = effective.enable444
let connectLine = "connect \(host.displayName) \(host.address):\(host.port) "
+ "mode=\(width)x\(height)@\(hz) codec=\(effective.codec) bitrate=\(bitrateKbps)kbps "
+ "hdr=\(hdrCapable) 444=\(want444) audio=\(audioChannels)ch/\(audioRateHz)Hz/\(audioBits)bit "
+ "pinned=\(pin != nil) tofu=\(allowTofu) launch=\(launchID ?? "-")"
sessionLog.info("\(connectLine, privacy: .public)")
Task.detached(priority: .userInitiated) {
// PunktfunkConnection.init blocks on the QUIC handshake keep it off the main
// actor. The persistent identity is presented on every connect so a paired
@@ -530,6 +539,14 @@ final class SessionModel: ObservableObject {
}
switch result {
case .success(let conn):
let landed = "connected \(host.displayName) "
+ "mode=\(conn.width)x\(conn.height)@\(conn.refreshHz) "
+ "codec=\(conn.videoCodec) bitrate=\(conn.resolvedBitrateKbps)kbps "
+ "depth=\(conn.bitDepth) chroma=\(conn.isChroma444 ? "444" : "420") hdr=\(conn.isHDR) "
+ "audio=\(conn.resolvedAudioChannels)ch/\(conn.resolvedAudioRateHz)Hz/\(conn.resolvedAudioBits)bit "
+ "shard=\(conn.shardPayload) compositor=\(conn.resolvedCompositor.rawValue) "
+ "gamepad=\(conn.resolvedGamepad.rawValue) mgmt=\(conn.hostMgmtPort)"
sessionLog.info("\(landed, privacy: .public)")
if pin != nil || autoTrust || requestAccess {
// requestAccess: the operator approved this device on the host, so the
// session is trusted stream directly (the caller pins it as paired).
@@ -553,6 +570,8 @@ final class SessionModel: ObservableObject {
+ "Pair with its PIN before streaming."
}
case .failure(let error):
sessionLog.warning(
"connect \(host.displayName, privacy: .public) failed: \(String(describing: error), privacy: .public)")
self.phase = .idle
self.activeHost = nil
SessionSettings.end() // the dial failed back to the plain globals
@@ -782,6 +801,10 @@ final class SessionModel: ObservableObject {
/// `disconnectQuit()` so the host skips the keep-alive linger; `sessionEnded()` (a host-ended /
/// dropped session) passes `false` to leave the linger intact.
func disconnect(deliberate: Bool = true) {
if connection != nil {
let line = "disconnect \(activeHost?.displayName ?? "-") deliberate=\(deliberate) phase=\(phase)"
sessionLog.info("\(line, privacy: .public)")
}
statsTimer?.invalidate()
statsTimer = nil
// Release the session's resolved settings: from here every reader falls back to the plain
@@ -902,6 +925,9 @@ final class SessionModel: ObservableObject {
// The shelf it came off falling back to the host's own if a caller launched a title
// without naming one, which is what that launch effectively browsed.
let shelf = launchedShelf ?? activeHost.map { LibraryTarget(host: $0) }
let endLine = "session ended by \(name) reason=\(reason) "
+ "rejection=\(rejection.map { String(describing: $0) } ?? "-")"
sessionLog.info("\(endLine, privacy: .public)")
disconnect(deliberate: false) // host/network ended it keep the linger for a reconnect
if let rejection {
// The shared typed-rejection wording ("Your access to this host has expired").
@@ -522,7 +522,25 @@ extension SettingsView {
}
described(inhibitShortcutsDescription, field: "inhibit_shortcuts") {
Toggle("Capture system shortcuts", isOn: scoped(SettingsFields.inhibitShortcuts))
// Turning it ON is the moment to ask for Accessibility never at stream start,
// where a TCC dialog over a captured stream would be the surprise.
.onChange(of: effective.inhibitShortcuts) { was, on in
if on, !was, !accessibilityTrusted { InputCapture.requestSystemShortcutAccess() }
}
if effective.inhibitShortcuts, !accessibilityTrusted {
Button("Allow Accessibility access…") {
InputCapture.requestSystemShortcutAccess()
// The prompt's own "Open System Settings" only shows the FIRST time the system
// asks; after that the user has to find the pane themselves open it for them.
if let url = URL(string: "x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility") {
NSWorkspace.shared.open(url)
}
}
}
}
.onReceive(NotificationCenter.default.publisher(
for: NSApplication.didBecomeActiveNotification
)) { _ in accessibilityTrusted = InputCapture.systemShortcutsAvailable }
#endif
described(
(ModifierLayout(rawValue: effective.modifierLayout) ?? .mac).detail,
@@ -549,8 +567,13 @@ extension SettingsView {
if (MouseInputMode(rawValue: effective.mouseMode) ?? .capture) == .desktop {
return "No effect under the desktop mouse model — switch Mouse input to Capture."
}
return "Sends ⌘ shortcuts to the host while captured. ⌘⎋ always stays local — it "
+ "releases capture."
if accessibilityTrusted {
return "Sends ⌘ shortcuts — ⌘Space, ⌘Tab and Mission Control included — to the host "
+ "while captured. ⌘⎋ always stays local — it releases capture."
}
return "Sends the app's ⌘ shortcuts (⌘Q, ⌘W, ⌘H…) to the host while captured. ⌘Space, "
+ "⌘Tab and Mission Control need Accessibility access — macOS claims them before any "
+ "app sees them. ⌘⎋ always stays local — it releases capture."
}
/// The SELECTED mouse model explained dynamic, like the touch-mode caption.
@@ -124,6 +124,10 @@ struct SettingsView: View {
/// instead of the app menu while captured). macOS-only: it is the one platform whose window
/// system hands a plain app no keyboard grab, so the client has to claim the chords itself.
@AppStorage(DefaultsKey.inhibitShortcuts) var inhibitShortcuts = true
/// Accessibility granted? Gates the system-shortcut half of `inhibit_shortcuts` (Space, Tab
/// need the event tap). Re-read whenever the app comes back to the front that is when the
/// user returns from flipping the switch in System Settings.
@State var accessibilityTrusted = InputCapture.systemShortcutsAvailable
@AppStorage(DefaultsKey.speakerUID) var speakerUID = ""
@AppStorage(DefaultsKey.micUID) var micUID = ""
@AppStorage(DefaultsKey.micChannel) var micChannel = 0
@@ -0,0 +1,39 @@
// "Send logs to host" the one action behind the host card's menu item and the gamepad options
// row. Posts `ClientLogRing` to the PAIRED host (`LibraryClient.sendLogs`), where the web
// console's Logs page shows it next to the host's own log. The Apple port of the Gaming Mode
// console's `ConsoleCmd::SendLogs` (clients/session/src/console.rs), same wording on success.
import Foundation
import PunktfunkKit
private let log = ClientLog(category: "logs")
enum SendLogs {
/// Upload this device's recent log to `host`. Never throws: the caller shows `message` either
/// way, and the outcome is itself the last line of the NEXT bundle.
static func toHost(_ host: StoredHost) async -> (ok: Bool, message: String) {
// The same two preconditions the library screen applies: this device's mTLS identity
// (minted on the first connect) and the host's pinned fingerprint (pairing) an upload
// is an outbound write carrying the device's diagnostics, and it goes to a host the user
// has actually paired with, not to whoever answers on that port.
guard let identity = (try? ClientIdentityStore.shared.load())?.identity else {
return (false, "Connect to this host once first — sending logs uses the identity "
+ "created on the first connect.")
}
guard let pin = host.pinnedSHA256 else {
return (false, "Pair with \(host.displayName) first — logs are only sent to a paired host.")
}
do {
let id = try await LibraryClient.sendLogs(
address: host.address, port: host.effectiveMgmtPort,
certPEM: identity.certPEM, keyPEM: identity.keyPEM, hostFingerprint: pin)
log.info("client logs uploaded to \(host.displayName, privacy: .public) id=\(id, privacy: .public)")
return (true, "Logs sent to \(host.displayName) — download them from its web console's "
+ "Logs page.")
} catch {
let why = (error as? LocalizedError)?.errorDescription ?? error.localizedDescription
log.warning("client log upload to \(host.displayName, privacy: .public) failed: \(why, privacy: .public)")
return (false, "Couldn't send logs — \(why)")
}
}
}
@@ -16,7 +16,7 @@ import os
import CoreAudio
#endif
private let log = Logger(subsystem: "io.unom.punktfunk", category: "audio")
private let log = ClientLog(category: "audio")
final class AudioDeviceWatcher {
/// Why the owner is being told. Only for the log line every reason leads to the same
@@ -158,6 +158,17 @@ final class AudioRing: @unchecked Sendable {
/// and must stay there for this much consumed audio. Long, because a shed is the only thing
/// here a listener could notice; it must never fire on a transient.
private static let shedSustainMS = 2_000
/// The mirror for the sync-driven INSERT: the depth average must sit below the requested
/// target for this much consumed audio before one frame is duplicated. Equal to the shed's,
/// so the two corrections are the same instrument in both directions and cannot fight; kept
/// separate so the insert can be sped up alone if a listen test proves it inaudible. Mirrors
/// `INSERT_SUSTAIN_MS`.
private static let insertSustainMS = shedSustainMS
/// How far below the sync-requested target the depth average must sit before the insert
/// arms. NOT `shedExcessMS`: the sync loop only asks for more depth once the offset has left
/// its ±`AvSync.deadbandMS`, so a margin at or above the deadband would leave every request it
/// is allowed to make permanently unanswered. Half the deadband. Mirrors `INSERT_MARGIN_MS`.
private static let insertMarginMS = AvSync.deadbandMS / 2
private static let crossfadeMS = 2
/// Time constant of the depth average.
private static let ewmaTauMS = 1_000
@@ -206,6 +217,9 @@ final class AudioRing: @unchecked Sendable {
private var emptyRun = 0
private var depthAvg: Double = 0
private var overRun = 0
/// The mirror: consumed samples for which the average has sat more than `insertMarginMS`
/// below the sync-requested target (see the insert branch in `read`).
private var underRun = 0
/// The live target in interleaved samples `targetMS` grown by underrun pressure
/// (`noteRead`), never below the base. Set in `init` (needs the rate).
private var targetLive = 0
@@ -219,6 +233,9 @@ final class AudioRing: @unchecked Sendable {
/// which is a different problem from the depth being wrong.
private var underrunCount = 0
private var shedCount = 0
/// Sync-driven inserts: one duplicated, crossfaded frame each. Concealment in BOTH directions
/// must be visible a ring being quietly deepened is a picture moving away from its audio.
private var insertCount = 0
/// The depth the A/V sync loop would like, in interleaved samples (`AvSync.desiredDepth`).
/// `nil` the default, and what an un-wired session keeps reproduces the pre-sync
/// behaviour exactly, so this ring could adopt sync without the other three diverging.
@@ -230,8 +247,9 @@ final class AudioRing: @unchecked Sendable {
/// episode (a RUN of consecutive near-misses while the ring refills) buys one measured
/// step, not a sprint to the ceiling.
private var nearMissGrown = false
/// The depth average runs a `deprimeDebtMS` debt against the target (set in `read`): an
/// underrun should re-prime at once instead of waiting out the hysteresis.
/// The depth average runs a `deprimeDebtMS` debt against the ADAPTIVE target the one
/// underrun pressure grew, never the sync-inflated one (set in `read`): an underrun should
/// re-prime at once instead of waiting out the hysteresis.
private var hollow = false
/// Interleaved samples left in the current shrink-probe window (0 = no probe outstanding).
private var probeRun = 0
@@ -378,12 +396,20 @@ final class AudioRing: @unchecked Sendable {
/// oversized read would otherwise inflate the debt threshold forever and turn the very next
/// late packet into a full re-prime.
private func target(lift quantum: Int) -> Int {
let floor = max(targetLive, quantum + frameSamples)
let floor = adaptiveTarget(lift: quantum)
guard let want = syncTarget else { return floor }
let cap = max(msSamples(Self.hardCapMS), floor)
return min(max(want, floor), cap)
}
/// The ADAPTIVE target: the live target underrun pressure has grown, lifted so it can always
/// serve one quantum plus a packet. The floor the sync request is clamped against, and
/// because it is what underrun evidence has PROVEN this link needs what `hollow` is judged
/// against. Mirrors `JitterPolicy::adaptive_target`.
private func adaptiveTarget(lift quantum: Int) -> Int {
max(targetLive, quantum + frameSamples)
}
/// The sync loop is asking to run shallower than the adaptive target has grown to the
/// evidence `noteRead` relaxes a grown target on. Compared against the LIVE target, not the
/// effective one: it is the underrun-driven growth that a sync request is evidence against,
@@ -393,6 +419,15 @@ final class AudioRing: @unchecked Sendable {
return want < targetLive
}
/// The sync loop is asking to run DEEPER than the adaptive target audio is early against
/// the picture. This is what arms the insert in `read`; without a sync request the ring never
/// adds depth by itself, so an un-wired ring behaves exactly as it did before the insert
/// existed. Mirrors `JitterPolicy::sync_wants_more`.
private var syncWantsMore: Bool {
guard let want = syncTarget else { return false }
return want > targetLive
}
/// Hand the ring the depth the A/V sync loop wants (`AvSync.desiredDepth`), in interleaved
/// samples, or `nil` to run unsynchronised. Called from the drain thread.
///
@@ -460,6 +495,7 @@ final class AudioRing: @unchecked Sendable {
dropFront(writeIdx - readIdx - cap)
depthAvg = Double(writeIdx - readIdx)
overRun = 0
underRun = 0
}
}
@@ -496,20 +532,51 @@ final class AudioRing: @unchecked Sendable {
// this instant: a single late packet empties the ring for a callback without making it
// hollow, and must keep the consecutive-empties hysteresis. Lifted by THIS callback's
// size, not the high-water quantum see `target(lift:)`.
hollow = depthAvg + Double(msSamples(Self.deprimeDebtMS)) < Double(target(lift: count))
//
// Judged against the ADAPTIVE target, never the sync-inflated one. The debt this exists
// to call in is GROWTH that was never banked underrun evidence raised the promise and
// only a re-prime cashes that. A sync request is not evidence of starvation; it is a
// request for alignment, and it has its own gentle instrument (the insert below).
// Measured against the effective target, a request for `deprimeDebtMS` more depth made
// the ring hollow on the very next callback and turned the next single late packet into a
// full re-prime. The effective target is never below the adaptive one, so this can only be
// LESS hollow. Mirrors `JitterPolicy::step`.
hollow = depthAvg + Double(msSamples(Self.deprimeDebtMS)) < Double(adaptiveTarget(lift: count))
// Drift correction: shed exactly one frame, crossfaded, once the AVERAGE has sat above
// the threshold for the sustain window. Anything shorter is jitter and must be left alone.
if depthAvg > Double(target + msSamples(Self.shedExcessMS)) {
overRun += count
underRun = 0
if overRun >= msSamples(Self.shedSustainMS) {
overRun = 0
shedOneFrame()
shedCount += 1
depthAvg = Double(writeIdx - readIdx)
}
} else if syncWantsMore, depthAvg + Double(msSamples(Self.insertMarginMS)) < Double(target) {
// The mirror of the shed. The sync loop has asked for a DEEPER ring than the adaptive
// target (audio is early against the picture) and the AVERAGE has sat more than the
// margin below what it asked for, for the sustain window: duplicate ONE frame at the
// front, crossfaded. Below-target-only, so it can never fight the trim; sync-only, so
// an un-wired ring never adds depth by itself and the hollow re-prime keeps its job
// for growth that was never banked. (Primed-only comes free: an un-primed read
// returned above.) The ring must hold a whole frame to duplicate if it does not it
// is running dry, and the drought path is the tool for that. Mirrors the insert
// branch in `JitterPolicy::step`.
overRun = 0
underRun += count
if underRun >= msSamples(Self.insertSustainMS), writeIdx - readIdx >= frameSamples {
underRun = 0
insertOneFrame()
insertCount += 1
// Whatever we duplicated is buffered now reflect it at once so the next
// callbacks don't re-fire on a stale average.
depthAvg += Double(frameSamples)
}
} else {
overRun = 0
underRun = 0
}
let n = min(writeIdx - readIdx, count)
@@ -660,15 +727,21 @@ final class AudioRing: @unchecked Sendable {
///
/// The fade is `crossfadeSamples` capped at half a frame then clamped again to what this
/// particular drop can actually spare on either side of the seam.
///
/// The fade-OUT source is the HEAD of what is discarded the continuation of the sample the
/// device just played blending into the head of what survives, so both ends of the seam are
/// continuous. (It used to fade out from the discarded region's TAIL, which is adjacent to the
/// survivors but not to the sample just played, so the seam still opened with a step of
/// `drop fade` samples of waveform. Core's `crossfade_drop` had the same defect and the same
/// fix; `AudioRingDriftTests` now checks the seam against the sample played before it.)
private func dropFront(_ drop: Int) {
let available = writeIdx - readIdx
guard drop > 0, available > drop else { return }
let fade = min(crossfadeSamples, min(drop, available - drop))
let capacity = buf.count
if fade > 0 {
// The tail of what we discard fades out into the head of what survives.
for i in 0..<fade {
let old = buf[(readIdx + drop - fade + i) % capacity]
let old = buf[(readIdx + i) % capacity]
let new = buf[(readIdx + drop + i) % capacity]
let t = Float(i + 1) / Float(fade + 1)
buf[(readIdx + drop + i) % capacity] = old * (1 - t) + new * t
@@ -677,6 +750,47 @@ final class AudioRing: @unchecked Sendable {
readIdx += drop
}
/// Duplicate one audio frame at the front the sync-driven deepening, the mirror of
/// `shedOneFrame`. The session's REAL frame (`setFrameUs`).
private func insertOneFrame() { insertFront(frameSamples) }
/// Duplicate the first `insert` interleaved samples at the front the ring plays them, then
/// plays them again linearly crossfading the seam so the correction is continuous rather
/// than a click. Mirrors `punktfunk_core::audio::crossfade_insert`; caller holds the lock.
///
/// Index-based where core's is a `VecDeque`: the copy lands in the `insert` slots just BEFORE
/// `readIdx`, which are free exactly when the ring has that much spare capacity (they hold
/// audio already consumed), and `readIdx` steps back over it. `readIdx`/`writeIdx` are plain
/// offsets reduced modulo the capacity wherever they touch `buf`, so when `readIdx` is too
/// small to step back both are shifted forward by one whole capacity first every position
/// they name is unchanged, and neither can go negative (which `%` would turn into a negative
/// index).
///
/// The seam: what would have followed the copy's last sample is the original's `insert`-th
/// sample onward, so THAT fades out into the original's head, in place. The copy is written
/// before the seam is blended, so it is verbatim; the fade-out reads sit `insert` past every
/// write, so one ascending pass is safe.
private func insertFront(_ insert: Int) {
let available = writeIdx - readIdx
let capacity = buf.count
guard insert > 0, available >= insert, available + insert <= capacity else { return }
let fade = min(crossfadeSamples, min(insert, available - insert))
if readIdx < insert {
readIdx += capacity
writeIdx += capacity
}
for i in 0..<insert {
buf[(readIdx - insert + i) % capacity] = buf[(readIdx + i) % capacity]
}
for i in 0..<fade {
let old = buf[(readIdx + insert + i) % capacity]
let new = buf[(readIdx + i) % capacity]
let t = Float(i + 1) / Float(fade + 1)
buf[(readIdx + i) % capacity] = old * (1 - t) + new * t
}
readIdx -= insert
}
/// Current buffered depth in milliseconds for the stats overlay and the drain thread's
/// periodic log.
var bufferedMS: Int {
@@ -692,6 +806,9 @@ final class AudioRing: @unchecked Sendable {
let targetMS: Int
let underruns: Int
let sheds: Int
/// Sync-driven inserts one duplicated, crossfaded frame each (`insertOneFrame`). Read
/// next to `sheds`: the same correction, the other direction.
let inserts: Int
/// The A/V sync loop's smoothed offset (ms): **positive = audio playing BEHIND the
/// picture**, negative = ahead of it. `0` before the loop has evidence, or with sync off.
///
@@ -712,6 +829,7 @@ final class AudioRing: @unchecked Sendable {
targetMS: samplesMs(target),
underruns: underrunCount,
sheds: shedCount,
inserts: insertCount,
avOffsetMS: avOffsetMS,
plcMS: plcMS)
}
@@ -751,7 +869,7 @@ struct AvSync {
/// discontinuity and buys nothing a listener can perceive detectability for A/V misalignment
/// sits an order of magnitude above it. The deadband is what keeps the loop from hunting
/// forever around zero, which would be audible in a way the misalignment it chased was not.
private static let deadbandMS = 10
static let deadbandMS = 10
/// Observations folded before the first correction is offered. The offset is derived from a
/// clock skew estimate and a video figure that both need a moment to settle after connect;
/// acting on the first sample would chase the handshake, not the stream.
@@ -38,7 +38,7 @@
import AVFoundation
import os
private let log = Logger(subsystem: "io.unom.punktfunk", category: "audio")
private let log = ClientLog(category: "audio")
/// Render-block-owned scratch storage: freed exactly when the closure (and thus the
/// last possible render call) is released never racing CoreAudio.
@@ -1229,7 +1229,7 @@ public final class SessionAudio {
if drained % 2_000 == 0 {
let s = ring.stats
log.info(
"audio: rate_hz=\(rateHz) frame_us=\(frameUs) buffer_ms=\(s.bufferedMS) target_ms=\(s.targetMS) underruns=\(s.underruns) drift_sheds=\(s.sheds) av_offset_ms=\(s.avOffsetMS) plc_ms=\(s.plcMS)"
"audio: rate_hz=\(rateHz) frame_us=\(frameUs) buffer_ms=\(s.bufferedMS) target_ms=\(s.targetMS) underruns=\(s.underruns) drift_sheds=\(s.sheds) drift_inserts=\(s.inserts) av_offset_ms=\(s.avOffsetMS) plc_ms=\(s.plcMS)"
)
}
return true
@@ -235,6 +235,40 @@ public enum LibraryClient {
return status.games ?? []
}
/// Upload this client's recent log (`ClientLogRing`) to the host `POST /api/v1/client-logs`,
/// the one WRITE a paired certificate may make (the host's `mgmt/client_logs.rs`). Same lane
/// and identity as the library; the host files the bundle under this device and shows it on
/// its web console's Logs page next to its own log. Returns the stored bundle id (empty for a
/// host that predates the id in the reply).
///
/// Why it exists: on an Apple TV (or a phone, for anyone who is not a developer) there is no
/// way to get the client's log off the device, so every fault report arrived with only the
/// host's half of the story. `hostFingerprint` is required, not optional: this is an outbound
/// write carrying the device's diagnostics, and it goes to the host the user paired with.
public static func sendLogs(
address: String,
port: UInt16 = punktfunkDefaultMgmtPort,
certPEM: String,
keyPEM: String,
hostFingerprint: Data
) async throws -> String {
let identity = try clientIdentity(certPEM: certPEM, keyPEM: keyPEM)
let body = Data(ClientLogRing.render(header: ClientLogRing.header()).utf8)
let response = try await send(
path: "/api/v1/client-logs", address: address, port: port,
identity: identity, hostFingerprint: hostFingerprint,
body: (body, "text/plain; charset=utf-8"))
switch response.status {
case 200, 201:
let json = try? JSONSerialization.jsonObject(with: response.body) as? [String: Any]
return json?["id"] as? String ?? ""
case 401, 403:
throw LibraryError.unauthorized
default:
throw LibraryError.http(response.status)
}
}
/// Just the slice of `/status` this client reads. Everything else on that payload is the
/// operator console's business, and decoding only what we use keeps an unrelated schema change
/// on the host from breaking the library screen.
@@ -259,12 +293,20 @@ public enum LibraryClient {
}
}
/// One GET against the host, with transport failures mapped onto `LibraryError`.
/// One request against the host a GET, or a POST when `body` is given with transport
/// failures mapped onto `LibraryError`.
static func send(
path: String, address: String, port: UInt16,
identity: SecIdentity, hostFingerprint: Data?
identity: SecIdentity, hostFingerprint: Data?,
body: (data: Data, contentType: String)? = nil
) async throws -> HTTPResponse {
do {
if let body {
return try await MgmtTransport.post(
host: address, port: port, path: path, body: body.data,
contentType: body.contentType,
identity: identity, pinnedHostFingerprint: hostFingerprint)
}
return try await MgmtTransport.get(
host: address, port: port, path: path,
identity: identity, pinnedHostFingerprint: hostFingerprint)
@@ -56,6 +56,41 @@ enum MgmtTransport {
identity: SecIdentity,
pinnedHostFingerprint: Data?,
timeout: TimeInterval = 15
) async throws -> HTTPResponse {
try await request(
host: host, port: port, method: "GET", path: path, body: nil, contentType: nil,
identity: identity, pinnedHostFingerprint: pinnedHostFingerprint, timeout: timeout)
}
/// `POST https://host:port/path` with a body same transport, trust and retry rule as `get`.
/// The one write a paired device may make is the client-log upload, which is idempotent in
/// the only sense that matters (a retried bundle is a second bundle, not a corrupted one).
static func post(
host: String,
port: UInt16,
path: String,
body: Data,
contentType: String,
identity: SecIdentity,
pinnedHostFingerprint: Data?,
timeout: TimeInterval = 15
) async throws -> HTTPResponse {
try await request(
host: host, port: port, method: "POST", path: path, body: body,
contentType: contentType, identity: identity,
pinnedHostFingerprint: pinnedHostFingerprint, timeout: timeout)
}
private static func request(
host: String,
port: UInt16,
method: String,
path: String,
body: Data?,
contentType: String?,
identity: SecIdentity,
pinnedHostFingerprint: Data?,
timeout: TimeInterval
) async throws -> HTTPResponse {
guard let nwPort = NWEndpoint.Port(rawValue: port) else {
throw MgmtTransportError.invalidPort(port)
@@ -70,7 +105,9 @@ enum MgmtTransport {
}
let wasReused = connection.hasServedRequest
do {
let response = try await connection.perform(path: path, timeout: timeout)
let response = try await connection.perform(
method: method, path: path, body: body, contentType: contentType,
timeout: timeout)
await MgmtConnectionPool.shared.release(connection, key: key)
return response
} catch {
@@ -230,7 +267,10 @@ final class MgmtConnection: @unchecked Sendable {
private let rejection: RejectionFlag
private final class RejectionFlag: @unchecked Sendable { var value = false }
func perform(path: String, timeout: TimeInterval) async throws -> HTTPResponse {
func perform(
method: String = "GET", path: String, body: Data? = nil, contentType: String? = nil,
timeout: TimeInterval
) async throws -> HTTPResponse {
try await withCheckedThrowingContinuation { continuation in
queue.async {
guard self.phase != .dead else {
@@ -240,7 +280,9 @@ final class MgmtConnection: @unchecked Sendable {
self.operation += 1
let op = self.operation
self.pending = continuation
self.pendingRequest = self.requestBytes(path: path)
self.pendingRequest = Self.requestBytes(
host: self.host, port: self.port,
method: method, path: path, body: body, contentType: contentType)
self.buffer.removeAll(keepingCapacity: true)
self.queue.asyncAfter(deadline: .now() + timeout) { [weak self] in
guard let self, self.operation == op else { return }
@@ -361,17 +403,24 @@ final class MgmtConnection: @unchecked Sendable {
rejection.value ? .pinMismatch : .connection(String(describing: error))
}
private func requestBytes(path: String) -> Data {
/// The wire bytes of one request. Pure (and `static`) so the framing is unit-testable.
static func requestBytes(
host: String, port: UInt16,
method: String, path: String, body: Data?, contentType: String?
) -> Data {
// An IPv6 literal is bracketed in the Host header (RFC 9110 §7.2); a name or IPv4 is not.
let authority = host.contains(":") ? "[\(host)]:\(port)" : "\(host):\(port)"
let request = """
GET \(path) HTTP/1.1\r
Host: \(authority)\r
User-Agent: punktfunk-apple\r
Accept: */*\r
\r
"""
return Data(request.utf8)
var head = "\(method) \(path) HTTP/1.1\r\nHost: \(authority)\r\n"
+ "User-Agent: punktfunk-apple\r\nAccept: */*\r\n"
if let body {
// Always framed by length a request body has no EOF to end it on a kept-alive
// connection, and the host's axum would otherwise wait for one.
head += "Content-Type: \(contentType ?? "application/octet-stream")\r\n"
head += "Content-Length: \(body.count)\r\n"
}
head += "\r\n"
var request = Data(head.utf8)
if let body { request.append(body) }
return request
}
}
@@ -19,7 +19,7 @@ import IOKit
import IOKit.hid
import os
private let log = Logger(subsystem: "io.unom.punktfunk", category: "gamepad")
private let log = ClientLog(category: "gamepad")
/// Opens one connected Sony DualSense and forwards motor rumble to it over raw HID.
///
@@ -3,7 +3,7 @@ import Foundation
import GameController
import os
private let log = Logger(subsystem: "io.unom.punktfunk", category: "gamepad")
private let log = ClientLog(category: "gamepad")
/// Tuning constants + the pure scheduling decisions of the rumble renderer, split out so the
/// policy is unit-testable without a `CHHapticEngine` or a physical pad.
@@ -48,7 +48,7 @@ import os
/// PUNKTFUNK_INPUT_DEBUG=1 in the environment to surface whether relative motion + buttons
/// are actually being SENT to the host without needing host-side logs. Motion is throttled
/// to once per second (see `motionDebugTick`); buttons log every transition.
private let inputLog = Logger(subsystem: "io.unom.punktfunk", category: "input")
private let inputLog = ClientLog(category: "input")
private let inputDebug = ProcessInfo.processInfo.environment["PUNKTFUNK_INPUT_DEBUG"] == "1"
public final class InputCapture {
@@ -60,6 +60,10 @@ public final class InputCapture {
private var keyboards: [GCKeyboard] = []
#if os(macOS)
private var keyEventMonitor: Any?
/// The system-shortcut tap (see `installSystemKeyTap`) and its run-loop source. Live only
/// while forwarding with `inhibit_shortcuts` on AND Accessibility granted; nil otherwise.
private var systemKeyTap: CFMachPort?
private var systemKeyTapSource: CFRunLoopSource?
#endif
// Main-queue-only state (see header comment).
@@ -194,7 +198,13 @@ public final class InputCapture {
if on {
forwarding = true
suppressedButton = suppressClick ? 1 : nil
#if os(macOS)
installSystemKeyTap()
#endif
} else if forwarding {
#if os(macOS)
removeSystemKeyTap()
#endif
releaseAll()
forwarding = false
suppressedButton = nil
@@ -369,6 +379,7 @@ public final class InputCapture {
NSEvent.removeMonitor(monitor)
keyEventMonitor = nil
}
removeSystemKeyTap()
#endif
// Don't clobber the handlers if a newer capture has taken the global devices.
if Self.activeCapture === self || Self.activeCapture == nil {
@@ -672,6 +683,128 @@ public final class InputCapture {
}
commandChordVKs.removeAll()
}
// MARK: - System shortcut tap
/// Whether the system-shortcut tap CAN run: Accessibility granted to this process. Read live
/// (the user flips it in System Settings while the app runs); never prompts the prompt is the
/// Settings toggle's job (`requestSystemShortcutAccess`), not something a stream start springs.
public static var systemShortcutsAvailable: Bool { AXIsProcessTrusted() }
/// Show the one-time Accessibility prompt (a no-op once granted). Called from Settings when the
/// user turns "Capture system shortcuts" on or presses the grant button.
public static func requestSystemShortcutAccess() {
let opts = [kAXTrustedCheckOptionPrompt.takeUnretainedValue(): true] as CFDictionary
_ = AXIsProcessTrustedWithOptions(opts)
}
/// The other half of `inhibit_shortcuts` on macOS. The keyDown monitor above claims the
/// chords that REACH the app but Space, Tab, and the rest of System Settings Keyboard
/// Shortcuts never do: WindowServer hands them to Spotlight / the Dock / Mission Control before
/// any app sees them. The SDL clients get those through a private CGS hotkey-mode call that a
/// sandboxed app cannot make; the sandbox-legal way is a session-level event tap, which sees
/// every key ahead of the hotkey dispatch and only exists with Accessibility granted.
///
/// The tap does NOT forward anything itself. It takes each keyDown/keyUp off the system and
/// re-posts it, addressed to the key window, into THIS app's event queue (`NSApp.postEvent`), so
/// it arrives exactly where the same key would have arrived had macOS not claimed it the
/// monitor first (client chords, chords host), then `StreamLayerView.keyDown/keyUp`
/// (everything else host). One key path, no second VK table, no second release bookkeeping.
/// In-process posts don't re-enter the tap, so there is no loop. Keys the system would have
/// delivered anyway are unaffected (we drop the original and deliver the copy) the tap only
/// changes what happens to the ones it wouldn't. Bonus: the keyUp of a -chord key now arrives
/// too (the tap sees HID, which never stopped delivering it), so `flushCommandChord` has less
/// to synthesize.
///
/// Gating, every event: `forwarding` (capture engaged and capture releases on any focus loss,
/// so this is never true with another app frontmost), `!desktopMouse` (system chords stay local
/// under the desktop model, like every other client), `NSApp.isActive` as belt-and-braces.
/// Anything else passes through untouched a tap that swallows keys for the whole Mac is the
/// failure mode to design against. Installed on the main run loop on purpose: a hung main thread
/// trips the tap's timeout and macOS disables it, handing the keyboard back.
private func installSystemKeyTap() {
// `desktopMouse` is NOT an install condition: M flips it mid-capture, so the callback
// reads it per event instead and the tap simply idles under the desktop model.
guard systemKeyTap == nil, SessionSettings.current.inhibitShortcuts, AXIsProcessTrusted()
else { return }
let mask = (1 << CGEventType.keyDown.rawValue) | (1 << CGEventType.keyUp.rawValue)
let callback: CGEventTapCallBack = { _, type, event, userInfo in
guard let userInfo else { return Unmanaged.passUnretained(event) }
let capture = Unmanaged<InputCapture>.fromOpaque(userInfo).takeUnretainedValue()
return capture.handleTapped(type: type, event: event)
}
guard let tap = CGEvent.tapCreate(
tap: .cgSessionEventTap, place: .headInsertEventTap, options: .defaultTap,
eventsOfInterest: CGEventMask(mask), callback: callback,
userInfo: Unmanaged.passUnretained(self).toOpaque())
else {
inputLog.error("system shortcut tap: tapCreate failed (Accessibility revoked?)")
return
}
let source = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, tap, 0)
CFRunLoopAddSource(CFRunLoopGetMain(), source, .commonModes)
CGEvent.tapEnable(tap: tap, enable: true)
systemKeyTap = tap
systemKeyTapSource = source
if inputDebug { inputLog.debug("system shortcut tap installed") }
}
private func removeSystemKeyTap() {
guard let tap = systemKeyTap else { return }
CGEvent.tapEnable(tap: tap, enable: false)
if let source = systemKeyTapSource {
CFRunLoopRemoveSource(CFRunLoopGetMain(), source, .commonModes)
}
CFMachPortInvalidate(tap)
systemKeyTap = nil
systemKeyTapSource = nil
if inputDebug { inputLog.debug("system shortcut tap removed") }
}
/// The tap callback body (main run loop). Returns the event to let it through, nil to swallow.
private func handleTapped(type: CGEventType, event: CGEvent) -> Unmanaged<CGEvent>? {
switch type {
case .tapDisabledByTimeout, .tapDisabledByUserInput:
// macOS switched us off (main thread stalled past the tap's deadline, or a
// system-level interruption); re-arm if still wanted, else stay down.
if let tap = systemKeyTap, forwarding { CGEvent.tapEnable(tap: tap, enable: true) }
return Unmanaged.passUnretained(event)
case .keyDown, .keyUp:
// Stamped with the KEY window: `NSApp.sendEvent` routes a key event by `event.window`,
// and an NSEvent wrapped straight from the CGEvent has none it reaches the local
// monitor but not the first responder (verified in a harness). The key window is the
// stream window whenever `forwarding` is true (capture releases on resignKey); if there
// somehow is none, let the key go rather than swallow it into nothing.
guard Self.tapClaims(forwarding: forwarding, desktopMouse: desktopMouse,
appActive: NSApp.isActive),
let windowNumber = NSApp.keyWindow?.windowNumber,
let copy = event.copy(), let raw = NSEvent(cgEvent: copy),
let stamped = Self.restamp(raw, windowNumber: windowNumber)
else { return Unmanaged.passUnretained(event) }
NSApp.postEvent(stamped, atStart: false)
return nil
default:
return Unmanaged.passUnretained(event)
}
}
/// The same key event, addressed to `windowNumber` (see `handleTapped`).
static func restamp(_ raw: NSEvent, windowNumber: Int) -> NSEvent? {
NSEvent.keyEvent(
with: raw.type, location: .zero, modifierFlags: raw.modifierFlags,
timestamp: raw.timestamp, windowNumber: windowNumber, context: nil,
characters: raw.characters ?? "",
charactersIgnoringModifiers: raw.charactersIgnoringModifiers ?? "",
isARepeat: raw.type == .keyDown && raw.isARepeat, keyCode: raw.keyCode)
}
/// Does the system-shortcut tap take this key off macOS and hand it to the app's own key path?
/// Pure, for the tests: only while captured, only under the capture mouse model, only with the
/// app frontmost. The `inhibit_shortcuts` setting is checked once at install time (the tap does
/// not exist with it off).
static func tapClaims(forwarding: Bool, desktopMouse: Bool, appActive: Bool) -> Bool {
forwarding && !desktopMouse && appActive
}
#endif
private func attach(mouse: GCMouse) {
@@ -0,0 +1,195 @@
// The client's own recent-log ring + the drop-in logger that feeds it the source for the
// "Send logs to host" action (`LibraryClient.sendLogs`), the Apple port of
// `pf_client_core::logring` + `punktfunk-session`'s `ring_layer`.
//
// WHY A RING AND NOT `OSLogStore`. The unified log already holds everything these loggers write,
// and `OSLogStore(scope: .currentProcessIdentifier)` can read it back but only the levels the
// system PERSISTS (`.notice`/`.error`/`.fault`). `.info` is memory-only and purged under pressure,
// and `.info` is exactly where the lines a field report needs live: the 1 Hz stats line, the
// decoder/presenter setup, the audio underrun notes. On an Apple TV there is no Console.app to
// read any of it on either. So every `ClientLog` call goes to os_log as before AND into this
// process-global ring, and an explicit user action posts the ring to the PAIRED host, where the
// web console shows it next to the host's own log.
//
// Bounded by lines AND bytes so a log-storm can't grow memory; the byte budget stays under the
// host's 1 MiB upload cap so a full ring always uploads whole. `.debug` deliberately skips the
// ring: it is per-key/per-event input chatter here, and a ring that a healthy keyboard can flush
// in thirty seconds is worse than no ring (the session client learned this from a Steam Deck
// bundle whose whole 27-minute session had been evicted by decoder DPB chatter).
import Foundation
import os
/// Process-global bounded ring of formatted log lines. `note` is cheap (one lock, one append);
/// `render` is the upload body.
public enum ClientLogRing {
/// Newest lines kept matches the host's own ring depth and the session client's.
public static let maxLines = 4096
/// Byte budget under the host's 1 MiB bundle cap with headroom for the header.
public static let maxBytes = 768 * 1024
private static let lock = OSAllocatedUnfairLock(initialState: State())
private struct State {
var lines: [String] = []
/// Index of the oldest live line in `lines` popped lazily, compacted when half is dead,
/// so eviction is O(1) amortised without a deque type.
var head = 0
var bytes = 0
var dropped = 0
}
/// Append one formatted log line (no trailing newline). Oversized lines are truncated to keep
/// a single event from evicting the whole ring.
public static func note(_ line: String) {
// `decoding:` rather than `String(_:)`: a cut mid-scalar yields U+FFFD, not nil.
let line = line.utf8.count > 2048
? String(decoding: line.utf8.prefix(2048), as: UTF8.self) + "" : line
let size = line.utf8.count
lock.withLock { s in
s.lines.append(line)
s.bytes += size
while s.lines.count - s.head > maxLines || s.bytes > maxBytes, s.head < s.lines.count {
s.bytes -= s.lines[s.head].utf8.count
s.head += 1
s.dropped += 1
}
if s.head > 0, s.head * 2 >= s.lines.count {
s.lines.removeFirst(s.head)
s.head = 0
}
}
}
/// The ring rendered as one text bundle, oldest first, prefixed by `header` (the app's own
/// identity line name, version, platform) and an eviction note when the ring wrapped.
public static func render(header: String) -> String {
lock.withLock { s in
var out = header + "\n"
if s.dropped > 0 {
out += "\(s.dropped) older lines evicted from the ring …\n"
}
for line in s.lines[s.head...] {
out += line
out += "\n"
}
return out
}
}
/// The bundle's first line: `punktfunk-apple 0.31.0 (42) (iOS 26.0.0 arm64; Apple TV) client
/// log bundle` the same shape as the session client's, so the host's log page reads them alike.
public static func header() -> String {
let info = Bundle.main.infoDictionary
let version = info?["CFBundleShortVersionString"] as? String ?? "dev"
let build = info?["CFBundleVersion"] as? String
let os = ProcessInfo.processInfo.operatingSystemVersion
#if os(macOS)
let platform = "macOS"
#elseif os(tvOS)
let platform = "tvOS"
#elseif os(iOS)
let platform = "iOS"
#else
let platform = "apple"
#endif
#if arch(arm64)
let arch = "arm64"
#else
let arch = "x86_64"
#endif
let v = build.map { "\(version) (\($0))" } ?? version
return "punktfunk-apple \(v) (\(platform) \(os.majorVersion).\(os.minorVersion).\(os.patchVersion) "
+ "\(arch); \(DeviceName.kind)) — client log bundle"
}
/// `2026-08-15T12:03:47.123Z` wall time, so a bundle correlates with the host log it lands
/// next to (the session client's `wallclock`).
static func stamp(_ date: Date = Date()) -> String {
Date.ISO8601FormatStyle(includingFractionalSeconds: true).format(date)
}
}
/// Drop-in for `Logger(subsystem: "io.unom.punktfunk", category:)`: the same call shape (string
/// interpolation with `privacy:`/`format:` options), forwarded to os_log AND noted in
/// `ClientLogRing`. Interpolated values are rendered in the clear in both places the unified log
/// was already being read with the app attached, and the ring only ever leaves the device by an
/// explicit "Send logs to host" to a host the user paired with.
public struct ClientLog: Sendable {
public let category: String
private let logger: Logger
public init(category: String) {
self.category = category
self.logger = Logger(subsystem: "io.unom.punktfunk", category: category)
}
/// os_log only see the file comment for why debug stays out of the ring.
public func debug(_ message: ClientLogMessage) {
logger.debug("\(message.text, privacy: .public)")
}
public func info(_ message: ClientLogMessage) {
logger.info("\(message.text, privacy: .public)")
note("INFO", message.text)
}
public func notice(_ message: ClientLogMessage) {
logger.notice("\(message.text, privacy: .public)")
note("INFO", message.text)
}
public func warning(_ message: ClientLogMessage) {
logger.warning("\(message.text, privacy: .public)")
note("WARN", message.text)
}
public func error(_ message: ClientLogMessage) {
logger.error("\(message.text, privacy: .public)")
note("ERROR", message.text)
}
public func fault(_ message: ClientLogMessage) {
logger.fault("\(message.text, privacy: .public)")
note("ERROR", message.text)
}
private func note(_ level: String, _ text: String) {
ClientLogRing.note("\(ClientLogRing.stamp()) \(level.padding(toLength: 5, withPad: " ", startingAt: 0)) \(category) \(text)")
}
}
/// The interpolated message: accepts the `OSLogMessage` options the call sites use (`privacy:`,
/// `format:`) so swapping `Logger` for `ClientLog` touches one declaration per file, not every
/// log line. Privacy is accepted and ignored (see `ClientLog`); `.fixed(precision:)` is honoured.
public struct ClientLogMessage: ExpressibleByStringInterpolation, ExpressibleByStringLiteral, Sendable {
public let text: String
public init(stringLiteral value: String) { text = value }
public init(stringInterpolation: StringInterpolation) { text = stringInterpolation.out }
public struct StringInterpolation: StringInterpolationProtocol, Sendable {
var out = ""
public init(literalCapacity: Int, interpolationCount: Int) {
out.reserveCapacity(literalCapacity + interpolationCount * 8)
}
public mutating func appendLiteral(_ literal: String) { out += literal }
public mutating func appendInterpolation<T>(_ value: T, privacy: OSLogPrivacy = .auto) {
out += String(describing: value)
}
public mutating func appendInterpolation<T: BinaryFloatingPoint>(
_ value: T, format: ClientLogFloatFormat, privacy: OSLogPrivacy = .auto
) {
switch format {
case .fixed(let precision):
out += String(format: "%.\(precision)f", Double(value))
}
}
}
}
/// The one float format the call sites use. `OSLogFloatFormatting` cannot be pattern-matched, so
/// the message type names its own same spelling at the call site: `format: .fixed(precision: 2)`.
public enum ClientLogFloatFormat: Sendable {
case fixed(precision: Int)
}
@@ -0,0 +1,39 @@
// The Rust core's log lines, routed into `ClientLog` (os_log + the send-to-host ring).
//
// The core logs through `tracing`. The desktop and Android shells install a subscriber/logger and
// see those lines; this app never did, so every transport warning (socket-buffer clamp, QoS
// refusal), every quinn connection event and every rustls handshake note vanished, and a bundle
// sent to the host carried the Swift half of the story only. `punktfunk_set_log_callback`
// (ABI v25) hands them to the C callback below, which files each under a `core.<crate>` category.
import Foundation
import PunktfunkCore
public enum CoreLog {
/// Install once at launch. Levels above `maxLevel` (1 = error 5 = trace) are not even
/// formatted on the Rust side. Info is the ceiling on purpose: quinn's debug/trace is
/// per-packet and would churn the ring the same gate the session client's ring applies.
/// `PUNKTFUNK_CORE_LOG_LEVEL=4` raises it for a debugging session.
public static func install() {
let level = UInt8(ProcessInfo.processInfo.environment["PUNKTFUNK_CORE_LOG_LEVEL"] ?? "") ?? 3
let status = punktfunk_set_log_callback(level, { level, target, message, _ in
// Called from whichever Rust thread logged copy both C strings out before anything
// else, then hand off to ClientLog, which is cheap (one lock + os_log) and thread-safe.
let target = target.map { String(cString: $0) } ?? "core"
let message = message.map { String(cString: $0) } ?? ""
// The crate (first path segment) becomes the category; the full target stays in the
// line, so `quinn::connection` reads as `core.quinn quinn::connection `.
let crate_ = target.split(separator: ":", maxSplits: 1).first.map(String.init) ?? target
let log = ClientLog(category: "core.\(crate_)")
switch level {
case 1: log.error("\(target, privacy: .public) \(message, privacy: .public)")
case 2: log.warning("\(target, privacy: .public) \(message, privacy: .public)")
case 3: log.info("\(target, privacy: .public) \(message, privacy: .public)")
default: log.debug("\(target, privacy: .public) \(message, privacy: .public)")
}
}, nil)
if status != PUNKTFUNK_STATUS_OK.rawValue {
ClientLog(category: "core").warning("core log callback not installed: status \(status)")
}
}
}
@@ -21,7 +21,7 @@ import Metal
import QuartzCore
import os
private let presenterLog = Logger(subsystem: "io.unom.punktfunk", category: "presenter")
private let presenterLog = ClientLog(category: "presenter")
#if os(macOS)
/// HOW a windowed (composited) macOS session pushes finished frames to glass the DCP
@@ -34,7 +34,7 @@ import Foundation
import Metal
import os
private let waveletLog = Logger(subsystem: "io.unom.punktfunk", category: "pyrowave")
private let waveletLog = ClientLog(category: "pyrowave")
/// The per-(component, level, band) 32x32-block table the exact Swift port of
/// `WaveletBuffers::init_block_meta` (pyrowave_common.cpp): the walk order (level 40,
@@ -56,9 +56,9 @@ let presentDebug = ProcessInfo.processInfo.environment["PUNKTFUNK_PRESENT_DEBUG"
/// SessionModel "stats" mirror's sibling, so DEADLINE sessions stream their pacing decomposition
/// to Console.app wirelessly with no env var / Xcode attach. Always on for deadline pacing (the
/// stats are a few arrays + one log line per second); other pacings keep the env-gated print.
private let presentLog = Logger(subsystem: "io.unom.punktfunk", category: "present")
private let presentLog = ClientLog(category: "present")
/// Pump-side events (loss recovery, format seeding) the stage-2 sibling of StreamPump's log.
private let pumpLog = Logger(subsystem: "io.unom.punktfunk", category: "pump")
private let pumpLog = ClientLog(category: "pump")
/// Decoded-frame hand-off between the decode half and the render thread. The POLICY is the
/// user's presentation intent (design/apple-presentation-rebuild.md the 2026-07 rebuild that
@@ -8,7 +8,7 @@ import AVFoundation
import Foundation
import os
private let pumpLog = Logger(subsystem: "io.unom.punktfunk", category: "video")
private let pumpLog = ClientLog(category: "video")
/// One pump per instance; create a fresh StreamPump per start (the stop is permanent
/// a restart hands the old pump its own token, so it can never be revived by a newer start()).
@@ -26,7 +26,7 @@ import os
/// Same diagnostic switch as InputCapture: PUNKTFUNK_INPUT_DEBUG=1 logs when the macOS
/// NSEvent mouse monitor (relative motion + buttons) is installed/removed, so the user can
/// confirm the new motion path is actually live for a session.
private let streamInputLog = Logger(subsystem: "io.unom.punktfunk", category: "input")
private let streamInputLog = ClientLog(category: "input")
private let streamInputDebug =
ProcessInfo.processInfo.environment["PUNKTFUNK_INPUT_DEBUG"] == "1"
@@ -47,7 +47,7 @@ import AVKit // AVDisplayManager — the per-session display-mode (HDR10/refresh
/// resolved pointer-lock state each time capture engages, so the user can see whether the
/// scene actually locked (GCMouse only delivers deltas while it did) or whether we're on
/// the touch fallback.
private let iosInputLog = Logger(subsystem: "io.unom.punktfunk", category: "input")
private let iosInputLog = ClientLog(category: "input")
private let iosInputDebug = ProcessInfo.processInfo.environment["PUNKTFUNK_INPUT_DEBUG"] == "1"
public struct StreamView: UIViewControllerRepresentable {
@@ -684,6 +684,173 @@ final class AudioRingDriftTests: XCTestCase {
XCTAssertTrue(scratch.contains { $0 != 0 }, "refilled to target — playback resumes")
}
// MARK: - Sync-driven DEEPENING: the insert, the mirror of the shed
//
// The Swift half of core's insert tests (`a_sync_request_for_more_depth_*`,
// `growth_not_banked_still_re_primes`, `crossfade_insert_*`). Same vectors, same bounds: the
// ring could lower its depth gently but could only RAISE it by de-priming, and a sync request
// for a deeper ring made it `hollow` at once so the next single late packet was a full
// re-prime's worth of silence. Now one crossfaded frame per sustain window, both directions.
/// A primed ring asked for +30 ms is NOT hollow (`hollow` is judged against the adaptive
/// target), so one short read leaves it primed; and once the average has sat below the request
/// for `insertSustainMS` of consumed audio, exactly one frame is duplicated. Mirrors
/// `a_sync_request_for_more_depth_never_de_primes`.
func testASyncRequestForMoreDepthNeverDeprimes() {
let ring = AudioRing(seconds: 1, channels: channels, rateHz: 48_000)
let want = 5 * perMS
var scratch = [Float](repeating: 0, count: want)
let feed = [Float](repeating: 0.5, count: 60 * perMS)
func write(ms: Int) {
feed.withUnsafeBufferPointer { ring.write($0.baseAddress!, count: ms * perMS) }
}
func read() {
scratch.withUnsafeMutableBufferPointer { ring.read(into: $0.baseAddress!, count: want) }
}
// Prime at the 20 ms base and hold the depth there for 100 ms.
write(ms: 25); read()
XCTAssertTrue(scratch.contains { $0 != 0 }, "25 ms primes the base")
ring.setSyncTarget(50 * perMS)
for _ in 0..<20 { write(ms: 5); read() }
// ONE late packet: four reads drain the 20 ms exactly, the fifth runs short. Before the fix
// the sync-inflated target made the ring hollow and this single click re-primed it.
for _ in 0..<5 { read() }
XCTAssertEqual(ring.stats.underruns, 1, "exactly one short read")
// Refill to the base. A de-primed ring would need the full 50 ms request before it
// played again and would answer this with silence.
write(ms: 25); read()
XCTAssertTrue(
scratch.contains { $0 != 0 },
"a single short read on a sync-deepened ring must keep the hysteresis, not de-prime")
// Steady at 20 ms again; the insert arms once the sustain window (counted since the
// request, ~130 ms of it already spent above) is full, and adds exactly one frame.
let before = ring.bufferedSamples
var firstInsertAtMS: Int?
for step in 0..<800 { // 4 s
write(ms: 5); read()
if firstInsertAtMS == nil, ring.stats.inserts > 0 { firstInsertAtMS = step * 5 }
}
guard let first = firstInsertAtMS else { return XCTFail("the insert never armed") }
XCTAssertGreaterThanOrEqual(first, 2_000 - 200, "armed before the sustain window")
XCTAssertLessThanOrEqual(first, 2_000 + 500, "armed long after the sustain window")
XCTAssertEqual(ring.stats.underruns, 1, "the deepening cost no clicks")
// One frame per sustain window: two of them in four seconds, each exactly a frame deep.
XCTAssertEqual(ring.stats.inserts, 2)
XCTAssertEqual(ring.bufferedSamples - before, 2 * ring.frameGeometry.frame)
}
/// The clean-link half of core's `a_sync_request_for_more_depth_deepens_without_a_de_prime_
/// on_a_clean_link`: sync asks for +20 ms, and the answer is a few inserts over a few seconds
/// with NO silent callback at all.
func testASyncRequestForMoreDepthDeepensWithoutADeprimeOnACleanLink() {
let ring = AudioRing(seconds: 1, channels: channels, rateHz: 48_000)
let want = 5 * perMS
var scratch = [Float](repeating: 0, count: want)
let feed = [Float](repeating: 0.5, count: 60 * perMS)
func write(ms: Int) {
feed.withUnsafeBufferPointer { ring.write($0.baseAddress!, count: ms * perMS) }
}
func read() {
scratch.withUnsafeMutableBufferPointer { ring.read(into: $0.baseAddress!, count: want) }
}
write(ms: 25); read()
ring.setSyncTarget(40 * perMS)
var silent = 0
var settledAtMS: Int?
for step in 0..<12_000 { // 60 s
write(ms: 5); read()
if scratch.allSatisfy({ $0 == 0 }) { silent += 1 }
// Settled once the ring holds the request minus the margin (5 ms), post-read.
if settledAtMS == nil, ring.bufferedMS >= 40 - 5 - 5 { settledAtMS = step * 5 }
}
XCTAssertEqual(silent, 0, "a clean link must stay silence-free")
XCTAssertEqual(ring.stats.underruns, 0)
XCTAssertGreaterThan(ring.stats.inserts, 0, "the deepening has to come from somewhere")
XCTAssertLessThanOrEqual(ring.stats.inserts, 8, "the insert kept firing once deep enough")
if let settledAtMS {
XCTAssertLessThanOrEqual(settledAtMS, 20_000, "deepening by 20 ms took \(settledAtMS) ms")
} else {
XCTFail("the ring never reached the sync target")
}
}
/// The seam of the insert, heard end to end: fill the ring with a ramp (any splice is a
/// visible jump), let one insert fire, and check every step of the PLAYED stream including
/// the one into the duplicated frame and the one out of it stays inside the fade's slope.
/// Mirrors `crossfade_insert_adds_exactly_one_frame_and_the_seam_is_continuous`.
func testTheInsertSeamIsContinuousInWhatIsPlayed() {
let ring = AudioRing(seconds: 1, channels: channels, rateHz: 48_000)
let want = 5 * perMS
var scratch = [Float](repeating: 0, count: want)
var next: Float = 1_000 // the ramp: +1 per interleaved sample
func write(ms: Int) {
var chunk = [Float](repeating: 0, count: ms * perMS)
for i in 0..<chunk.count { chunk[i] = next; next += 1 }
chunk.withUnsafeBufferPointer { ring.write($0.baseAddress!, count: chunk.count) }
}
var played: [Float] = []
func read() {
scratch.withUnsafeMutableBufferPointer { ring.read(into: $0.baseAddress!, count: want) }
played.append(contentsOf: scratch)
}
write(ms: 25); read()
ring.setSyncTarget(35 * perMS)
// Run until exactly one insert has happened, then a little past it.
var steps = 0
while ring.stats.inserts < 1, steps < 1_000 { write(ms: 5); read(); steps += 1 }
XCTAssertEqual(ring.stats.inserts, 1, "expected exactly one insert by now")
for _ in 0..<10 { write(ms: 5); read() }
XCTAssertEqual(ring.stats.underruns, 0)
// A duplicated 5 ms frame with a 2 ms fade: the seam smears 480 samples of ramp over
// 192, so |step| 480/192 + 1 3.5. A hard splice would step by 480.
let (frame, fade) = ring.frameGeometry
let maxSlope = Float(frame) / Float(fade) + 2
var worst: Float = 0
for i in 1..<played.count { worst = max(worst, abs(played[i] - played[i - 1])) }
XCTAssertLessThanOrEqual(worst, maxSlope, "a step of \(worst) is a splice, not a fade")
// And exactly one frame was added: everything written is either played or still buffered,
// plus the one duplicated frame.
let written = Int(next - 1_000)
XCTAssertEqual(played.count, written + frame - ring.bufferedSamples, "not exactly +1 frame")
}
/// The DROP's seam, checked the same way against the sample the device played just before
/// it. This is the check the fade never had, and the one the old tail-sourced fade-out failed
/// by a step of `drop fade` samples. Driven through the hard-cap trim, which is the drop
/// that actually fires in the field. Mirrors `crossfade_drop_is_continuous_with_what_was_just_
/// played`.
func testTheDropSeamIsContinuousWithWhatWasJustPlayed() {
let ring = AudioRing(seconds: 1, channels: channels, rateHz: 48_000)
let want = 5 * perMS
var scratch = [Float](repeating: 0, count: want)
var next: Float = 1_000
func write(ms: Int) {
var chunk = [Float](repeating: 0, count: ms * perMS)
for i in 0..<chunk.count { chunk[i] = next; next += 1 }
chunk.withUnsafeBufferPointer { ring.write($0.baseAddress!, count: chunk.count) }
}
var played: [Float] = []
func read() {
scratch.withUnsafeMutableBufferPointer { ring.read(into: $0.baseAddress!, count: want) }
played.append(contentsOf: scratch)
}
// Prime and play one callback, so "the sample just played" is a real one.
write(ms: 25); read()
// A 60 ms burst lands on the 20 ms left: 80 ms > the 50 ms cap, so 30 ms is trimmed off
// the FRONT right behind the sample just played with a 2 ms fade.
write(ms: 60)
read(); read()
let (_, fade) = ring.frameGeometry
let drop = 30 * perMS
let maxSlope = Float(drop) / Float(fade) + 2
var worst: Float = 0
for i in 1..<played.count { worst = max(worst, abs(played[i] - played[i - 1])) }
XCTAssertLessThanOrEqual(
worst, maxSlope,
"a step of \(worst) across the trim is a splice, not a fade (the old fade-out source "
+ "would step by \(drop - fade))")
}
/// The four client rings adopt sync one at a time; an un-wired one must behave exactly as it
/// did. `nil` is the default, so this pins the initializer too and every other test in this
/// file runs without a sync target, which is the real guard that nothing moved underneath them.
@@ -0,0 +1,69 @@
// The client log ring behind "Send logs to host", and the POST framing that carries it.
import XCTest
@testable import PunktfunkKit
final class ClientLogTests: XCTestCase {
/// The ring is process-global, so this single test owns the whole lifecycle (parallel tests
/// over one global would interleave) the same shape as `pf_client_core::logring`'s test.
func testRingBoundsAndRendersWithEvictionNote() {
let marker = "ringtest-\(ProcessInfo.processInfo.processIdentifier)"
for i in 0..<(ClientLogRing.maxLines + 10) {
ClientLogRing.note("\(marker) line \(i)")
}
let text = ClientLogRing.render(header: "punktfunk-apple test")
XCTAssertTrue(text.hasPrefix("punktfunk-apple test\n"))
XCTAssertTrue(text.contains("older lines evicted from the ring"))
XCTAssertFalse(text.contains("\n\(marker) line 0\n"), "oldest line survived eviction")
XCTAssertTrue(text.hasSuffix("\(marker) line \(ClientLogRing.maxLines + 9)\n"))
XCTAssertLessThanOrEqual(text.utf8.count, ClientLogRing.maxBytes + 256)
// A pathological line is truncated, not ring-flushing and cut safely mid-scalar.
ClientLogRing.note(String(repeating: "é", count: 10_000))
let after = ClientLogRing.render(header: "h")
XCTAssertTrue(after.contains(""))
XCTAssertTrue(after.hasSuffix("\n"))
// The drop-in logger formats `stamp LEVEL category message` and honours the OSLogMessage
// options the call sites use; debug stays out of the ring.
let log = ClientLog(category: "test")
log.info("\(marker) value \(1.23456, format: .fixed(precision: 2)) \(42, privacy: .public)")
log.debug("\(marker) debug-only")
let lines = ClientLogRing.render(header: "h").components(separatedBy: "\n")
let info = lines.last { $0.contains("\(marker) value") }
XCTAssertNotNil(info)
XCTAssertTrue(info!.contains(" INFO test \(marker) value 1.23 42"), info!)
// `2026-08-15T12:03:47.123Z ` leads wall time, so a bundle lines up with the host log.
XCTAssertNotNil(
info!.range(of: #"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z INFO test "#, options: .regularExpression),
info!)
XCTAssertFalse(lines.contains { $0.contains("debug-only") })
}
func testHeaderNamesTheAppAndPlatform() {
let header = ClientLogRing.header()
XCTAssertTrue(header.hasPrefix("punktfunk-apple "))
XCTAssertTrue(header.hasSuffix(" — client log bundle"))
#if os(macOS)
XCTAssertTrue(header.contains("macOS"))
#endif
}
func testPostIsLengthFramedAndGetHasNoBody() {
let body = Data("hello ring\n".utf8)
let post = String(decoding: MgmtConnection.requestBytes(
host: "fd00::1", port: 47990, method: "POST", path: "/api/v1/client-logs",
body: body, contentType: "text/plain; charset=utf-8"), as: UTF8.self)
XCTAssertTrue(post.hasPrefix("POST /api/v1/client-logs HTTP/1.1\r\nHost: [fd00::1]:47990\r\n"))
XCTAssertTrue(post.contains("\r\nContent-Type: text/plain; charset=utf-8\r\n"))
XCTAssertTrue(post.contains("\r\nContent-Length: \(body.count)\r\n\r\nhello ring\n"))
XCTAssertTrue(post.hasSuffix("\r\n\r\nhello ring\n"))
let get = String(decoding: MgmtConnection.requestBytes(
host: "192.168.1.2", port: 47990, method: "GET", path: "/api/v1/library",
body: nil, contentType: nil), as: UTF8.self)
XCTAssertTrue(get.hasPrefix("GET /api/v1/library HTTP/1.1\r\nHost: 192.168.1.2:47990\r\n"))
XCTAssertFalse(get.contains("Content-Length"))
XCTAssertTrue(get.hasSuffix("\r\n\r\n"))
}
}
@@ -106,6 +106,25 @@ final class CommandChordTests: XCTestCase {
XCTAssertEqual(InputCapture.keyCodeToVK[leftArrow], 0x25) // VK_LEFT
}
/// The system-shortcut tap (Space, Tab the keys macOS claims before the app sees them)
/// takes keys off the system ONLY while captured, under the capture mouse model, with the app
/// frontmost. Any other state must pass through: a tap that eats keys for the whole Mac is the
/// failure to pin here.
func testTheSystemShortcutTapOnlyClaimsWhileCapturedAndFrontmost() {
XCTAssertTrue(InputCapture.tapClaims(forwarding: true, desktopMouse: false, appActive: true))
XCTAssertFalse(InputCapture.tapClaims(forwarding: false, desktopMouse: false, appActive: true))
XCTAssertFalse(InputCapture.tapClaims(forwarding: true, desktopMouse: true, appActive: true))
XCTAssertFalse(InputCapture.tapClaims(forwarding: true, desktopMouse: false, appActive: false))
}
/// The keys the tap exists for must have host VKs it reposts them into the ordinary key path,
/// which drops unmapped keyCodes on the floor.
func testTheSystemShortcutKeysMapToHostVKs() {
XCTAssertEqual(InputCapture.keyCodeToVK[49], 0x20) // Space (Space)
XCTAssertEqual(InputCapture.keyCodeToVK[48], 0x09) // Tab (Tab)
XCTAssertEqual(InputCapture.keyCodeToVK[126], 0x26) // Up arrow ( Mission Control)
}
private func keyEvent(_ keyCode: UInt16, _ flags: NSEvent.ModifierFlags) -> NSEvent? {
NSEvent.keyEvent(
with: .keyDown, location: .zero, modifierFlags: flags, timestamp: 0,
+9
View File
@@ -81,6 +81,15 @@ WHY THE APP ASKS FOR WHAT IT ASKS FOR
- network.server (macOS): the app is outbound-only, but the App Sandbox gates bind() itself. Our
QUIC endpoint and UDP socket each bind a local port to receive host-to-client datagrams;
without this, no video, audio or rumble arrives.
- Accessibility (macOS, optional, never requested unprompted): "Capture system shortcuts" in
Settings > Input lets ⌘Space, ⌘Tab and Mission Control reach the remote desktop instead of the
Mac while the stream has captured the keyboard -- the same thing every remote-desktop/VM app
offers. macOS delivers those keys to Spotlight/the Dock before any app, so the only way to
receive them is a keyboard event tap, which needs Accessibility. The prompt appears only when
the user turns the toggle on or presses "Allow Accessibility access…"; the tap exists only while
a stream has the keyboard captured and the app is frontmost, and it reads nothing -- keys are
handed to the app's own stream window, never logged or stored. Without the grant, the toggle
still works for the app's own ⌘ shortcuts and simply says the system ones need Accessibility.
- UIBackgroundModes "audio" (iPhone/iPad): a session carries real, audible audio from the host,
and this keeps it alive if the user steps away briefly. Backgrounded, video decoding stops, only
the real audio keeps rendering, and a bounded timer disconnects automatically. We never play
+18 -5
View File
@@ -370,15 +370,26 @@ from the config directory for a true factory reset."
.unwrap_or(DISCOVER_DEFAULT_SECS)
.min(DISCOVER_MAX_SECS);
let found = pf_client_core::discovery::discover_for(Duration::from_secs_f64(secs));
// `read`, not `load`: this verb only LOOKS at the records to annotate what it found, and
// never hands their ids back. `load` would mint ids for a pre-mint store and save them
// a write from a read-only verb, and one that races the `hosts list` a caller is very
// likely running at the same moment (the Decky panel issues both together).
// `read`, not `load`: this verb never hands a record's id back, so it has no business
// MINTING one. `load` would mint ids for a pre-mint store and save them, racing the
// `hosts list` a caller is very likely running at the same moment (the Decky panel issues
// both together) — after which the ids one of them already handed out no longer resolve.
let known = KnownHosts::read();
let rows: Vec<(
&pf_client_core::discovery::DiscoveredHost,
Option<&KnownHost>,
)> = found.iter().map(|d| (d, match_saved(&known, d))).collect();
// The one write this verb does make, and why it doesn't contradict the above: an advert
// is the only place a host's wake MAC is ever published, and this verb is the only one
// the Decky panel runs that ever sees one. Without it a Deck in Gaming Mode never learns
// a MAC at all and Wake-on-LAN cannot fire, with nothing to show for it (#322).
// `learn_from_advert` mints nothing either, and writes only when an advert genuinely
// taught the record something new — so a steady-state panel refresh touches no disk.
for (d, saved) in &rows {
if let Some(k) = saved {
trust::learn_from_advert(&k.fp_hex, &k.addr, k.port, &d.mac, &d.os, d.mgmt_port);
}
}
if has(args, "--json") {
let hosts: Vec<serde_json::Value> = rows
.iter()
@@ -733,7 +744,9 @@ from the config directory for a true factory reset."
};
let host = &known.hosts[i];
if host.mac.is_empty() {
eprintln!("no Wake-on-LAN address known for {} — connect to it once while it's awake so the client can learn it", host.name);
// A MAC is learned from the host's mDNS advert, never from a connect — say so, since
// "connect to it once" sent at least one Deck owner looking in the wrong place (#322).
eprintln!("no Wake-on-LAN address known for {} — run `punktfunk discover` while it's awake (the Deck panel does this every time it opens) so the client learns it from the host's advert", host.name);
return UNRESOLVED;
}
if !has(args, "--wait") {
+14 -27
View File
@@ -1087,33 +1087,20 @@ impl HostsPage {
// Online = advertising on mDNS OR proven reachable by the last probe sweep.
let online = self.adverts.values().any(|a| matches(k, a))
|| self.probed.get(&saved_key(k)).copied().unwrap_or(false);
// Learn this host's wake MAC(s) from its live advert while it's online.
if let Some(a) = self
.adverts
.values()
.find(|a| matches(k, a) && !a.mac.is_empty())
{
crate::trust::learn_mac(&k.fp_hex, &k.addr, k.port, &a.mac);
}
// Same for its OS chain — the icon then survives the host going offline.
if let Some(a) = self
.adverts
.values()
.find(|a| matches(k, a) && !a.os.is_empty())
{
crate::trust::learn_os(&k.fp_hex, &k.addr, k.port, &a.os);
}
// Same for its management port — and this one is not cosmetic: without it a host
// that moved off 47990 loses its library the moment mDNS is unavailable, because
// the advert was the only place the real port ever lived.
if let Some(a) = self
.adverts
.values()
.find(|a| matches(k, a) && a.mgmt_port.is_some())
{
if let Some(p) = a.mgmt_port {
crate::trust::learn_mgmt_port(&k.fp_hex, &k.addr, k.port, p);
}
// Learn what this host's live advert teaches while it's online: its wake MAC(s),
// its OS chain (so the icon survives it going offline), and its management port
// — the last one not cosmetic, since a host that moved off 47990 loses its
// library the moment mDNS is unavailable and the advert is the only place the
// real port ever lived.
if let Some(a) = self.adverts.values().find(|a| matches(k, a)) {
crate::trust::learn_from_advert(
&k.fp_hex,
&k.addr,
k.port,
&a.mac,
&a.os,
a.mgmt_port,
);
}
saved.push_back(HostCard {
connecting: self.connecting.as_deref() == Some(k.fp_hex.as_str()),
+30 -3
View File
@@ -53,9 +53,9 @@ use punktfunk_core::config::Role;
use punktfunk_core::input::{InputEvent, InputKind};
use punktfunk_core::packet::FLAG_PROBE;
use punktfunk_core::quic::{
endpoint, io, window_loss_ppm, BitrateChanged, CursorRenderMode, Hello, LossReport,
ProbeRequest, ProbeResult, Reconfigure, Reconfigured, RequestKeyframe, SetBitrate, Start,
Welcome,
endpoint, io, window_loss_ppm, BitrateChanged, CursorRenderMode, DeliveryReport, Hello,
LossReport, ProbeRequest, ProbeResult, Reconfigure, Reconfigured, RequestKeyframe, SetBitrate,
Start, Welcome,
};
use punktfunk_core::transport::UdpTransport;
use punktfunk_core::{CompositorPref, Mode, PunktfunkError, Session};
@@ -987,10 +987,18 @@ async fn session(args: Args) -> Result<()> {
let mut ls = send;
let lp = loss_ppm.clone();
let df = dropped_frames.clone();
// Delivery truth for the host's dead-data-plane check: report what actually landed on the
// wire, so the probe reproduces a real client's answer rather than the "cannot answer"
// sentinel — which is exactly what makes it usable for testing that path.
let rxp = rx_wire_packets.clone();
tokio::spawn(async move {
use std::sync::atomic::Ordering::Relaxed;
let mut last_report = std::time::Instant::now();
let mut last_dropped = 0u64;
// Mirrors the real clients' rule (see `pump/data.rs`): report the delivery count every
// window while it is zero, once when the first packets land, then stop — so a host that
// predates the message is not flooded with "unknown control message" on a good session.
let mut delivery_confirmed = false;
loop {
tokio::time::sleep(std::time::Duration::from_millis(100)).await;
let d = df.load(Relaxed);
@@ -1007,6 +1015,25 @@ async fn session(args: Args) -> Result<()> {
if last_report.elapsed() >= std::time::Duration::from_millis(750) {
last_report = std::time::Instant::now();
let v = lp.swap(u32::MAX, Relaxed);
// Independent of whether there is a fresh loss sample: "no fresh sample" is
// exactly the shape a dead data plane has, so gating it on one would silence
// it in the state it exists to report.
let received = rxp.load(Relaxed);
if received == 0 || !delivery_confirmed {
delivery_confirmed = received > 0;
if io::write_msg(
&mut ls,
&DeliveryReport {
packets_received: received,
}
.encode(),
)
.await
.is_err()
{
break; // control stream gone
}
}
if v != u32::MAX
&& io::write_msg(&mut ls, &LossReport { loss_ppm: v }.encode())
.await
+57 -6
View File
@@ -82,6 +82,7 @@ pub fn run(target: Option<&str>) -> u8 {
.or_else(|| k.and_then(|h| h.mgmt_port))
.unwrap_or(library::DEFAULT_MGMT_PORT),
can_wake: false,
clipboard_sync: k.is_some_and(|h| h.clipboard_sync),
last_used: k.and_then(|h| h.last_used),
os: k.map(|h| h.os.clone()).unwrap_or_default(),
pin: None,
@@ -336,6 +337,7 @@ fn fake_host_row() -> HostRow {
online: true,
mgmt_port: library::DEFAULT_MGMT_PORT,
can_wake: false,
clipboard_sync: false,
last_used: None,
os: "linux/arch/steamos".into(),
pin: None,
@@ -667,9 +669,12 @@ impl ServiceState {
r.request();
}
}
// A platform-native screen (Android's Controllers/Licences views) — the desktop
// shell has no such rows, so this never arrives here.
// A platform-native screen (Android's Licences view) — the desktop shell has no
// such row, so this never arrives here.
ConsoleCmd::OpenPlatformScreen { .. } => {}
// Grants and rumble tests from the controllers screen. Android-only for the same
// reason: the settings row that opens that screen is not on the desktop's list.
ConsoleCmd::PadAction { .. } => {}
ConsoleCmd::SetPin {
key,
profile_id,
@@ -695,6 +700,40 @@ impl ServiceState {
// `run` refreshes the rows right after this drain, so the carousel and
// the pin screen reflect the new card within the same service pass.
}
ConsoleCmd::BindProfile { key, profile_id } => {
// The BINDING half of the profile pair — `KnownHost::profile_id`, what a
// plain A-press on the primary tile connects with. `SetPin` above is the
// presentation half and never touches this field; this never touches the
// pins. Same store discipline, same refresh-after-drain.
let mut known = trust::KnownHosts::load();
let idx = index_for_key(&known, &key);
let Some(h) = idx.and_then(|i| known.hosts.get_mut(i)) else {
tracing::warn!(%key, "profile bind for an unknown host — ignoring");
return;
};
if h.profile_id != profile_id {
h.profile_id = profile_id;
if let Err(e) = known.save() {
tracing::warn!(error = %format!("{e:#}"), "saving known hosts");
}
}
}
ConsoleCmd::SetClipboard { key, on } => {
// Per-host clipboard trust (`KnownHost::clipboard_sync`) — the host
// menu's toggle. Same store discipline as the two arms above.
let mut known = trust::KnownHosts::load();
let idx = index_for_key(&known, &key);
let Some(h) = idx.and_then(|i| known.hosts.get_mut(i)) else {
tracing::warn!(%key, "clipboard toggle for an unknown host — ignoring");
return;
};
if h.clipboard_sync != on {
h.clipboard_sync = on;
if let Err(e) = known.save() {
tracing::warn!(error = %format!("{e:#}"), "saving known hosts");
}
}
}
}
}
@@ -761,11 +800,21 @@ impl ServiceState {
|| (d.addr == h.addr && d.port == h.port)
});
let online = advert.is_some() || probed.get(&key).copied().unwrap_or(false);
// Write the advertised mgmt port down while the host is visible, so this console
// keeps working against a moved port once it is not. No-op (and no disk write)
// Write down everything the advert teaches while the host is visible: the mgmt
// port (so this console keeps working against a moved one once it is not), the
// OS chain, and the wake MAC — which matters most here, because this console and
// the Decky panel are the only surfaces a Deck in Gaming Mode ever runs, and a
// record that never learned a MAC can never be woken. No-op (and no disk write)
// when unchanged, so this is safe on every refresh tick.
if let Some(p) = advert.and_then(|d| d.mgmt_port) {
pf_client_core::trust::learn_mgmt_port(&h.fp_hex, &h.addr, h.port, p);
if let Some(a) = advert {
pf_client_core::trust::learn_from_advert(
&h.fp_hex,
&h.addr,
h.port,
&a.mac,
&a.os,
a.mgmt_port,
);
}
let row = HostRow {
key: key.clone(),
@@ -784,6 +833,7 @@ impl ServiceState {
.or(h.mgmt_port)
.unwrap_or(library::DEFAULT_MGMT_PORT),
can_wake: !online && !h.mac.is_empty(),
clipboard_sync: h.clipboard_sync,
last_used: h.last_used,
os: advert
.filter(|d| !d.os.is_empty())
@@ -842,6 +892,7 @@ impl ServiceState {
online: true,
mgmt_port: d.mgmt_port.unwrap_or(library::DEFAULT_MGMT_PORT),
can_wake: false,
clipboard_sync: false,
last_used: None,
os: d.os.clone(),
pin: None,
+23
View File
@@ -840,6 +840,29 @@ mod session_main {
// speaker pair.
let speaker = arg_flag("--speaker");
let coils = arg_flag("--coils") || !speaker;
// Say up front whether a real session would render what this is about to prove
// works. The devtest drives the pad DIRECTLY, so it is deliberately blind to the
// settings — which makes "the tone plays here but the game is silent" a genuinely
// confusing result, and one that has cost a whole debugging evening: the toggle is
// on the client while every instinct sends you measuring the host. The capability
// is never advertised when the toggle is off, so no later log line can catch this.
{
let s = trust::Settings::load();
if speaker && !pf_client_core::pad_audio::speaker_active(&s.pad_speaker) {
println!(
"note: \"Controller speaker\" is OFF in your settings (pad_speaker = \
{:?}), so a streaming session will NOT render the pad's speaker even if \
the tone below is audible.",
s.pad_speaker
);
}
if coils && !s.pad_haptics {
println!(
"note: \"Controller haptics\" is OFF in your settings, so a streaming \
session will NOT render the voice coils even if the tone below is felt."
);
}
}
return match pf_client_core::pad_audio::pad_audio_test(seconds, coils, speaker) {
Ok(()) => 0,
Err(e) => {
+1 -29
View File
@@ -68,7 +68,7 @@ impl<S: tracing::Subscriber> tracing_subscriber::Layer<S> for RingLayer {
event.record(&mut v);
pf_client_core::logring::note(format!(
"{} {:5} {} {}",
wallclock(),
pf_client_core::logring::wallclock(),
meta.level().as_str(),
meta.target(),
v.0
@@ -76,34 +76,6 @@ impl<S: tracing::Subscriber> tracing_subscriber::Layer<S> for RingLayer {
}
}
/// `2026-08-15T12:03:47.123Z` from the system clock — wall time, so a bundle correlates with
/// the host log it lands next to. No chrono dep; same civil-date derivation the host uses.
fn wallclock() -> String {
let ms = std::time::SystemTime::now()
.duration_since(std::time::UNIX_EPOCH)
.map(|d| d.as_millis() as u64)
.unwrap_or(0);
let secs = (ms / 1000) as i64;
let days = secs.div_euclid(86_400);
let tod = secs.rem_euclid(86_400);
// Howard Hinnant's civil_from_days.
let z = days + 719_468;
let era = if z >= 0 { z } else { z - 146_096 }.div_euclid(146_097);
let doe = z - era * 146_097;
let yoe = (doe - doe / 1460 + doe / 36524 - doe / 146_096) / 365;
let y = yoe + era * 400;
let doy = doe - (365 * yoe + yoe / 4 - yoe / 100);
let mp = (5 * doy + 2) / 153;
let d = doy - (153 * mp + 2) / 5 + 1;
let mo = if mp < 10 { mp + 3 } else { mp - 9 };
let y = if mo <= 2 { y + 1 } else { y };
let (h, mi, s) = (tod / 3600, (tod % 3600) / 60, tod % 60);
format!(
"{y:04}-{mo:02}-{d:02}T{h:02}:{mi:02}:{s:02}.{:03}Z",
ms % 1000
)
}
#[cfg(test)]
mod tests {
use super::*;
+7 -4
View File
@@ -33,11 +33,14 @@ the fast **`punktfunk/1`** protocol.
hooks with Moonlight-style capture: Ctrl+Alt+Shift+Q releases the pointer, a click on the stream
re-captures it, and system shortcuts (Alt+Tab, Win, …) can act locally or forward to the host.
Builds and ships for both **x64** and **ARM64** as a signed **MSIX**.
Builds and ships for both **x64** and **ARM64**, three ways from one layout: a signed **installer**
(the default — a per-user setup.exe whose stable install path Steam can launch, so the Steam
overlay and Big Picture work), a **portable zip**, and a signed **MSIX** (kept for Microsoft Store
compatibility).
## Get it
Install the signed MSIX from the package registry — see
Install the signed installer from the package registry — see
**[docs.punktfunk.unom.io/docs/install-client](https://docs.punktfunk.unom.io/docs/install-client)**.
A stock [Moonlight](https://moonlight-stream.org/) client also works over GameStream if you prefer.
@@ -58,7 +61,7 @@ punktfunk-client --headless --speed-test --connect host[:port] # probe burst
```
> `CARGO_HOME` must be an ASCII path — non-ASCII characters break SDL3's MSVC precompiled-header
> build. Packaging (MSIX manifest, signing) lives in [`packaging/`](packaging/).
> build. Packaging (MSIX manifest, the Inno Setup installer, signing) lives in [`packaging/`](packaging/).
## Layout
@@ -79,7 +82,7 @@ src/
trust.rs · discovery.rs persistent identity, TOFU/PIN pairing, mDNS browse
probe.rs · wol.rs speed probe · Wake-on-LAN
logfile.rs log tee to %LOCALAPPDATA%
packaging/ MSIX manifest, signing, pack script
packaging/ MSIX manifest + Inno Setup installer, signing, pack scripts
```
## Manual smoke checklist
+24 -5
View File
@@ -1,11 +1,30 @@
# punktfunk Windows client — MSIX packaging
# punktfunk Windows client — packaging
The Windows client ships as **signed MSIX** packages so Windows boxes get a real package (Start
tile, clean install/uninstall) instead of a loose exe. CI builds + publishes them from
[`.gitea/workflows/windows-client.yml`](../../../.gitea/workflows/windows-client.yml) to Gitea's
The Windows client ships **three ways, packed from one assembled layout** by CI
([`.gitea/workflows/windows-client.yml`](../../../.gitea/workflows/windows-client.yml)) to Gitea's
**generic** package registry (`https://git.unom.io/unom/-/packages`), on every `main` push that
touches the client (canary) and on `vX.Y.Z` release tags (stable) — see
[Release Channels](https://punktfunk.unom.io/docs/channels).
[Release Channels](https://punktfunk.unom.io/docs/channels):
1. **Inno Setup installer** (`punktfunk-client-setup_<arch>.exe`) — the **default download**. A
per-user, no-UAC install to `%LOCALAPPDATA%\Programs\Punktfunk`. It exists because the MSIX
install shape breaks the top user-reported flows: the exe lands under the ACL'd
`C:\Program Files\WindowsApps`, which Steam's *Add a Non-Steam Game* picker can't browse, and
the alias/`shell:AppsFolder` activation defeats the Steam overlay's injection and Big Picture
launch — Steam must spawn the exe itself from a normal path. `punktfunk-client.iss` +
`pack-client-installer.ps1`; it re-creates the manifest's declarative grants per-user
(`punktfunk://` in HKCU Classes, Start shortcuts, `{app}` on the user PATH for the
`punktfunk` CLI) and fetches the Windows App Runtime when missing.
2. **Portable zip** (`punktfunk-client-windows_<arch>-portable.zip`) — the same signed file set,
nothing registered.
3. **Signed MSIX** (`punktfunk-client-windows_<arch>.msix`) — kept for **Microsoft Store**
compatibility. Everything below the fold documents this path.
`pack-msix.ps1` assembles the layout and packs the MSIX; `pack-client-installer.ps1` then consumes
that same `layout/` for the installer + zip (and signs the four exes individually — the MSIX only
signs its container).
# MSIX packaging
**Two architectures, one x64 runner.** Both `x64` and `arm64` packages are produced off the single
x64 Windows runner — `x86_64-pc-windows-msvc` builds natively, `aarch64-pc-windows-msvc` is
@@ -0,0 +1,246 @@
<#
.SYNOPSIS
Pack + sign the punktfunk Windows client as an Inno Setup setup.exe (the default download) and a
portable .zip, from the layout pack-msix.ps1 already assembled.
.DESCRIPTION
Runs AFTER pack-msix.ps1 in the same job and consumes its $OutDir\layout verbatim one assembly,
three artifacts (.msix, setup.exe, portable .zip). Why the installer exists at all: the MSIX
install shape (WindowsApps ACLs + alias-only activation) breaks Steam's non-Steam-game picker,
the Steam overlay's injection, and Big Picture launching — see punktfunk-client.iss's header.
Steps:
1. stage the runtime file set from -LayoutDir (drops AppxManifest.xml + the tile Assets),
2. sign the four exes individually (the MSIX only signs its container),
3. zip the stage -> the portable build,
4. ISCC punktfunk-client.iss over the same stage, sign the setup.exe,
5. emit CLIENT_SETUP_PATH / CLIENT_ZIP_PATH to GITHUB_ENV for the publish step.
Signing backend precedence is identical to pack-msix.ps1 / pack-host-installer.ps1 (Azure
Artifact Signing -> supplied .pfx -> ephemeral self-signed; fail closed on v* tags). No .cer is
exported here: unlike an MSIX, a plain exe RUNS regardless of signer trust an untrusted
signature only costs a SmartScreen warning, so canary self-signed builds need nothing imported.
.EXAMPLE
pwsh -File pack-client-installer.ps1 -Version 0.2.137.0 -Arch x64 `
-LayoutDir C:\t\msix\layout -OutDir C:\t\installer
#>
[CmdletBinding()]
param(
[Parameter(Mandatory = $true)][string]$Version, # 4-part numeric, same as the MSIX
[Parameter(Mandatory = $true)][string]$LayoutDir, # pack-msix.ps1's $OutDir\layout
[ValidateSet('x64', 'arm64')][string]$Arch = 'x64',
[string]$OutDir = (Join-Path (Split-Path -Parent $LayoutDir) 'installer'),
# Subject for the EPHEMERAL self-signed fallback only; Azure/pfx carry their own subjects.
[string]$Publisher = "CN=unom - Enrico B$([char]0xFC)hler, O=unom - Enrico B$([char]0xFC)hler, L=Rottweil, S=Baden-W$([char]0xFC)rttemberg, C=DE",
[string]$PfxBase64 = $env:MSIX_CERT_PFX_B64, # reuse the client's signing secret
[string]$PfxPassword = $env:MSIX_CERT_PASSWORD,
[string]$AzureEndpoint = $env:AZURE_CODESIGNING_ENDPOINT,
[string]$AzureAccount = $env:AZURE_CODESIGNING_ACCOUNT,
[string]$AzureProfile = $env:AZURE_CODESIGNING_PROFILE,
[string]$AzureDlib = $env:AZURE_CODESIGNING_DLIB,
[ValidateSet('auto', 'true', 'false')][string]$RequireSignedCert = 'auto',
[switch]$NoSign # skip signing (local debug)
)
$ErrorActionPreference = 'Stop'
$ProgressPreference = 'SilentlyContinue'
# Keep the "check $LASTEXITCODE myself" model (see pack-host-installer.ps1): pwsh 7.4 must not
# turn a non-zero native exit into a terminating error before Sign-File's timestamp retry runs.
$PSNativeCommandUseErrorActionPreference = $false
if ($Version -notmatch '^\d+\.\d+\.\d+\.\d+$') {
throw "Version must be 4-part numeric (Major.Minor.Build.Revision); got '$Version'."
}
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
$iss = Join-Path $here 'punktfunk-client.iss'
# --- locate ISCC (Inno Setup) + signtool (Windows SDK) — same finders as the sibling scripts ---
function Find-Iscc {
foreach ($p in @(
'C:\Program Files (x86)\Inno Setup 6\ISCC.exe',
'C:\Program Files\Inno Setup 6\ISCC.exe')) {
if (Test-Path $p) { return $p }
}
$c = Get-Command iscc -ErrorAction SilentlyContinue
if ($c) { return $c.Source }
throw "ISCC.exe (Inno Setup 6, any 6.x) not found - install it (choco install innosetup -y)."
}
function Find-SdkTool([string]$name) {
$root = 'C:\Program Files (x86)\Windows Kits\10\bin'
$hit = Get-ChildItem -Path $root -Recurse -Filter $name -ErrorAction SilentlyContinue |
Where-Object { $_.FullName -match '\\(10\.0\.\d+\.\d+)\\x64\\' } |
Sort-Object { [version]([regex]::Match($_.FullName, '\\(10\.0\.\d+\.\d+)\\x64\\').Groups[1].Value) } |
Select-Object -Last 1
if (-not $hit) { throw "$name not found under $root - install the Windows 10/11 SDK." }
$hit.FullName
}
function Find-AzureDlib([string]$Explicit) {
if ($Explicit) {
if (-not (Test-Path $Explicit)) { throw "AZURE_CODESIGNING_DLIB points at a missing file: $Explicit" }
return (Resolve-Path $Explicit).Path
}
$roots = @(
(Join-Path $env:USERPROFILE '.nuget\packages\microsoft.trusted.signing.client'),
'C:\trusted-signing\microsoft.trusted.signing.client'
) | Where-Object { $_ -and (Test-Path $_) }
$hit = $roots | ForEach-Object { Get-ChildItem -Path $_ -Recurse -Filter 'Azure.CodeSigning.Dlib.dll' -ErrorAction SilentlyContinue } |
Where-Object { $_.FullName -match '\\bin\\x64\\' } |
Sort-Object LastWriteTime | Select-Object -Last 1
if (-not $hit) {
throw ("Azure.CodeSigning.Dlib.dll not found. Install the signing client on this box, e.g. " +
"``nuget install Microsoft.Trusted.Signing.Client -OutputDirectory " +
"`$env:USERPROFILE\.nuget\packages``, or set AZURE_CODESIGNING_DLIB to its full path.")
}
$hit.FullName
}
$iscc = Find-Iscc
Write-Host "ISCC: $iscc"
# --- stage the runtime file set (the portable layout = what the installer lays down) ----------
# Explicit list, not a wildcard copy: the MSIX layout also holds AppxManifest.xml and the tile
# Assets, which mean nothing outside a package (the exes embed their icons via build.rs).
$required = @('punktfunk-client.exe', 'punktfunk-session.exe', 'punktfunk-console.exe', 'punktfunk.exe',
'Microsoft.WindowsAppRuntime.Bootstrap.dll', 'SDL3.dll', 'resources.pri')
$stage = Join-Path $OutDir 'portable'
if (Test-Path $stage) { Remove-Item $stage -Recurse -Force }
New-Item -ItemType Directory -Force -Path $stage | Out-Null
foreach ($f in $required) {
$src = Join-Path $LayoutDir $f
if (-not (Test-Path $src)) { throw "missing '$f' in $LayoutDir (did pack-msix.ps1 run first?)" }
Copy-Item $src (Join-Path $stage $f) -Force
}
$licSrc = Join-Path $LayoutDir 'licenses'
if (-not (Test-Path $licSrc)) { throw "missing licenses\ in $LayoutDir (did pack-msix.ps1 run first?)" }
Copy-Item $licSrc (Join-Path $stage 'licenses') -Recurse -Force
# --- signing backend, same precedence + fail-closed rule as pack-msix.ps1 ---------------------
$requireCert = if ($RequireSignedCert -eq 'auto') { $env:GITHUB_REF -like 'refs/tags/v*' }
else { [Convert]::ToBoolean($RequireSignedCert) }
if ($NoSign -and $requireCert) {
throw "release build ($env:GITHUB_REF) with -NoSign - refusing to publish an unsigned installer."
}
$pfxPath = Join-Path $OutDir 'signing.pfx'
$azureMetadata = Join-Path $OutDir 'azure-codesigning.json'
$signMode = 'none'
$signtool = $null
if (-not $NoSign) {
$signtool = Find-SdkTool 'signtool.exe'
Write-Host "signtool: $signtool"
if ($AzureEndpoint -and $AzureAccount -and $AzureProfile) {
$signMode = 'azure'
$AzureDlib = Find-AzureDlib $AzureDlib
@{
Endpoint = $AzureEndpoint
CodeSigningAccountName = $AzureAccount
CertificateProfileName = $AzureProfile
} | ConvertTo-Json | Set-Content -Path $azureMetadata -Encoding utf8
Write-Host "signing via Azure Artifact Signing: $AzureAccount/$AzureProfile at $AzureEndpoint"
foreach ($v in 'AZURE_TENANT_ID', 'AZURE_CLIENT_ID', 'AZURE_CLIENT_SECRET') {
if (-not [Environment]::GetEnvironmentVariable($v)) {
throw ("Azure signing selected but $v is not set. The dlib authenticates with " +
"DefaultAzureCredential; without the service-principal trio it falls through to " +
"an interactive login that cannot complete on a runner and hangs the build.")
}
}
}
elseif ($PfxBase64) {
$signMode = 'pfx'
Write-Host "signing with supplied code-signing cert (MSIX_CERT_PFX_B64)"
[IO.File]::WriteAllBytes($pfxPath, [Convert]::FromBase64String($PfxBase64))
}
elseif ($requireCert) {
throw ("release build ($env:GITHUB_REF) with neither AZURE_CODESIGNING_* nor MSIX_CERT_PFX_B64 - " +
"refusing to fall back to an ephemeral self-signed cert. Restore the signing secrets " +
"(packaging/windows/README.md), or pass -RequireSignedCert false if this really is a test build.")
}
else {
$signMode = 'selfsigned'
Write-Host "no MSIX_CERT_PFX_B64 -> generating an ephemeral self-signed cert (subject $Publisher)"
if (-not $PfxPassword) { $PfxPassword = 'punktfunk' }
$tmp = New-SelfSignedCertificate -Type Custom -Subject $Publisher `
-KeyUsage DigitalSignature -FriendlyName 'punktfunk client installer (self-signed)' `
-CertStoreLocation 'Cert:\CurrentUser\My' `
-TextExtension @('2.5.29.37={text}1.3.6.1.5.5.7.3.3', '2.5.29.19={text}')
$sec = ConvertTo-SecureString -String $PfxPassword -Force -AsPlainText
Export-PfxCertificate -Cert "Cert:\CurrentUser\My\$($tmp.Thumbprint)" -FilePath $pfxPath -Password $sec | Out-Null
Remove-Item "Cert:\CurrentUser\My\$($tmp.Thumbprint)" -Force
}
}
# Timestamp policy matches the sibling scripts: best-effort for a long-lived .pfx, MANDATORY under
# Azure signing (those leaf certs expire in ~3 days; untimestamped signatures die with them).
function Sign-File([string]$Path) {
if ($NoSign) { return }
if ($signMode -eq 'azure') {
$signArgs = @('sign', '/fd', 'SHA256', '/dlib', $AzureDlib, '/dmdf', $azureMetadata)
$ts = 'http://timestamp.acs.microsoft.com'
}
else {
$signArgs = @('sign', '/fd', 'SHA256', '/f', $pfxPath)
if ($PfxPassword) { $signArgs += @('/p', $PfxPassword) }
$ts = 'http://timestamp.digicert.com'
}
& $signtool ($signArgs + @('/tr', $ts, '/td', 'SHA256', $Path))
if ($LASTEXITCODE -eq 0) { return }
if ($signMode -eq 'azure') {
throw ("timestamped sign failed for $Path ($LASTEXITCODE) - NOT retrying without a timestamp. " +
"An Azure signing cert is valid for ~3 days; an untimestamped signature would go " +
"untrusted within days of release.")
}
Write-Warning "timestamped sign failed for $Path - retrying without a timestamp"
& $signtool ($signArgs + @($Path))
if ($LASTEXITCODE -ne 0) { throw "signtool sign failed for $Path ($LASTEXITCODE)" }
}
# --- sign the inner exes, zip the stage (portable build), then build + sign the installer ------
foreach ($f in $required | Where-Object { $_ -like '*.exe' }) {
Sign-File (Join-Path $stage $f)
}
$zip = Join-Path $OutDir "punktfunk-client-windows_${Version}_${Arch}-portable.zip"
if (Test-Path $zip) { Remove-Item $zip -Force }
Compress-Archive -Path (Join-Path $stage '*') -DestinationPath $zip
Write-Host "==> portable zip: $zip"
# Stage the .iss + branding next to each other under $OutDir: ISCC is a 32-bit process, and on the
# SYSTEM-profile runner WOW64 redirection breaks reads from the checkout path (see
# pack-host-installer.ps1's staging note) — everything ISCC touches must live under C:\t.
$issLocal = Join-Path $OutDir 'punktfunk-client.iss'
Copy-Item -LiteralPath $iss -Destination $issLocal -Force
$brandSrc = (Resolve-Path (Join-Path $here '..\..\..\packaging\windows\branding')).Path
$brandStage = Join-Path $OutDir 'branding'
if (Test-Path $brandStage) { Remove-Item $brandStage -Recurse -Force }
New-Item -ItemType Directory -Force -Path $brandStage | Out-Null
Copy-Item (Join-Path $brandSrc '*.bmp') $brandStage -Force
Copy-Item (Join-Path $brandSrc 'punktfunk.ico') $brandStage -Force
$defines = @(
"/DMyAppVersion=$Version",
"/DArch=$Arch",
"/DLayoutDir=$stage",
"/DBrandingDir=$brandStage",
"/DOutputDir=$OutDir"
)
Write-Host "==> ISCC $($defines -join ' ') $issLocal"
& $iscc @defines $issLocal
if ($LASTEXITCODE -ne 0) { throw "ISCC failed ($LASTEXITCODE)" }
$setup = Join-Path $OutDir "punktfunk-client-setup-${Version}_${Arch}.exe"
if (-not (Test-Path $setup)) { throw "expected installer not produced: $setup" }
Sign-File $setup
Remove-Item $pfxPath -Force -ErrorAction SilentlyContinue
Remove-Item $azureMetadata -Force -ErrorAction SilentlyContinue
Write-Host ""
Write-Host "==> installer: $setup"
if ($signMode -eq 'azure') {
Write-Host "==> signed by a publicly trusted CA."
}
elseif ($signMode -ne 'none') {
Write-Host "==> $signMode-signed: the exe still runs everywhere; expect a SmartScreen prompt on canary builds."
}
if ($env:GITHUB_ENV) {
"CLIENT_SETUP_PATH=$setup" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
"CLIENT_ZIP_PATH=$zip" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
}
@@ -0,0 +1,244 @@
; punktfunk Windows CLIENT installer (Inno Setup 6) — the default download.
;
; A classic per-user setup.exe, NOT because MSIX failed technically (the app is full-trust Win32
; either way) but because the MSIX install SHAPE breaks the most-reported use case: the exe lands
; under the ACL'd C:\Program Files\WindowsApps, which Steam's "Add a Non-Steam Game" picker cannot
; browse and whose activation path defeats the overlay's GameOverlayRenderer64.dll injection —
; Steam has to spawn the process itself from a normal path for the overlay (and a Big Picture
; launch) to work. This installs to {userpf}\Punktfunk: user-writable-visible, no UAC, and a
; stable path Steam can target. The MSIX is kept for Microsoft Store compatibility
; (clients/windows/packaging/pack-msix.ps1 — both are packed from the same layout every build).
;
; Built by pack-client-installer.ps1, e.g.:
; ISCC.exe /DMyAppVersion=0.2.137.0 /DArch=x64 /DLayoutDir=C:\t\installer\portable \
; /DBrandingDir=C:\t\installer\branding /DOutputDir=C:\t\installer punktfunk-client.iss
;
; What the MSIX manifest granted declaratively is re-created here per-user (all HKCU, so no
; elevation and uninstall leaves nothing behind):
; punktfunk:// protocol -> HKCU\Software\Classes\punktfunk (deeplink.rs positional parse)
; Start entries -> {userprograms} shortcuts (Punktfunk + Punktfunk Console)
; punktfunk.exe CLI alias -> {app} appended to the HKCU PATH (Playnite importer shells to it)
; punktfunk-client.exe alias -> unnecessary: deeplink.rs targets current_exe() when unpackaged
; Microsoft.WindowsAppRuntime.2 PackageDependency
; -> download + run the runtime installer when missing ([Code])
#ifndef MyAppVersion
#define MyAppVersion "0.0.0.0"
#endif
#ifndef Arch
#define Arch "x64"
#endif
#ifndef LayoutDir
#define LayoutDir "."
#endif
#ifndef BrandingDir
#define BrandingDir "..\..\..\packaging\windows\branding"
#endif
#ifndef OutputDir
#define OutputDir "."
#endif
; The unpackaged app resolves an INSTALLED Windows App SDK runtime via the bootstrap DLL
; (windows-reactor pins WINDOWSAPPSDK_RELEASE_MAJORMINOR = 0x20000; the MSIX manifest's
; PackageDependency floor is 2.2 — keep the two in sync with packaging/AppxManifest.xml).
#define AppRuntimeUrl "https://aka.ms/windowsappsdk/2.2/latest/windowsappruntimeinstall-" + Arch + ".exe"
[Setup]
AppId={{52464E61-68A1-4621-B6B3-5B8BBB823D1A}
AppName=Punktfunk
AppVersion={#MyAppVersion}
AppPublisher=unom
AppPublisherURL=https://git.unom.io/unom/punktfunk
; Per-user, no UAC: {userpf} = %LOCALAPPDATA%\Programs. A browsable, stable path is the point —
; see the header (Steam overlay / Big Picture).
DefaultDirName={userpf}\Punktfunk
PrivilegesRequired=lowest
DisableProgramGroupPage=yes
UsePreviousAppDir=yes
; Same floor as the MSIX manifest's TargetDeviceFamily MinVersion (10.0.17763).
MinVersion=10.0.17763
#if Arch == "arm64"
ArchitecturesAllowed=arm64
ArchitecturesInstallIn64BitMode=arm64
#else
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
#endif
OutputDir={#OutputDir}
OutputBaseFilename=punktfunk-client-setup-{#MyAppVersion}_{#Arch}
Compression=lzma2/max
SolidCompression=yes
; Modern branded wizard, same version gate as the host installer (punktfunk-host.iss).
#if VER >= EncodeVer(6,6,0)
WizardStyle=modern dynamic windows11
#else
WizardStyle=modern
#endif
SetupIconFile={#BrandingDir}\punktfunk.ico
WizardImageFile={#BrandingDir}\wizard-image-*.bmp
WizardSmallImageFile={#BrandingDir}\wizard-small-*.bmp
UninstallDisplayName=Punktfunk {#MyAppVersion}
UninstallDisplayIcon={app}\punktfunk-client.exe
; {app} goes on the USER PATH (see [Registry] + PathNeedsAdd/RemoveAppFromPath below) so the
; documented `punktfunk hosts list` / `punktfunk launch` one-liners work by name — same contract
; the MSIX's punktfunk.exe app-execution alias provided. Broadcasts WM_SETTINGCHANGE.
ChangesEnvironment=yes
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "Create a Desktop shortcut"; Flags: unchecked
[Files]
; The staged MSIX layout, minus the package-only bits (AppxManifest.xml, the tile Assets — the
; exes embed their own icons via build.rs winresource). pack-client-installer.ps1 signs the four
; exes individually before ISCC runs; the .msix signs only its container, so this cannot be
; skipped by "the MSIX build already signed them".
Source: "{#LayoutDir}\punktfunk-client.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\punktfunk-session.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\punktfunk-console.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\punktfunk.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\Microsoft.WindowsAppRuntime.Bootstrap.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\SDL3.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "{#LayoutDir}\resources.pri"; DestDir: "{app}"; Flags: ignoreversion
; MIT/Apache + the client-scoped THIRD-PARTY-NOTICES — same payload the MSIX carries.
Source: "{#LayoutDir}\licenses\*"; DestDir: "{app}\licenses"; Flags: ignoreversion
[Icons]
; Flat Start-menu entries, mirroring the MSIX's two Application tiles.
Name: "{userprograms}\Punktfunk"; Filename: "{app}\punktfunk-client.exe"
Name: "{userprograms}\Punktfunk Console"; Filename: "{app}\punktfunk-console.exe"; \
Comment: "Controller-driven couch interface for TVs and HTPCs"
Name: "{userdesktop}\Punktfunk"; Filename: "{app}\punktfunk-client.exe"; Tasks: desktopicon
[Registry]
; The punktfunk:// scheme (design/client-deep-links.md §4.2) — the registry twin of the MSIX
; manifest's windows.protocol extension. Protocol activation delivers the URI as "%1" on the
; command line, so this lands in the same positional URL parse in main() that the packaged
; activation does. HKCU + uninsdeletekey: nothing survives uninstall.
Root: HKCU; Subkey: "Software\Classes\punktfunk"; ValueType: string; \
ValueData: "URL:Punktfunk stream link"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\Classes\punktfunk"; ValueType: string; ValueName: "URL Protocol"; ValueData: ""
Root: HKCU; Subkey: "Software\Classes\punktfunk\DefaultIcon"; ValueType: string; \
ValueData: "{app}\punktfunk-client.exe,0"
Root: HKCU; Subkey: "Software\Classes\punktfunk\shell\open\command"; ValueType: string; \
ValueData: """{app}\punktfunk-client.exe"" ""%1"""
; Put {app} on the USER PATH so `punktfunk` (the headless CLI) is runnable by name. Appended to
; {olddata} and guarded by PathNeedsAdd so a repair/upgrade never appends a duplicate. NOT
; uninsdeletevalue — that would delete the whole Path value; the uninstaller surgically removes
; just our entry (RemoveAppFromPath). expandsz preserves %VAR%-style entries other software put here.
Root: HKCU; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; \
ValueData: "{olddata};{app}"; Check: PathNeedsAdd(ExpandConstant('{app}'))
[Code]
const
EnvKey = 'Environment'; { the HKCU per-user environment key }
{ Is the install dir missing from the user PATH? Guards the [Registry] append so a repair or
upgrade can't add a second copy. Semicolon-delimited, case-insensitive — a path that merely
CONTAINS ours as a substring doesn't count as a match. (Same helper as punktfunk-host.iss,
retargeted from the HKLM machine key to HKCU.) }
function PathNeedsAdd(Param: String): Boolean;
var
OrigPath: String;
begin
if not RegQueryStringValue(HKEY_CURRENT_USER, EnvKey, 'Path', OrigPath) then
begin
Result := True; { no Path value at all - the append creates it }
exit;
end;
Result := Pos(';' + Uppercase(Param) + ';', ';' + Uppercase(OrigPath) + ';') = 0;
end;
{ Remove exactly our install-dir entry from the user PATH on uninstall, leaving every other entry
(and their order) intact. Entry-by-entry rebuild, never a substring delete. }
procedure RemoveAppFromPath;
var
OrigPath, NewPath, Entry: String;
Target: String;
P: Integer;
begin
if not RegQueryStringValue(HKEY_CURRENT_USER, EnvKey, 'Path', OrigPath) then
exit;
Target := Uppercase(ExpandConstant('{app}'));
NewPath := '';
OrigPath := OrigPath + ';';
repeat
P := Pos(';', OrigPath);
Entry := Trim(Copy(OrigPath, 1, P - 1));
OrigPath := Copy(OrigPath, P + 1, Length(OrigPath));
if (Entry <> '') and (Uppercase(Entry) <> Target) then
begin
if NewPath <> '' then NewPath := NewPath + ';';
NewPath := NewPath + Entry;
end;
until OrigPath = '';
RegWriteExpandStringValue(HKEY_CURRENT_USER, EnvKey, 'Path', NewPath);
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
RemoveAppFromPath;
end;
{ The Windows App SDK runtime the bootstrap DLL resolves at launch (the unpackaged twin of the
MSIX's PackageDependency). Probe per-user via Get-AppxPackage; when missing, fetch Microsoft's
runtime installer and run it quietly — it registers Store-signed framework packages, which
needs no elevation. Every failure path is NON-FATAL and ends in the same message the docs
carry, because the app itself reports the missing runtime on first launch too. }
function AppRuntimeMissing(): Boolean;
var
ResultCode: Integer;
begin
{ exit 0 = found, 1 = missing; a powershell failure (rc <> 0/1) counts as missing - the
download below is idempotent and the runtime installer no-ops when it is present. }
if not Exec('powershell.exe',
'-NoProfile -ExecutionPolicy Bypass -Command "if (Get-AppxPackage -Name Microsoft.WindowsAppRuntime.2*) { exit 0 } else { exit 1 }"',
'', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
Result := True;
exit;
end;
Result := ResultCode <> 0;
end;
procedure EnsureAppRuntime;
var
ResultCode: Integer;
Installer: String;
begin
if not AppRuntimeMissing() then
exit;
Installer := 'windowsappruntimeinstall.exe';
try
DownloadTemporaryFile('{#AppRuntimeUrl}', Installer, '', nil);
if not Exec(ExpandConstant('{tmp}\' + Installer), '--quiet', '',
SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
RaiseException('runtime installer exit code ' + IntToStr(ResultCode));
except
SuppressibleMsgBox(
'The Windows App Runtime 2.x could not be installed automatically.' + #13#10 + #13#10 +
'Punktfunk needs it to start. Install it from ' + #13#10 +
'https://learn.microsoft.com/windows/apps/windows-app-sdk/downloads' + #13#10 +
'and then launch Punktfunk normally.',
mbInformation, MB_OK, IDOK);
end;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
ResultCode: Integer;
begin
{ On upgrade a running shell/stream locks the exes; kill them best-effort so the copy succeeds.
taskkill matches the image NAME, so "punktfunk.exe" hits only the CLI, not the host service. }
if CurStep = ssInstall then
Exec(ExpandConstant('{sys}\taskkill.exe'),
'/F /IM punktfunk-client.exe /IM punktfunk-session.exe /IM punktfunk-console.exe /IM punktfunk.exe',
'', SW_HIDE, ewWaitUntilTerminated, ResultCode);
{ ssPostInstall, NOT a wizard-page hook: silent installs (winget-style /VERYSILENT) show no
pages, and skipping the runtime there would ship an app that cannot start. This step runs on
every install mode, and SuppressibleMsgBox keeps the failure path unattended-safe. }
if CurStep = ssPostInstall then
EnsureAppRuntime;
end;
+15 -23
View File
@@ -700,31 +700,23 @@ pub(crate) fn hosts_page(props: &HostsProps, cx: &mut RenderCx) -> Element {
.iter()
.any(|h| h.fp_hex == k.fp_hex || (h.addr == k.addr && h.port == k.port))
|| props.probed.get(&k.fp_hex).copied().unwrap_or(false);
// Learn this host's wake MAC(s) from its live advert while it's online, so we can wake
// it once it sleeps (no-op / no disk write when unchanged).
if let Some(a) = hosts.iter().find(|h| {
(h.fp_hex == k.fp_hex || (h.addr == k.addr && h.port == k.port))
&& !h.mac.is_empty()
}) {
crate::trust::learn_mac(&k.fp_hex, &k.addr, k.port, &a.mac);
}
// Same for its OS chain — the tile's mark then survives the host going offline.
if let Some(a) = hosts.iter().find(|h| {
(h.fp_hex == k.fp_hex || (h.addr == k.addr && h.port == k.port)) && !h.os.is_empty()
}) {
crate::trust::learn_os(&k.fp_hex, &k.addr, k.port, &a.os);
}
// Same for its management port — load-bearing, unlike the two above: a host moved off
// 47990 loses its library entirely once mDNS is gone unless we write the port down.
if let Some(p) = hosts
// Learn what this host's live advert teaches while it's online: its wake MAC(s) (so we
// can wake it once it sleeps), its OS chain (so the tile's mark survives it going
// offline), and its management port — the last load-bearing rather than cosmetic, as
// a host moved off 47990 loses its library entirely once mDNS is gone unless we write
// the port down. No-op, and no disk write, when unchanged.
if let Some(a) = hosts
.iter()
.find(|h| {
(h.fp_hex == k.fp_hex || (h.addr == k.addr && h.port == k.port))
&& h.mgmt_port.is_some()
})
.and_then(|h| h.mgmt_port)
.find(|h| h.fp_hex == k.fp_hex || (h.addr == k.addr && h.port == k.port))
{
crate::trust::learn_mgmt_port(&k.fp_hex, &k.addr, k.port, p);
crate::trust::learn_from_advert(
&k.fp_hex,
&k.addr,
k.port,
&a.mac,
&a.os,
a.mgmt_port,
);
}
let can_wake = !online && !k.mac.is_empty();
let menu = {
+32 -7
View File
@@ -203,14 +203,30 @@ pub(crate) fn queue(url: String) {
INBOX.lock().unwrap().push(url);
}
/// Whether this process runs with MSIX package identity. Decides how a shortcut must target us
/// (`write_shortcut` below) and whether the process may stamp its own AppUserModelID
/// (`set_app_user_model_id` in main.rs).
pub(crate) fn has_package_identity() -> bool {
use windows::Win32::appmodel::GetCurrentPackageFullName;
use windows::Win32::winerror::APPMODEL_ERROR_NO_PACKAGE;
// SAFETY: `GetCurrentPackageFullName` with `len = 0` and no buffer is the documented identity
// PROBE — it writes nothing and only reports whether this process is packaged.
unsafe {
let mut len: u32 = 0;
GetCurrentPackageFullName(&mut len, None) != APPMODEL_ERROR_NO_PACKAGE
}
}
/// Write a `.lnk` on the Desktop that launches this URL, and return its path.
///
/// The shortcut targets the app execution alias with the URL as an ARGUMENT, rather than being
/// a `.url` internet shortcut. Both would work while the scheme is registered; only this one
/// still works if it isn't, because it invokes the client directly — which is the whole point
/// of a shortcut being a container for a URL rather than a second launch mechanism
/// (design/client-deep-links.md §5). Targeting the alias (not the package path) is what keeps
/// it valid across updates, since the install path changes and the alias doesn't.
/// The shortcut targets the client exe with the URL as an ARGUMENT, rather than being a `.url`
/// internet shortcut. Both would work while the scheme is registered; only this one still works
/// if it isn't, because it invokes the client directly — which is the whole point of a shortcut
/// being a container for a URL rather than a second launch mechanism
/// (design/client-deep-links.md §5). Which exe reference is durable depends on how we were
/// installed: under MSIX the install path changes on every update but the app execution alias
/// doesn't, so packaged runs target the alias; the Inno Setup / portable installs have no alias
/// but a stable install dir, so unpackaged runs target the absolute exe path.
pub(crate) fn write_shortcut(label: &str, url: &str) -> Result<std::path::PathBuf, String> {
use windows::core::{Interface, HSTRING};
use windows::Win32::combaseapi::{CoCreateInstance, CoInitializeEx};
@@ -223,6 +239,15 @@ pub(crate) fn write_shortcut(label: &str, url: &str) -> Result<std::path::PathBu
.map(|p| std::path::PathBuf::from(p).join("Desktop"))
.map_err(|_| "USERPROFILE isn't set".to_string())?;
let path = desktop.join(format!("{}.lnk", file_name(label)));
// Alias when packaged, absolute path when not — see the doc comment above.
let target = if has_package_identity() {
"punktfunk-client.exe".to_string()
} else {
std::env::current_exe()
.map_err(|e| format!("current exe: {e}"))?
.to_string_lossy()
.into_owned()
};
// SAFETY: COM calls on this thread's apartment. `CoCreateInstance` returns an owned interface
// checked by `?`, and every setter below takes a borrowed `HSTRING`/`PCWSTR` that outlives its
// synchronous call; nothing here dereferences a pointer the caller supplied.
@@ -233,7 +258,7 @@ pub(crate) fn write_shortcut(label: &str, url: &str) -> Result<std::path::PathBu
let _ = CoInitializeEx(None, COINIT_APARTMENTTHREADED as u32);
let link: IShellLinkW = CoCreateInstance(&ShellLink, None, CLSCTX_INPROC_SERVER)
.map_err(|e| format!("shell link: {e}"))?;
link.SetPath(&HSTRING::from("punktfunk-client.exe"))
link.SetPath(&HSTRING::from(target.as_str()))
.ok()
.map_err(|e| format!("shortcut target: {e}"))?;
link.SetArguments(&HSTRING::from(url))
+1 -1
View File
@@ -29,7 +29,7 @@ pub struct DiscoveredHost {
/// persisted like `mac`. Empty if absent (older host).
pub os: String,
/// The management API's port from the mDNS `mgmt` TXT — where the game library is served.
/// Persisted like `mac` (`trust::learn_mgmt_port`), and load-bearing rather than cosmetic:
/// Persisted like `mac` (`trust::learn_from_advert`), and load-bearing rather than cosmetic:
/// a host moved off 47990 loses its library once mDNS is gone unless we write this down.
/// `None` if absent (older host) — resolve via `library::DEFAULT_MGMT_PORT`.
pub mgmt_port: Option<u16>,
+4 -10
View File
@@ -173,18 +173,12 @@ fn main() {
/// processes are left alone. Must run before any window exists.
#[cfg(windows)]
fn set_app_user_model_id() {
use windows::Win32::appmodel::GetCurrentPackageFullName;
use windows::Win32::shobjidl_core::SetCurrentProcessExplicitAppUserModelID;
use windows::Win32::winerror::APPMODEL_ERROR_NO_PACKAGE;
// SAFETY: `GetCurrentPackageFullName` is called with `len = 0` and no buffer, which is the
// documented identity PROBE — it writes nothing and only reports whether this process is
// packaged; `SetCurrentProcessExplicitAppUserModelID` takes a static wide literal.
if deeplink::has_package_identity() {
return; // packaged (or indeterminate) — leave the identity alone
}
// SAFETY: `SetCurrentProcessExplicitAppUserModelID` takes a static wide literal.
unsafe {
let mut len: u32 = 0;
// No buffer: just probe whether the process has package identity.
if GetCurrentPackageFullName(&mut len, None) != APPMODEL_ERROR_NO_PACKAGE {
return; // packaged (or indeterminate) — leave the identity alone
}
// Must stay in sync with pf-presenter's win32.rs, or the windows stop grouping.
let _ = SetCurrentProcessExplicitAppUserModelID(windows::core::w!("unom.punktfunk.client"));
}
+2 -2
View File
@@ -8,6 +8,6 @@
//! still load via a serde alias in core.
pub use pf_client_core::trust::{
hex, learn_mac, learn_mgmt_port, learn_os, load_or_create_identity, pair_error_message,
parse_hex32, KnownHost, KnownHosts, Settings,
hex, learn_from_advert, load_or_create_identity, pair_error_message, parse_hex32, KnownHost,
KnownHosts, Settings,
};
+7
View File
@@ -150,6 +150,13 @@ rand = "0.9"
# (SteamOS, flatpak runtimes, Arch, Ubuntu ≥ 22.10) clears.
pipewire = { version = "0.9", features = ["v0_3_49"] }
sdl3 = { version = "0.18", features = ["hidapi"] }
# Audio-thread priority (`audio_rt`): one blocking D-Bus call per boosted thread — the Realtime
# PORTAL (session bus) inside a flatpak, where the sandbox's PID namespace makes a direct rtkit
# call unresolvable, and rtkit (system bus) outside one. The same zbus, features and backend
# choice as `pf-frame`'s `thread_qos` (which the host uses for the same purpose): `tokio` because
# core's `quic` already resolves tokio for this crate, `blocking-api` because the callers are
# plain worker threads, no default `async-io`.
zbus = { version = "5", default-features = false, features = ["tokio", "blocking-api"] }
# Native VAAPI decode (M6 of the native-decode program): the hand-declared libva buffer
# layouts, the profile/format/surface decisions, the AuPlan → picparams/IQ/slice
# conversion and the DRM-PRIME export descriptor that `video_vaapi_native` marshals.
+15
View File
@@ -503,6 +503,17 @@ fn pw_thread(
step.crossfade,
);
}
// The mirror: the sync loop asked for a DEEPER ring, and the policy answers
// with one duplicated, crossfaded frame instead of a de-prime. Allocation-free
// on this realtime loop: the ring is reserved for the hard cap plus slack and
// the policy only inserts below its target.
if step.insert_front > 0 {
punktfunk_core::audio::crossfade_insert(
&mut ud.ring,
step.insert_front,
step.crossfade,
);
}
let mut ran_short = false;
let n_frames = if let Some(slice) = data.data() {
@@ -529,6 +540,7 @@ fn pw_thread(
ud.vitals.note_callback(
ran_short,
step.drop_front > 0,
step.insert_front > 0,
ud.policy.avg_depth_ms(),
ud.policy.target_ms(),
);
@@ -611,6 +623,9 @@ impl MicStreamer {
let thread = std::thread::Builder::new()
.name("punktfunk-mic".into())
.spawn(move || {
// The capture stream's `process` runs on THIS thread (no RT_PROCESS): capture,
// encode and send are all here, and a late tick is mic latency. Best-effort.
crate::audio_rt::boost_and_log("punktfunk-mic");
if let Err(e) = mic_thread(&connector, quit_rx, muted, echo_cancel) {
tracing::warn!(error = %e, "mic uplink thread ended");
}
+202
View File
@@ -0,0 +1,202 @@
//! Best-effort scheduling priority for the client's audio threads.
//!
//! The device callbacks already run where the OS puts realtime audio: the PipeWire playback
//! callback is on the graph's data loop (`RT_PROCESS`), and WASAPI's event-driven render loop
//! is woken by the engine. The threads that FEED them are ordinary threads: the decode leg
//! (`punktfunk-audio-rx` — receive, conceal, decode, queue), the pad-audio renderer, and on
//! Windows the render/mic loops themselves. Their lateness is absorbed by the jitter ring — a
//! decode thread descheduled past the ring depth is a drought the callback conceals — but on a
//! Steam Deck the same four cores decode 1440p120 and present it, and on a loaded Windows box
//! the render loop competes with the game and the compositor. This module is the one place that
//! asks the OS for priority for those threads, on the sanctioned unprivileged paths only.
//!
//! **Linux.** Three rungs, first one that works wins:
//! 1. `setpriority(-10)` — honoured wherever `RLIMIT_NICE` allows (a developer's shell, most
//! desktops). On SteamOS the user's `RLIMIT_NICE` is 0 and this is a no-op.
//! 2. Inside a flatpak (`/.flatpak-info` exists): the **Realtime portal**
//! (`org.freedesktop.portal.Realtime` on the session bus). The sandbox has its own PID
//! namespace, and rtkit-daemon (0.14 verified on the Deck) does NOT translate — it looks up
//! `/proc/<pid>/task/<tid>/stat` with the numbers it is given, so a direct call from a
//! sandbox is answered with ENOENT. The portal maps the sandboxed pid/tid to the host's and
//! calls rtkit on the app's behalf; portals are reachable from every sandbox without a
//! `--talk-name`. This is the same split PipeWire's own `module-rt` makes.
//! 3. Otherwise **rtkit** directly (`org.freedesktop.RealtimeKit1` on the system bus,
//! `MakeThreadHighPriorityWithPID`) — what gives PipeWire's data loop its priority on the
//! Deck, and what `pf_frame::thread_qos` uses on the host.
//!
//! Both bus rungs are gated by polkit's `acquire-high-priority` action with the TARGET process
//! as the subject — allowed for the user's active session and for their session-less user
//! services (a client launched by Steam is one), refused for a remote (ssh) session. Verified on
//! the Deck 2026-08-18 by renicing a live active-session thread and a `steam` user-service thread
//! through both rungs, and restoring them.
//!
//! **Never** `setcap`/`SCHED_RR` here — the `cap_sys_nice` route is the one that killed KDE
//! sessions in the field, and a nice level is all the decode leg needs.
//!
//! **Windows.** MMCSS "Pro Audio" + `THREAD_PRIORITY_HIGHEST` for the calling thread — the
//! same pair every audio engine on the platform uses; the MMCSS handle is intentionally leaked
//! (thread-lifetime; the OS reverts it at exit), as `pf_frame::session_tuning::on_hot_thread`
//! does on the host.
//!
//! Every path is best-effort and logs at debug what it got; a refusal is exactly what the thread
//! had before this existed.
/// Nice level asked for on Linux. `-10` is comfortably inside rtkit's default `MinNiceLevel`
/// (15 on the Deck) and what the host's own hot threads ask for.
#[cfg(target_os = "linux")]
const NICE: i32 = -10;
/// Raise the CALLING thread's priority for audio work. Call at the top of the thread, before
/// any audio state is touched, from a plain worker thread (the bus calls block); returns what
/// happened for the caller's log line.
#[cfg(target_os = "linux")]
pub fn boost_current_thread() -> Boost {
// SAFETY: three by-value integers, no pointers; `PRIO_PROCESS` with `who == 0` targets the
// calling thread on Linux and only adjusts its nice value.
if unsafe { libc::setpriority(libc::PRIO_PROCESS, 0, NICE) } == 0 {
return Boost::Setpriority;
}
// SAFETY: `gettid` takes no arguments, touches no memory, and returns the calling thread's
// kernel tid — always valid on Linux.
let tid = unsafe { libc::syscall(libc::SYS_gettid) } as u64;
let pid = u64::from(std::process::id());
if std::path::Path::new("/.flatpak-info").exists() {
match linux_bus::portal_high_priority(pid, tid, NICE) {
Ok(()) => Boost::Portal,
Err(e) => Boost::Refused(format!("realtime portal: {e}")),
}
} else {
match linux_bus::rtkit_high_priority(pid, tid, NICE) {
Ok(()) => Boost::Rtkit,
Err(e) => Boost::Refused(format!("rtkit: {e}")),
}
}
}
#[cfg(target_os = "linux")]
mod linux_bus {
/// One-shot blocking system-bus call to rtkit. Per-call connection rather than cached: this
/// runs a handful of times per session (thread starts), and holding a bus connection for the
/// session's lifetime to save microseconds is a bad trade against a wedged bus daemon
/// pinning a socket in every session forever. Mirrors `pf_frame::thread_qos`.
pub(super) fn rtkit_high_priority(pid: u64, tid: u64, nice: i32) -> Result<(), zbus::Error> {
let conn = zbus::blocking::Connection::system()?;
// `MakeThreadHighPriorityWithPID(u64 process, u64 thread, i32 priority)` — priority is a
// nice level, floored by rtkit's MinNiceLevel. The WithPID variant with our own pid is
// the explicit spelling of "this thread of this process"; rtkit still authenticates the
// caller via the bus and hands the target process to polkit.
conn.call_method(
Some("org.freedesktop.RealtimeKit1"),
"/org/freedesktop/RealtimeKit1",
Some("org.freedesktop.RealtimeKit1"),
"MakeThreadHighPriorityWithPID",
&(pid, tid, nice),
)?;
Ok(())
}
/// The same request through the Realtime portal on the SESSION bus — the sandbox's own
/// pid/tid, which the portal maps before it calls rtkit. Same method name and signature
/// (`tti`), on `org.freedesktop.portal.Desktop` at `/org/freedesktop/portal/desktop`.
pub(super) fn portal_high_priority(pid: u64, tid: u64, nice: i32) -> Result<(), zbus::Error> {
let conn = zbus::blocking::Connection::session()?;
conn.call_method(
Some("org.freedesktop.portal.Desktop"),
"/org/freedesktop/portal/desktop",
Some("org.freedesktop.portal.Realtime"),
"MakeThreadHighPriorityWithPID",
&(pid, tid, nice),
)?;
Ok(())
}
}
/// Raise the CALLING thread's priority for audio work: MMCSS "Pro Audio" plus the highest
/// normal-class thread priority. Returns what happened for the caller's log line.
#[cfg(windows)]
pub fn boost_current_thread() -> Boost {
// Declared here rather than through the `windows` crate's feature list: two calls, both
// stable Win32 exports, and `pf_frame::session_tuning` already spells
// `AvSetMmThreadCharacteristicsW` this way. A raw HANDLE is a pointer-sized integer; NULL
// means failure for AvSet…, and SetThreadPriority returns a BOOL.
#[link(name = "avrt")]
unsafe extern "system" {
fn AvSetMmThreadCharacteristicsW(task_name: *const u16, task_index: *mut u32) -> isize;
}
#[link(name = "kernel32")]
unsafe extern "system" {
fn GetCurrentThread() -> isize;
fn SetThreadPriority(thread: isize, priority: i32) -> i32;
}
const THREAD_PRIORITY_HIGHEST: i32 = 2;
// SAFETY: C-ABI FFI declared with matching `extern "system"` signatures. `task` is a local
// NUL-terminated UTF-16 buffer alive for the whole call, so `task.as_ptr()` is a valid
// LPCWSTR; `&mut idx` is a live local u32 the call writes the task index into. The returned
// MMCSS handle is intentionally leaked — the OS reverts the characteristics at thread exit —
// so there is nothing to free. `GetCurrentThread` returns a pseudo-handle that needs no
// closing; `SetThreadPriority` takes only that handle and a flag.
let (mmcss, prio) = unsafe {
let task: Vec<u16> = "Pro Audio\0".encode_utf16().collect();
let mut idx: u32 = 0;
let h = AvSetMmThreadCharacteristicsW(task.as_ptr(), &mut idx);
let p = SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST);
(h != 0, p != 0)
};
match (mmcss, prio) {
(true, true) => Boost::Mmcss,
(true, false) => Boost::Refused("MMCSS ok, SetThreadPriority refused".into()),
(false, true) => Boost::Refused("SetThreadPriority ok, MMCSS refused".into()),
(false, false) => Boost::Refused("MMCSS and SetThreadPriority refused".into()),
}
}
/// What [`boost_current_thread`] managed. Logged, never acted on: every path is best-effort.
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum Boost {
/// Linux: `setpriority` was honoured (RLIMIT_NICE allowed it).
#[cfg(target_os = "linux")]
Setpriority,
/// Linux, sandboxed: the Realtime portal granted the nice level.
#[cfg(target_os = "linux")]
Portal,
/// Linux: rtkit granted the nice level after `setpriority` was refused (SteamOS).
#[cfg(target_os = "linux")]
Rtkit,
/// Windows: MMCSS "Pro Audio" plus `THREAD_PRIORITY_HIGHEST`.
#[cfg(windows)]
Mmcss,
/// Nothing was granted; the thread runs exactly as it did before. The string says why.
Refused(String),
}
impl Boost {
/// The one-word tag for a log line.
pub fn as_str(&self) -> &'static str {
match self {
#[cfg(target_os = "linux")]
Boost::Setpriority => "setpriority",
#[cfg(target_os = "linux")]
Boost::Portal => "portal",
#[cfg(target_os = "linux")]
Boost::Rtkit => "rtkit",
#[cfg(windows)]
Boost::Mmcss => "mmcss",
Boost::Refused(_) => "refused",
}
}
}
/// Boost the calling thread and log the outcome under `what` — the shape every audio thread
/// start uses.
pub fn boost_and_log(what: &'static str) {
match boost_current_thread() {
Boost::Refused(why) => {
tracing::debug!(thread = what, why = %why, "audio thread priority refused");
}
got => tracing::debug!(
thread = what,
via = got.as_str(),
"audio thread priority raised"
),
}
}
+25 -7
View File
@@ -7,7 +7,7 @@
//! missed graph cycle, which is a click. So the callback publishes numbers into these atomics
//! and the decode thread, an ordinary thread that already wakes every frame, prints them at the
//! old cadence with the old field names (`audio playback buffer_ms= target_ms= underruns=
//! drift_sheds= plc_ms=`), so a field-log grep keeps working. The WASAPI twin runs its render
//! drift_sheds= drift_inserts= plc_ms=`), so a field-log grep keeps working. The WASAPI twin runs its render
//! loop on a plain thread and could log in place, but publishes here too: one logging site,
//! one line shape, on both platforms.
@@ -23,6 +23,10 @@ pub struct PlaybackVitals {
pub underruns: AtomicU64,
/// Drops the policy asked for: drift sheds and hard trims together.
pub sheds: AtomicU64,
/// Inserts the policy asked for: sync-driven deepening, one duplicated crossfaded frame each
/// (`JitterStep::insert_front`). Logged next to `sheds` so concealment in BOTH directions
/// stays visible — a ring being quietly deepened is a picture moving away from its audio.
pub inserts: AtomicU64,
/// The policy's smoothed ring depth, ms — what drift correction reacts to.
pub buffer_ms: AtomicU32,
/// The policy's LIVE target depth, ms (grows under underrun pressure, follows A/V sync).
@@ -36,8 +40,15 @@ pub struct PlaybackVitals {
impl PlaybackVitals {
/// Callback side: one callback done. `ran_short` = it could not be filled from the ring;
/// `shed` = the policy dropped something this callback.
pub fn note_callback(&self, ran_short: bool, shed: bool, buffer_ms: u32, target_ms: u32) {
/// `shed` = the policy dropped something this callback; `insert` = it duplicated a frame.
pub fn note_callback(
&self,
ran_short: bool,
shed: bool,
insert: bool,
buffer_ms: u32,
target_ms: u32,
) {
self.callbacks.fetch_add(1, Ordering::Relaxed);
if ran_short {
self.underruns.fetch_add(1, Ordering::Relaxed);
@@ -45,6 +56,9 @@ impl PlaybackVitals {
if shed {
self.sheds.fetch_add(1, Ordering::Relaxed);
}
if insert {
self.inserts.fetch_add(1, Ordering::Relaxed);
}
self.buffer_ms.store(buffer_ms, Ordering::Relaxed);
self.target_ms.store(target_ms, Ordering::Relaxed);
}
@@ -68,6 +82,7 @@ impl PlaybackVitals {
callbacks: self.callbacks.load(Ordering::Relaxed),
underruns: self.underruns.load(Ordering::Relaxed),
sheds: self.sheds.load(Ordering::Relaxed),
inserts: self.inserts.load(Ordering::Relaxed),
buffer_ms: self.buffer_ms.load(Ordering::Relaxed),
target_ms: self.target_ms.load(Ordering::Relaxed),
requested_frames: self.requested_frames.load(Ordering::Relaxed),
@@ -83,6 +98,7 @@ pub struct Snapshot {
pub callbacks: u64,
pub underruns: u64,
pub sheds: u64,
pub inserts: u64,
pub buffer_ms: u32,
pub target_ms: u32,
pub requested_frames: u32,
@@ -98,14 +114,16 @@ mod tests {
fn counters_accumulate_and_gauges_overwrite() {
let v = PlaybackVitals::default();
assert!(!v.quantum_known());
v.note_callback(false, false, 15, 15);
v.note_callback(true, true, 9, 25);
v.note_callback(true, false, 12, 25);
v.note_callback(false, false, false, 15, 15);
v.note_callback(true, true, false, 9, 25);
v.note_callback(true, false, false, 12, 25);
v.note_callback(false, false, true, 12, 25);
v.note_quantum(240, 8192, 240);
let s = v.snapshot();
assert_eq!(s.callbacks, 3);
assert_eq!(s.callbacks, 4);
assert_eq!(s.underruns, 2);
assert_eq!(s.sheds, 1);
assert_eq!(s.inserts, 1);
assert_eq!(
(s.buffer_ms, s.target_ms),
(12, 25),

Some files were not shown because too many files have changed in this diff Show More