Skip to content

USB devices are no longer present after waking from suspend #497

Open

Description

@mjm

Machine model: Apple MacBook Pro (16-inch, M2 Max, 2023)
Linux version 6.19.14
Distro: NixOS

Whenever I suspend my MacBook, any USB devices plugged in to it are not usable after waking the system. Mostly this comes up with the YubiKey that I keep connected to it, but I also tested a flash drive and it had the same behavior. If I disconnect a device and reconnect it, then I can use again until I suspend again.

In the kernel logs I see these messages on resume:

May 13 19:40:23 athena kernel: xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit
May 13 19:40:23 athena kernel: usb usb1: root hub lost power or was reset
May 13 19:40:23 athena kernel: usb usb2: root hub lost power or was reset

xhci-hcd.0.auto appears to be the relevant host controller for the device that is plugged in:

May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: hcc params 0x0238ffcd hci version 0x110 quirks 0x0000808000000010
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: irq 122, io mem 0x702280000
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
May 13 19:31:14 athena kernel: xhci-hcd xhci-hcd.0.auto: Host supports USB 3.1 Enhanced SuperSpeed
May 13 19:31:14 athena kernel: hub 1-0:1.0: USB hub found
May 13 19:31:14 athena kernel: hub 1-0:1.0: 1 port detected
May 13 19:31:14 athena kernel: usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
May 13 19:31:14 athena kernel: hub 2-0:1.0: USB hub found
May 13 19:31:14 athena kernel: hub 2-0:1.0: 1 port detected
May 13 19:31:14 athena kernel: usb 1-1: new full-speed USB device number 2 using xhci-hcd
May 13 19:31:14 athena kernel: input: Yubico YubiKey OTP+FIDO+CCID as /devices/platform/soc/702280000.usb/xhci-hcd.0.auto/usb1/1-1/1-1:1.0/0003:1050:0407.0006/input/input7
May 13 19:31:14 athena kernel: hid-generic 0003:1050:0407.0006: input,hidraw2: USB HID v1.10 Keyboard [Yubico YubiKey OTP+FIDO+CCID] on usb-xhci-hcd.0.auto-1/input0
May 13 19:31:14 athena kernel: hid-generic 0003:1050:0407.0007: hiddev96,hidraw3: USB HID v1.10 Device [Yubico YubiKey OTP+FIDO+CCID] on usb-xhci-hcd.0.auto-1/input1

And then when I disconnect and reconnect the device, I see these messages:

May 13 19:40:40 athena kernel: macsmc-power macsmc-power: Port 1 state change (charge port: 2)
May 13 19:40:40 athena kernel: macsmc-power macsmc-power: Connector event: Port 1 (status 0x02)
May 13 19:40:40 athena kernel: macsmc-power macsmc-power: Connector event: Port 1 (status 0x03)
May 13 19:40:40 athena kernel: macsmc 2a2400000.smc: RTKit: syslog message: aceElec.cpp:708:         Elec: Elec Cause 0x0
May 13 19:40:40 athena kernel: macsmc-power macsmc-power: Connector event: Port 1 (status 0x05)
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: remove, state 4
May 13 19:40:41 athena kernel: usb usb2: USB disconnect, device number 1
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: USB bus 2 deregistered
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: remove, state 4
May 13 19:40:41 athena kernel: usb usb1: USB disconnect, device number 1
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: Host controller not halted, aborting reset.
May 13 19:40:41 athena kernel: xhci-hcd xhci-hcd.0.auto: USB bus 1 deregistered
May 13 19:40:45 athena kernel: macsmc-power macsmc-power: Port 1 state change (charge port: 2)
May 13 19:40:45 athena kernel: macsmc-power macsmc-power: Connector event: Port 1 (status 0x05)
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 1
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: hcc params 0x0238ffcd hci version 0x110 quirks 0x0000808000000010
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: irq 122, io mem 0x702280000
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: xHCI Host Controller
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: new USB bus registered, assigned bus number 2
May 13 19:40:45 athena kernel: xhci-hcd xhci-hcd.0.auto: Host supports USB 3.1 Enhanced SuperSpeed
May 13 19:40:45 athena kernel: hub 1-0:1.0: USB hub found
May 13 19:40:45 athena kernel: hub 1-0:1.0: 1 port detected
May 13 19:40:45 athena kernel: usb usb2: We don't know the algorithms for LPM for this host, disabling LPM.
May 13 19:40:45 athena kernel: hub 2-0:1.0: USB hub found
May 13 19:40:45 athena kernel: hub 2-0:1.0: 1 port detected
May 13 19:40:45 athena kernel: usb 1-1: new full-speed USB device number 2 using xhci-hcd
May 13 19:40:46 athena kernel: input: Yubico YubiKey OTP+FIDO+CCID as /devices/platform/soc/702280000.usb/xhci-hcd.0.auto/usb1/1-1/1-1:1.0/0003:1050:0407.0008/input/input10
May 13 19:40:46 athena kernel: hid-generic 0003:1050:0407.0008: input,hidraw2: USB HID v1.10 Keyboard [Yubico YubiKey OTP+FIDO+CCID] on usb-xhci-hcd.0.auto-1/input0
May 13 19:40:46 athena kernel: hid-generic 0003:1050:0407.0009: hiddev96,hidraw3: USB HID v1.10 Device [Yubico YubiKey OTP+FIDO+CCID] on usb-xhci-hcd.0.auto-1/input1

