From: Patrick Delaunay Date: Fri, 3 Aug 2018 13:38:45 +0200 Subject: [U-Boot] [PATCH 4/4] cli: handle getch error In-Reply-To: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> References: <1533296325-2490-1-git-send-email-patrick.delaunay@st.com> Message-ID: <1533296325-2490-5-git-send-email-patrick.delaunay@st.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Handle getch error (when getch return 0x0) to avoid display issue in the console. Signed-off-by: Patrick Delaunay --- common/cli_readline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/common/cli_readline.c b/common/cli_readline.c index 60a232b..99b6317 100644 --- a/common/cli_readline.c +++ b/common/cli_readline.c @@ -273,6 +273,10 @@ static int cread_line(const char *const prompt, char *buf, unsigned int *len, ichar = getcmd_getch(); + /* ichar=0x0 when error occurs in U-Boot getc */ + if (!ichar) + continue; + if ((ichar == '\n') || (ichar == '\r')) { putc('\n'); break; -- 2.7.4