title: Reliably detecting presence of external hardware
body: <p>I have to support an increasing range of hardware that's considered, at least by today's standards, legacy. What nearly all of these devices have in common is an FTDI FT232 UART chip, which acts as a Serial-to-USB converter. Windows sees it as a standard COM port, though it is virtualized. </p>
  
  <p>Consequently, programmatically identifying these devices is troublesome. Since they all use the same chip (or similar), querying by typical Hardware IDs is no help since it's always the same. Are there any other metrics available to ID a device?</p>
  
  <p>My current solution has been to loop through all the active Serial Ports, and issue pre-known "hello" commands at all the common baud rates. If I receive a response on that port at the baud rate tested, it's assumed the device of interest is found. Some pseudocode:</p>
  
  <pre><code>for each(Serial Port)
  {
      for each(Device Definition)
      {
          for each(Baud Rate)
          {
              WriteToPort(Device Definition.helloString, Baud Rate)
              ReadPort(response)
  
              if(response)
                  Serial Port = this device // break loop
              else
                  continue;
          }
      }
  }
  </code></pre>
  
  <p>This works OK, but is unreliable and slow at best, as I have to wait for the read to timeout for each tested baud rate, multiplied by each device actually connected to the system (there can be one or many). This gets slower with each new piece of hardware that has to be supported. </p>
  
  <p>One of the features of this code is that it "Just Works"™, users don't have to fuss with identifying their device and setting up the COM connection. It's pretty clear that my method isn't scalable; Is there anything I can do, short of empowering the user and forfeiting one of the redeeming qualities of my software?</p>
  
  <p><strong>EDIT:</strong> I wanted to update my question with some visuals that demonstrates the issue. The accepted answer had some informative information, but when I decided to give the implementation a go, I'm still not certain how to proceed.</p>
  
  <p>Consider the following two entries in my registry: <img src="https://i.stack.imgur.com/WpyAg.jpg" alt="enter image description here"></p>
  
  <p>They both share the same Vendor ID, Hardware ID, and virtually every other distinguishing property. However, they are known to be different devices; The only thing they share in common is the communication interface, ala FTDI chip. Knowing the PortName / COM Address isn't helpful at all since the number they receive from the system is arbitrary... whatever is next in line. </p>
  
  <p>How are the numbers circled in red generated? As far as I can tell, this is the only useful piece of information as it seems like devices receive similar Serial Numbers appended to their entry.</p>
  
  <p>The next image shows an entry that is actually useful: <img src="https://i.stack.imgur.com/mZyR8.jpg" alt="enter image description here"></p>
  
  <p>The manufacturer is listed, with a registered Vendor and Hardware ID, and there is a description of the connected device. This I could do something with. Unfortunately, it seems to be the exception rather than the rule. </p>
  
  <p>Is there any other way to proceed IDing these devices? Running checks across the devices in parallel will provide a small boost, but the real bottleneck is testing baud rates against the command sets. </p>