diff --git a/PsychSourceGL/Source/Common/IOPort/IOPort.c b/PsychSourceGL/Source/Common/IOPort/IOPort.c index 2fbfb13922..9b978d0173 100755 --- a/PsychSourceGL/Source/Common/IOPort/IOPort.c +++ b/PsychSourceGL/Source/Common/IOPort/IOPort.c @@ -369,7 +369,7 @@ PsychError IOPORTOpenSerialPort(void) "or on OS/X and Linux in 'Cooked' processing mode as line delimiter. A setting of -1 will try to disable the line terminator.\n\n" "DTR=os default -- Setting for 'Data Terminal Ready' pin: 0 or 1.\n\n" "RTS=os default -- Setting for 'Request To Send' pin: 0 or 1.\n\n" - "BreakBehaviour=Ignore -- Behaviour if a 'Break Condition' is detected on the line: Ignore, Flush, Zero. On Windows, this setting is ignored.\n\n" + "BreakBehaviour=Ignore -- Behaviour if a 'Break Condition' is detected on the line: Ignore, Flush, Zero. On Windows, only 'Ignore' is allowed.\n\n" "OutputBufferSize=4096 -- Size of output buffer in bytes.\n\n" "InputBufferSize=4096 -- Size of input buffer in bytes. You can't read more than that amount per read command.\n\n" "HardwareBufferSizes=input,output -- Set size of the hardware driver internal input and output buffers in bytes. " diff --git a/PsychSourceGL/Source/Windows/IOPort/PsychSerialWindowsGlue.c b/PsychSourceGL/Source/Windows/IOPort/PsychSerialWindowsGlue.c index 3a65481e0a..99e3c74954 100755 --- a/PsychSourceGL/Source/Windows/IOPort/PsychSerialWindowsGlue.c +++ b/PsychSourceGL/Source/Windows/IOPort/PsychSerialWindowsGlue.c @@ -762,6 +762,15 @@ PsychError PsychIOOSConfigureSerialPort( PsychSerialDeviceRecord* device, const // updatetermios = TRUE; // } + // Handling of Break condition: + if ((p = strstr(configString, "BreakBehaviour="))) { + if (p != strstr(p, "BreakBehaviour=Ignore")) { + printf("Invalid break behaviour %s not accepted (Valid on MS-Windows: Ignore)!", p); + return(PsychError_user); + } + updatetermios = TRUE; + } + // Handling of data bits: if ((p = strstr(configString, "DataBits="))) { // Clear all databit settings: @@ -1387,8 +1396,11 @@ int PsychIOOSCheckError(PsychSerialDeviceRecord* device, char* inerrmsg) return(0xdeadbeef); } + // Ignore the break condition altogether, meaning no error notification and no error condition (which otherwise could result in discarding received data). + estatus &= ~CE_BREAK; + if (estatus > 0 && inerrmsg) { - if (estatus & CE_BREAK) { sprintf(errmsg, "IOPort: Break condition on receive line detected.\n"); strcat(inerrmsg, errmsg); } + if (estatus & CE_BREAK) { sprintf(errmsg, "IOPort: Break condition on receive line detected.\n"); strcat(inerrmsg, errmsg); } // maybe useful in the future if (estatus & CE_FRAME) { sprintf(errmsg, "IOPort: Data packet framing error detected.\n"); strcat(inerrmsg, errmsg); } if (estatus & CE_OVERRUN) { sprintf(errmsg, "IOPort: Character buffer overrun detected.\n"); strcat(inerrmsg, errmsg); } if (estatus & CE_RXOVER) { sprintf(errmsg, "IOPort: Receive buffer overflow detected.\n"); strcat(inerrmsg, errmsg); }