Browse Source

Merge branch 'icarus_ms' into bfgminer

Luke Dashjr 10 years ago
parent
commit
a488b3fe6f
2 changed files with 4 additions and 0 deletions
  1. 3 0
      driver-icarus.c
  2. 1 0
      lowl-vcom.h

+ 3 - 0
driver-icarus.c

@@ -246,6 +246,9 @@ int icarus_read(const char * const repr, uint8_t *buf, const int fd, struct time
 		{
 		{
 			if (remaining_ms > 100)
 			if (remaining_ms > 100)
 				remaining_ms = 100;
 				remaining_ms = 100;
+			else
+			if (remaining_ms < 1)
+				remaining_ms = 1;
 			vcom_set_timeout_ms(fd, remaining_ms);
 			vcom_set_timeout_ms(fd, remaining_ms);
 			// Read first byte alone to get earliest tv_finish
 			// Read first byte alone to get earliest tv_finish
 			ret = read(fd, buf, first ? 1 : read_size);
 			ret = read(fd, buf, first ? 1 : read_size);

+ 1 - 0
lowl-vcom.h

@@ -39,6 +39,7 @@ extern ssize_t _serial_read(int fd, char *buf, size_t buflen, char *eol);
 	_serial_read(fd, buf, bufsiz, &eol)
 	_serial_read(fd, buf, bufsiz, &eol)
 extern int serial_close(int fd);
 extern int serial_close(int fd);
 
 
+// NOTE: timeout_ms=0 means it never times out
 extern bool vcom_set_timeout_ms(int fd, unsigned timeout_ms);
 extern bool vcom_set_timeout_ms(int fd, unsigned timeout_ms);
 #define vcom_set_timeout(fd, timeout)  vcom_set_timeout_ms(fd, (timeout) * 100)
 #define vcom_set_timeout(fd, timeout)  vcom_set_timeout_ms(fd, (timeout) * 100)
 extern enum bfg_gpio_value get_serial_cts(int fd);
 extern enum bfg_gpio_value get_serial_cts(int fd);