Browse Source

bitforce: Reopen on communication error

Luke Dashjr 13 years ago
parent
commit
65eccd3b77
1 changed files with 6 additions and 0 deletions
  1. 6 0
      driver-bitforce.c

+ 6 - 0
driver-bitforce.c

@@ -635,6 +635,12 @@ static int64_t bitforce_scanhash(struct thr_info *thr, struct work *work, int64_
 		bitforce->device_not_well_reason = REASON_DEV_COMMS_ERROR;
 		bitforce->dev_comms_error_count++;
 		bitforce->hw_errors++;
+		BFclose(bitforce->device_fd);
+		int fd = bitforce->device_fd = BFopen(bitforce->device_path);
+		if (fd == -1) {
+			applog(LOG_ERR, "BFL%i: Error reopening");
+			return -1;
+		}
 		/* empty read buffer */
 		bitforce_clear_buffer(bitforce);
 	}