Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How can I from the shell remove and apply USB power to one of the host USB ports in my machine?

share|improve this question

2 Answers 2

This was asked on Stackoverflow and really should have been migrated here.

http://stackoverflow.com/questions/4702216/controlling-a-usb-power-supply-on-off-with-linux

share|improve this answer
    
Funny thing is, that answers is not correct. Echoing suspend to that file will request the device to power off (or suspend), but there will still be 5V on pin 1 in the USB cable, thus the device will still draw power from the USB port. –  Bjarke Freund-Hansen Dec 12 '11 at 6:34
    
@bjarkef Right - thanks for the heads up. –  Paul Dec 12 '11 at 8:34
up vote 1 down vote accepted

So it seems that this cannot be done, which I kind of already suspected.

The advice found in some places about echoing on and suspend to /sys/bus/usb/devices/usb?/power/level does not really remove power from the USB host port, it merely requests the device to go into suspend mode, and vice-versa.

I solved my problem by attaching a USB hub with an external power supply, and then cutting the USB 5V wire in the USB cable going from the host machine to the USB. Then I can turn power on an off from my device via an external power relay connected to the USB hub power supply.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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