There is a way to do this using software (control power to ports on a USB hub).
Some useful information from a forum thread on the Raspberry Pi website:
the Pi model B+ has no hardware in place to disconnect power on the USB ports!
it can detect a short (USB power Fault) and then the USB power controller (P2553W6) will
automatically block the USB power, but it can't switch off the power to USB using software.
What it can do is bring the LAN9514 into sleep mode, but that doesn't turn the power off!
reply from a moderator & RPi engineer:
Yes it can.
Issuing a USB Hub class request (
CLEAR_FEATURE PORT_POWER) to port 2
on the LAN9514 will deactivate the USB output power switch.
There's an app for that:
For the above application, the command you can use is
sudo ./hub-ctrl -h 3 -P 1 -p 0
h is the hub,
P is the port, and
p is for switching power on (1) or off (0).
The hub and port values for a device can be found with
Some other details (from a reply in 2016,
lsusb data could be more accurate):
Just tested this with the Pi 3 [...] The USB port numbering from the picture posted above:
Hub:Port -- Controlled port(s)
0:1 -- Controls the Ethernet port
0:2 -- Controls all four USB ports (not the Ethernet)
0:3 -- Controls USB Port 4
0:4 -- Controls USB Port 2
0:5 -- Controls USB Port 3
As best I can tell, USB Port 1 cannot be controlled individually.
sysfsbut I am not sure how applicable that is to individual ports; ideally, if the device implements such functionality, you may be able to ask it to turn off.