I am trying to test code for simple comms with a serial device (at the moment just a hard loopback). The USB to serial adapter I'm using installs on COM20 by default, but disconnecting and reconnecting a few times has caused it to bind to COM21.
I would like to try and make my life a little easier and search for the port that is bound to the USB-serial driver. On TeraTerm, I get to choose from a dropdown that shows all COM ports and drivers. I would like to add that functionality to my code.
The SerialPort
class only has a GetPortNames
method that simply gives all the port names, i.e. COM1, COM2, ..., COM21 etc.