summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt_flush_console_autoboot.patch
blob: 628086207e1182cb19a920058eb707065314575c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# Now sets the boot delay from python code in u-boot.inc
==============================================================
# This change sets the bootdelay to 2 seconds.  On old devices
# the bootdelay may be in the environment variable partitions.
# When updating a system, u-boot setenv command must be used
# to set the bootdelay to 2 in the environment.  A bootdelay
# of zero will make it nearly impossible to enter U-Boot,
# and zero is the old default, and may be in the environment.
# For MTCDT only the unpowered EXAR serial to USB convertor
# leaks the output of the console back to the input in some
# cases.  Therefore it is necessary to flush the UART before
# attempting to monitor keystrokes.  The output of the
# console must be quiet, or in the case of the normal
# boot where the EXAR part is unpowered, the read of the
# keyboard may be reading output to the console screen.
# This problem never occurs if the EXAR part is connected
# to a PC, and is powered.
diff -Naru orig/common/autoboot.c new/common/autoboot.c
--- orig/common/autoboot.c	2019-08-15 10:56:58.183468370 -0500
+++ new/common/autoboot.c	2019-08-15 10:30:11.363515940 -0500
@@ -219,6 +219,12 @@
 	printf("Hit any key to stop autoboot: %2d ", bootdelay);
 #endif
 
+        /* Flush input -- must be done because of loopback
+         * issue on MTCDT models with unpowered EXAR part
+         * which do loopback unintentionally by default.
+         */
+        while (tstc())
+                getc();
 	/*
 	 * Check if key already pressed
 	 */