Browse Source

hashfast: Store firmware revision

Luke Dashjr 11 years ago
parent
commit
3d446a5c21
1 changed files with 9 additions and 0 deletions
  1. 9 0
      driver-hashfast.c

+ 9 - 0
driver-hashfast.c

@@ -259,6 +259,13 @@ bool hashfast_detect_one(const char * const devpath)
 		        __func__, devpath, pmsg->data[8]);
 		        __func__, devpath, pmsg->data[8]);
 		goto err;
 		goto err;
 	}
 	}
+	uint16_t fwrev = upk_u16le(pmsg->data, 0);
+	if (!fwrev)
+	{
+		// fwrev == 0 means latest experimental; make it >= every possible comparison
+		fwrev = 0xffff;
+		pk_u16le(pmsg->data, 0, fwrev);
+	}
 	
 	
 	if (serial_claim_v(devpath, &hashfast_ums_drv))
 	if (serial_claim_v(devpath, &hashfast_ums_drv))
 		return false;
 		return false;
@@ -290,6 +297,7 @@ struct hashfast_dev_state {
 	uint8_t cores_per_chip;
 	uint8_t cores_per_chip;
 	int fd;
 	int fd;
 	struct hashfast_chip_state *chipstates;
 	struct hashfast_chip_state *chipstates;
+	uint16_t fwrev;
 };
 };
 
 
 struct hashfast_chip_state {
 struct hashfast_chip_state {
@@ -323,6 +331,7 @@ bool hashfast_init(struct thr_info * const master_thr)
 		.chipstates = chipstates,
 		.chipstates = chipstates,
 		.cores_per_chip = pmsg->coreaddr,
 		.cores_per_chip = pmsg->coreaddr,
 		.fd = serial_open(dev->device_path, 0, 1, true),
 		.fd = serial_open(dev->device_path, 0, 1, true),
+		.fwrev = upk_u16le(pmsg->data, 0),
 	};
 	};
 	
 	
 	for (i = 0; i < pmsg->chipaddr; ++i)
 	for (i = 0; i < pmsg->chipaddr; ++i)