
Hello,
Are there cross-platform methods to discover all the devices currently connected through serial ports with Boost?
The idea is to have a function returning a list of device objects, each containing a handle, the related vendor id, product id and the baud rate at which the device was able to communicate.
My knowledge of serial communication is very limited, may be it is technically infeasible. Do you have any thoughts for Boost or other
On 04/10/2013, Vincent Boucher wrote: libs? It is technically infeasible. First of all, you would have to know the communication details (Baud rate, parity, stop bits and whatnot) in order to establish any kind of communication. Note that there is no feature in RS232 to find out these parameters. If you don't know them (mislaid your manual), you can only try to enumerate all possible combinations (which will be somewhere in the millions). Even worse, if you got the communication parameters right, there is no standard set of commands that can be sent. Some devices behave nicely and give you some sort of error message if they encounter a wrong command, but even that is vendor-specific. So even with the right communication parameters you might not recognize this unless you send the right command (I don't know whether there are any devices that only receive commands and never send answers, but in an infinitely large universe anything is possible ;-) On 04/10/2013, Vincent Boucher wrote:
In my case, I have to address a serial over USB adapter.
So, I would have to implement an OS-dependent method looping over all serial devices found (/dev/tty* or COM*), query them, wait for reply, then return a list of objects.
This only works if you know what you are looking for. Sometimes I have to do this when there are a lot of USB-RS232 adapters plugged in and I forgot which adapter was assigned which port number. Regards, Stuart