return self.symbols.get(name);
def timeout(self):
print "timeout\n";
- def serInit(self, port=None, timeout=2):
+ def serInit(self, port=None, timeout=2, attemptlimit=None):
"""Open the serial port"""
# Make timeout None to wait forever, 0 for non-blocking mode.
connected=0;
while connected==0:
while self.verb!=0x7F or self.data!="http://goodfet.sf.net/":
- if attempts>2:
+ if attemptlimit is not None and attempts >= attemptlimit:
+ return
+ elif attempts>2:
print "Resyncing.";
self.serialport.flushInput()
self.serialport.flushOutput()
CLRSS;
ccspitrans8(0x08); //SFLUSHRX
SETSS;
- txdata(app,verb,cmddata[0]+2);
+ //Only should transmit length of one more than the reported
+ // length of the frame, which holds the length byte:
+ txdata(app,verb,cmddata[0]+1);
}else{
//No packet.
txdata(app,verb,0);