Browse Source

Bugfix: gridseed: use a signed integer so that returning -1 has defined behavior

Nate Woolls 11 years ago
parent
commit
f0411ef2e1
3 changed files with 4 additions and 4 deletions
  1. 2 2
      driver-gridseed.c
  2. 1 1
      gc3355.c
  3. 1 1
      gc3355.h

+ 2 - 2
driver-gridseed.c

@@ -76,7 +76,7 @@ bool gridseed_detect_custom(const char *path, struct device_drv *driver, struct
 	
 	
 	gridseed_empty_work(fd);
 	gridseed_empty_work(fd);
 	
 	
-	uint32_t fw_version = gc3355_get_firmware_version(fd);
+	int64_t fw_version = gc3355_get_firmware_version(fd);
 	
 	
 	if (fw_version == -1)
 	if (fw_version == -1)
 	{
 	{
@@ -98,7 +98,7 @@ bool gridseed_detect_custom(const char *path, struct device_drv *driver, struct
 	gc3355_init_usborb(device->device_fd, info->freq, false, false);
 	gc3355_init_usborb(device->device_fd, info->freq, false, false);
 	
 	
 	applog(LOG_INFO, "Found %"PRIpreprv" at %s", device->proc_repr, path);
 	applog(LOG_INFO, "Found %"PRIpreprv" at %s", device->proc_repr, path);
-	applog(LOG_DEBUG, "%"PRIpreprv": Init: firmware=%d", device->proc_repr, fw_version);
+	applog(LOG_DEBUG, "%"PRIpreprv": Init: firmware=%"PRId64, device->proc_repr, fw_version);
 	
 	
 	return true;
 	return true;
 }
 }

+ 1 - 1
gc3355.c

@@ -719,7 +719,7 @@ void gc3355_sha2_prepare_work(unsigned char cmd[52], struct work *work, bool sim
 	}
 	}
 }
 }
 
 
-uint32_t gc3355_get_firmware_version(int fd)
+int64_t gc3355_get_firmware_version(int fd)
 {
 {
 	gc3355_send_cmds(fd, firmware_request_cmd);
 	gc3355_send_cmds(fd, firmware_request_cmd);
 	
 	

+ 1 - 1
gc3355.h

@@ -56,7 +56,7 @@ void gc3355_scrypt_only_reset(int fd);
 
 
 extern void gc3355_scrypt_prepare_work(unsigned char cmd[156], struct work *);
 extern void gc3355_scrypt_prepare_work(unsigned char cmd[156], struct work *);
 extern void gc3355_sha2_prepare_work(unsigned char cmd[52], struct work *, bool simple);
 extern void gc3355_sha2_prepare_work(unsigned char cmd[52], struct work *, bool simple);
-extern uint32_t gc3355_get_firmware_version(int fd);
+extern int64_t gc3355_get_firmware_version(int fd);
 extern void gc3355_set_pll_freq(int fd, int pll_freq);
 extern void gc3355_set_pll_freq(int fd, int pll_freq);
 
 
 #define gc3355_get_cts_status(fd)  ((get_serial_cts(fd) == BGV_LOW) ? 1 : 0)
 #define gc3355_get_cts_status(fd)  ((get_serial_cts(fd) == BGV_LOW) ? 1 : 0)