Request For Simple C Logging Utility

A place for small project requests from the team to exist and grow into something fully fledged and useful to the masses.
Post Reply
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Request For Simple C Logging Utility

Post by Fred »

Following on from the great success that I had with John and the bench testing utility here:

viewtopic.php?f=8&t=1486

I want a new app! Who wants to write it?

Purpose
  • Get Cutecom out of the picture, it's clunky to use.
  • Get meta data into the log file by default to improve the self descriptive qualities
  • Make binary logging a single command operation and not a gui marathon
  • Remove variables from logging by defaulting to standard FreeEMS comms properties
Requirements

Options:
  • Adjustable serial device via option.
  • Adjustable log stream type via option.
Flow:
  1. Configure serial port
  2. Open serial port
  3. Send stop logging packet
  4. Start recording to .bin file
  5. Request meta data packets and dump each to console
  6. Send start logging packet
  7. Die when killed or asked to die
Properties:
  • Maintain a minimal buffer so as to lose minimal data when killed. Write per packet received would likely work well. No point in doing it more often.
Console dump format suggestion:

Code: Select all

################################################################################
###################### Initiating Interrogation Sequence!! #####################
################################################################################
Interface Version: IFreeEMS Vanilla 0.0.0
Firmware Version:  0.2.0-SNAPSHOT-94-gd1b8c27-DEV
Decoder Name:      EvenTeeth-Both-12and1
Build Date:        Sun Feb 26 21:05:56 CET 2012
Compiler Version:  3.3.6-m68hc1x-20060122
Build OS Type:     Linux
Maximum Size:      2064
Echo length:       10
################################################################################
################### Interrogation Sequence Completed in 65ms! ##################
################################################################################
Obviously with less HUGE header/footer more appropriate to the task.

Standard Usage

binflogger

Should get you a log dumping to FreeEMS.log.yyyy-MM-DD.HH-mm-ss.bin (or similar)

binflogger filename.bin

Should get you a log dumping into that file name from /dev/ttyUSB0

binflogger -d /dev/ttyUSB1 filename.bin

Should get you the same from the second usb serial device.

binflogger -d /dev/ttyUSB1

Should get you the standard dated log name from that device.

The rest can be tweaked in source for now, including the default stream type, though an option would be easy to add.

Bonus Points For
  • No args usage with intelligent file naming including firmware hash, decoder type, log type and current time/date stamp etc
  • parity none/odd/even override that outputs a "You've changed the parity, this won't work without custom firmware" warning.
  • baud rate override the same warning style
  • ~/.* config file to spec the standard log directory and default file name format with a pattern
  • To save the the interrogation data to a matching file name with .meta or .info suffix as well as dumping it to the console
  • Having a nice way to stop logging and/or doing it in a thread and interrogating the user for context about the log in a format similar to Sim's file
  • Having a defaults for each mostly static entry in the config file so that enter takes you through most of it quickly
Dev Stages

1:

dumb send of packets with sleeps in between
dumb record of data to file
hard coded everything
required single argument of file name

2:

add options to control various things
add date file name default stuff

3:

Be smart about receiving packets using time outs on serial read calls for the first section and then just dumping per byte there after
Output of meta data to console while reading it from device

4:

Stuff from bonus points section

Dev Suggestions

Use lacerated pempheridae code as a basis
Use my parser source from firmware/bin/ as a basis

So, who's going to be the man? Or woman?

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Preston
LQFP112 - Up with the play
Posts: 128
Joined: Fri Feb 26, 2010 5:26 am
Location: Aucks

Re: Request For Simple C Logging Utility

Post by Preston »

I would like to give this a go! what you say Fred?

Preston.
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Request For Simple C Logging Utility

Post by Fred »

Apparently John already started, but that doesn't mean someone can't take over:

https://github.com/johnhowe/Lacerated-Bathynomus

As long as anyone intending to do the work posts, then there will be no wasted effort.

Be prepared for the usual fred-spec critique, though. Tech criticism and feedback is not and should not be taken as insulting! :-)

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Request For Simple C Logging Utility

Post by Fred »

viewtopic.php?f=54&t=1819

Interim solution is EMStudio!

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply