Permalink
Browse files

try directly /dev/ttyUSBs if not on windows

  • Loading branch information...
1 parent 2d6cba5 commit 886c4ab3e43b5242b009e52377d597aeb6959154 @m0mchil committed Mar 20, 2013
Showing with 6 additions and 2 deletions.
  1. +6 −2 ioutil.py
View
@@ -1,7 +1,6 @@
+from detect import LINUX, WINDOWS
from glob import glob
-from serial.tools import list_ports
-from detect import LINUX, WINDOWS
def find_udev(check, product_id):
ports = []
@@ -28,9 +27,14 @@ def find_serial_by_id(check, product_id):
def find_com_ports(check):
ports = []
if WINDOWS:
+ from serial.tools import list_ports
com_ports = [p[0] for p in list_ports.comports()]
com_ports.sort()
for port in com_ports:
if check(port, False):
ports.append(port)
+ else:
+ for port in glob('/dev/ttyUSB*'):
+ if check(port):
+ ports.append(port)
return ports

0 comments on commit 886c4ab

Please sign in to comment.