Ok @stingray21 … I grabbed now my laptop and tested it myself.
In battery mode my usb devices are off anyway when set to “auto”. That depends how you UEFI firmware works.
Here is what I have…
$ P=("autosuspend" "autosuspend_delay_ms" "control" "level"); for x in ${P[@]}; do echo "$x : $(cat /sys/bus/usb/devices/usb1/power/${x})"; done
autosuspend : 0
autosuspend_delay_ms : 0
control : auto
level : auto
There auto suspending works like expected. Even if in AC mode, USB is still suspended, but the HUB have to support this, otherwise it will be always on.
If I want to force it to turn it on, I type:
echo "on" | sudo tee -a /sys/bus/usb/devices/usb1/power/control
and the USB Flash Drive gets power. The LED turns on.
I can turn it off by typing:
echo "auto" | sudo tee -a /sys/bus/usb/devices/usb1/power/control
When I unplug and plugin again, the flash drive will not turn on.
So conclusion: The only way to disable usb is suspending it and that works only in “auto” mode and the hub have to support this behavior. And of course there are USB HUBs (most old ones) which don’t have this functionality.
A more radical way, would be unloading the usbcore module, but I don’t recommend this.
So check yourself, if your internal HUBs can do “autosuspend”…