views:

4070

answers:

5

I would like to power cycle an usb device through software on windows.

I am doing development on a small usb power microcontroller. This chip will revert to native behavior on a power cycle and allow a code download. Since my code will crash the device when things go wrong -- making it ignore all USB commands -- I have to physically unplug the device from the system.

I want to do development remotely, and not have to be physically present.

So far I have tried using "devcon" to disable portions of the USB stack. While this takes the hubs into D3 (should be powered off!), there is still power being supplied to the device.

Thanks in advance for any preexisting solutions or SetupAPI tricks that might help.

A: 

Maybe these links will be of some help:

codelogic
Unfortunetly it's not working:) From the first link: This method is currently not implemented by WMI. To use this method, you must implement it in your own provider.
Ilya
A: 

Unfortunately, it's not possible on stock PCs.

USB host chipsets do not have the capability to fully power-down. There is some signaling that you can do in USB 2.0 or 3.0 to ask the device to go into a sleep-state, but the port will provide power even when the PC is turned off. (That's so devices like iPods and whatnot can still charge if needed.)

Mark Maxham
This is not correct and depend on specific hardware. There is an option to turn off/on power for root hub sometime you can't do it per port and only for all root hub ports. But you definitely can power down the port
Ilya
+2  A: 

Since its for dev/test instead of production, I'd recommend having a solid state relay as part of a second device and using that to cycle the power on the USB connection.

devstuff
We use this method, just power relay instead electricity we cat Vbus cable and insert it in the power relay. I know that there is dedicated USB relays for exactly this purpose, but i assume that they are pricey.
Ilya
Would there already exist USB hubs that power off the devices when the host takes the hub into low power mode? Since this is in a lab environment, using custom hardware will require a uphill battle.
i posted the link as separated answer.
Ilya
A: 

i googled and find the hardware i mention in my comment to devstuf answer. I sure that there is more solution like this.

Ilya
A: 

I like @devstuff's suggestion, but I would put the relay on a Powered USB Hub's DC input.

kenny