Let me go straight to the problem.
Let say, I have a Arduino Uno (COM4) and Arduino Mega (COM5), both is communicating with my OS through serial port. How can I detect that COM4 is really an Arduino Uno so that I don't mistakenly connecting my program to COM5 port? The process of connecting to the serial port is done in runtime by my program.
The code that I saw online here in another SO question and from my experiment with that code earlier, it only listed out all serial ports while it don't reveal out what is that device is (so the program don't know what is really that device, either can be Arduino Uno or Arduino Mega or something else).
So my question is, how can I achieve this purpose? Cross-platform is preferred but if such things can't be achieve, then please answer on how to do it inside Windows (as I currently developing this program for computer that's using Windows OS)