Skip to content

Add T1 Touch Bar firmware handoff and apple-ib-tb wiring - #7064

Open
shawnyeager wants to merge 4 commits into
omacom:quattrofrom
shawnyeager:t1-touchbar
Open

shawnyeager wants to merge 4 commits into
omacom:quattrofrom
shawnyeager:t1-touchbar

Conversation

@shawnyeager

@shawnyeager shawnyeager commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

T1 MacBook Pros (2016–2017 Touch Bar) leave the bar dark on Omarchy. Apple's EFI memboots EFI/APPLE/EMBEDDEDOS from the ESP; that tree is written by macOS, includes machine-specific FDRData, and cannot be redistributed. The in-tree hid-appletb-* drivers are for T2 (05ac:8302). T1 shows up as iBridge 05ac:8600 and needs apple-ib-tb.

The manual currently lists the Touch Bar as non-functional. This replaces that with a USB handoff that we ran end-to-end on a MacBookPro14,3.

Depends on the package bump: omacom-io/omarchy-pkgs#152. Current macbook12-spi-driver-dkms (0+git.315) fails to build apple-ib-tb on kernel 6.11+ / 7.1. That PR switches the package to Heratiki's fork so the modules this wiring loads actually exist. Firmware + udev without that bump still leaves a dark bar.

How the two scripts fit

One stick, two directions. Firmware is never in the package.

  1. On macOS, before the wipe: install/hardware/apple/copy-t1-firmware.command (bash 3.2, double-clickable). It mounts this Mac's EFI slice with diskutil and copies APPLE/EMBEDDEDOS onto a USB. Documented in manual/44-mac-support.md with a curl-from-quattro path; the same file is on the ISO.
  2. On Omarchy: omarchy setup apple touchbar (also in Setup when omarchy-hw-apple-t1). Shared helpers in install/hardware/apple/t1-touchbar.sh:
    • firmware on the USB → copy to the ESP (cp -r, not -a; VFAT cannot store Unix ownership)
    • USB mounted but empty → write the macOS collector onto it
    • already on the ESP → install wiring only
  3. Installer: fix-t1-touchbar.sh does the silent copy when the stick is already plugged in, otherwise prints the setup command.
  4. Existing installs: migration 1786820569.

Wiring after the T1 is membooted

hid-generic is built in and claims 05ac:8600 before the out-of-tree driver loads. A udev rule on apple_ib_tb module add runs omarchy-hw-apple-t1-bind (no systemd oneshot, no softdep on a builtin). modules-load.d loads apple-ibridge, apple-ib-tb, apple-ib-als. Default fnmode=1 (icons first, Fn for F1–F12).

Test plan

  • ./test/cli
  • test/shell.d/t1-touchbar-test.sh
  • test/shell.d/menu-test.sh and menu-guards-test.sh
  • MacBookPro14,3: firmware on ESP → T1 leaves recovery (05ac:8600) → apple-ib-tb draws the icon row

Copilot AI balanced review requested due to automatic review settings August 16, 2026 03:13

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds end-to-end support for first-generation (T1) MacBook Pro Touch Bar firmware handoff and Linux-side wiring, including a macOS collector script, installer hook, migration, udev rebind helper, and documentation.

Changes:

  • Add T1 detection + udev/module wiring + firmware copy helpers for Linux.
  • Add macOS copy-t1-firmware.command to collect machine-specific firmware onto a USB for handoff.
  • Add migration + setup command + docs + tests to integrate and validate the workflow.

Reviewed changes