I tried updating m1n1 and recopying the peripheral firmware using the Asahi Installer, but neither of these fixed the issue. Please let me know if there is any other information that would be useful here.

Activity

  1. yuyuyureka commented on May 19, 2026

    @yuyuyureka

    As a workaround, I use tuxvdmtool disconnect to reset the usb port. But I agree this should not happen.

  2. whananaki commented on May 20, 2026

    @whananaki

    As a workaround, I use tuxvdmtool disconnect to reset the usb port. But I agree this should not happen.

    That is a good workaround, I have been meaning to build tuxvdmtool for this exact purpose! Can you please share your nix derivation/flake you use to build tuxvdmtool?

  3. mjm commented on May 21, 2026

    @mjm
    Author
  4. yuyuyureka commented on May 21, 2026

    @yuyuyureka

    I simply cloned the tuxvdmtool repository and ran cargo build --release, but a Nix derivation would be nice to have. In case you want to upstream the packaging into nixpkgs, feel free to request a review from me.

  5. ameenjuz commented on Jun 2, 2026

    @ameenjuz

    @yuyuyureka @mjm i have same usb issue after wake disconnection
    i compiled cargo build--release
    please guide me how to use it where i put this
    i m using asahi linux fedora 44 kde plasma

  6. bencef commented on Jun 30, 2026

    @bencef

    Same issue here on MacBook Pro 14-inch M2 Max, NixOS 26.11, confirmed broken on 6.19.11 and 7.0.13.

    full disclosure: I collected the details with the aid of claude but was supervising closely.

    My affected controller is xhci-hcd.0.auto at io mem 0xf02280000 (vs your 0x702280000 — different of the three USB controllers on the M2 Max, same behavior).

    After looking at the dmesg carefully I think I can add some detail on what's happening.

    Every wake shows the same pattern, regardless of how the preceding suspend went:

    xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit
    usb usb1: root hub lost power or was reset
    usb usb2: root hub lost power or was reset
    

    Root hubs re-register but no downstream devices enumerate. I've confirmed this across 4 sleep/wake cycles including one where the suspend itself failed with CMD_RUN timeout / -110 — the halt-failure during suspend does not affect the outcome on wake.

    The xhci_reinit() path is insufficient. When USBSTS 0x401 triggers xhci_resume() → xhci_reinit(), it resets the xHCI driver state but the USB PHY is not restored to a state where downstream devices can enumerate.

    The physical reconnect works because it triggers a firmware PHY reset — as you can see in your own log:

    xhci-hcd xhci-hcd.0.auto: remove, state 4   ← both buses active
    xhci-hcd xhci-hcd.0.auto: remove, state 4
    xhci-hcd xhci-hcd.0.auto: Host halt failed, -110
    

    When the controller is in an active state (PM state 4) and the halt fails, the firmware performs a full PHY reset. That's why reconnecting the device works — the physical disconnect/reconnect drives the controller through that path. It doesn't survive the next sleep because xhci_reinit() on wake doesn't go through the same firmware path.

    Working hypothesis: the xhci_resume() / xhci_reinit() path needs to either trigger the firmware PHY reset directly, or the PHY state needs to be preserved/restored correctly across suspend. The firmware can do the right thing (we see it happen on halt failure) — it's just not being asked to during normal resume.

  7. yuyuyureka commented on Jun 30, 2026

    @yuyuyureka

    @bencef please write up the result by hand instead of pasting the Claude output.

  8. bencef commented on Jun 30, 2026

    @bencef

    I can but i'm skeptical about the added value:

    • I can confirm that the issue is present on both 6.19.11 and 7.0.13
    • unplugging and re-plugging the usb hub works as expected

    dmesg output I collected:

    Jun 29 23:06:09 charles kernel: xhci-hcd xhci-hcd.0.auto: WARN: xHC CMD_RUN timeout
    Jun 29 23:06:09 charles kernel: xhci-hcd xhci-hcd.0.auto: PM: dpm_run_callback(): platform_pm_suspend returns -110
    Jun 29 23:06:09 charles kernel: xhci-hcd xhci-hcd.0.auto: PM: failed to suspend async: error -110
    Jun 30 08:58:10 charles kernel: xhci-hcd xhci-hcd.0.auto: xHC error in resume, USBSTS 0x401, Reinit
    

    (pasted from terminal)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions