I have a nice little USB light which has no off switch, it is 'on' for the duration of being plugged in.

My question is, is there a way of disabling the USB port so as to turn off the light while it is still plugged in? Preferably, this could be done from the command line, but if it's possible at all that would be really cool regardless. I use Mac and Linux, but am interested to learn if this is possible in any OS, or if physical hardware prevents usage like this.

link|improve this question

I would assume that it depends on the drive. – soandos Jul 24 '11 at 13:43
I'm not sure what you mean... do you mean hard drive? How would the hard drive impact the ability to toggle power to the USB port? – Jeff Welling Jul 24 '11 at 14:04
1  
If you want to disable the whole thing, use a device manager type thing (dont know what it is in mc or linux). If you just want to disable the light, it depends o the hardware (USB drive) involved. – soandos Jul 24 '11 at 14:07
I only know how to do this in Windows. Are you interested in the Windows way? – Larssend Jul 24 '11 at 16:13
Well I don't think I'd have included the sentence at the end of the question otherwise.. ;) – Jeff Welling Jul 24 '11 at 22:41
show 1 more comment
feedback

3 Answers

up vote 1 down vote accepted

In most cases, USB accessories like fans and lights aren't real USB devices - they just want a little bit of 5v power.

The way USB works for real devices is that they get a little bit of power to start, enough for them to turn on. Then they enumerate with the USB controller and request more power.

Since these fake USB devices aren't actually talking to the computer at all, the only way to turn it off would be to completely unpower that USB port, which as far as I know there is not usually a way to do in software.

link|improve this answer
feedback

I haven't actually tried this myself, but from the research I have done on the topic (to accomplish exactly the same thing as you), you will need:

  • A USB hub which supports "per-port power switching" - not many support this
  • A utility to actually toggle the power

Take a look at http://www.gniibe.org/development/ac-power-control-by-USB-hub/index, he is doing similar things, and includes some background on the topic, a list of supported hubs as well as the C source code to build the utility.

I couldn't find any of the USB hubs he had mentioned in the US, and after getting in touch with me confirmed that the D-Link DUB-H7 will work - you can get it on Amazon for example.

I haven't yet found a way to do this on Windows, but it looks like you're mostly interest in Linux anyways.

link|improve this answer
Awesome answer! The only reason I accepted the other answer was because I was specifically interested in the possibility of disabling it purely from software without additional hardware, but I love how far you took this, it sounds like there's a lot of potential with that DLink DUB-H7 device hehe. Has lots of weekend-project potential :) – Jeff Welling Mar 27 at 16:39
Exactly :-). The USB hub is sitting on my desk already, now I just need some time ... – Lucky Luke Apr 2 at 2:44
feedback

for linux:

People discuss here that it's possible to power off an USB port by doing a

echo suspend >/sys/bus/usb/devices/1-2/power/level

command. Also read this other site about power management.

Also do some search in your computer and read what's inside the power-management.txt file.

fow windows

you can take a look about programing it do be turned off.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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