Cygwin: serial: tcsetattr: set timeouts unconditionally
tcsetattr checks if the VTIME and VMIN values changed and only calls SetCommTimeouts if so. That's a problem if tcsetattr is supposed to set VTIME and VIMN to 0, because these are the start values anyway. But this requires to set ReadIntervalTimeout to MAXDWORD, which just doesn't happen. Fix this by dropping the over-optimization of checking the old values before calling SetCommTimeouts, Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
72294cd211
commit
912c902615
@ -600,7 +600,6 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
|
|||||||
bool dropDTR = false;
|
bool dropDTR = false;
|
||||||
COMMTIMEOUTS to;
|
COMMTIMEOUTS to;
|
||||||
DCB ostate, state;
|
DCB ostate, state;
|
||||||
cc_t ovtime = vtime_, ovmin = vmin_;
|
|
||||||
int tmpDtr, tmpRts, res;
|
int tmpDtr, tmpRts, res;
|
||||||
res = tmpDtr = tmpRts = 0;
|
res = tmpDtr = tmpRts = 0;
|
||||||
|
|
||||||
@ -909,8 +908,6 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
|
|||||||
|
|
||||||
debug_printf ("vtime %u, vmin %u", vtime_, vmin_);
|
debug_printf ("vtime %u, vmin %u", vtime_, vmin_);
|
||||||
|
|
||||||
if (ovmin != vmin_ || ovtime != vtime_)
|
|
||||||
{
|
|
||||||
memset (&to, 0, sizeof (to));
|
memset (&to, 0, sizeof (to));
|
||||||
|
|
||||||
if ((vmin_ > 0) && (vtime_ == 0))
|
if ((vmin_ > 0) && (vtime_ == 0))
|
||||||
@ -940,8 +937,9 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
|
|||||||
to.ReadIntervalTimeout = MAXDWORD;
|
to.ReadIntervalTimeout = MAXDWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_printf ("ReadTotalTimeoutConstant %u, ReadIntervalTimeout %u, ReadTotalTimeoutMultiplier %u",
|
debug_printf ("ReadTotalTimeoutConstant %u, ReadIntervalTimeout %u, "
|
||||||
to.ReadTotalTimeoutConstant, to.ReadIntervalTimeout, to.ReadTotalTimeoutMultiplier);
|
"ReadTotalTimeoutMultiplier %u", to.ReadTotalTimeoutConstant,
|
||||||
|
to.ReadIntervalTimeout, to.ReadTotalTimeoutMultiplier);
|
||||||
|
|
||||||
if (!SetCommTimeouts(get_handle (), &to))
|
if (!SetCommTimeouts(get_handle (), &to))
|
||||||
{
|
{
|
||||||
@ -951,7 +949,6 @@ fhandler_serial::tcsetattr (int action, const struct termios *t)
|
|||||||
__seterrno ();
|
__seterrno ();
|
||||||
res = -1;
|
res = -1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user