tags:

views:

117

answers:

1

I have a USB modem and it often drops the signal. When this happens I pull unplug and re-plug it from the USB port and it gets the signal right back; Can I write a program that does that without having to physically disconnect the modem from the port?

A: 

As hinted in a comment, programmatically resetting USB ports is an OS-specific feature.

In Windows the easiest approach is probably by leveraging WMI aka Windows Management Instrumentation. You can get several snippets that "mess" with USB ports, in various languages, by searching the web with "WMI", "USB" and such keywords.

This MSDN article is of broader interest than just USB controllers but provides a good overview of the CIM model and WMI interface.

Edit:
Indeed if this question pertains to Windows, I just discovered it is a duplicate on SO:

BTW, both these links were identified automatically by SO, in the "Related" list on the right of the page
  ==> We need to remember to check thislist more systematically
  ==> In many cases, this list is damn good

mjv