def scan_ports():
names = []<EOL>for number in range(<NUM_LIT>):<EOL><INDENT>try:<EOL><INDENT>s = pyserial.Serial(number)<EOL>name = getattr(s, '<STR_LIT:name>', getattr(s, '<STR_LIT>', str(number)))<EOL>names.append((number, name,))<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>return tuple(names)<EOL>
Scan for known serial ports available in the underling system.
Returns a tuple of tuples where each inner tuple contains the port
number and port name. For example:

.. sourcecode:: python

    scan_ports()
    ((0, '/dev/ttyS0'), (1, '/dev/ttyS1'), ...)