Skip to content

Instantly share code, notes, and snippets.

@janmisek
Last active March 23, 2024 21:26
Show Gist options
  • Save janmisek/4f156d0a6122b6d0c74f5843cf19f388 to your computer and use it in GitHub Desktop.
Save janmisek/4f156d0a6122b6d0c74f5843cf19f388 to your computer and use it in GitHub Desktop.
PCI and USB power management in linux
# If usb hdd is made sleeping using hdparm or unbind. The usb device still consumes about 1W.
# This power consumtpion could be spared removing whole usb hub from pci bus
# Make sleep using hdparm
##########################################
hdparm -y /dev/sdb
# Connect / disconnect usb device
###########################################
# list device
lsusb -t
# unbind device
echo '2-3' | sudo tee /sys/bus/usb/drivers/usb/unbind
# rebind device
echo '2-3' | sudo tee /sys/bus/usb/drivers/usb/bind
# remove/rescan pci device - whole usb hub
###########################################
# Sideeffect is that whole usb hub is sleeping
#list devices
lspci -t
#disable
echo 1 | sudo tee /sys/devices/pci0000\:00/0000\:00\:14.0/remove
# reenable
echo 1 | sudo tee /sys/bus/pci/devices/0000\:00\:00.0/rescan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment