~dongpo-deng/sahana-eden/test

« back to all changes in this revision

Viewing changes to modules/pygsm/scanlinux.py

  • Committer: Deng Dongpo
  • Date: 2010-08-01 09:29:44 UTC
  • Revision ID: dongpo@dhcp-21193.iis.sinica.edu.tw-20100801092944-8t9obt4xtl7otesb
initial

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /usr/bin/env python
 
2
"""\
 
3
Scan for serial ports. Linux specific variant that also includes USB/Serial
 
4
adapters.
 
5
 
 
6
Part of pySerial (http://pyserial.sf.net)
 
7
(C) 2009 <cliechti@gmx.net>
 
8
"""
 
9
 
 
10
import serial
 
11
import glob
 
12
 
 
13
def scan():
 
14
    """scan for available ports. return a list of device names."""
 
15
    return glob.glob('/dev/ttyS*') + glob.glob('/dev/ttyUSB*')
 
16
 
 
17
if __name__=='__main__':
 
18
    print "Found ports:"
 
19
    for name in scan():
 
20
        print name