int v24CountPorts

( unsigned long* BitMask )

Detect installed serial devices.

Documentation

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:4
   

The 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!

Parameters:
BitMask - pointer to a unsigned long variable.
Returns:
(int) number of detected ports or -1.

Alphabetic index



This page was generated with the help of DOC++.