Browse Source

x6500: Whenever we get a hardware error, purge buffers just in case of read/write desync

Luke Dashjr 13 years ago
parent
commit
816c777022
1 changed files with 6 additions and 0 deletions
  1. 6 0
      driver-x6500.c

+ 6 - 0
driver-x6500.c

@@ -486,6 +486,12 @@ int64_t x6500_process_results(struct thr_info *thr, struct work *work)
 				++hw_errors;
 				++x6500->hw_errors;
 				++imm_bad_nonces;
+
+				// Purge buffers just in case of read/write desync
+				mutex_lock(&x6500->device_mutex);
+				ft232r_purge_buffers(jtag->a->ftdi, FTDI_PURGE_BOTH);
+				mutex_unlock(&x6500->device_mutex);
+				jtag->a->bufread = 0;
 			}
 		}