xiaoxiang781216 commented on code in PR #3126: URL: https://github.com/apache/nuttx-apps/pull/3126#discussion_r2200558367
########## games/snake/snake_input_console.h: ########## @@ -63,6 +63,27 @@ void init_termios(int echo) fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK); /* set non-blocking mode */ } +/**************************************************************************** + * Name: deinit_termios + * + * Description: + * Restore back g_old terminal I/O settings. + * + * Parameters: + * None + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void deinit_termios(void) +{ + g_old.c_lflag |= ECHO; /* enable ECHO bit */ + tcsetattr(0, TCSANOW, &g_old); /* restore old terminal i/o settings */ + fcntl(STDIN_FILENO, F_SETFL, 0); /* restore blocking mode */ Review Comment: don't need since the program will exit ########## games/snake/snake_input_console.h: ########## @@ -63,6 +63,27 @@ void init_termios(int echo) fcntl(STDIN_FILENO, F_SETFL, O_NONBLOCK); /* set non-blocking mode */ } +/**************************************************************************** + * Name: deinit_termios + * + * Description: + * Restore back g_old terminal I/O settings. + * + * Parameters: + * None + * + * Returned Value: + * None. + * + ****************************************************************************/ + +void deinit_termios(void) +{ + g_old.c_lflag |= ECHO; /* enable ECHO bit */ Review Comment: the previous setting may disable echo too, so it's better to restore g_old directly -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org