Last active
May 11, 2019 03:49
-
-
Save jpcaparas/c49cf455e8e46f8b3ee673ddf482b321 to your computer and use it in GitHub Desktop.
systemd service to restart usb ports after suspend (Manjaro)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Restart USB ports after waking up from suspend/hibernate | |
After=suspend.target hibernate.target | |
[Service] | |
Type=oneshot | |
ExecStart=/opt/usr/bin/reset-usb-ports.sh | |
[Install] | |
WantedBy=suspend.target hibernate.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#see https://forum.manjaro.org/t/keyboard-and-mouse-not-working-after-suspend/61424 | |
#reset all USB1/2/3 ports | |
for i in /sys/bus/pci/drivers/[uoex]hci_hcd/*:*; do | |
[ -e "$i" ] || continue | |
echo "${i##*/}" > "${i%/*}/unbind" | |
echo "${i##*/}" > "${i%/*}/bind" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment