mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
kdb: support new lines without carriage returns
kdb expects carriage returns through the serial port to terminate commands. Modify it to accept the first seen carriage return or new line as a terminator, but not treat \r\n as two terminators. Change-Id: I06166017e7703d24310eefcb71c3a7d427088db7 Signed-off-by: Colin Cross <ccross@android.com>
This commit is contained in:
parent
688a90183a
commit
e657952e41
1 changed files with 10 additions and 2 deletions
|
@ -216,7 +216,7 @@ static char *kdb_read(char *buffer, size_t bufsize)
|
|||
int i;
|
||||
int diag, dtab_count;
|
||||
int key;
|
||||
|
||||
static int last_crlf;
|
||||
|
||||
diag = kdbgetintenv("DTABCOUNT", &dtab_count);
|
||||
if (diag)
|
||||
|
@ -237,6 +237,9 @@ poll_again:
|
|||
return buffer;
|
||||
if (key != 9)
|
||||
tab = 0;
|
||||
if (key != 10 && key != 13)
|
||||
last_crlf = 0;
|
||||
|
||||
switch (key) {
|
||||
case 8: /* backspace */
|
||||
if (cp > buffer) {
|
||||
|
@ -254,7 +257,12 @@ poll_again:
|
|||
*cp = tmp;
|
||||
}
|
||||
break;
|
||||
case 13: /* enter */
|
||||
case 10: /* new line */
|
||||
case 13: /* carriage return */
|
||||
/* handle \n after \r */
|
||||
if (last_crlf && last_crlf != key)
|
||||
break;
|
||||
last_crlf = key;
|
||||
*lastchar++ = '\n';
|
||||
*lastchar++ = '\0';
|
||||
if (!KDB_STATE(KGDB_TRANS)) {
|
||||
|
|
Loading…
Reference in a new issue