From: travisutk Date: Mon, 24 May 2010 05:21:19 +0000 (+0000) Subject: Automatic port scanning for Windows. X-Git-Url: http://git.rot13.org/?p=goodfet;a=commitdiff_plain;h=b16927a85ac4a4c6f925a41bfeef04224f8581f9 Automatic port scanning for Windows. git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@565 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- diff --git a/client/GoodFET.py b/client/GoodFET.py index e0f6431..8244aaa 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -89,7 +89,14 @@ class GoodFET: 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, diff --git a/client/goodfet b/client/goodfet index 070f810..c8e2187 100755 --- a/client/goodfet +++ b/client/goodfet @@ -26,25 +26,26 @@ if verb=="scan": 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;