Giter Site home page Giter Site logo

retrover's Introduction

retrover - Retrospective Rover

A serial port monitor that makes it easy to see rare events and their context.

Watches multiple serial ports for rare events among line-oriented protocols. Omits and/or compresses traffic that's not around those events.

Usage

Pass serial port names as parameters:

pipenv run python retrover.py COM11 --regex "!!!!"
pipenv run python retrover.py COM11 COM7 --regex "(^No)|!!!!"
pipenv run python retrover.py /dev/ttyUSB0 --regex ^no !!!!

If multiple serial ports are provided, output is interleaved by line.

Press Ctrl+C once to see a summary of what's been seen so far, and again to quit.

Command-line options

usage: retrover.py [-h] [--baud [BAUD]] [--log LOGFILE]
                   [--window WINDOWRADIUS] [--eventrun]
                   [--delta] [--single] --regex REGEX
                   [REGEX ...] [--ignorecase] [--utc]

positional arguments:
  PORT                  a serial port to watch

options:
  -h, --help            show this help message and exit

  --baud [BAUD]         baud rate for all serial ports

  --log LOGFILE         file to log events to

  --window WINDOWRADIUS
                        Log this many lines before and after the event.

  --eventrun            An event is counted for each run of lines that has any match.

  --delta               An event is counted for each match that's different from the previous line.

  --single              An event is counted for each match.

  --regex REGEX [REGEX ...]
                        A line that matches one or more regexes, anywhere, is an event.

  --ignorecase          whether to distinguish upper and lower case letters or not

  --utc                 whether to log times in UTC, vs. local time

File output

The lines around events are written to retrover.log in the current directory, like this:

2023-08-07 14:35:45.968481 <  3.30 V
2023-08-07 14:35:46.115271  > ~S=4 ?=1 ?*
2023-08-07 14:35:47.210118  > ~S=4 ?=1 ?*
2023-08-07 14:35:47.210118  > OTA:
2023-08-07 14:35:47.312100  > ~S=7
==
== EVENT FOUND ==
==
2023-08-07 14:35:47.424675  > Up?
2023-08-07 14:35:48.520659  > No.
2023-08-07 14:35:48.617749  > ~S=5
2023-08-07 14:35:48.618748  > ~S=5 ?=1 ?*
2023-08-07 14:35:49.053728  > ~S=3
2023-08-07 14:35:49.546138  > ~S=3 ?=1 ?*

A timestamp is prefixed, and the == EVENT FOUND == marker is output just after each event.

A number of lines are included before and after the event equal to the --window argument.

For two serial ports, lines from the first port listed on the command line are preceded by < , and lines from the second one are preceded by >.

Console output

All incoming data is displayed.

Each line is prefixed by the number of events seen so far.

This allows you to monitor all the output as it passes by, while logging and counting only the real events.

retrover's People

Contributors

teejaydub avatar

Watchers

 avatar

retrover's Issues

Pull constants out to command-line arguments

So far I've been content to modify the .py file when I need to change EVENT_PATTERN, since it's all been for one project, but that in particular should be pulled out, then COM_PORT_BAUD_RATE, the other constants associated with searching, etc.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.