Skip to content

Commit c06bcaa

Browse files
committed
Add guarded MacBookPro14,3 T1 loader reference and validation
1 parent ddeb75a commit c06bcaa

12 files changed

Lines changed: 718 additions & 0 deletions

File tree

‎docs/macbookpro14-3/README.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# MacBookPro14,3 T1 loader reference
2+
3+
This branch shares a guarded late-loader implementation and independent hardware observations for discussion on [omarchy-pkgs #298](https://github.com/omacom/omarchy-pkgs/pull/298). It is a reference for extracting improvements into the existing proposal, not a request to ship two competing iBridge packages. Do not install this package alongside `apple-ib-drv-dkms`.
4+
5+
The source is in [pkgbuilds/apple-t1-touchbar-dkms](../../pkgbuilds/apple-t1-touchbar-dkms). The driver remains attributed to its upstream authors and pinned to a full commit with checksums. The loader adds strict model and USB identity checks, limited generic-HID ownership handover, refusal of recovery/configuration-2 devices, rollback and sixteen synthetic-sysfs tests.
6+
7+
[Hardware observations](validation-report.md) distinguish the implementation tested on MacBookPro14,3 from pending upstream PRs. [Verification results](TESTS.md) include the successful source build, the clean-chroot rebuild still needed, and the failures in the separate Omarchy installer suite. Installer and NVMe references mentioned in that report remain local and are not part of this package branch.
8+
9+
Only MacBookPro14,3 was physically tested. This is not general MacBook support or a production Wi-Fi/Thunderbolt suspend fix. The three experimental resume cycles do not establish USB 3.x transfers, 5 GHz Wi-Fi, attached-peripheral suspend or overnight stability. Firmware, recovery material, private logs and workstation-built binaries are excluded.

‎docs/macbookpro14-3/TESTS.md‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Verification performed
2+
3+
## Focused checks
4+
5+
- Cleaned T1 source package: `makepkg --nodeps --log` completed using the already installed build dependencies and kernel headers. Source checksums, module compilation, vermagic checks and all 16 loader tests passed. No package was installed.
6+
- `udevadm verify` accepted the gmux rule. `systemd-analyze verify` accepted the T1 service, while reporting the pre-existing escaped-PCI-path warning in the machine's installed NVMe service.
7+
- Installer tests passed: MacBookPro14,3 selects the T1 package, other SPI models retain their current package, T2 is untouched, and a package failure prevents service enablement. The test stubs package/system actions; it does not install anything.
8+
- NVMe reference tests passed: actual NVMe selected, GPU unchanged, multiple controllers and no-controller case handled. This reference is not recommended as another competing PR; #11624 has a more conservative controller scope.
9+
- All 9 experimental suspend guard/restore tests passed. Actual protected suspend observations are in `validation-report.md`.
10+
- `git diff --check` passed in all three worktrees. Installer/NVMe patches passed `git apply --check` against the unchanged Omarchy base checkout.
11+
- The submission directory was scanned for the local username/home path, recorded boot IDs, private firmware artifact names and local-network address patterns; no matches were found. Only explicit source files and reviewed summaries were copied.
12+
13+
## Full Omarchy suite
14+
15+
`./test/all` completed. The CLI suite passed. The shell suite reported 5 failures out of 245 test files:
16+
17+
| Test | Follow-up |
18+
|---|---|
19+
| `launch-about-test.sh` | Same failure reproduced in an unchanged checkout: roomy-window animation assertion |
20+
| `omarchy-kernel-migration-test.sh` | Same failure reproduced in an unchanged checkout: superseded PTL migration assertion |
21+
| `snapper-test.sh` | Same failure reproduced in an unchanged checkout: required sibling `omarchy-iso` checkout absent |
22+
| `update-pacman-test.sh` | Same failure reproduced in an unchanged checkout: guarded invocation assertion |
23+
| `locate-test.sh` | Failed decoding Python bytecode created under `bin/__pycache__` by earlier tests; passed in the clean checkout and in the changed checkout after removing only those generated cache files |
24+
25+
The full suite is therefore not green in this environment. These results must accompany any submission; do not claim all repository tests passed. No unrelated production code was changed to silence the failures.
26+
27+
The package build also emitted a fakeroot payload warning despite completing successfully. Archive ownership and modes were inspected. An official clean-chroot rebuild remains necessary before publishing the package; the workstation-built binary is excluded from this submission.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# MacBookPro14,3: independent T1, brightness and suspend observations
2+
3+
Test platform: Intel 15-inch 2017 MacBook Pro (MacBookPro14,3, Apple T1), Omarchy, kernel `7.2.5-3-omarchy`, Radeon Pro 560, BCM43602 (`14e4:43ba`), dual Alpine Ridge NHI (`8086:15d2`) and xHCI (`8086:15d4`). Only this model was physically tested.
4+
5+
These observations concern a local implementation. They are not a claim that PR #298, #9910, #11570 or any other pending PR was installed or validated verbatim.
6+
7+
## Touch Bar
8+
9+
The driver was pinned to `monomyth/t1-touchbar@a33c7eb27777339c047b8f532d1e6baebaec46bd`, including the resume/input changes related to AJ-dev-i60/t1-touchbar#1. The local loader checks model and healthy USB `05ac:8600`, validates identity before changes, only hands over permitted generic HID owners, refuses recovery mode and configuration-2 display stacks, and verifies the virtual control and SPI Fn handler after binding. It loads late, avoids SOCW calls and disables remote wake after HID binding.
10+
11+
Physical Esc/F1–F12/Fn-media operation, camera and subsequent boots were verified. Touch Bar resume was observed; physical Esc/F keys were confirmed after an earlier suspend. Sixteen synthetic-sysfs loader tests cover refusals and rollback. The cleaned source package compiled and passed all sixteen tests against the installed Omarchy headers, with module vermagic checked. DKMS remains responsible for installing modules on the user's kernel.
12+
13+
The public reference package contains no firmware recovery mechanism. Missing T1 firmware is a separate prerequisite: a recovery-mode T1 must not be reported as fixed merely because the DKMS package installed.
14+
15+
## Native panel brightness persistence
16+
17+
`gmux_backlight` is under PNP; the stock udev `path_id` import prevented the native systemd-backlight service from being requested. A local rule supplied `ID_PATH=platform-apple-gmux`, added the systemd tag and requested the native backlight unit. A save/change/load test restored the exact value, and a subsequent normal restart preserved it. This independently supports the diagnosis in omarchy#9910; that PR's rule omits the explicit identity, so our result is not a verbatim test of its implementation.
18+
19+
Volume also survived a normal restart under existing WirePlumber route/profile restoration. No additional volume daemon or fixed startup level is proposed.
20+
21+
## Suspend comparison
22+
23+
| Variant | Observed result |
24+
|---|---|
25+
| Disable D3cold on Wi-Fi, Thunderbolt and upstream bridges | Wi-Fi recovered in one cycle, but Thunderbolt produced inaccessible-device errors and both xHCI controllers disappeared |
26+
| Keep only both xHCI controllers runtime-active | Thunderbolt errors persisted; Wi-Fi failed MMIO reads with `0xffffffff` and resume error `-19`; user restarted to regain Wi-Fi |
27+
| Protect Wi-Fi and its bridge from D3cold, remove healthy empty Thunderbolt trees before s2idle, rescan afterwards | Three completed cycles in the same boot, both NHI/xHCI pairs restored, connected 2.4 GHz Wi-Fi with HTTPS verification, brightness and volume preserved |
28+
29+
In the second successful cycle one HTTPS attempt timed out after five seconds; subsequent requests to two independent sites returned HTTP 200, and three gateway pings had no loss. The third cycle returned HTTP 200 from both sites on the first attempt. No previous inaccessible-device/MMIO/resume/Thunderbolt warning patterns appeared during these protected resume intervals.
30+
31+
Wi-Fi firmware reinitialized after resume; this did not preserve the firmware instance. No claim is made for 5 GHz. The USB memory physically checked was later observed on the chipset USB 2.0 controller at 480 Mbit/s. NHI/xHCI re-enumeration therefore does not prove a real SuperSpeed transfer. Suspend with attached storage, displays or other peripherals and prolonged/overnight sleep remain unvalidated.
32+
33+
The experiment used `ExecStartPre` and `ExecStopPost` on `systemd-suspend.service`, rather than a sleep hook that cannot stop suspend on failure. Preflight refuses model/topology mismatch, external PCI/USB devices, attached block devices, external displays and overlapping trials. It saves policies before modification and restores them after failure as well as after wake. Nine offline tests cover the guard and recovery paths. The one-shot override was removed after each test series. It is not a production fix.
34+
35+
## NVMe targeting
36+
37+
On this machine, `01:00.0` is the Radeon GPU and `02:00.0` is Samsung NVMe (`144d:a804`). The installed Omarchy service named as an NVMe workaround wrote to the GPU. This confirms the mismatch described in #11624/#10877. The existing GPU policy was not changed during the suspend trials; correcting the installer target must not be represented as independently resolving these resume failures.
38+
39+
## Packaging review limits
40+
41+
The source package, loader tests, udev syntax and unit verification passed. The build emitted a fakeroot payload warning; the build completed and archive ownership/modes were inspected, but official packaging CI should rebuild it in a clean chroot. No binary built on this workstation is proposed for distribution. Repository-wide test results are recorded in [TESTS.md](TESTS.md).
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"source": "local"
3+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# gmux is on PNP, where the stock path_id builtin fails. Keep native systemd
2+
# save/restore but supply a stable identity without the failing IMPORT match.
3+
ACTION=="add|change", SUBSYSTEM=="backlight", KERNEL=="gmux_backlight", ENV{ID_PATH}="platform-apple-gmux", TAG+="systemd", ENV{SYSTEMD_WANTS}+="systemd-backlight@backlight:gmux_backlight.service"
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
pkgname=apple-t1-touchbar-dkms
3+
pkgver=0.1.r2.ga33c7eb
4+
pkgrel=1
5+
pkgdesc='Pinned T1 Touch Bar DKMS driver with guarded late loading for MacBookPro14,3'
6+
arch=('x86_64')
7+
url='https://github.com/monomyth/t1-touchbar'
8+
license=('GPL-2.0-only')
9+
depends=('dkms' 'python' 'kmod' 'systemd' 'linux-omarchy-headers')
10+
makedepends=('linux-omarchy-headers')
11+
conflicts=('macbook12-spi-driver-dkms' 'apple-ib-drv-dkms' 'apple-ib-drv-dkms-git'
12+
'apple-t1-touchbar-dkms-local')
13+
backup=('etc/modprobe.d/apple-t1-touchbar.conf')
14+
options=('!strip' '!debug' '!lto')
15+
16+
_pin=a33c7eb27777339c047b8f532d1e6baebaec46bd
17+
_base="https://raw.githubusercontent.com/monomyth/t1-touchbar/${_pin}/apple-ib-drv"
18+
source=("${_base}/apple-ibridge.c"
19+
"${_base}/apple-touchbar.c"
20+
"${_base}/apple-ibridge.h"
21+
"${_base}/hid-ids.h"
22+
"${_base}/Makefile"
23+
"${_base}/LICENSE"
24+
'dkms.conf'
25+
'apple-t1-touchbar.conf'
26+
'apple-t1-touchbar.service'
27+
't1-touchbar'
28+
'test_t1_touchbar.py'
29+
'README.md'
30+
'99-zz-apple-gmux-backlight.rules')
31+
sha256sums=('96fc45f6ab17a01a1472e180ad7ff36648188db7a65dfc6712cf24eb7b09952d'
32+
'ed4e076a117c354740fabf69baea592f735e007d337b1a1673bf5ec5fe1ec8f5'
33+
'34d7c6c294a657b3675502e9e082cb5499ef0204c4a0206360be7498a3754754'
34+
'70b551b047fc5c4e8c029764b64ef0a6167aa93b55913459f8df487ec1be2974'
35+
'0b83960367a409292ce1b12c2d3cb62aa3a1bf9b5a911a999b9de1a222f33982'
36+
'db296f2f7f35bca3a174efb0eb392b3b17bd94b341851429a3dff411b1c2fc73'
37+
'caf9f6bb22cc5c4940dc62ca19e307bde2a2946b139eaf348afaa87964522b1f'
38+
'9180d262cc8c7ee615a0928a2dae57b1ba11e46bf15ad6a261a79ed8eb70105c'
39+
'2cceada4b2994f9a7107c6bae033e5226c3058b707f078848eced5a312e8dc64'
40+
'8dda01c561c9819e53241cb60920ac3828be1849a07558259166cfb0010938a4'
41+
'787d5393d26c3819669e00b14f687136106ee629cb49cf52dcc784baa0e0d853'
42+
'8804d88710e880fdc9f019483a5089c9928e882b77904e3651b3d1cf8cc19ae0'
43+
'a84a3e9247e37ba5505faf0080d2f6a29ba90fc579df2b279f12f62fd191eee3')
44+
45+
build() {
46+
# A chroot/container shares the host uname, not its installed kernel headers.
47+
local headers kernel module built=0
48+
for headers in /usr/lib/modules/*/build; do
49+
[[ -f "$headers/Makefile" ]] || continue
50+
kernel=${headers%/build}
51+
kernel=${kernel##*/}
52+
make -C "$headers" M="$srcdir" clean
53+
make -C "$headers" M="$srcdir" -j2 modules
54+
for module in apple-ibridge apple-touchbar; do
55+
[[ $(modinfo -F vermagic "$srcdir/$module.ko") == "$kernel "* ]] || return 1
56+
done
57+
built=1
58+
done
59+
(( built )) || { error 'No installed kernel headers found'; return 1; }
60+
}
61+
62+
check() {
63+
PYTHONDONTWRITEBYTECODE=1 python3 -B "$srcdir/test_t1_touchbar.py" -v
64+
}
65+
66+
package() {
67+
local dest="$pkgdir/usr/src/apple-t1-touchbar-${pkgver}"
68+
install -d "$dest"
69+
install -m644 "$srcdir"/{apple-ibridge.c,apple-touchbar.c,apple-ibridge.h,hid-ids.h,Makefile,LICENSE,dkms.conf} "$dest/"
70+
install -Dm644 "$srcdir/apple-t1-touchbar.conf" "$pkgdir/etc/modprobe.d/apple-t1-touchbar.conf"
71+
install -Dm644 "$srcdir/apple-t1-touchbar.service" "$pkgdir/usr/lib/systemd/system/apple-t1-touchbar.service"
72+
install -Dm755 "$srcdir/t1-touchbar" "$pkgdir/usr/lib/apple-t1-touchbar/t1-touchbar"
73+
install -Dm644 "$srcdir/99-zz-apple-gmux-backlight.rules" "$pkgdir/usr/lib/udev/rules.d/99-zz-apple-gmux-backlight.rules"
74+
install -Dm644 "$srcdir/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
75+
install -Dm644 "$srcdir/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
76+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Apple T1 Touch Bar for MacBookPro14,3
2+
3+
This opt-in DKMS package supports the fixed-function Touch Bar on the Intel 15-inch 2017 MacBook Pro. Only MacBookPro14,3 has been validated; the loader refuses other models. It leaves the in-kernel `applespi` keyboard and trackpad drivers in place. It is not a T2 or Apple Silicon package.
4+
5+
The driver comes from [monomyth/t1-touchbar](https://github.com/monomyth/t1-touchbar/tree/a33c7eb27777339c047b8f532d1e6baebaec46bd/apple-ib-drv), pinned to `a33c7eb27777339c047b8f532d1e6baebaec46bd`, with its GPL-2.0-only license and fixed source checksums. Credit for the driver and its resume/input fixes belongs to the upstream authors; this contribution packages and integrates their work.
6+
7+
## Firmware prerequisite
8+
9+
The internal T1 must already enumerate as `05ac:8600`. A device in recovery mode (`05ac:1281`) is refused. No firmware, personalization tickets or device identifiers are included, downloaded or flashed. This package cannot repair missing T1 firmware; recovery is a separate, device-specific procedure. A running T1 does not by itself prove firmware persistence across power-off.
10+
11+
## Behavior
12+
13+
- Esc and F1–F12 are the default; holding Fn selects media keys.
14+
- The loader verifies model, USB identity and interface ownership before changing bindings. It refuses custom configuration-2 display stacks and incompatible loaded drivers.
15+
- Only generic HID owners on the verified T1 may be handed over; other USB/HID devices are untouched.
16+
- The loader avoids ACPI power calls and applies the remote-wake policy after HID binding. This is a compatibility policy, not a complete system-suspend fix.
17+
- The service is ordered after `multi-user.target` and enabled through `graphical.target`. Installing the package does not enable the service or load modules.
18+
- A gmux udev rule supplies the stable identity missing from the PNP backlight so native `systemd-backlight` saves and restores brightness.
19+
- Omarchy headers remain an explicit dependency for DKMS rebuilds. Kernel updates still require checking the DKMS build result.
20+
21+
## Enable and verify
22+
23+
After installation, run `t1-touchbar` using its full path:
24+
25+
```sh
26+
/usr/lib/apple-t1-touchbar/t1-touchbar preflight
27+
sudo systemctl enable --now apple-t1-touchbar.service
28+
systemctl status apple-t1-touchbar.service
29+
dkms status
30+
```
31+
32+
A skipped service condition is not a successful hardware test. Verify the service is active, physically test press/release of Esc, F1–F12 and Fn/media, and confirm the camera and keyboard remain usable. Stopping or disabling the service does not unload the running kernel modules; reboot to return to a boot without the service.
33+
34+
## Validation and limits
35+
36+
The pinned driver and loader were tested on MacBookPro14,3 with `7.2.5-3-omarchy`, including physical keys, camera, firmware persistence and native brightness restoration after a normal restart. The loader has sixteen fake-sysfs tests, including refusals and rollback. The build checks compilation and module vermagic against installed headers rather than the build host's `uname`.
37+
38+
Complete Wi-Fi/Thunderbolt suspend recovery is outside this package. A separate local experiment recovered those devices in three cycles by protecting Wi-Fi and removing/re-enumerating empty Thunderbolt branches, but USB 3.x transfers, 5 GHz Wi-Fi and attached-peripheral suspend remain unvalidated. That workaround is not installed by this package.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
# Suppress modalias autoload. The guarded late service uses explicit modprobe.
3+
blacklist apple_ibridge
4+
blacklist apple_touchbar
5+
6+
options apple_ibridge skip_acpi_power=1
7+
options apple_touchbar fnmode=2 idle_timeout=-1 dim_timeout=-1
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[Unit]
2+
Description=Apple T1 Touch Bar (guarded configuration-1 driver)
3+
After=multi-user.target
4+
5+
[Service]
6+
Type=oneshot
7+
RemainAfterExit=yes
8+
TimeoutStartSec=45
9+
ExecCondition=/usr/lib/apple-t1-touchbar/t1-touchbar condition
10+
ExecStart=/usr/lib/apple-t1-touchbar/t1-touchbar start
11+
12+
[Install]
13+
WantedBy=graphical.target
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# SPDX-License-Identifier: GPL-2.0-only
2+
PACKAGE_NAME="apple-t1-touchbar"
3+
PACKAGE_VERSION="0.1.r2.ga33c7eb"
4+
BUILT_MODULE_NAME[0]="apple-ibridge"
5+
DEST_MODULE_LOCATION[0]="/updates/dkms"
6+
BUILT_MODULE_NAME[1]="apple-touchbar"
7+
DEST_MODULE_LOCATION[1]="/updates/dkms"
8+
MAKE[0]="make KVERSION=${kernelver}"
9+
AUTOINSTALL="yes"

0 commit comments

Comments
 (0)