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
Post a Comment