There is no univeral way of identifying serial port (UART RS232) devices.
Unless the devices have special commands that you can send to the device and have it respond with identifying information there is not much you can do.
Typically application that rely on the serial port will have a standard setting screen that the user would use to configure the serial port the device is connected to, port configuration for things like baud rate, parity bits, stop bits and data bits. If mutiple devices can be switched on the same port, the operator would then be responsible for selecting the correct configuration for the target device before communicating with the device.
This is the advantage of newer technologies like USB etc. where device identification is built into the standard.