Platform definitions.
[goodfet] / client / GoodFET.py
index 7e32773..d97fb94 100755 (executable)
@@ -93,10 +93,13 @@ class GoodFET:
             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
-                    
+                try:
+                    if hwid.index('FTDI')==0:
+                        port=comport;
+                        #print "Using FTDI port %s" % port
+                except:
+                    #Do nothing.
+                    a=1;
         
         self.serialport = serial.Serial(
             port,
@@ -195,6 +198,10 @@ class GoodFET:
                         print "# DEBUG %s" % self.serialport.read(self.count)
                            elif self.verb==0xFE:
                         print "# DEBUG 0x%x" % struct.unpack(fmt[self.count-1], self.serialport.read(self.count))[0]
+                    elif self.verb==0xFD:
+                        #Do nothing, just wait so there's no timeout.
+                        print "# NOP.";
+                        
                     sys.stdout.flush();
                 else:
                     self.data=self.serialport.read(self.count);
@@ -277,6 +284,9 @@ class GoodFET:
     def peekword(self,address):
         """Read a word of memory from the monitor."""
         return self.peekbyte(address)+(self.peekbyte(address+1)<<8);
+    def peek(self,address):
+        """Read a word of memory from the monitor."""
+        return self.peekbyte(address)+(self.peekbyte(address+1)<<8);
     def pokebyte(self,address,value):
         """Set a byte of memory by the monitor."""
         self.data=[address&0xff,address>>8,value];