Author Topic: On Windows I want to know how far my device is from a powered hub  (Read 6172 times)

Tony Naggs

  • Member
  • ***
  • Posts: 5
I'm working with a development board, and during Flash memory reprogramming the reliability of the programming is vastly greater when connected close to a powered hub.

(I want to be able warn the user if they try to reprogram the development board and it is more than 1 unpowered hub away from the host or a powered hub.)

So I am happily using the Windows Setup APIs to find the (HID Bootloader) device for programming; but it is not obvious to me how to walk back up the chain of Windows information about hubs to the host bus controller, or (so far) to identify in Windows which hubs are powered.

Jan Axelson

  • Administrator
  • Frequent Contributor
  • *****
  • Posts: 3033
    • Lakeview Research
Re: On Windows I want to know how far my device is from a powered hub
« Reply #1 on: August 07, 2015, 12:21:52 pm »
Two bus-powered hubs should never connect in series. The upstream hub can guarantee no more than 100
mA to each downstream port, and that amount doesn’t leave enough current to power a second hub that also has one or more downstream ports that each require 100 mA.

It's unfortunate that the host doesn't refuse to configure the second hub, which can't provide the current it must promise.

How much bus current does the device need?

Bret

  • Frequent Contributor
  • ****
  • Posts: 68
Re: On Windows I want to know how far my device is from a powered hub
« Reply #2 on: August 07, 2015, 01:15:56 pm »
There's also the problem that at least some hubs (I've had several) claim in their descriptors that they are self-powered when they actually aren't.  A host can't necessarily believe what the hubs are telling it, at least when it comes to their power source.  So, even if Windows has a call or set of calls that could be used to determine a devices power source (which I don't think Windows has), it wouldn't necessarily be correct.

Tony Naggs

  • Member
  • ***
  • Posts: 5
Re: On Windows I want to know how far my device is from a powered hub
« Reply #3 on: August 07, 2015, 06:12:14 pm »
Jan, Bret thanks for the comments.  :)

I think the power problem is mostly due to the transients of the current switching on & off when programming the Flash memory.
The device keeps running, but the memory is not correctly erased & reprogrammed.


I'm hoping that in Windows there is a way to work backwards from the device to the root hub, so that I can count bus segments.
(Ignoring whether the hubs are bus powered or self-powered seems lika good idea, thanks.)

John Hyde's book shows how (like USBview) to iterate through the root hubs, and search the tree of connected hubs & devices. I can do my search like this, but it seems a bit inefficient.