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.

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.

share|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

4 Answers

up vote 3 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.

share|improve this answer
add comment

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.

share|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 '12 at 16:39
    
Exactly :-). The USB hub is sitting on my desk already, now I just need some time ... –  Lucky Luke Apr 2 '12 at 2:44
add comment

Try using http://www.nirsoft.net/utils/usbdeview.zip. This executable displays all USB devices attached to your computer and allows you to disconnect them individually as required.

As noted from the read me:

USBDeview is a small utility that lists all USB devices that currently connected to your computer, as well as all USB devices that you previously used. For each USB device, extended information is displayed: Device name/description, device type, serial number (for mass storage devices), the date/time that device was added, VendorID, ProductID, and more... USBDeview also allows you to uninstall USB devices that you previously used, and disconnect USB devices that are currently connected to your computer. You can also use USBDeview on a remote computer, as long as you login to that computer with admin user.

share|improve this answer
add comment

7-port USB hub D-Link DUB_H7 revision 2 (black) does NOT have Per-port power switching, it only supports Ganged power switching.

#lsusb -v

output shows twice a 4-port hub, here is the output for Hub Descriptor:

Hub Descriptor:
  bLength               9
  bDescriptorType      41
  nNbrPorts             4
  wHubCharacteristic 0x00e0
    Ganged power switching
    Ganged overcurrent protection
    TT think time 32 FS bits
    Port indicators
  bPwrOn2PwrGood       50 * 2 milli seconds
  bHubContrCurrent    100 milli Ampere
  DeviceRemovable    0x00
  PortPwrCtrlMask    0xff
 Hub Port Status:
   Port 1: 0000.0100 power
   Port 2: 0000.0100 power
   Port 3: 0000.0100 power
   Port 4: 0000.0100 power
share|improve this answer
add comment

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.