Copilot reviewed 9 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/shell.d/t1-touchbar-test.sh Adds shell-level regression tests covering detection, wiring, migration, and firmware copy paths.
migrations/1786820569.sh Introduces a migration to install T1 wiring and optionally copy firmware from USB.
manual/44-mac-support.md Documents the T1 firmware collection/handoff process and updates known limitations.
install/hardware/apple/t1-touchbar.sh Adds shared helper functions for locating media, ESP, installing wiring, and copying firmware.
install/hardware/apple/fix-t1-touchbar.sh Adds installer-time hook to set up wiring and copy firmware if a prepared USB is present.
install/hardware/apple/copy-t1-firmware.command Adds macOS-compatible collector script to copy EFI/APPLE firmware to external USB media.
install/hardware/all.sh Wires the new T1 hook into the general hardware install flow.
default/udev/apple-t1-touchbar.rules Adds udev rule to rebind HID once the Touch Bar module loads.
default/omarchy/omarchy-menu.jsonc Adds a setup menu entry to run the Touch Bar firmware wizard on T1 machines.
bin/omarchy-setup-apple-touchbar Adds a user-facing command to install wiring and copy firmware from USB to the ESP.
bin/omarchy-hw-apple-t1-bind Adds sysfs rebind helper to move 05ac:8600 from hid-generic to apple-ibridge-hid.
bin/omarchy-hw-apple-t1 Adds hardware detection helper for identifying T1 Touch Bar MacBook Pros.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread migrations/1786820569.sh Resolved
Comment thread migrations/1786820569.sh Resolved
Comment thread manual/44-mac-support.md Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 12 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

migrations/1786820569.sh:4

  • This migration lacks a shebang and doesn’t set strict modes itself. If it’s ever run directly (e.g., by an external runner using ./migrations/...), it may execute under /bin/sh and behave incorrectly. Add #!/bin/bash and set -euo pipefail (or align with the project’s migration conventions) to ensure consistent execution.
echo "Install T1 Touch Bar wiring and copy firmware from a USB stick if present"

# First-generation Touch Bar MacBook Pros only. Other Apple hardware is
# unchanged. See install/hardware/apple/t1-touchbar.sh for the USB handoff.

install/hardware/apple/copy-t1-firmware.command:151

  • Avoid eval for selecting the destination volume. Even with numeric validation, eval is an unnecessary code-execution primitive and is fragile. Prefer a non-eval selection method (e.g., derive the Nth line from USB_LIST, or iterate with a counter until choice is reached).
DEST=""
if [ "$n" -eq 1 ]; then
  DEST="$1"
  echo
  echo "Using the only external volume: $DEST"
else
  echo
  printf "Number of the USB to copy onto: "
  read -r choice
  case "$choice" in
    ''|*[!0-9]*) echo "Not a number."; exit 1 ;;
  esac
  if [ "$choice" -lt 1 ] || [ "$choice" -gt "$n" ]; then
    echo "Out of range."
    exit 1
  fi
  eval DEST=\$$choice
fi

Comment thread migrations/1786820569.sh Resolved
Copilot AI review requested due to automatic review settings August 16, 2026 03:33

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 12 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

migrations/1786820569.sh:28

  • This control flow is silent when firmware is found but t1_esp_mount fails (no VFAT ESP mounted at /boot, /boot/efi, or /efi). That makes it hard to understand why the firmware wasn’t copied. Add an else branch for the t1_esp_mount check that prints a short, actionable message (e.g., no ESP mounted + suggest running omarchy setup apple touchbar after mounting the ESP) while still keeping wiring installed.
if src=$(t1_find_firmware); then
  if esp=$(t1_esp_mount); then
    if ! t1_copy_firmware "$src" "$esp"; then
      echo "Found T1 firmware on USB but could not copy it to the EFI partition."
      echo "Wiring is installed; later run: omarchy setup apple touchbar"
    fi
  fi
fi

install/hardware/apple/copy-t1-firmware.command:151

  • eval is avoidable here and is risky in a script that may run as root (via sudo). Even though choice is validated as numeric, using eval increases the blast radius of any future edits. Prefer a non-eval selection approach (e.g., iterate through the listed volumes with an index and pick the matching one, or store volumes in a bash array and select via index) while keeping bash 3.2 compatibility.
  if [ "$choice" -lt 1 ] || [ "$choice" -gt "$n" ]; then
    echo "Out of range."
    exit 1
  fi
  eval DEST=\$$choice
fi

Comment thread install/hardware/apple/t1-touchbar.sh Resolved
Copilot AI review requested due to automatic review settings August 16, 2026 03:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 12 changed files in this pull request and generated no new comments.

Suppressed comments (3)

migrations/1786820569.sh:4

  • This migration script has no shebang and doesn’t enable strict mode itself. If it’s ever executed directly (or by a runner that doesn’t consistently invoke bash -euo pipefail), behavior becomes fragile (e.g., silent source failures). Add a #!/bin/bash header and set -euo pipefail near the top to make the migration self-contained and reliably fail-fast.
echo "Install T1 Touch Bar wiring and copy firmware from a USB stick if present"

# First-generation Touch Bar MacBook Pros only. Other Apple hardware is
# unchanged. See install/hardware/apple/t1-touchbar.sh for the USB handoff.

migrations/1786820569.sh:17

  • This script assumes OMARCHY_PATH is set before sourcing helpers and before re-execing itself under sudo. If OMARCHY_PATH is unset (common for one-off script execution), source \"$OMARCHY_PATH/...\" will fail, and the sudo re-exec path also won’t resolve. Consider setting a default early (consistent with bin/omarchy-setup-apple-touchbar), e.g., defaulting to /usr/share/omarchy, then using that variable for both source and the sudo exec target.
# shellcheck source=../install/hardware/apple/t1-touchbar.sh
source "$OMARCHY_PATH/install/hardware/apple/t1-touchbar.sh"

# Real dests live under /etc and /boot. Tests override OMARCHY_T1_* to a
# writable tmp tree and skip the privilege hop.
if (( $(id -u) != 0 )) && [[ $(t1_udev_rule_dest) == /etc/* ]]; then
  exec sudo --preserve-env=OMARCHY_PATH,OMARCHY_T1_UDEV_DEST,OMARCHY_T1_UDEV_SRC,OMARCHY_T1_MODULES_LOAD,OMARCHY_T1_ESP,OMARCHY_T1_MEDIA_ROOTS,OMARCHY_T1_COLLECTOR,OMARCHY_DMI_PRODUCT_NAME \
    /bin/bash -euo pipefail "$OMARCHY_PATH/migrations/1786820569.sh"
fi

install/hardware/apple/copy-t1-firmware.command:151

  • Using eval to select DEST is avoidable and increases risk if validation ever regresses or the selection logic changes. You can pick the Nth entry without eval by iterating over the positional parameters (e.g., loop with an index until it equals choice) after set -- $USB_LIST.
  printf "Number of the USB to copy onto: "
  read -r choice
  case "$choice" in
    ''|*[!0-9]*) echo "Not a number."; exit 1 ;;
  esac
  if [ "$choice" -lt 1 ] || [ "$choice" -gt "$n" ]; then
    echo "Out of range."
    exit 1
  fi
  eval DEST=\$$choice
fi

The T1 memboot image is written by macOS, unique to the machine, and
cannot be shipped. A USB stick is the handoff: copy-t1-firmware.command
runs on macOS (bash 3.2), and omarchy setup apple touchbar copies
APPLE/EMBEDDEDOS onto the ESP, installs the udev rebind, and loads
apple-ib-tb. The installer does the same when the stick is already
plugged in.

hid-generic is built in and claims 05ac:8600 first, so the udev rule
fires when apple_ib_tb appears and rebinds the iBridge to apple-ibridge.
Keep the migration going after a failed ESP copy so wiring still lands,
but say so when firmware and the ESP were both found. Point pre-install
docs at the ISO path first and at a HEAD GitHub URL instead of quattro.
omarchy-pkg-add ran before the non-root sudo re-exec, so a regular-user
migration could fail before wiring. Source the dest helper, escalate if
needed, then install linux-headers and the remaining privileged work.
mkdir, rm, and cp now return 1 so migration and setup can print recovery
instructions. sync is non-fatal. Setup wraps the copy the same way.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants