From 538b0ebf883d231cb630973664473f1b7aa9a1e2 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Tue, 14 Feb 2012 12:01:30 -0500 Subject: [PATCH] bitforce: Set a 30 second timeout for serial port on Windows, since the default is undefined --- bitforce.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bitforce.c b/bitforce.c index efa4c202..d868a645 100644 --- a/bitforce.c +++ b/bitforce.c @@ -40,6 +40,10 @@ static int BFopen(const char *devpath) HANDLE hSerial = CreateFile(devpath, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); if (unlikely(hSerial == INVALID_HANDLE_VALUE)) return -1; + + COMMTIMEOUTS cto = {30000, 0, 30000, 0, 30000}; + SetCommTimeouts(hSerial, &cto); + return _open_osfhandle((LONG)hSerial, 0); }