From 0b92a77db417a3f3b0482a5c5444c50042674fda Mon Sep 17 00:00:00 2001 From: rmspeers Date: Sat, 12 Mar 2011 23:37:51 +0000 Subject: [PATCH] radios/ccspi firmware fixed off-by-one error on packet rx; GoodFET.py added serInit ability to timeout after multiple sync attempts with device git-svn-id: https://svn.code.sf.net/p/goodfet/code/trunk@964 12e2690d-a6be-4b82-a7b7-67c4a43b65c8 --- client/GoodFET.py | 6 ++++-- firmware/apps/radios/ccspi.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/GoodFET.py b/client/GoodFET.py index d8e4ac5..673ffde 100755 --- a/client/GoodFET.py +++ b/client/GoodFET.py @@ -72,7 +72,7 @@ class GoodFET: 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. @@ -119,7 +119,9 @@ class GoodFET: 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() diff --git a/firmware/apps/radios/ccspi.c b/firmware/apps/radios/ccspi.c index 377a5f0..277a440 100644 --- a/firmware/apps/radios/ccspi.c +++ b/firmware/apps/radios/ccspi.c @@ -166,7 +166,9 @@ void ccspi_handle_fn( uint8_t const app, 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); -- 2.20.1