glob_list = glob.glob("/dev/ttyUSB*");
if len(glob_list) > 0:
port = glob_list[0];
-
+ if os.name=='nt':
+ from scanwin32 import winScan;
+ scan=winScan();
+ for order,comport,desc,hwid in sorted(scan.comports()):
+ if hwid.index('FTDI')==0:
+ port=comport;
+ #print "Using FTDI port %s" % port
+
self.serialport = serial.Serial(
port,
from scanwin32 import *;
# INIT COMPORT SCAN
scan=winScan();
- scan.comports();
-
+ #scan.comports();
+
for order, port, desc, hwid in sorted(scan.comports()):
# Look for FTDIBUS
try:
- hwid.index('FTDI')
- print "*************"
- print "GOODFET FOUND"
- print "*************"
- print "%s: (%s) ->" % (port, hwid),
+ #hwid.index('FTDI')
+ #print "*************"
+ #print "GOODFET FOUND"
+ #print "*************"
+ if hwid.index('FTDI')!=0: continue;
+ print "%s: (%s)" % (port, hwid),
try:
serial.Serial(port)
except serial.serialutil.SerialException:
- print "Not Ready - Is the process in use?"
+ print "Busy"
else:
print "Ready"
except:
pass
-
+ sys.exit(0);
driver=sys.argv[1];
print "Using driver %s" % driver;