Detect installed serial devices.
Detect installed serial devices. The goal of this function is to detect which serial devices are installed. Therefore the /proc file system is used. The content of the virtual file /proc/tty/driver/serial must be present. It must hold a specially formatted line for each device (see below). A device is recognized as `installed' if this line doesn't contain the word ``unknown'' but contain the ``tx:''.The line format of the virtual file should look like this:
0: uart:16550A port:3F8 irq:4 tx:0 rx:0 1: uart:16550A port:2F8 irq:3 tx:0 rx:0 2: uart:unknown port:3E8 irq:4The result of the detection is stored in a unsigned long variable. For every port found, the corresponding bit is set. The above sample shows us, that port0 (ttyS0) and port1 (ttyS1) are present. So the bit0 and bit1 of the variable referenced by BitMask are set.
If the function failes to detect the installed ports, a -1 is return. If all went fine, the number of detected ports is returned.
Note: this function can be used without an opened device!