c# - How to Reset USB Port Programatically -


we have systems connect through devices connected pcs through usb. in cases there adapter in between rs-232 usb conversion. possible tell device manager remove port , add in? drivers various devices (which in cases more 1 such device through usb serial adapter) reset. seems removing port , adding in ensure drivers reconnect. important third party drivers can "stuck" , due threading not possible use anymore. means require physical removal of connection, or full system reset.

so hoping knows if there simple way connect device manager find ports remove them , reconnect them. this:

public class devicemanagerwrapper {     public void resetallports()     {         using(var devicemanager = new system....devicemanager()         {             foreach(var port in devicemanager.getports())             {                  port.disconnect();                  port.reconnect();             }         }     } } 

obviously doesn't work. hoping point me in right direction.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -