Power on/off USB port in Linux/Mac Terminal

If the USB host/hub is compatible, you 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


git clone https://github.com/mvp/uhubctl



./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 USB power control

Beaglebone Black can power on/off USB ports via devmem2, useful for automatic remote powering on/off of USB peripherals to save energy/heat.

In general devmem2 reads/writes bytes, here the address to control the Beaglebone USB port is known a priori.

Easy install devmem2

apt install devmem2

Compile devmem2

If apt install devmem2 doesn’t work, you can manually compile:

git clone https://github.com/VCTLabs/devmem2
make install

Beaglebone Black USB power example

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.


Reference for USB power on command using devmem2

Leave a Comment