Files
SDK_SG200x_V2/u-boot-2021.10/cmd/conitrace.c
carbon 0545e9dc6d init version 2024-05-07
commit d1edce71135cc6d98c0a4b5729774542b676e769
Author: sophgo-forum-service <forum_service@sophgo.com>
Date:   Fri Mar 15 16:07:33 2024 +0800

    [fix] recommend using ssh method to clone repo.
    [fix] fix sensor driver repo branch name.
2024-05-07 19:36:36 +08:00

53 lines
993 B
C

// SPDX-License-Identifier: GPL-2.0+
/*
* The 'conitrace' command prints the codes received from the console input as
* hexadecimal numbers.
*
* Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de>
*/
#include <common.h>
#include <command.h>
#include <linux/delay.h>
static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
bool first = true;
printf("Waiting for your input\n");
printf("To terminate type 'x'\n");
/* Empty input buffer */
while (tstc())
getchar();
for (;;) {
int c = getchar();
if (first && (c == 'x' || c == 'X'))
break;
printf("%02x ", c);
first = false;
/* 10 ms delay - serves to detect separate keystrokes */
udelay(10000);
if (!tstc()) {
printf("\n");
first = true;
}
}
return CMD_RET_SUCCESS;
}
#ifdef CONFIG_SYS_LONGHELP
static char conitrace_help_text[] = "";
#endif
U_BOOT_CMD_COMPLETE(
conitrace, 2, 0, do_conitrace,
"trace console input",
conitrace_help_text, NULL
);