Created
February 16, 2011 09:46
-
-
Save Oneiroi/829098 to your computer and use it in GitHub Desktop.
Scanning for available USB tty devices on OSX differes slightly from Linux.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#adapted from pySerial examples for use on OSX systems | |
import serial | |
from glob import glob | |
def _scan(): | |
dev_list = glob('/dev/tty*usb*') | |
available = [] | |
for dev in dev_list: | |
try: | |
s = serial.Serial(dev) | |
available.append(dev) | |
s.close() | |
except serial.SerialException: | |
pass | |
return available |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment