/usr/share/doc/python-serial/examples/scanlinux.py is in python-serial 2.5-2.1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | #! /usr/bin/env python
"""\
Scan for serial ports. Linux specific variant that also includes USB/Serial
adapters.
Part of pySerial (http://pyserial.sf.net)
(C) 2009 <cliechti@gmx.net>
"""
import serial
import glob
def scan():
"""scan for available ports. return a list of device names."""
return glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*')
if __name__=='__main__':
print "Found ports:"
for name in scan():
print name
|