Apache/2.4.7 (Ubuntu) Linux sman1baleendah 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) safemode : OFF MySQL: ON | Perl: ON | cURL: OFF | WGet: ON > / usr / share / doc / python-serial / examples / | server ip : 172.67.156.115 your ip : 172.71.255.78 H O M E |
Filename | /usr/share/doc/python-serial/examples/scanlinux.py |
Size | 481 |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 27-Apr-2025 09:56 |
Last modified | 04-Mar-2011 09:27 |
Last accessed | 06-Jul-2025 23:32 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
#! /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 <[email protected]>
"""
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*') + glob.glob('/dev/ttyACM*')
if __name__=='__main__':
print "Found ports:"
for name in scan():
print name
"""\
Scan for serial ports. Linux specific variant that also includes USB/Serial
adapters.
Part of pySerial (http://pyserial.sf.net)
(C) 2009 <[email protected]>
"""
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*') + glob.glob('/dev/ttyACM*')
if __name__=='__main__':
print "Found ports:"
for name in scan():
print name