Reputation: 1888
I have a project that I'm working on and I want to use these: http://www.woot.com/blog/post/usb-powered-woot-off-lights-2
However it looks like they just have on/off switches. They aren't something that you can interface with programmatically.
So I was thinking, if I could find a way to cut the power to the USB port, that would allow me to turn the lights on and off with my app. However I cant find any way to cut the power to the USB port. Is this possible?
Upvotes: 10
Views: 26513
Reputation: 31
EDIT: unfortunately it seems the products from this company are not sold anymore.
The powered-woot-off-lights-2 are powered via a regular usb plug which mean they are 5 volts and there are in each one light and one motor.
I could not find how many Amps are needs but I know that this extension would be perfect if 200 mA for one powered-woot-off-lights is enough.
The C# or VB.NET code would look like this.
// On
nusbio.GPIOS[NusbioGpio.Gpio0].DigitalWrite(true);
nusbio.GPIOS[NusbioGpio.Gpio1].DigitalWrite(true);
// Off
nusbio.GPIOS[NusbioGpio.Gpio0].DigitalWrite(false);
nusbio.GPIOS[NusbioGpio.Gpio1].DigitalWrite(false);
see Nusbio's website and I think the extension is in their store. I used a similar nusbio extension myself.
to turn on/off my a USB fan and a battery powered small lamp
Upvotes: 2
Reputation: 61
I had a similar problem and solved it using DevManView.exe (freeware):
Download DevManView.exe and put the .exe file somewhere: http://www.nirsoft.net/utils/device_manager_view.html
Go to your Device Manager and figure out which USB-Controller you have to enable/disable, so that your device does/doesn't get power anymore. For me disabling "USB Serial Converter" does cut the power of all USB slots.
USB Serial Converter in device manager
In C#, create and start a new process for disabling the device (using the name of the USB-Controller).
Process devManViewProc = new Process();
devManViewProc.StartInfo.FileName = @"<path to DevManView.exe>\DevManView.exe";
devManViewProc.StartInfo.Arguments = "/disable \"USB Serial Converter\"";
devManViewProc.Start();
devManViewProc.WaitForExit();
And enable it again.
devManViewProc.StartInfo.Arguments = "/enable \"USB Serial Converter\"";
devManViewProc.Start();
devManViewProc.WaitForExit();
Upvotes: 5
Reputation: 187
If you have admin privileges, then run the following:
Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord);
Upvotes: -1