"vendor id, product id
"
What's that ?
I mean for a serial
device. If they are present in the device protocol then
fine, but that depends on the individual devices and their
protocols.
You can check whether
there has been any traffic, which might be useful, but
serial connections are just streams of bytes.
I think the OP might be mixing up serial-bridges with the actual
bridged serial devices. E.g. FTDI-bridges have a Vendor-ID,
Product-ID pair which can be used to identify bridged serial
devices, if you assign special values. However, only their
proprietary drivers (d2xx) allow enumerating the bridges attached to
the PC. So there is no cross-platform or even a cross-vendor way to
do that. However, if you know that your devices are FTDI-bridges and
you happen to work on OS's with driver support, then you can bypass
the virtual serial ports alltogether and
identify/enumerate/communicate with the devices (I'm not too sure if
the d2xx-drivers hand out handles that you can use with the usual OS
file API though).