1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-23 12:21:54 +01:00

trace/serial_trace: Add capability to trace serial traffic

We add a TraceCollector which logs the traffic on a serial port. This
can then be used to debug why a board crashes, or to extract extra
information from the device whilst it is running a workload.
This commit is contained in:
Sascha Bischoff
2018-06-12 16:24:39 +01:00
committed by setrofim
parent c4f6a1a85f
commit 6abe6067da
3 changed files with 78 additions and 2 deletions

View File

@@ -49,7 +49,7 @@ def pulse_dtr(conn, state=True, duration=0.1):
def get_connection(timeout, init_dtr=None, logcls=SerialLogger,
*args, **kwargs):
logfile=None, *args, **kwargs):
if init_dtr is not None:
kwargs['dsrdtr'] = True
try:
@@ -60,7 +60,7 @@ def get_connection(timeout, init_dtr=None, logcls=SerialLogger,
conn.setDTR(init_dtr)
conn.nonblocking()
conn.flushOutput()
target = fdpexpect.fdspawn(conn.fileno(), timeout=timeout)
target = fdpexpect.fdspawn(conn.fileno(), timeout=timeout, logfile=logfile)
target.logfile_read = logcls('read')
target.logfile_send = logcls('send')