Browse Source

rockminer: Bugfix: must specify a baud rate (maximum of 115200) to get a read response
Potentially a Silicon Labs driver on Mac OS X - not an issue on Linux
Tried (and failed) baud rates: 128000, 153600, 230400, 256000

Nate Woolls 11 years ago
parent
commit
b99fc3bf86
1 changed files with 10 additions and 2 deletions
  1. 10 2
      driver-rockminer.c

+ 10 - 2
driver-rockminer.c

@@ -27,6 +27,8 @@
 #define ROCKMINER_MIDTASK_TIMEOUT_US  500000
 #define ROCKMINER_MIDTASK_TIMEOUT_US  500000
 #define ROCKMINER_MIDTASK_RETRY_US   1000000
 #define ROCKMINER_MIDTASK_RETRY_US   1000000
 #define ROCKMINER_TASK_TIMEOUT_US    5273438
 #define ROCKMINER_TASK_TIMEOUT_US    5273438
+#define ROCKMINER_IO_SPEED 115200
+#define ROCKMINER_READ_TIMEOUT 1 //deciseconds
 
 
 #define ROCKMINER_MAX_CHIPS  64
 #define ROCKMINER_MAX_CHIPS  64
 #define ROCKMINER_WORK_REQ_SIZE  0x40
 #define ROCKMINER_WORK_REQ_SIZE  0x40
@@ -49,6 +51,12 @@ struct rockminer_chip_data {
 	int requested_work;
 	int requested_work;
 };
 };
 
 
+static
+int rockminer_open(const char *devpath)
+{
+	return serial_open(devpath, ROCKMINER_IO_SPEED, ROCKMINER_READ_TIMEOUT, true);
+}
+
 static
 static
 void rockminer_job_buf_init(uint8_t * const buf, const uint8_t chipid)
 void rockminer_job_buf_init(uint8_t * const buf, const uint8_t chipid)
 {
 {
@@ -157,7 +165,7 @@ bool rockminer_detect_one(const char * const devpath)
 	uint8_t buf[ROCKMINER_WORK_REQ_SIZE], reply[ROCKMINER_REPLY_SIZE];
 	uint8_t buf[ROCKMINER_WORK_REQ_SIZE], reply[ROCKMINER_REPLY_SIZE];
 	ssize_t rsz;
 	ssize_t rsz;
 	
 	
-	fd = serial_open(devpath, 0, 1, true);
+	fd = rockminer_open(devpath);
 	if (fd < 0)
 	if (fd < 0)
 		return_via_applog(err, , LOG_DEBUG, "%s: %s %s", rockminer_drv.dname, "Failed to open", devpath);
 		return_via_applog(err, , LOG_DEBUG, "%s: %s %s", rockminer_drv.dname, "Failed to open", devpath);
 	
 	
@@ -314,7 +322,7 @@ void rockminer_poll(struct thr_info * const master_thr)
 	
 	
 	if (fd < 0)
 	if (fd < 0)
 	{
 	{
-		fd = serial_open(dev->device_path, 0, 1, true);
+		fd = rockminer_open(dev->device_path);
 		if (fd < 0)
 		if (fd < 0)
 		{
 		{
 			timer_set_delay_from_now(&master_thr->tv_poll, ROCKMINER_RETRY_US);
 			timer_set_delay_from_now(&master_thr->tv_poll, ROCKMINER_RETRY_US);