Skip to content

Instantly share code, notes, and snippets.

@ErikMCM
Last active November 30, 2023 23:35
Show Gist options
  • Save ErikMCM/62677ee2d248eb954e39ae8e1c581753 to your computer and use it in GitHub Desktop.
Save ErikMCM/62677ee2d248eb954e39ae8e1c581753 to your computer and use it in GitHub Desktop.
Disable XHC/XHCI devices from waking up or preventing computer to sleep or suspend
# Adapted from Ropid's post on https://bbs.archlinux.org/viewtopic.php?id=263268
#
# This solved my U-Phoria UMC204HD from preventing system suspend (sleep), causing an XHCI error of sorts.
#
# I used journalctl --boot=-1 --grep="suspend"
# to figure out some service related to XHCI was tossing error code -16 and prevented sleep.
#
# If using systemd you just toss it in the following
# /etc/systemd/system/disableXHCwakeup.service
#
# Run sudo systemctl enable disableXHCwakeup.service
# You will likely need to shutdown/restart for this service to work
#
# !!! IF THIS DOES NOT WORK, OR INTERFERES WITH OTHER DEVICES
# I highly suggest you check out https://gist.github.com/ioggstream/8f380d398aef989ac455b93b92d42048
[Unit]
Description=disableXHCwakeup
[Service]
Type=oneshot
ExecStart=bash -c '\
while read -r device _ status _; do \
[[ $device == +([EX]HC*) && $status == "*enabled" ]] && \
echo $device > /proc/acpi/wakeup; \
done < /proc/acpi/wakeup; \
true \
'
[Install]
WantedBy=multi-user.target
@ErikMCM
Copy link
Author

ErikMCM commented Nov 30, 2023

Disable XHC/XHCI devices from waking up or preventing computer to sleep or suspend

Adapted from Ropid's post on https://bbs.archlinux.org/viewtopic.php?id=263268


This solved my U-Phoria UMC204HD from preventing system suspend (sleep), causing an XHCI error of sorts.

I used journalctl --boot=-1 --grep="suspend" to figure out some service related to XHCI was tossing error code -16 and prevented sleep.

If using systemd you just toss it in /etc/systemd/system/disableXHCwakeup.service and run sudo systemctl enable disableXHCwakeup.service
You will likely need to shutdown/restart for this service to work.


!!! IF THIS DOES NOT WORK, OR INTERFERES WITH OTHER DEVICES !!!

I highly suggest you check out https://gist.github.com/ioggstream/8f380d398aef989ac455b93b92d42048

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