Browse Source

bifury: chips init setting to workaround buggy hardware which reports wrong chip count

Luke Dashjr 11 years ago
parent
commit
a4a2ecaf40
1 changed files with 23 additions and 0 deletions
  1. 23 0
      driver-bifury.c

+ 23 - 0
driver-bifury.c

@@ -87,6 +87,27 @@ bool bifury_lowl_match(const struct lowlevel_device_info * const info)
 	return lowlevel_match_product(info, "bi\xe2\x80\xa2""fury");
 	return lowlevel_match_product(info, "bi\xe2\x80\xa2""fury");
 }
 }
 
 
+const char *bifury_init_chips(struct cgpu_info * const proc, const char * const option, const char * const setting, char * const replybuf, enum bfg_set_device_replytype * const success)
+{
+	int *procs_p = proc->device_data;
+	
+	if (!setting || !*setting)
+		return "missing setting";
+	
+	const int val = atoi(setting);
+	if (val < 1)
+		return "invalid setting";
+	
+	*procs_p = val;
+	
+	return NULL;
+}
+
+static const struct bfg_set_device_definition bifury_set_device_funcs_probe[] = {
+	{"chips", bifury_init_chips, NULL},
+	{NULL},
+};
+
 static
 static
 bool bifury_detect_one(const char * const devpath)
 bool bifury_detect_one(const char * const devpath)
 {
 {
@@ -160,6 +181,8 @@ bool bifury_detect_one(const char * const devpath)
 	if (serial_claim_v(devpath, &bifury_drv))
 	if (serial_claim_v(devpath, &bifury_drv))
 		return false;
 		return false;
 	
 	
+	drv_set_defaults(&bifury_drv, bifury_set_device_funcs_probe, &chips, devpath, detectone_meta_info.serial, 1);
+	
 	cgpu = malloc(sizeof(*cgpu));
 	cgpu = malloc(sizeof(*cgpu));
 	*cgpu = (struct cgpu_info){
 	*cgpu = (struct cgpu_info){
 		.drv = &bifury_drv,
 		.drv = &bifury_drv,