USB host/hubs can use Terminal commands to power on/off USB port remotely.
apt install gcc make libusb-1.0-0-dev
brew install gcc libusb make
The uhubctl program allows controlling power for many USB hub models:
git clone https://github.com/mvp/uhubctl make ./uhubctl -h
Note: key system devices, even built-in laptop keyboards are connected by USB, and you could accidentally poweroff your own laptop keyboard. So use a little care to identify which hardware port a device is connected to.
Beaglebone Black can power on/off USB ports via
devmem2, useful for automatic remote powering on/off of USB peripherals to save energy/heat.
devmem2 reads/writes bytes, here the address to control the Beaglebone USB port is known a priori.
apt install devmem2
apt install devmem2 doesn’t work, you can manually compile:
git clone https://github.com/VCTLabs/devmem2 make make install
Power on USB port remotely:
devmem2 0x47401c60 b 1
This powered up my Wifi dongle.
I measured 0 V on the USB host port before issuing this command, and measured 5 V after the command.