-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb6f039
commit 47e7795
Showing
1 changed file
with
14 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,24 +105,24 @@ void tty_initialize(void) { | |
s->oldtty = tty; | ||
// Set terminal to "raw" mode | ||
tty.c_lflag &= ~(ECHO | // Echo off | ||
ICANON | // Canonical mode off | ||
ECHONL | // Do not echo NL (redundant with ECHO and ICANON) | ||
ISIG | // Signal chars off | ||
IEXTEN // Extended input processing off | ||
ICANON | // Canonical mode off (input byte-by-byte, no input processing, disable line editing) | ||
ISIG | // Signal chars off (e.g., CTRL+C and CTRL+Z) | ||
IEXTEN | // Extended input processing off (e.g. disable CTRL+V processing) | ||
ECHONL // Do not echo NL despite ECHO being off | ||
); | ||
tty.c_iflag &= ~(IGNBRK | // Generate \377 \0 \0 on BREAK | ||
BRKINT | // | ||
PARMRK | // | ||
ICRNL | // No CR-to-NL | ||
tty.c_iflag &= ~(BRKINT | // -- | ||
PARMRK | // Generate \377 \0 \0 on BREAK | ||
IGNBRK | // -- | ||
ICRNL | // No CR-to-NL (i.e., typing ENTER CR does not become LF) | ||
INPCK | // Disable parity checking | ||
ISTRIP | // Do not strip off 8th bit | ||
IXON | // Disable software flow control (e.g. CTRL+S XOFF and CTRL+Q XON) | ||
INLCR | // No NL-to-CR | ||
IGNCR | // Do not ignore CR | ||
IXON // Disable XON/XOFF flow control on output | ||
IGNCR // Do not ignore CR | ||
); | ||
tty.c_oflag |= OPOST; // Enable output processing | ||
// Enable parity generation on output and checking for input | ||
tty.c_cflag &= ~(CSIZE | PARENB); | ||
tty.c_cflag |= CS8; | ||
tty.c_oflag &= ~(OPOST); // Disable output processing (e.g., LF -> CR LF) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
diegonehab
Author
Contributor
|
||
tty.c_cflag |= CS8; // Set char size to 8 bits | ||
tty.c_cflag &= ~(PARENB); // Disable parity generation on output and checking on input | ||
// Read returns with 1 char and no delay | ||
tty.c_cc[VMIN] = 1; | ||
tty.c_cc[VTIME] = 0; | ||
|
I was testing this commit.
Disabling OPOST (output processing) will disable LR -> CR LF conversion, and this fixes the problem here, so I agree that we could disable OPOST. But the side effect of this is disabling
\r
even for printfs outside the interpreter, meaning all printfs (including from machine.cpp, cartesi-machine-lua, etc) will not have\r
on every\n
and not return to line beginning in the terminal, making all printfs outside the machine messy.I see two possible solutions for this side effect:
\r\n
in all printfs outside the machine, I think this is too much rewrite and a pain.tcsetattr
before and after interpret). I did not test this though, but then "printf" debugging and our DUMPs while interpreting becomes a little more painful, they all need to use\r\n
. Or we could be more aggressive and disable/enable OPOST on everytty_putchar
.