I have a problem with disabling any USB ports with the command: sudo sh -c "echo 0 > /sys/devices/platform/soc/3f980000.usb/buspower" Nothing happens at all, though the content of the file IS changed to 0x0 or 0x1.

When entering

sudo sh -c "echo 0 > /sys/devices/platform/soc/3f980000.usb/buspower"

the LED of the webcam I'm trying to turn off flashes of and on for about half a second so it is affecting the USB ports in some way.

Thanks in advance!

2 Answers 2


Here is a related question where we discussed an app that allows control of USB ports from the command-line.

  • Thank you! The small C-program did it, totally missed that. Thanks alot! Commented Jul 14, 2016 at 17:29

Because it's impossible to disable the usb power, I've used udev rules and a script installed in /usr/local/sbin (tested on Raspberry PI3)

The script :

 \#Exceptions network device  
 EXC="1-1.1 1-1:1.0"  
 for host in $ROOTUSB/*  
if [ -f $host/authorized ];then  
\# Parse exception to allow them to be enabled (network...)  
for device in $EXC  
\# If host ending equal excetion =>> dont change state  
[[ $host =~ \/$device$ ]] && disable=0  
\#Otherwise change state ==> disable  
if [ $disable = 1 ];then  
\#USB host to disable  
echo 0 >  $host/authorized  

The udev rules

ACTION=="add", SUBSYSTEMS=="usb", RUN+="/usr/local/sbin/disable-usb.sh"  

Refresh udev rules

udevadm control --reload-rules  

Plug in a storage usb device, now, you are not allowed to enumerate filesystems

  • please read the other answer! There is a way of controlling the power and it's by using the feature that check if the USB port is shorten or not, check github.com/codazoda/hub-ctrl.c
    – MatsK
    Commented Sep 11, 2017 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.