Fixed python client buffering issues, minor changes to SPI app.
[goodfet] / client / GoodFET.py
index 18a3eb1..ec65900 100755 (executable)
@@ -55,20 +55,21 @@ class GoodFET:
         self.serialport.write(chr(app));
         self.serialport.write(chr(verb));
         
-            
+        
+        #print "TX %02x %02x" % (app,verb);
+        
         #little endian 16-bit length
         self.serialport.write(chr(count&0xFF));
         self.serialport.write(chr(count>>8));
         
         #print "count=%02x, len(data)=%04x" % (count,len(data));
-        if count!=0:
-            for d in data:
-                self.serialport.write(chr(d));
-        
-        #self.serialport.flushOutput();
-        #self.serialport.flushInput();
-        
         
+        if count!=0:
+            for i in range(0,count):
+                #print "Converting %02x at %i" % (data[i],i)
+                data[i]=chr(data[i]);
+            outstr=''.join(data);
+            self.serialport.write(outstr);
         if not self.besilent:
             self.readcmd();