Browse Source

Merge commit '7046c97' into bfgminer

Luke Dashjr 13 years ago
parent
commit
c59fbb6511
1 changed files with 13 additions and 9 deletions
  1. 13 9
      driver-bitforce.c

+ 13 - 9
driver-bitforce.c

@@ -180,14 +180,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);
@@ -245,9 +247,9 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
 
 static bool bitforce_send_work(struct thr_info *thr, struct work *work)
 {
-	unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>";
 	struct cgpu_info *bitforce = thr->cgpu;
 	int fdDev = bitforce->device_fd;
+	unsigned char ob[70];
 	char pdevbuf[0x100];
 	char *s;
 
@@ -268,8 +270,10 @@ re_send:
 		return false;
 	}
 
+	sprintf((char *)ob, ">>>>>>>>");
 	memcpy(ob + 8, work->midstate, 32);
 	memcpy(ob + 8 + 32, work->data + 64, 12);
+	sprintf((char *)ob + 8 + 32 + 12, ">>>>>>>>");
 
 	BFwrite(fdDev, ob, 60);
 	BFgets(pdevbuf, sizeof(pdevbuf), fdDev);