diff --git a/pyocd/subcommands/rtt_cmd.py b/pyocd/subcommands/rtt_cmd.py index 075c96455..d866b3591 100644 --- a/pyocd/subcommands/rtt_cmd.py +++ b/pyocd/subcommands/rtt_cmd.py @@ -61,6 +61,8 @@ def get_args(cls) -> List[argparse.ArgumentParser]: help="Down channel ID.") rtt_options.add_argument("-d", "--log-file", type=str, default=None, help="Log file name. When specified, logging mode is enabled.") + rtt_options.add_argument("--echo", action=argparse.BooleanOptionalAction, default=True, + help="Echo locally typed characters. By default echo is on.") return [cls.CommonOptions.COMMON, cls.CommonOptions.CONNECT, rtt_parser] @@ -191,8 +193,9 @@ def viewer_loop(self, up_chan, down_chan, kb): if ord(c) == 27: # process ESC break - elif c.isprintable() or c == '\n': - print(c, end="", flush=True) + if self._args.echo: + if c.isprintable() or c == '\n': + print(c, end="", flush=True) # add char to buffer cmd += c.encode("utf-8")