diff --git a/AGENTS.md b/AGENTS.md index c580cdc..8691cc7 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -83,6 +83,15 @@ falling back from a release that does not come up. every digest for `url-file` sources only; a `regular-file` source is written unchecked. A stick is read as `file:///run/construct/update`, the CDN as https. Transfers are generated (`cmd/image/transfers.go`), never hand-written. +- **Super with a letter is one table**, `usr/share/construct/keys.json`: keyd (`etc/keyd/default.conf`, + held to the table by `go test ./cmd/image`) swallows Super and sends copy, paste and cut as the + Insert chords every application takes, and each other letter as F13 to F24, which xkb knows as + such only through `etc/xkb/rules/evdev` (xkeyboard-config's `fkeys(basic_13-24)` under every + layout and option); the shell's `keys` extension turns those into the chord the focused + application binds (Ctrl, or Ctrl+Shift in a terminal), and `construct-keys` (Super+K) shows the + table. keyd sees no window and the shell cannot send a chord cleanly while Super is held, which + is why the two share the work; keyd's socket stays closed to the session (recipes/keyd). + `task test` presses the letters in windows posing as Files and as Ghostty. - **Nothing reaches the machine that it did not ask for.** The firewall (`usr/lib/construct/firewall.nft`, before any network) drops what comes in but replies, what IPv4/IPv6, DHCP and mDNS need, the containers' bridges, Tailscale, and SSH when a person turned it diff --git a/README.md b/README.md index 6b2c2c5..38ad6c1 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,12 @@ of a forgotten password. Take the stick out and restart. `/var` anew (every person, file, container and setting gone; the system slots untouched) and GNOME's Initial Setup asks who it is for. The disk still opens with the password it was installed with: to hand the machine to someone else, install it again from the stick. +- **Super with a letter, the same everywhere.** Super+C, V and X copy, paste and cut in every + application and in a terminal, where Ctrl+C would interrupt; Super+T, W, N, F, A, Z, S, P, Q, + R, L and O do what Ctrl with the letter does in most applications and what Ctrl+Shift with it + does in a terminal, so a terminal's own Ctrl+R, L and P stay its. Super alone is the overview, + Super+number the dock, Super+M the notifications, and Super+K shows the whole table, per + application (*Keyboard Shortcuts* in the app grid). Ctrl keeps working as before. - **Firmware the image cannot carry.** A few parts boot only their maker's firmware, licensed to the machine's owner and to nobody else: the ThinkPad X9-15p's sensor hub (ambient light, rotation, presence) and the tuning of its four speakers are in Lenovo's Windows driver packages diff --git a/build/grype.yaml b/build/grype.yaml index edaf3fd..47f7f1e 100644 --- a/build/grype.yaml +++ b/build/grype.yaml @@ -17,28 +17,6 @@ check-for-app-update: false # party can rebuild: kept here, listed by the report with what nobody has fixed, until a release # of theirs built after the fix. Each rule names the file, the vulnerability and the reason. ignore: - # vsce-sign, the .NET binary VS Code bundles to check an extension's signature as it installs, - # embeds System.Security.Cryptography.Pkcs 9.0.5: CVE-2026-84008's quadratic CPU use in - # SignedCms.CheckSignature over X.509 data the signature carries (2026-10-13, fixed in 9.0.21), - # and GHSA-2fmv-rv2c-59x7 beside it. Microsoft's @vscode/vsce-sign was last released 2.1.0 on - # 2026-08-17, so no VS Code fixes it; the exposure is the CPU of a signature check on an - # extension a person installs. Drop the rules when a VS Code ships a vsce-sign built after - # 2026-10-13 (strings vsce-sign | grep '^9\.0\.' says its runtime). The rules name the assembly, - # its version and type, not the file: the watch scans the release's SBOM, which records no - # location for an assembly a binary embeds, and a rule with one never applied there (issue #17). - - vulnerability: GHSA-846f-f764-76mx - reason: "only Microsoft can rebuild VS Code's vsce-sign; no VS Code release carries one built after the fix" - package: - name: System.Security.Cryptography.Pkcs - version: 9.0.5 - type: dotnet - - vulnerability: GHSA-2fmv-rv2c-59x7 - reason: "only Microsoft can rebuild VS Code's vsce-sign; no VS Code release carries one built after the fix" - package: - name: System.Security.Cryptography.Pkcs - version: 9.0.5 - type: dotnet - # A fix a recipe carries from its upstream's branch at a version Wolfi's feed does not know: # the feed names the Wolfi build that fixed it, and a recipe below that build is flagged though # it holds the same fix. Each rule names the recipe's build, so it lapses at the next one. diff --git a/build/host.env b/build/host.env index a83535e..2613d0e 100644 --- a/build/host.env +++ b/build/host.env @@ -11,8 +11,8 @@ TASK_VERSION=3.54.0 TASK_SHA256=680859dbb4d881a9c72d4d9a8f510825450849af8567deacd7302c01124416fb # gh, which publishes a release, from its GitHub release. -GH_VERSION=2.104.0 -GH_SHA256=98cb101ad87dbbd3f6b2f2bfcbd43197ccd07643140121d8a9cfaa91eadbc24e +GH_VERSION=2.106.0 +GH_SHA256=a476449fa9625413c54a3734eded62e9e480e49f421ff08e7f3b3879c059a033 # What the harness runs on the host, from the distribution: the UEFI firmware its machines boot # (OVMF, Secure Boot's build), mtools to forge sticks (the lifecycle), dosfstools for the stick diff --git a/build/versions.env b/build/versions.env index 6ee4235..1657f00 100644 --- a/build/versions.env +++ b/build/versions.env @@ -7,12 +7,12 @@ WOLFI_BASE_IMAGE=cgr.dev/chainguard/wolfi-base:latest@sha256:88a20e2d017bd20cdc0 # The kernel, from kernel.org. A new series can fail the fragments' assertions; Arch's base config # (kernel/Dockerfile) is pinned to the same version, or Arch's newest while it has none for this one. -KERNEL_VERSION=7.3.4 -KERNEL_SHA256=b11b6df8295e8e991ff040b71aaa4994a8b55caa23b6b092907f195b5840fd1f +KERNEL_VERSION=7.3.7 +KERNEL_SHA256=c4cbb90c12f90d59e49320b9ab0b5e7b7de0c15dd56ede5bc0c81ba16b30e59d # Firmware (firmware/Dockerfile): linux-firmware's release, and Intel's microcode from its own. -LINUX_FIRMWARE_VERSION=20261019 -LINUX_FIRMWARE_SHA256=a10d1ab5baf2c74ba92e8c7cf313e691696c26bddfa6df00db795e48d70cd4ca +LINUX_FIRMWARE_VERSION=20261124 +LINUX_FIRMWARE_SHA256=2cabe10253005f55bf4bbc0ebb25c0964d66f7c4121ffa47853ff1e70ea1aa54 INTEL_MICROCODE_VERSION=microcode-20261110 INTEL_MICROCODE_SHA256=989a5cd345808babee491da69ed80ae5741697bc87743a71d0ba611f3fd6afa5 diff --git a/cmd/image/keybinds.go b/cmd/image/keybinds.go new file mode 100644 index 0000000..2596a5d --- /dev/null +++ b/cmd/image/keybinds.go @@ -0,0 +1,132 @@ +package main + +import ( + "encoding/json" + "fmt" + "os" + "regexp" + "sort" + "strings" +) + +// keysTable is usr/share/construct/keys.json: Super with a letter, the same in every application, +// as keyd and the shell's keys extension do it between them (etc/keyd/default.conf says how). Its +// readers are the extension and construct-keys; here it is checked against keyd's file. +type keysTable struct { + Everywhere []keyEntry `json:"everywhere"` + Default []keyEntry `json:"default"` + Apps map[string]keysForApp `json:"apps"` + Shell []keyEntry `json:"shell"` +} + +type keysForApp struct { + Name string `json:"name"` + Keys []keyEntry `json:"keys"` +} + +type keyEntry struct { + Key string `json:"key"` + Plain string `json:"plain"` + Does string `json:"does"` + Sends string `json:"sends"` +} + +func readKeysTable(path string) (keysTable, error) { + var t keysTable + b, err := os.ReadFile(path) + if err != nil { + return t, err + } + if err := json.Unmarshal(b, &t); err != nil { + return t, fmt.Errorf("%s: %w", path, err) + } + return t, nil +} + +// keydLines are the bindings keyd's file must hold for the table: the Insert chords of what +// works everywhere, and the plain key of each default letter, in keyd's own spelling. +func (t keysTable) keydLines() ([]string, error) { + var lines []string + for _, e := range t.Everywhere { + chord, err := keydChord(e.Sends) + if err != nil { + return nil, err + } + lines = append(lines, e.Key+" = "+chord) + } + for _, e := range t.Default { + if e.Plain == "" { + return nil, fmt.Errorf("default %s: no plain key for keyd to send", e.Key) + } + lines = append(lines, e.Key+" = "+strings.ToLower(e.Plain)) + } + return lines, nil +} + +var chordPart = regexp.MustCompile(`<(Control|Shift|Alt)>`) + +// keydChord spells a GTK accelerator ("Insert") as keyd does ("C-insert"). +func keydChord(accel string) (string, error) { + mods := "" + for _, m := range chordPart.FindAllStringSubmatch(accel, -1) { + mods += map[string]string{"Control": "C-", "Shift": "S-", "Alt": "A-"}[m[1]] + } + key := chordPart.ReplaceAllString(accel, "") + if key == "" || strings.ContainsAny(key, "<>") { + return "", fmt.Errorf("%q is no accelerator", accel) + } + return mods + strings.ToLower(key), nil +} + +// keydBindings are the bindings a keyd file's [meta] layer holds. +func keydBindings(conf string) []string { + var lines []string + in := false + for _, l := range strings.Split(conf, "\n") { + l = strings.TrimSpace(l) + switch { + case strings.HasPrefix(l, "["): + in = l == "[meta]" + case in && l != "" && !strings.HasPrefix(l, "#"): + lines = append(lines, l) + } + } + return lines +} + +// appKeysCovered is the letters an app's table leaves to the default: every app entry must name a +// default letter, so that the extension never has a letter keyd sends and no chord for it. +func (t keysTable) check() error { + defaults := map[string]bool{} + plains := map[string]bool{} + for _, e := range t.Default { + defaults[e.Key] = true + if plains[e.Plain] { + return fmt.Errorf("default %s: %s is another letter's plain key too", e.Key, e.Plain) + } + plains[e.Plain] = true + } + for _, e := range t.Everywhere { + if defaults[e.Key] { + return fmt.Errorf("%s is everywhere's and default's", e.Key) + } + } + apps := make([]string, 0, len(t.Apps)) + for id := range t.Apps { + apps = append(apps, id) + } + sort.Strings(apps) + for _, id := range apps { + for _, e := range t.Apps[id].Keys { + if !defaults[e.Key] { + return fmt.Errorf("%s: %s is no default letter, so keyd sends nothing for it", id, e.Key) + } + if e.Sends != "" { + if _, err := keydChord(e.Sends); err != nil { + return fmt.Errorf("%s: %w", id, err) + } + } + } + } + return nil +} diff --git a/cmd/image/keybinds_test.go b/cmd/image/keybinds_test.go new file mode 100644 index 0000000..9e6b392 --- /dev/null +++ b/cmd/image/keybinds_test.go @@ -0,0 +1,55 @@ +package main + +import ( + "os" + "strings" + "testing" +) + +// keyd's file holds exactly what the table says it must: the Insert chords of copy, paste and +// cut, and the plain key of each default letter; and the table is consistent with itself. +func TestKeydFollowsTheKeysTable(t *testing.T) { + t.Chdir("../..") + table, err := readKeysTable("image/rootfs/usr/share/construct/keys.json") + if err != nil { + t.Fatal(err) + } + if err := table.check(); err != nil { + t.Fatal(err) + } + want, err := table.keydLines() + if err != nil { + t.Fatal(err) + } + conf, err := os.ReadFile("image/rootfs/etc/keyd/default.conf") + if err != nil { + t.Fatal(err) + } + if got := keydBindings(string(conf)); strings.Join(got, "\n") != strings.Join(want, "\n") { + t.Errorf("etc/keyd/default.conf's [meta] layer:\n%s\nkeys.json says:\n%s", strings.Join(got, "\n"), strings.Join(want, "\n")) + } + // xkeyboard-config's evdev map gives F13 to F24's keycodes XF86 keysyms the extension cannot + // grab and gsd acts on; only its fkeys(basic_13-24), applied by the image's own rules, makes + // them F13 to F24. + rules, err := os.ReadFile("image/rootfs/etc/xkb/rules/evdev") + if err != nil { + t.Fatal(err) + } + if !strings.Contains(string(rules), "! include %S/evdev") || !strings.Contains(string(rules), "* = +fkeys(basic_13-24)") { + t.Error("etc/xkb/rules/evdev does not apply fkeys(basic_13-24) over xkeyboard-config's rules, without which keyd's F13 to F24 are not F13 to F24") + } + if len(table.Apps) < 2 || table.Apps["com.mitchellh.ghostty.desktop"].Name == "" { + t.Errorf("the terminals are in the table: %v", table.Apps) + } +} + +func TestKeydChord(t *testing.T) { + for accel, want := range map[string]string{"Insert": "C-insert", "Delete": "S-delete", "t": "C-S-t", "F13": "f13"} { + if got, err := keydChord(accel); err != nil || got != want { + t.Errorf("%s: %q %v", accel, got, err) + } + } + if _, err := keydChord(""); err == nil { + t.Error("an accelerator without a key") + } +} diff --git a/cmd/image/session.go b/cmd/image/session.go index 8c4cd81..8364eff 100644 --- a/cmd/image/session.go +++ b/cmd/image/session.go @@ -66,6 +66,34 @@ func (r *report) keyd(v *qemu.VM, g *guest) { until(60*time.Second, time.Second, func() bool { got, err = g.run(`cat `+keydProbeOut, ""); return err == nil }) r.add("keyd: Super+V, A, C, X", got == "mkjkj" && overview == "false", fmt.Sprintf("the field held %q, want \"mkjkj\"; overview open %s", got, overview)+errText(err)) + // The letters keyd sends as plain keys reach the focused application as the chord it binds + // (usr/share/construct/keys.json, the keys extension): Super+T, W and R to a window posing as + // Files are Ctrl+T, Ctrl+W and Ctrl+R; to one posing as Ghostty, Ctrl+Shift+T and + // Ctrl+Shift+W, and nothing for R, which is the shell's own history search. + for _, c := range []struct{ pose, want string }{ + {"org.gnome.Nautilus", "ctrl+t\nctrl+w\nctrl+r"}, + {"com.mitchellh.ghostty", "ctrl+shift+t\nctrl+shift+w"}, + } { + _, _ = g.run(`rm -f `+keydProbeOut, "") + if _, err := g.eval(`GLib.spawn_command_line_async("/usr/lib/construct-test/keyd-probe.py ` + c.pose + `"); true`); err != nil { + r.add("keys: "+c.pose, false, "the probe: "+err.Error()) + continue + } + if !until(20*time.Second, time.Second, func() bool { + var has string + _ = g.evalJSON(`return global.get_window_actors().map(a => a.meta_window).filter(w => w.get_title() === "`+keydProbeTitle+`").map(w => (Main.activateWindow(w), w.has_focus())).some(Boolean) ? "true" : "false";`, &has) + return has == "true" + }) { + r.add("keys: "+c.pose, false, "the probe's window never had the focus") + continue + } + step("meta_l", "t") + step("meta_l", "w") + step("meta_l", "r") + var got string + until(60*time.Second, time.Second, func() bool { got, err = g.run(`cat `+keydProbeOut, ""); return err == nil }) + r.add("keys: "+c.pose, strings.TrimSpace(got) == c.want, fmt.Sprintf("the window got %q, want %q", strings.TrimSpace(got), c.want)+errText(err)) + } } // usbStick plugs a stick into the running session as a person does: udisks sees it, GNOME mounts diff --git a/image/apko.lock.yaml b/image/apko.lock.yaml index f40262a..ee5067d 100644 --- a/image/apko.lock.yaml +++ b/image/apko.lock.yaml @@ -22,7 +22,7 @@ contents: - bluez-doc=5.88-r1 - bolt=0.9.11-r1 - ccid=1.8.4-r0 - - code=1.145.2-r0 + - code=1.148.0-r0 - colord=1.4.8-r0 - colord-gtk=0.3.1-r0 - construct-brand=0_git20261005-r5 @@ -380,9 +380,9 @@ contents: - curl-doc=8.23.0-r4 - cyrus-sasl-heimdal-libs=2.1.28-r59 - db=2026.10.8-r2 - - dbus=1.16.4-r0 - - dbus-doc=1.16.4-r0 - - dbus-libs=1.16.4-r0 + - dbus=1.16.4-r1 + - dbus-doc=1.16.4-r1 + - dbus-libs=1.16.4-r1 - dmidecode=3.7-r5 - dmidecode-doc=3.7-r5 - docbook-xml=4.5-r10 @@ -917,8 +917,8 @@ contents: - libxkbcommon=1.13.2-r5 - libxkbcommon-doc=1.13.2-r5 - libxkbfile=1.2.0-r6 - - libxml2-16=2.15.4-r5 - - libxml2-utils=2.15.4-r5 + - libxml2-16=2.15.4-r6 + - libxml2-utils=2.15.4-r6 - libxrandr=1.5.5-r8 - libxrender-dev=0.9.13-r2 - libxrender1=0.9.13-r2 @@ -1096,8 +1096,8 @@ contents: - util-linux-misc=2.42.4-r3 - util-linux-su=2.42.4-r3 - util-macros=1.20.2-r6 - - vim=9.2.1428-r0 - - vim-doc=9.2.1428-r0 + - vim=9.2.1434-r0 + - vim-doc=9.2.1434-r0 - vulkan-loader=1.4.369-r0 - vulkan-loader-libs=1.4.369-r0 - wayland-libs-client=1.26.0-r4 diff --git a/image/initrd/apko.lock.yaml b/image/initrd/apko.lock.yaml index 122ed69..863aeab 100644 --- a/image/initrd/apko.lock.yaml +++ b/image/initrd/apko.lock.yaml @@ -39,8 +39,8 @@ contents: - cryptsetup=2.8.9-r0 - curl=8.23.0-r4 - cyrus-sasl-heimdal-libs=2.1.28-r59 - - dbus=1.16.4-r0 - - dbus-libs=1.16.4-r0 + - dbus=1.16.4-r1 + - dbus-libs=1.16.4-r1 - e2fsprogs=1.47.4-r6 - e2fsprogs-libs=1.47.4-r6 - fontconfig-config=2.18.4-r0 diff --git a/image/rootfs/etc/dconf/db/local.d/00-construct b/image/rootfs/etc/dconf/db/local.d/00-construct index 1f30632..24c2d6e 100644 --- a/image/rootfs/etc/dconf/db/local.d/00-construct +++ b/image/rootfs/etc/dconf/db/local.d/00-construct @@ -38,7 +38,7 @@ unmaximize=@as [] # Drive Menu and Night Theme Switcher are installed, off: Orchis is the system shell theme, and # the last turns libadwaita light by day while the shell and GTK 3 stay on Orchis's dark theme. [org/gnome/shell] -enabled-extensions=['appindicatorsupport@rgcjonas.gmail.com', 'clipboard-indicator@tudmotu.com', 'just-perfection-desktop@just-perfection', 'caffeine@patapon.info', 'Vitals@CoreCoding.com', 'tilingshell@ferrarodomenico.com', 'dash-to-panel@jderose9.github.com', 'gtk4-ding@smedius.gitlab.com'] +enabled-extensions=['keys@constructlinux.org', 'appindicatorsupport@rgcjonas.gmail.com', 'clipboard-indicator@tudmotu.com', 'just-perfection-desktop@just-perfection', 'caffeine@patapon.info', 'Vitals@CoreCoding.com', 'tilingshell@ferrarodomenico.com', 'dash-to-panel@jderose9.github.com', 'gtk4-ding@smedius.gitlab.com'] # The dock: Files, the browser, the editor, the terminal, Software, Calendar. favorite-apps=['org.gnome.Nautilus.desktop', 'firefox.desktop', 'code.desktop', 'com.mitchellh.ghostty.desktop', 'org.gnome.Software.desktop', 'org.gnome.Calendar.desktop'] @@ -137,13 +137,24 @@ enable-smartcard-authentication=false [org/gnome/shell/keybindings] show-screenshot-ui=['Print', 'XF86SelectiveScreenshot'] -# keyd takes Super with C, V, X, Z, A, S, F, T, W and Q for the clipboard and the rest -# (etc/keyd/default.conf): the shell never sees them, so it binds none. The notification list -# keeps Super+M; the app grid is Super pressed twice; Quick Settings is the panel's menu. +# keyd takes Super with a letter (etc/keyd/default.conf, usr/share/construct/keys.json): the +# clipboard's as Insert chords, the rest as F13 to F24, which the keys extension turns into each +# application's chord; the shell never sees Super with those letters, so it binds none. The +# notification list keeps Super+M, Super+K opens the table (construct-keys, below); the app grid +# is Super pressed twice; Quick Settings is the panel's menu. toggle-message-tray=['m'] toggle-application-view=@as [] toggle-quick-settings=@as [] +# Super+K: the table of what Super does with each letter, per application (construct-keys). +[org/gnome/settings-daemon/plugins/media-keys] +custom-keybindings=['/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/keys/'] + +[org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/keys] +name='Keyboard shortcuts' +command='construct-keys' +binding='k' + # Vitals' readings at their own widths: fixed widths reserved room for the widest value each can # take, which spread the bar out; the bar's numbers are tabular, so a reading keeps its width as # it changes. diff --git a/image/rootfs/etc/keyd/default.conf b/image/rootfs/etc/keyd/default.conf index c2b3a64..7995e1e 100644 --- a/image/rootfs/etc/keyd/default.conf +++ b/image/rootfs/etc/keyd/default.conf @@ -1,8 +1,11 @@ # Super with a letter, as a Mac's Command: on every keyboard, in every application, from the # console to GDM. Copy, paste and cut go as Ctrl+Insert, Shift+Insert and Shift+Delete, which # GTK, browsers, VS Code and terminals take for the clipboard, so a terminal copies rather than -# interrupts. The rest go as Ctrl with the letter: in a terminal they are its control characters -# (Super+S stops output, Super+Q resumes it, Super+Z suspends). Super alone still opens the +# interrupts. Each other letter goes as a plain key no keyboard has, F13 to F24, which the shell's +# keys extension (usr/share/gnome-shell/extensions/keys@constructlinux.org) turns into the chord +# the focused application binds for it - Ctrl+T in Files, Ctrl+Shift+T in a terminal - as +# usr/share/construct/keys.json says: one table for keyd, the extension and construct-keys, and +# go test ./cmd/image fails this file when it strays from it. Super alone still opens the # overview, and Ctrl+C and Ctrl+V work as before. `sudo keyd reload` after an edit. [ids] * @@ -11,10 +14,15 @@ c = C-insert v = S-insert x = S-delete -z = C-z -a = C-a -s = C-s -f = C-f -t = C-t -w = C-w -q = C-q +a = f13 +z = f14 +s = f15 +f = f16 +t = f17 +w = f18 +n = f19 +p = f20 +q = f21 +r = f22 +l = f23 +o = f24 diff --git a/image/rootfs/etc/xkb/rules/evdev b/image/rootfs/etc/xkb/rules/evdev new file mode 100644 index 0000000..dc8f795 --- /dev/null +++ b/image/rootfs/etc/xkb/rules/evdev @@ -0,0 +1,11 @@ +// keyd sends Super with a letter as F13 to F24 for the shell's keys extension to grab +// (etc/keyd/default.conf). xkeyboard-config's evdev map gives those keycodes XF86Tools, +// XF86Launch5-9, XF86AudioMicMute and the touchpad's keysyms, on several of which gsd acts; +// its own fkeys(basic_13-24) gives back F13 to F24, which nothing else binds. libxkbcommon reads +// /etc/xkb before its own data, so this applies under every layout and option a person picks, +// at GDM as in the session, where an xkb-options default in dconf would go with the first +// option set in Tweaks. A person's ~/.config/xkb/rules/evdev replaces this file. +! include %S/evdev + +! model = symbols + * = +fkeys(basic_13-24) diff --git a/image/rootfs/usr/bin/construct-keys b/image/rootfs/usr/bin/construct-keys new file mode 100755 index 0000000..1735ebe --- /dev/null +++ b/image/rootfs/usr/bin/construct-keys @@ -0,0 +1,101 @@ +#!/usr/bin/python3 +# Keyboard shortcuts: the table of Super with a letter (usr/share/construct/keys.json), as keyd and +# the shell's keys extension apply it, shown per application. A viewer only: the table is the +# image's, and go test ./cmd/image keeps keyd's file to it. +import gettext +import json +import sys + +import gi + +gi.require_version("Gtk", "4.0") +gi.require_version("Adw", "1") +from gi.repository import Adw, Gtk # noqa: E402 + +_ = gettext.translation("construct-keys", fallback=True).gettext + +APP_ID = "io.github.construct_linux.Keys" +TABLE = "/usr/share/construct/keys.json" + + +def chord_label(accel): + """"t" as a person reads it: Ctrl+Shift+T.""" + if not accel: + return _("nothing") + parts = [] + rest = accel + while rest.startswith("<"): + mod, rest = rest[1:].split(">", 1) + parts.append({"Control": "Ctrl", "Shift": "Shift", "Alt": "Alt"}.get(mod, mod)) + parts.append(rest.upper() if len(rest) == 1 else rest) + return "+".join(parts) + + +def key_label(key): + return key.upper() if len(key) == 1 else key + + +class Page: + def __init__(self, title, note, rows): + self.title, self.note, self.rows = title, note, rows + + +def pages(table): + everywhere = [(key_label(e["key"]), e["does"], chord_label(e["sends"])) for e in table["everywhere"]] + default = [(key_label(e["key"]), e["does"], chord_label(e["sends"])) for e in table["default"]] + result = [ + Page(_("Everywhere"), _("Super with the letter, in every application, the console and the login screen"), everywhere), + Page(_("Most applications"), _("Super with the letter, where the application binds Ctrl with it"), default), + ] + for app in table["apps"].values(): + rows = [(key_label(e["key"]), e["does"], chord_label(e["sends"])) for e in app["keys"]] + result.append(Page(app["name"], _("Super with the letter, as this application binds it"), everywhere + rows)) + result.append(Page(_("The shell"), _("Super on its own, and with what the shell keeps"), [(e["key"], e["does"], "") for e in table["shell"]])) + return result + + +class KeysWindow(Adw.ApplicationWindow): + def __init__(self, app, table): + super().__init__(application=app, title=_("Keyboard shortcuts"), default_width=760, default_height=560) + split = Adw.NavigationSplitView() + self.set_content(split) + sidebar = Gtk.ListBox(css_classes=["navigation-sidebar"]) + self._pages = pages(table) + for page in self._pages: + sidebar.append(Gtk.Label(label=page.title, xalign=0, margin_top=8, margin_bottom=8, margin_start=8)) + sidebar.connect("row-selected", lambda _box, row: self._show(self._pages[row.get_index()]) if row else None) + side = Adw.ToolbarView() + side.add_top_bar(Adw.HeaderBar()) + side.set_content(Gtk.ScrolledWindow(child=sidebar)) + split.set_sidebar(Adw.NavigationPage(title=_("Keyboard shortcuts"), child=side)) + self._content = Adw.ToolbarView() + self._content.add_top_bar(Adw.HeaderBar()) + self._page = Adw.NavigationPage(title=self._pages[0].title, child=self._content) + split.set_content(self._page) + sidebar.select_row(sidebar.get_row_at_index(0)) + + def _show(self, page): + self._page.set_title(page.title) + group = Adw.PreferencesGroup(description=page.note) + for key, does, sends in page.rows: + row = Adw.ActionRow(title=does, subtitle=sends) + chip = Gtk.Label(label=f"Super+{key}" if len(key) == 1 or key[0].isdigit() else key, css_classes=["keycap"], valign=Gtk.Align.CENTER) + row.add_prefix(chip) + group.add(row) + prefs = Adw.PreferencesPage() + prefs.add(group) + self._content.set_content(prefs) + + +class KeysApp(Adw.Application): + def __init__(self): + super().__init__(application_id=APP_ID) + + def do_activate(self): + with open(TABLE) as f: + table = json.load(f) + win = self.props.active_window or KeysWindow(self, table) + win.present() + + +sys.exit(KeysApp().run([])) diff --git a/image/rootfs/usr/share/applications/io.github.construct_linux.Keys.desktop b/image/rootfs/usr/share/applications/io.github.construct_linux.Keys.desktop new file mode 100644 index 0000000..8f1f1b4 --- /dev/null +++ b/image/rootfs/usr/share/applications/io.github.construct_linux.Keys.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Keyboard Shortcuts +Comment=Super with a letter, the same in every application +Icon=input-keyboard-symbolic +Exec=construct-keys +Categories=Settings;System; +StartupNotify=true diff --git a/image/rootfs/usr/share/construct/keys.json b/image/rootfs/usr/share/construct/keys.json new file mode 100644 index 0000000..0afee47 --- /dev/null +++ b/image/rootfs/usr/share/construct/keys.json @@ -0,0 +1,65 @@ +{ + "about": "Super with a letter, as a Mac's Command, the same in every application. keyd (etc/keyd/default.conf) takes the letters below the compositor: copy, paste and cut as the Insert chords every application and terminal takes, and each other letter as a plain key no keyboard has (F13 to F24), which the shell's keys extension turns into the chord the focused application binds for it: Ctrl with the letter in most, Ctrl+Shift in a terminal, whose Ctrl+letter are its control characters. Super alone opens the overview, Super+number the dock's apps, Super+M the notifications, Super+K this table. construct-keys shows it.", + "everywhere": [ + {"key": "c", "does": "Copy", "sends": "Insert"}, + {"key": "v", "does": "Paste", "sends": "Insert"}, + {"key": "x", "does": "Cut", "sends": "Delete"} + ], + "default": [ + {"key": "a", "plain": "F13", "does": "Select all", "sends": "a"}, + {"key": "z", "plain": "F14", "does": "Undo", "sends": "z"}, + {"key": "s", "plain": "F15", "does": "Save", "sends": "s"}, + {"key": "f", "plain": "F16", "does": "Find", "sends": "f"}, + {"key": "t", "plain": "F17", "does": "New tab", "sends": "t"}, + {"key": "w", "plain": "F18", "does": "Close the tab or window", "sends": "w"}, + {"key": "n", "plain": "F19", "does": "New window or document", "sends": "n"}, + {"key": "p", "plain": "F20", "does": "Print", "sends": "p"}, + {"key": "q", "plain": "F21", "does": "Quit", "sends": "q"}, + {"key": "r", "plain": "F22", "does": "Reload", "sends": "r"}, + {"key": "l", "plain": "F23", "does": "The location or address", "sends": "l"}, + {"key": "o", "plain": "F24", "does": "Open", "sends": "o"} + ], + "apps": { + "com.mitchellh.ghostty.desktop": { + "name": "Ghostty", + "keys": [ + {"key": "a", "does": "Select all", "sends": "a"}, + {"key": "f", "does": "Find", "sends": "f"}, + {"key": "t", "does": "New tab", "sends": "t"}, + {"key": "w", "does": "Close the tab", "sends": "w"}, + {"key": "n", "does": "New window", "sends": "n"}, + {"key": "q", "does": "Quit", "sends": "q"}, + {"key": "z", "does": "Nothing: the shell's own Ctrl+Z suspends", "sends": ""}, + {"key": "s", "does": "Nothing: the shell's own Ctrl+S stops output", "sends": ""}, + {"key": "p", "does": "Nothing: the shell's own Ctrl+P is the previous command", "sends": ""}, + {"key": "r", "does": "Nothing: the shell's own Ctrl+R searches the history", "sends": ""}, + {"key": "l", "does": "Nothing: the shell's own Ctrl+L clears the screen", "sends": ""}, + {"key": "o", "does": "Nothing", "sends": ""} + ] + }, + "org.gnome.Ptyxis.desktop": { + "name": "Ptyxis", + "keys": [ + {"key": "a", "does": "Select all", "sends": "a"}, + {"key": "f", "does": "Find", "sends": "f"}, + {"key": "t", "does": "New tab", "sends": "t"}, + {"key": "w", "does": "Close the tab", "sends": "w"}, + {"key": "n", "does": "New window", "sends": "n"}, + {"key": "q", "does": "Quit", "sends": "q"}, + {"key": "z", "does": "Nothing: the shell's own Ctrl+Z suspends", "sends": ""}, + {"key": "s", "does": "Nothing: the shell's own Ctrl+S stops output", "sends": ""}, + {"key": "p", "does": "Nothing: the shell's own Ctrl+P is the previous command", "sends": ""}, + {"key": "r", "does": "Nothing: the shell's own Ctrl+R searches the history", "sends": ""}, + {"key": "l", "does": "Nothing: the shell's own Ctrl+L clears the screen", "sends": ""}, + {"key": "o", "does": "Nothing", "sends": ""} + ] + } + }, + "shell": [ + {"key": "Super", "does": "The overview; pressed twice, the app grid"}, + {"key": "1 to 9", "does": "The dock's apps, in order"}, + {"key": "m", "does": "Notifications"}, + {"key": "k", "does": "This table"}, + {"key": "Tab", "does": "Switch windows"} + ] +} diff --git a/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/extension.js b/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/extension.js new file mode 100644 index 0000000..b5ffe6d --- /dev/null +++ b/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/extension.js @@ -0,0 +1,95 @@ +// Super with a letter, the same in every application (usr/share/construct/keys.json). keyd, below +// the compositor, swallows Super and sends a plain key no keyboard has for each letter (F13 to +// F24); this grabs those keys and sends the focused application the chord it binds for the letter: +// Ctrl+T to Files, Ctrl+Shift+T to a terminal. The chord goes through a virtual keyboard of the +// compositor's with a clean modifier state, which is why keyd must not pass Super along: a chord +// sent while Super is held reaches the application as Super+Ctrl+T, which nothing binds. +import Clutter from 'gi://Clutter'; +import Gio from 'gi://Gio'; +import GLib from 'gi://GLib'; +import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; + +import {Extension} from 'resource:///org/gnome/shell/extensions/extension.js'; +import * as Main from 'resource:///org/gnome/shell/ui/main.js'; + +const TABLE = '/usr/share/construct/keys.json'; + +// Keysyms for what the table sends: letters are their ASCII, the rest X11's. +const KEYSYMS = { + Control: Clutter.KEY_Control_L, Shift: Clutter.KEY_Shift_L, Alt: Clutter.KEY_Alt_L, + Insert: Clutter.KEY_Insert, Delete: Clutter.KEY_Delete, comma: Clutter.KEY_comma, +}; + +function keysym(name) { + if (name in KEYSYMS) + return KEYSYMS[name]; + if (name.length === 1) + return name.toLowerCase().charCodeAt(0); + throw new Error(`keys: no keysym for ${name}`); +} + +// chord takes "t" apart: the modifiers to hold, then the key. +function chord(accel) { + const mods = []; + let rest = accel; + for (;;) { + const m = rest.match(/^<(Control|Shift|Alt)>/); + if (!m) + break; + mods.push(keysym(m[1])); + rest = rest.slice(m[0].length); + } + return {mods, key: keysym(rest)}; +} + +export default class KeysExtension extends Extension { + enable() { + const [, bytes] = Gio.File.new_for_path(TABLE).load_contents(null); + const table = JSON.parse(new TextDecoder().decode(bytes)); + this._defaults = new Map(table.default.map(e => [e.key, e.sends])); + this._apps = new Map(Object.entries(table.apps).map(([id, app]) => [id, new Map(app.keys.map(e => [e.key, e.sends]))])); + this._actions = new Map(); + for (const e of table.default) { + const action = global.display.grab_accelerator(e.plain, Meta.KeyBindingFlags.NONE); + if (action === Meta.KeyBindingAction.NONE) { + console.warn(`keys: ${e.plain} could not be grabbed`); + continue; + } + Main.wm.allowKeybinding(Meta.external_binding_name_for_action(action), Shell.ActionMode.NORMAL); + this._actions.set(action, e.key); + } + this._activated = global.display.connect('accelerator-activated', (_display, action) => this._send(action)); + this._keyboard = global.stage.context.get_backend().get_default_seat().create_virtual_device(Clutter.InputDeviceType.KEYBOARD_DEVICE); + } + + disable() { + global.display.disconnect(this._activated); + for (const action of this._actions.keys()) + global.display.ungrab_accelerator(action); + this._actions = null; + this._keyboard = null; + } + + // The chord for the letter in the focused window's application, or the default's; a table + // entry that sends nothing leaves the letter to the application (a terminal's own Ctrl+R). + _send(action) { + const letter = this._actions.get(action); + if (letter === undefined) + return; + const window = global.display.focus_window; + const app = window ? Shell.WindowTracker.get_default().get_window_app(window) : null; + const forApp = this._apps.get(app?.get_id() ?? ''); + const accel = forApp?.has(letter) ? forApp.get(letter) : this._defaults.get(letter); + if (!accel) + return; + const {mods, key} = chord(accel); + const now = () => GLib.get_monotonic_time(); + for (const m of mods) + this._keyboard.notify_keyval(now(), m, Clutter.KeyState.PRESSED); + this._keyboard.notify_keyval(now(), key, Clutter.KeyState.PRESSED); + this._keyboard.notify_keyval(now(), key, Clutter.KeyState.RELEASED); + for (const m of mods.reverse()) + this._keyboard.notify_keyval(now(), m, Clutter.KeyState.RELEASED); + } +} diff --git a/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/metadata.json b/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/metadata.json new file mode 100644 index 0000000..c1e4458 --- /dev/null +++ b/image/rootfs/usr/share/gnome-shell/extensions/keys@constructlinux.org/metadata.json @@ -0,0 +1,7 @@ +{ + "uuid": "keys@constructlinux.org", + "name": "Keys", + "description": "Super with a letter, the same in every application: the plain keys keyd sends for them become the chord the focused application binds, from usr/share/construct/keys.json.", + "shell-version": ["51"], + "version": 1 +} diff --git a/image/test/rootfs/usr/lib/construct-test/keyd-probe.py b/image/test/rootfs/usr/lib/construct-test/keyd-probe.py index c2dc4a4..50d6d3c 100755 --- a/image/test/rootfs/usr/lib/construct-test/keyd-probe.py +++ b/image/test/rootfs/usr/lib/construct-test/keyd-probe.py @@ -8,25 +8,43 @@ import gi gi.require_version("Gtk", "4.0") -from gi.repository import GLib, Gtk # noqa: E402 +from gi.repository import Gdk, GLib, Gtk # noqa: E402 TITLE = "construct-keyd-probe" OUT = "/run/user/1000/construct-test/keyd.txt" SECONDS = 40 +# With an application id as the argument the probe poses as that application (the shell's keys +# extension sends a terminal Ctrl+Shift with the letter, others Ctrl), and writes the chords its +# window received, one a line - "ctrl+shift+t" - instead of the field's text. +POSE = sys.argv[1] if len(sys.argv) > 1 else "" -app = Gtk.Application(application_id="io.github.construct_linux.KeydProbe") +app = Gtk.Application(application_id=POSE or "io.github.construct_linux.KeydProbe") def activate(app): entry = Gtk.Entry() win = Gtk.ApplicationWindow(application=app, title=TITLE, child=entry, default_width=400) + chords = [] + if POSE: + def pressed(_controller, keyval, _keycode, state): + name = Gdk.keyval_name(keyval) or "" + if name in ("Control_L", "Shift_L", "Alt_L", "Super_L", "Control_R", "Shift_R"): + return False + mods = [m for flag, m in ((Gdk.ModifierType.CONTROL_MASK, "ctrl"), (Gdk.ModifierType.SHIFT_MASK, "shift"), + (Gdk.ModifierType.ALT_MASK, "alt"), (Gdk.ModifierType.SUPER_MASK, "super")) if state & flag] + chords.append("+".join(mods + [name.lower()])) + return True + + keys = Gtk.EventControllerKey(propagation_phase=Gtk.PropagationPhase.CAPTURE) + keys.connect("key-pressed", pressed) + win.add_controller(keys) win.present() entry.grab_focus() def done(): os.makedirs(os.path.dirname(OUT), exist_ok=True) with open(OUT, "w") as f: - f.write(entry.get_text()) + f.write("\n".join(chords) if POSE else entry.get_text()) app.quit() GLib.timeout_add_seconds(SECONDS, done) diff --git a/kernel/Dockerfile b/kernel/Dockerfile index 82e536e..1b2c213 100644 --- a/kernel/Dockerfile +++ b/kernel/Dockerfile @@ -54,8 +54,8 @@ COPY kernel/platform.config kernel/desktop.config /usr/src/fragments/ # newer than Arch's newest tag (7.3 on the day it came out) builds over the newest tag's: every # symbol the base does not know takes olddefconfig's default, a driver new in this kernel is not # built, and the log lists them (listnewconfig); Arch's tag for the kernel replaces it when it is. -ADD --checksum=sha256:bb03d28b8af371cd47eebf18378197c57e26c951d33c872d52ae97a2690d1ec6 \ - https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/7.3.4.arch1-2/config.x86_64 \ +ADD --checksum=sha256:4f1c75c66623f09b80c4adcafd998377fea51ae962c26e0a30656e3edd873069 \ + https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/7.3.6.arch1-2/config.x86_64 \ /usr/src/base.config # Which kernel this is: the fragments merged over the base, in order, a later one's line for a diff --git a/kernel/patches/0001-7226c5c21f48.patch b/kernel/patches/0001-7226c5c21f48.patch deleted file mode 100644 index d83c658..0000000 --- a/kernel/patches/0001-7226c5c21f48.patch +++ /dev/null @@ -1,235 +0,0 @@ -construct: Mark Brown's sound tree (broonie CI, 2026-09-15; not in a release yet), as committed there: it applies to 7.3. The X9-15p's four CS35L57 amplifiers are lost after a suspend without it: audio dead until a reboot (thesofproject/linux#5898). - -From 7226c5c21f486aee3f1dad0e5bef20db6006a662 Mon Sep 17 00:00:00 2001 -From: Richard Fitzgerald -Date: Tue, 15 Sep 2026 11:21:10 +0100 -Subject: [PATCH] ASoC: cs35l56: Wait for firmware timer expiry before system - suspend - -On CS35L5x firmware older than 3.13.7 (B0 silicon) and 4.7.16 (B2 silicon) -a SoundWire bus reset is not allowed within 250ms of the last firmware -timer start. - -This is already avoided during runtime suspend by the various idle -timeouts. System suspend can happen at any time so needs special -protection. The driver cannot cancel the firmware timer, so it must wait -long enough for the timer to expire. - -The delay is placed in the suspend stage because typically this has less -impact on end users than delays in resuming. The amp is in PS3 power -state when suspending and no new timers will be started in this state. -An extra 10ms is added to the delay to avoid a race on the exact instant -the firmware timer expires. - -There is no need to have the delay for every driver instance. The timers -on each amp will expire in parallel, so the delay is only needed once. -A global flag is used so that the first instance to reach its suspend() -callback will delay and then clear the flag. The cs35l56_fw_idle_wait_lock -mutex is to ensure this is still safe if async_suspend was ever enabled -for SoundWire devices. - -Fixes: e496112529006 ("ASoC: cs35l56: Add driver for Cirrus Logic CS35L56") -Reported-by: Ferenc Lengyel -Closes: https://github.com/thesofproject/linux/issues/5898 -Signed-off-by: Richard Fitzgerald -Link: https://patch.msgid.link/20260915102110.3276924-1-rf@opensource.cirrus.com -Signed-off-by: Mark Brown ---- - include/sound/cs35l56.h | 4 ++++ - sound/soc/codecs/cs35l56-sdw.c | 27 +++++++++++++++++++++- - sound/soc/codecs/cs35l56-shared.c | 38 +++++++++++++++++++++++++++++++ - sound/soc/codecs/cs35l56.c | 17 ++++++++++++++ - sound/soc/codecs/cs35l56.h | 1 + - 5 files changed, 86 insertions(+), 1 deletion(-) - -diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h -index 45a5df574aa6d2..447876ba295413 100644 ---- a/include/sound/cs35l56.h -+++ b/include/sound/cs35l56.h -@@ -209,6 +209,9 @@ struct snd_ctl_elem_value; - - #define CS35L56_GPIO_FN_GPIO 0x00000001 - -+/* DSP1_FW_VER */ -+#define CS35L56_FW_MAIN_VERSION_MASK GENMASK(19, 0) -+ - /* Mixer input sources */ - #define CS35L56_INPUT_SRC_NONE 0x00 - #define CS35L56_INPUT_SRC_ASP1RX1 0x08 -@@ -445,6 +448,7 @@ int cs35l56_cal_set_status_get(struct cs35l56_base *cs35l56_base, - int cs35l56_read_prot_status(struct cs35l56_base *cs35l56_base, - bool *fw_missing, unsigned int *fw_version); - void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base); -+bool cs35l56_needs_wait_for_firmware_timer_expiry(struct cs35l56_base *cs35l56_base); - void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp); - int cs35l56_hw_init(struct cs35l56_base *cs35l56_base); - int cs35l56_get_speaker_id(struct cs35l56_base *cs35l56_base); -diff --git a/sound/soc/codecs/cs35l56-sdw.c b/sound/soc/codecs/cs35l56-sdw.c -index 98bb4542b9143f..b2507a6a37c1a7 100644 ---- a/sound/soc/codecs/cs35l56-sdw.c -+++ b/sound/soc/codecs/cs35l56-sdw.c -@@ -9,6 +9,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -36,6 +37,9 @@ - #define CS35L56_LATE_READ_POLL_US 10 - #define CS35L56_LATE_READ_TIMEOUT_US 1000 - -+static DEFINE_MUTEX(cs35l56_fw_idle_wait_lock); -+static bool cs35l56_fw_idle_wait_pending; -+ - static int cs35l56_sdw_poll_mem_status(struct sdw_slave *peripheral, - unsigned int mask, - unsigned int match) -@@ -382,14 +386,34 @@ static int __maybe_unused cs35l56_sdw_runtime_resume(struct device *dev) - return 0; - } - -+static int cs35l56_sdw_system_suspend_prepare(struct device *dev) -+{ -+ cs35l56_fw_idle_wait_pending = true; -+ -+ return 0; -+} -+ - static int __maybe_unused cs35l56_sdw_system_suspend(struct device *dev) - { - struct cs35l56_private *cs35l56 = dev_get_drvdata(dev); -+ int ret; - - if (cs35l56->sdw_attached) - cs35l56_mask_soundwire_interrupts(cs35l56); - -- return cs35l56_system_suspend(dev); -+ ret = cs35l56_system_suspend(dev); -+ if (ret < 0) -+ return ret; -+ -+ scoped_guard(mutex, &cs35l56_fw_idle_wait_lock) { -+ if (cs35l56_fw_idle_wait_pending && cs35l56->needs_wait_for_fw_idle) { -+ dev_dbg(cs35l56->base.dev, "Wait for FW timer expiry\n"); -+ msleep(CS35L56_FW_REQ_ACTIVE_TIMEOUT_MS + 10); -+ cs35l56_fw_idle_wait_pending = false; -+ } -+ } -+ -+ return 0; - } - - static int cs35l56_sdw_probe(struct sdw_slave *peripheral, const struct sdw_device_id *id) -@@ -455,6 +479,7 @@ static void cs35l56_sdw_remove(struct sdw_slave *peripheral) - } - - static const struct dev_pm_ops cs35l56_sdw_pm = { -+ .prepare = cs35l56_sdw_system_suspend_prepare, - SET_RUNTIME_PM_OPS(cs35l56_sdw_runtime_suspend, cs35l56_sdw_runtime_resume, NULL) - SYSTEM_SLEEP_PM_OPS(cs35l56_sdw_system_suspend, cs35l56_system_resume) - LATE_SYSTEM_SLEEP_PM_OPS(cs35l56_system_suspend_late, cs35l56_system_resume_early) -diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c -index 7b3e37d462d61e..b37f65cd4d336a 100644 ---- a/sound/soc/codecs/cs35l56-shared.c -+++ b/sound/soc/codecs/cs35l56-shared.c -@@ -1379,6 +1379,44 @@ void cs35l56_warn_if_firmware_missing(struct cs35l56_base *cs35l56_base) - } - EXPORT_SYMBOL_NS_GPL(cs35l56_warn_if_firmware_missing, "SND_SOC_CS35L56_SHARED"); - -+bool cs35l56_needs_wait_for_firmware_timer_expiry(struct cs35l56_base *cs35l56_base) -+{ -+ unsigned int fw_ver; -+ bool prot_sts; -+ int ret; -+ -+ switch (cs35l56_base->type) { -+ case 0x54: -+ case 0x56: -+ case 0x57: -+ switch (cs35l56_base->rev) { -+ case 0xb0: -+ ret = cs35l56_read_prot_status(cs35l56_base, &prot_sts, &fw_ver); -+ if (ret) -+ return true; -+ -+ if ((fw_ver & CS35L56_FW_MAIN_VERSION_MASK) < 0x30d07) -+ return true; -+ -+ return false; -+ case 0xb2: -+ ret = cs35l56_read_prot_status(cs35l56_base, &prot_sts, &fw_ver); -+ if (ret) -+ return true; -+ -+ if ((fw_ver & CS35L56_FW_MAIN_VERSION_MASK) < 0x40710) -+ return true; -+ -+ return false; -+ default: -+ return false; -+ } -+ default: -+ return false; -+ } -+} -+EXPORT_SYMBOL_NS_GPL(cs35l56_needs_wait_for_firmware_timer_expiry, "SND_SOC_CS35L56_SHARED"); -+ - void cs35l56_log_tuning(struct cs35l56_base *cs35l56_base, struct cs_dsp *cs_dsp) - { - __be32 pid, sid, tid; -diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c -index 35d2106266279f..07f773a1ea005c 100644 ---- a/sound/soc/codecs/cs35l56.c -+++ b/sound/soc/codecs/cs35l56.c -@@ -1639,6 +1639,10 @@ int cs35l56_system_resume(struct device *dev) - - dev_dbg(dev, "system_resume\n"); - -+ /* Assume the firmware reset to default until we can check it */ -+ if (cs35l56->base.init_done) -+ cs35l56->needs_wait_for_fw_idle = true; -+ - /* - * We might have done a hard reset or the CS35L56 was power-cycled - * so wait for control port to be ready. -@@ -1653,6 +1657,16 @@ int cs35l56_system_resume(struct device *dev) - if (ret) - return ret; - -+ if (cs35l56->sdw_peripheral && cs35l56->base.init_done) { -+ ret = pm_runtime_resume_and_get(cs35l56->base.dev); -+ if (ret < 0) -+ return ret; -+ -+ cs35l56->needs_wait_for_fw_idle = -+ cs35l56_needs_wait_for_firmware_timer_expiry(&cs35l56->base); -+ pm_runtime_put_autosuspend(cs35l56->base.dev); -+ } -+ - /* Firmware won't have been loaded if the component hasn't probed */ - if (!cs35l56->component) - return 0; -@@ -2177,6 +2191,9 @@ int cs35l56_init(struct cs35l56_private *cs35l56) - if (ret) - return dev_err_probe(cs35l56->base.dev, ret, "Failed to write ASP1_CONTROL3\n"); - -+ cs35l56->needs_wait_for_fw_idle = -+ cs35l56_needs_wait_for_firmware_timer_expiry(&cs35l56->base); -+ - cs35l56->base.init_done = true; - complete_all(&cs35l56->init_completion); - -diff --git a/sound/soc/codecs/cs35l56.h b/sound/soc/codecs/cs35l56.h -index f7cf8aa653e285..b46f410f0e0938 100644 ---- a/sound/soc/codecs/cs35l56.h -+++ b/sound/soc/codecs/cs35l56.h -@@ -43,6 +43,7 @@ struct cs35l56_private { - bool soft_resetting; - bool sdw_attached; - bool component_registered; -+ bool needs_wait_for_fw_idle; - struct completion init_completion; - - int speaker_id; diff --git a/recipes/code.yaml b/recipes/code.yaml index 10f9bd3..0e23775 100644 --- a/recipes/code.yaml +++ b/recipes/code.yaml @@ -5,7 +5,7 @@ # image's releases: the tarball cannot update itself. Its license is Microsoft's, not open. package: name: code - version: 1.145.2 + version: 1.148.0 epoch: 0 description: Visual Studio Code, Microsoft's build copyright: @@ -29,7 +29,7 @@ pipeline: - uses: fetch with: uri: https://update.code.visualstudio.com/${{package.version}}/linux-x64/stable - expected-sha256: 3b01286639fa026fd860944b811d418f7b93bc5dc447d9e607b0cd1377cfbaa2 + expected-sha256: 7acdaf01a1d7a27c55828156ec3fdbe75b8e0809070fecd10de022c4982a0f16 extract: false # chrome-sandbox, setuid root in the tarball, loses the bit: Electron sandboxes with user