Commit 7046c976bc66ca6ee4745f747d777c8827fc4384

Con Kolivas 2012-07-04T16:51:55

Attempt to initialise while bitforce device returns BUSY.

diff --git a/driver-bitforce.c b/driver-bitforce.c
index 49461c2..4b45e59 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -176,14 +176,16 @@ void bitforce_init(struct cgpu_info *bitforce)
 		return;
 	}
 
-	BFwrite(fdDev, "ZGX", 3);
-	BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
-	
-	if (unlikely(!pdevbuf[0])) {
-		mutex_unlock(&bitforce->device_mutex);
-		applog(LOG_ERR, "BFL%i: Error reading (ZGX)", bitforce->device_id);
-		return;
-	}
+	do {
+		BFwrite(fdDev, "ZGX", 3);
+		BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
+
+		if (unlikely(!pdevbuf[0])) {
+			mutex_unlock(&bitforce->device_mutex);
+			applog(LOG_ERR, "BFL%i: Error reading (ZGX)", bitforce->device_id);
+			return;
+		}
+	} while (!strstr(pdevbuf, "BUSY"));
 
 	if (unlikely(!strstr(pdevbuf, "SHA256"))) {
 		mutex_unlock(&bitforce->device_mutex);