depthcharge.monitor

Depthcharge Monitor functionality can be used to observe data written to and read from the console interface. This can be helpful when debugging or simply as a means to better understand how Depthcharge is performing requested operations.

The monitor is shown in the following animation, in the bottom terminal. Observed that the commands used by the depthcharge-inspect and depthcharge-readmem (using ItestMemoryReader) can be observed.

../_images/monitor.gif
class depthcharge.monitor.Monitor

The Monitor class implements a no-op base implementation that simply discards all data.

classmethod register(name: str, impl_class)

Register a Monitor implementation to be returned by Monitor.create(). This the Monitor functionality to be extended at run-time.

classmethod create(spec: str)

Create and return a monitor from a “specification” string structured as follows:

<type>[:arg1,...]

Below are the supported types and arguments.

Monitor Type

Argument(s)

'file'

Filename to write logged console data to.

'pipe'

Named pipe (FIFO) to write logged console data to.

'colorpipe'

Named pipe (FIFO) to write logged console data to.

'term'

None.

read(data)

Insert data read from the target (i.e. U-Boot output) into the monitor.

write(data)

Insert data written to the target (i.e. Depthcharge output) into the monitor.

close()

Close the monitor and its underlying resources.

class depthcharge.monitor.FileMonitor(path='/tmp/depthcharge-monitor.txt')

A Monitor subclass that logs console data to a file.

class depthcharge.monitor.NamedPipeMonitor(path='/tmp/depthcharge-monitor.pipe')

A Monitor subclass that logs console data to a named pipe.

class depthcharge.monitor.ColorNamedPipeMonitor(path='/tmp/depthcharge-monitor.pipe')

A Monitor subclass that logs console data to a named pipe and styleizes output using VT-100 escape sequences, as described below.

Styling

Applied to…

None

U-Boot output containing printable characters

Hex-encoded, magenta

U-Boot output containing non-printable characters

Green

Depthcharge output containing printable characters

Hex-encoded, cyan

Depthcharge output containing non-printable characters

class depthcharge.monitor.TerminalMonitor

This ColorNamedPipeMonitor opens a terminal and displays the stylized data read from the underlying named pipe (using /usr/bin/cat).

The following terminals are supported. One will be automatically selected.

  • /usr/bin/terminator

  • /usr/bin/xfce4-terminator

  • /usr/bin/gnome-terminator

  • /usr/bin/xterm