Browse Source

fpgautils: Skip SetCommConfig on Windows if baud is not to be set

Luke Dashjr 12 years ago
parent
commit
9306982030
1 changed files with 5 additions and 1 deletions
  1. 5 1
      fpgautils.c

+ 5 - 1
fpgautils.c

@@ -1052,7 +1052,9 @@ int serial_open(const char *devpath, unsigned long baud, uint8_t timeout, bool p
 		return -1;
 		return -1;
 	}
 	}
 
 
-	// thanks to af_newbie for pointers about this
+	if (baud)
+	{
+
 	COMMCONFIG comCfg = {0};
 	COMMCONFIG comCfg = {0};
 	comCfg.dwSize = sizeof(COMMCONFIG);
 	comCfg.dwSize = sizeof(COMMCONFIG);
 	comCfg.wVersion = 1;
 	comCfg.wVersion = 1;
@@ -1065,6 +1067,8 @@ int serial_open(const char *devpath, unsigned long baud, uint8_t timeout, bool p
 
 
 	SetCommConfig(hSerial, &comCfg, sizeof(comCfg));
 	SetCommConfig(hSerial, &comCfg, sizeof(comCfg));
 
 
+	}
+
 	// Code must specify a valid timeout value (0 means don't timeout)
 	// Code must specify a valid timeout value (0 means don't timeout)
 	const DWORD ctoms = ((DWORD)timeout * 100);
 	const DWORD ctoms = ((DWORD)timeout * 100);
 	COMMTIMEOUTS cto = {ctoms, 0, ctoms, 0, ctoms};
 	COMMTIMEOUTS cto = {ctoms, 0, ctoms, 0, ctoms};