7

The USB 2.0 standard supports the disabling of individual hub ports. I am looking for an API to call from user code under Windows 8, specifically to disable hub ports, either in C# or in C++, using existing Windows user-mode drivers.

It looks like the IOCTL to disable a hub port has been deprecated in the WDF.

I've built and used DevCon - it will disable devices through the DDK, but will not disable hub ports.

WinUSB is a powerful interface, which requires specifying WinUSB.sys as your driver stack. However, I don't think its libraries, setupapi.lib and winusb.lib, provide this level of hub control.

I would really appreciate a pointer to the correct user-mode API in Windows 8, especially a C# interface. If no such API exists, that would also be very helpful to know.

-- Added 6/3: Since no information on this has turned up, we're now looking into a software-based bank-switching algorithm that disables and re-enables the devices directly. We hope to be able to build this out at an arbitrary size, but of course the technology is unproven at this point. I'll keep this thread up to date with progress.

Dana
  • 354
  • 2
  • 9
  • I'm hoping this will be re-opened, as I can't find this info anywhere else. Let me know if it needs more editing, please. – Dana May 20 '13 at 20:56
  • WinUSB seems to be the MS api for accessing USB devices. I don't know if it will do what you want, but it may be worth a look. See also http://stackoverflow.com/questions/12036077/usb-api-for-windows – chue x May 20 '13 at 21:14
  • Would appreciate votes to re-open this question, now that it is shortened and more to the point. – Dana May 21 '13 at 02:28

1 Answers1

1

Have you considered implementing a bit of hardware to accomplish the same goal?

Since nobody appears to have a software-only solution yet, this may well prove to be the quickest way to get things going. Also, it would be completely OS independent, which might help with future maintainability.

A simple bank switching approach

As a very basic example, you could use an off-the-shelf serial relay box (such as this one) to control the power supply going to all the hubs individually. That way you could enable one "end hub" at a time to access the devices that are connected to that hub. Be sure to use self-powered hubs that only work when external power supply is present though - I've seen quite a few powered hubs that still connect when external power is absent.

Serious hacking: a DIY USB proxy device

Since you mentioned that you have experience with embedded software development, you could also consider building a passthrough device that acts as "proxy" between the hubs (with devices) and the host machine. It could send the required USB commands to the hubs downstream to disable/enable the ports. If high data rate isn't a requirement, such a device may be built using an Arduino and a USB Host Shield.

Mels
  • 476
  • 2
  • 17
  • Yes, we are definitely looking into hardware, but since this project is on a tight schedule, hardware is our least favorite approach. – Dana Jun 03 '13 at 17:02
  • Just to close this up, I worked for a few months with a an engineer at Microsoft, and I determined that bank switching in software did not work. According to the USB spec it should, but at least for Windows 7, the low-level USB driver implementation sometimes did not correctly re-enable the nodes, and they would eventually drop off. Very unfortunate! – Dana Sep 10 '15 at 21:09