Resetting the USB bus

G

Guest

I am trying to Reset the USB bus.

I have a system with various USB devices attached to it including video
capture devices. Occasionally some of the USB devices either disappear or
fail to operate. Restarting the computer or unplugging and replugging the
device corrects this, however this is not a viable solution while the system
is running.

I'm looking for a way of resetting or re-initializing the USB bus or the USB
hub in the hope that this will reset the device. I can detect when the device
is not present in the software and therefore when to attempt to reset the
device or USB bus.

I tried the following code (in C#) to reset the USB line, but it throws an
exception:
public static void ListUSB()
{
System.Management.ObjectQuery objectQuery =
//new System.Management.ObjectQuery("select * from CIM_USBController");
new System.Management.ObjectQuery("select * from CIM_USBHub");

// search and get the list
System.Management.ManagementObjectSearcher searcher = new
System.Management.ManagementObjectSearcher(objectQuery);
System.Management.ManagementObjectCollection list = searcher.Get();

// step through the list of devices
foreach (System.Management.ManagementObject item in list)
{
item.InvokeMethod("Reset", null);
}
}


I have tried this with the CIM_USBHub and CIM_USBController classes.

Can anyone help or does anyone know how to do this?

Thanks
 
J

Jeffrey Tan[MSFT]

Hi Richard,

There are several replies to your questions in wmi and kernel newsgroup,
please follow up there. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top