1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 04:58:05 +11:00

tools: improve reliability of ttyopen()

Previously, communications with my RC2014 would always be rocky and
fail most of the time. By sending an CR at init, things go much
smoother.
This commit is contained in:
Virgil Dupras 2020-09-17 10:25:08 -04:00
parent 1a6a549857
commit a19c814b0d

View File

@ -149,6 +149,11 @@ int ttyopen(char *devname)
set_interface_attribs(fd, 0, 0);
set_blocking(fd, 0);
mempty(fd);
// Communication with device is much more reliable if we
// begin by sending, asynchronously, a CR to make sure we
// empty any pending stuff on all sides.
write(fd, "\r", 1);
mempty(fd);
set_blocking(fd, 1);
return fd;
}