Skip to content

Instantly share code, notes, and snippets.

@Oneiroi
Created February 16, 2011 09:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oneiroi/829098 to your computer and use it in GitHub Desktop.
Save Oneiroi/829098 to your computer and use it in GitHub Desktop.
Scanning for available USB tty devices on OSX differes slightly from Linux.
#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