Skip to content

Keep the MacBookPro14,1 USB-C controller awake for hotplug - #15537

Open
hermitokatt wants to merge 2 commits into
omacom:quattrofrom
hermitokatt:macbookpro141-alpine-ridge-usb
Open

hermitokatt wants to merge 2 commits into
omacom:quattrofrom
hermitokatt:macbookpro141-alpine-ridge-usb

Conversation

@hermitokatt

Copy link
Copy Markdown

Summary

On a MacBookPro14,1 the left-side USB-C ports are the Alpine Ridge xHCI (8086:15d4). With nothing plugged in, that controller runtime-suspends and its root hubs have remote wakeup disabled. A stick then gets VBUS (the LED lights) while the controller never sees the connect.

This keeps the controller and those hubs at power/control=on, the same shape of quirk as the N1x USB4 root ports. A system-sleep hook repeats the write after resume, because the controller's power cycle does not always keep the policy. The PCH xHCI is left alone. New installs get it from hardware setup. Existing installs get it from a migration, which does not replace a rule or hook already on disk.

This does not change S3 resume. #10593 is the separate report that deep sleep kills Thunderbolt on this model.

Verified on a MacBookPro14,1: a USB stick that previously only lit its LED enumerated after the controller and its root hubs were held awake.

Test plan

  • bash test/shell.d/alpine-ridge-usb-test.sh
  • bash test/shell.d/privileged-heredoc-test.sh
  • On a MacBookPro14,1, plug a USB device into a left-side USB-C port that was empty at boot and confirm it enumerates without another nudge
  • Suspend and resume, then plug the device again

The Alpine Ridge xHCI (8086:15d4) runtime-suspends when nothing is plugged
in, and its root hubs have remote wakeup disabled, so a device can take
VBUS while the controller never sees the connect. Keep the controller and
those hubs out of runtime suspend, and repeat the write after resume
because the controller's power cycle drops the policy.
@greptile-apps

greptile-apps Bot commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge, with a non-blocking retry gap remaining in the previous migration finding.

Findings

  1. P2 Retry leaves rule inactive ▶

Summary

Keeps the Alpine Ridge USB-C controller and its root hubs awake on MacBookPro14,1.

  • MacBookPro14,1 USB-C ports detect devices plugged in later.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Matching MacBook] --> B{New or existing install?}
  B -->|New| C[Install rule and sleep hook]
  B -->|Existing| D[Install missing files]
  C --> E[Reload when udev is running]
  D --> E
  E --> F[Keep controller and root hubs awake]
  G[Resume from sleep] --> F
Loading

Reviews (2) · Last reviewed commit: "Don't let a missing udev daemon stop Mac..." · Reviewed by Greptile

Comment thread migrations/1792055925.sh Outdated
Comment on lines +30 to +32
if (( installed_rule )); then
sudo udevadm control --reload-rules
fi

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.

P2 Retry leaves rule inactive

If the hook install or reload fails after the rule file is installed, the file remains on disk. The next run sets installed_rule=0, skips the reload, and can mark the migration complete. The rule then stays inactive until a reboot or manual reload. Keep track of an unfinished reload or reload existing Omarchy-owned rules on retry.

Knowledge Base Used: Migration framework

The ISO runs hardware setup in a chroot with no udevd, and a failed
udevadm control there aborted the rest of the install. Skip the reload
when /run/udev/control is absent. The next daemon reads the rule from disk.

A migration that installed the rule and then failed left the file on disk
and skipped the reload on retry, so the rule stayed inactive. Record the
reload before the later steps, and leave that marker in place when the
reload fails so the next run tries again.
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for this. I read the diff at 75b2a48 and classified it as a hardware compatibility fix for the MacBookPro14,1 Alpine Ridge controller. That classification is not settled yet: it needs a second model (Codex Medium) to agree, and that model did not run because omabot's review budget for today was already used up. So no labels have been added, nothing was run on a worker, and this has not been verified yet.

Reading only, I found nothing to report against this head. Both of Greptile's earlier findings are handled here: the install script skips udevadm control --reload-rules when /run/udev/control is missing, and the migration keeps a reload marker, so a failed reload is tried again on the next run.

Next: this goes round the queue again once review capacity is back, and the full review happens then. Because the bug depends on hardware a worker does not have, verifying it will need someone with a MacBookPro14,1 to confirm the fix at the head commit. That confirmation has to come from a maintainer or someone who reported the problem, not the pull request's author.

@angellindo

Copy link
Copy Markdown

MacBookPro14,3 (2017 15", two JHL6540): same problem on both Alpine Ridge controllers

Kernel 7.2.5-3-omarchy. Both Thunderbolt xHCIs here are 8086:15d4 (07:00.0 left side, 7d:00.0 right side). With the default power/control=auto they sit in D3hot, and a USB 3 stick (Kingston DataTraveler 70) plugged into any USB-C port enumerates on the PCH xHCI 00:14.0 at 480M. With power/control=on on the two Thunderbolt xHCIs only, the same stick enumerates at 5000M on bus 4 (left, 07:00.0) and bus 6 (right, 7d:00.0). The journal shows device links to tunneled native ports are missing! for both NHIs, so the likely cause is that Apple's ACPI does not describe those links. I did not need to touch the root hubs; the PCI write alone was enough here.

Rule used (the DMI match only matters for a manual install; your hardware script already filters):

ACTION=="add|change", SUBSYSTEM=="pci", ATTR{vendor}=="0x8086", ATTR{device}=="0x15d4", \
  ATTR{[dmi/id]sys_vendor}=="Apple Inc.", ATTR{[dmi/id]product_name}=="MacBookPro13,[23]|MacBookPro14,[123]", \
  TEST=="power/control", ATTR{power/control}="on"

I installed this rule and rebooted. Both controllers came up at on with nothing done by hand, and the stick ran at 5000M on both sides. In udevadm test, a copy with a different product_name doesn't match either controller.

Cost: on battery, 10-minute windows alternating on and auto, the difference was about -0.10 W, inside the noise between equal windows. With the rule in place, Thunderbolt survived two first S3 cycles suspended by closing the lid, one on battery and one on the charger. After the battery one, the stick was back at 5000M on the right side, the only side I checked in that run. One caveat from #11570: systemctl suspend with the lid open wakes this machine after ~3 s and leaves Thunderbolt inaccessible, rule or not, so test S3 by closing the lid.

Could the gate be MacBookPro14,[123] (in omarchy-hw-match and the sleep hook) instead of MacBookPro14,1 only? Not tested: 14,2, 13,2 and 13,3. I assume they have the same 4-port controller, but I have not checked their PCI IDs. If one has a different ID, the rule does nothing there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants