I am currently looking into the possibilities of how I can monitor and control individual ports on an external USB Hub. Specifically I would want to monitor port status changes related to erroneous scenarios like over-current, port disable due to bus errors etc and also would like to control the port power (Turn off or on). The devices that are going to get connected to these ports in most cases will follow standard USB classes like HID, and thereby I don?t own the drivers for them. Looking at MSDN/WDK documentation for USB IOCTLs, I don?t see anything that I can use to get/set information on the hub. Some of the software protocol analyzers suggest that the internal IOCTLs of the hub device is used for the purpose.
Can the above explained requirement be fulfilled from an application? I have read that Windows pops up a error message in case of an over current scenario, but is there a way my application can listen for that? Additionally, can I control the features of a hub port from the application?
If (1) is not possible, is writing a Hub lower filter driver to monitor the activities and have a control device communicate the same to my application the only other approach?
I am confused on how my requirements can be met, and any help on how this can be achieved would be of great help.
Just in case it makes any difference, my targeted platform is Windows XP Embedded.
Have a look at IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX. It has USB_CONNECTION_STATUS member in its structure, which might be what you are looking for.
As regards to controlling the port power, I don’t think it is a good idea since the HUB driver is the incharge for controlling the port power.
Hi Shakti,
Thanks for the information. I think the connection status member should provide me the sufficient information if I poll the same periodically.
From reading through the spec, I understand that the Hub would place the ports on which an over current condition has been observed in the powered off state. I was looking into possibilities on how I can re-enable the port so that I don?t need to unplug and reconnect the device. I am still not clear on how this can be achieved.
Thanks again,
Anees
Thanks again Shakti.
I did have a look at these IOCTLs, but as the name suggests they are internal IOCTL?s and cannot be triggered from an application. From the information that I currently have, I am inclined towards a solution with a filter driver for the hub, but wanted to first ensure that whatever I am trying to do is not achievable from user mode.