feat(monitor): flush terminal detection seq

This commit is contained in:
Peter Dragun 2023-04-06 11:48:16 +02:00
parent f0dea7d9ff
commit 1b03bfb3ea
4 changed files with 17 additions and 5 deletions

View File

@ -19,6 +19,9 @@ CTRL_X = '\x18'
CTRL_L = '\x0c'
CTRL_RBRACKET = '\x1d' # Ctrl+]
# VT100 escape sequences
CONSOLE_STATUS_QUERY = b'\x1b[5n'
# Command parsed from console inputs
CMD_STOP = 1
CMD_RESET = 2

View File

@ -16,9 +16,9 @@ from .chip_specific_config import get_chip_config
from .console_parser import ConsoleParser, prompt_next_action # noqa: F401
from .console_reader import ConsoleReader # noqa: F401
from .constants import (CMD_APP_FLASH, CMD_ENTER_BOOT, CMD_MAKE, CMD_OUTPUT_TOGGLE, CMD_RESET, CMD_STOP,
CMD_TOGGLE_LOGGING, CMD_TOGGLE_TIMESTAMPS, PANIC_DECODE_DISABLE, PANIC_END, PANIC_IDLE,
PANIC_READING, PANIC_STACK_DUMP, PANIC_START)
from .coredump import CoreDump
CMD_TOGGLE_LOGGING, CMD_TOGGLE_TIMESTAMPS, CONSOLE_STATUS_QUERY, PANIC_DECODE_DISABLE,
PANIC_END, PANIC_IDLE, PANIC_READING, PANIC_STACK_DUMP, PANIC_START)
from .coredump import CoreDump # noqa: F401
from .exceptions import SerialStopException
from .gdbhelper import GDBHelper
from .line_matcher import LineMatcher
@ -106,6 +106,11 @@ class SerialHandler:
self.logger.handle_possible_pc_address_in_line(line)
check_gdb_stub_and_run(line)
self._force_line_print = False
if self._last_line_part.startswith(CONSOLE_STATUS_QUERY):
self.logger.print(CONSOLE_STATUS_QUERY)
self._last_line_part = self._last_line_part[len(CONSOLE_STATUS_QUERY):]
# Now we have the last part (incomplete line) in _last_line_part. By
# default we don't touch it and just wait for the arrival of the rest
# of the line. But after some time when we didn't received it we need
@ -255,6 +260,10 @@ class SerialHandlerNoElf(SerialHandler):
self.compare_elf_sha256(line.decode(errors='ignore'))
self._force_line_print = False
if self._last_line_part.startswith(CONSOLE_STATUS_QUERY):
self.logger.print(CONSOLE_STATUS_QUERY)
self._last_line_part = self._last_line_part[len(CONSOLE_STATUS_QUERY):]
force_print_or_matched = any((
self._force_line_print,
(finalize_line and line_matcher.match(self._last_line_part.decode(errors='ignore')))

View File

@ -9,7 +9,7 @@
I (793) mdf_device_handle: [mdf_device_init_handle, 908]:silicon revision : 0
I (801) mdf_device_handle: [mdf_device_init_handle, 910]:flash : 4 MB external
I (810) mdf_device_handle: [mdf_device_init_handle, 911]:***************************************************
E (45488) mesh: [esp_mesh_push_to_nwk_queue,5360] null args
E (45488) mesh: [esp_mesh_push_to_nwk_queue,5360] null args
I (50495) mdf_device_handle: [mdf_show_sysinfo_timercb, 73]:parent: 00:00:00:00:00:00, mac:30:ae:a4:00:43:84, layer: -1, free heap: 87712, compile time: May 26 2018 00:22:11
I (55495) mdf_device_handle: [mdf_show_sysinfo_timercb, 73]:parent: 20:a6:80:98:dc:b4, mac:30:ae:a4:00:43:84, layer: 1, free heap: 88452, compile time: May 26 2018 00:22:11
I (60495) mdf_device_handle: [mdf_show_sysinfo_timercb, 73]:parent: 20:a6:80:98:dc:b4, mac:30:ae:a4:00:43:84, layer: 1, free heap: 71792, compile time: May 26 2018 00:22:11

View File

@ -1,5 +1,5 @@
D (318) vfs: esp_vfs_register_fd_range is successful for range <54; 64) and VFS ID 1
D (59342) vfs: esp_vfs_select starts with nfds = 55
D (59342) vfs: esp_vfs_select starts with nfds = 55
D (59343) vfs: FDs in readfds =
D (59343) vfs: 54
D (59355) vfs: calling socket_select with the following FDs