|
@@ -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};
|