Author Topic: Controlling the Power of a Port in a Hub in WIndows 7?  (Read 15363 times)

Dieter

  • Member
  • ***
  • Posts: 3
Controlling the Power of a Port in a Hub in WIndows 7?
« on: July 03, 2014, 10:56:51 am »
Hi Guys,
this is my first post here, so please forgive if I make a mistake.
Research so far:
Many hits from google state that you cannot control the Vbus of a port, but indeed it is possible!
Some hubs do not tell the truth in their discriptors. But there are hubs that actually can switch the Vbus.
I have such a hub on my desk (Delock 87445, was less than 4€). From Linux I can switch the Vbus with the hub-cntrl tool http://www.gniibe.org/development/ac-power-control-by-USB-hub/index.html.

Unfortunatelly I need to do this in Windows7. There is is not too easy, I found some interesting IOCTLs just to see a second later that they are deprecated from Vista on.
I also managed to compile the Linux code for Windows. It uses usblib, so I used the win port of it. Problem is that it does not work to capture hubs by libusb driver without loosing the hub functionality.

Some experiments with devcon removes power for a very short time (200ms) - too short for my needs.
The VID/PID in the cmd line below belongs to the hub, not to a device connected.
Code: [Select]
devcon restart "USB\VID_05E3&PID_0608*"

Any hints?

Dieter :-)
Dieter :-)

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: Controlling the Power of a Port in a Hub in WIndows 7?
« Reply #1 on: July 03, 2014, 12:28:26 pm »
If the Windows hub driver doesn't support what you need, you might be able to add new capabilities using a filter driver.

The pwrtest utility in the Windows 8 (not 8.1) WDK might have something:

http://msdn.microsoft.com/en-us/library/windows/hardware/ff550682%28v=vs.85%29.aspx

What are you trying to accomplish with the VBUS switching?

Dieter

  • Member
  • ***
  • Posts: 3
Re: Controlling the Power of a Port in a Hub in WIndows 7?
« Reply #2 on: July 14, 2014, 05:03:23 am »
Hi Jan,
well, it is a long story.
In short:
I have been asked to help with a big installation of USB devices. Spread in the country, so replacing the hardware will take a long time.
The devices sometimes hang while power up. Only way to resolve is to unplug/replug them to remove power (firmware is not running yet, so no way to fix in firmware).
If the hub does turn off the power, the device gets a second chance to boot up.

Dieter :-)
Dieter :-)

Bret

  • Frequent Contributor
  • ****
  • Posts: 68
Re: Controlling the Power of a Port in a Hub in WIndows 7?
« Reply #3 on: July 14, 2014, 02:31:58 pm »
Somebody correct me if I'm wrong, but I think that, per the spec, all external Hubs are supposed to support power switching on the downstream ports (and root hubs don't have to provide any power switching capabilities at all).  However, the Hub spec does not necessarily require the downstream ports to be controlled individually -- all of the ports could be "ganged" together so that you must turn the power on or off to all downstream devices at the same time.  If the device is self-powered, of course, manipulating the bus power should have no effect, anyway.

In addition, not all OS's provide a way to access to the power control even if the hub provides it, and the fact that a hub is supposed to allow power control doesn't necessarily mean it actually does.

I think the bottom line in your situation is that power control is the wrong approach -- I don't think you can count on it working 100% of the time.

Dieter

  • Member
  • ***
  • Posts: 3
Re: Controlling the Power of a Port in a Hub in WIndows 7?
« Reply #4 on: July 15, 2014, 04:19:17 am »
Hi Bret,
you are right with the Hub Specifications. "ganged" or "indivudually" can be seen in the descriptors.
Reality is however, that many Hubs do not have the switches build in.

In a general way, I agree that we cannot count on power control.
In my (very special) situation it is the only way to avoid replacing hardware all over the country.
The hardware is well known and the same in all these places.
A software update can happen over night. So it will be the first try. I have no results back from field tests yet.

Thanks! Dieter :-)
Dieter :-)

Barry Twycross

  • Frequent Contributor
  • ****
  • Posts: 263
Re: Controlling the Power of a Port in a Hub in WIndows 7?
« Reply #5 on: July 15, 2014, 02:35:20 pm »
Somebody correct me if I'm wrong, but I think that, per the spec, all external Hubs are supposed to support power switching on the downstream ports (and root hubs don't have to provide any power switching capabilities at all).
Bus powered hubs must support power switching, self powered ones don't. I wouldn't count on any particular hub to support power switching.

When I started I wanted to put power switching into my host implementation, but once I realized that not all hubs support it I dropped the idea. We managed to work without the capability, its only really broken devices which need this.