Browse Source

Make the bf1 getinfo size a macro

Con Kolivas 12 years ago
parent
commit
bdbe9dd5fe
1 changed files with 5 additions and 4 deletions
  1. 5 4
      driver-bitfury.c

+ 5 - 4
driver-bitfury.c

@@ -16,6 +16,7 @@
 /* Wait longer 1/3 longer than it would take for a full nonce range */
 /* Wait longer 1/3 longer than it would take for a full nonce range */
 #define BF1WAIT 1600
 #define BF1WAIT 1600
 #define BF1MSGSIZE 7
 #define BF1MSGSIZE 7
+#define BF1INFOSIZE 14
 
 
 static void bitfury_empty_buffer(struct cgpu_info *bitfury)
 static void bitfury_empty_buffer(struct cgpu_info *bitfury)
 {
 {
@@ -75,15 +76,15 @@ static bool bitfury_getinfo(struct cgpu_info *bitfury, struct bitfury_info *info
 		       bitfury->drv->name, bitfury->device_id);
 		       bitfury->drv->name, bitfury->device_id);
 		return false;
 		return false;
 	}
 	}
-	err = usb_read(bitfury, buf, 14, &amount, C_BF1_GETINFO);
+	err = usb_read(bitfury, buf, BF1INFOSIZE, &amount, C_BF1_GETINFO);
 	if (err) {
 	if (err) {
 		applog(LOG_INFO, "%s %d: Failed to read GETINFO",
 		applog(LOG_INFO, "%s %d: Failed to read GETINFO",
 		       bitfury->drv->name, bitfury->device_id);
 		       bitfury->drv->name, bitfury->device_id);
 		return false;
 		return false;
 	}
 	}
-	if (amount != 14) {
-		applog(LOG_INFO, "%s %d: Getinfo received %d bytes instead of 14",
-		       bitfury->drv->name, bitfury->device_id, amount);
+	if (amount != BF1INFOSIZE) {
+		applog(LOG_INFO, "%s %d: Getinfo received %d bytes instead of %d",
+		       bitfury->drv->name, bitfury->device_id, amount, BF1INFOSIZE);
 		return false;
 		return false;
 	}
 	}
 	info->version = buf[1];
 	info->version = buf[1];