From 49bfa06f8e53ef0508f8be96da9cd1d97850d0c1 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Tue, 21 Apr 2015 10:39:00 -0700 Subject: [PATCH] minimodem: --binary-raw {nbits} output mode --- src/minimodem.1.in | 9 +++++++++ src/minimodem.c | 15 ++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/minimodem.1.in b/src/minimodem.1.in index cebdec5..90a7c1f 100644 --- a/src/minimodem.1.in +++ b/src/minimodem.1.in @@ -173,6 +173,15 @@ The bits are printed in the order they are received. Framing bits (start and stop bits) are omitted from the output. (This option applies to \-\-rx mode only). .TP +.B \-\-binary-raw {nbits} +Print all received bits (data bits and any framing bits) as raw binary output +using characters '0' and '1'. Framing bits are not interpreted, but simply +passed through to the output. The bits are printed in the order they are +received, in lines {nbits} wide. So in order to display a standard 8-N-1 +bitstream (8 databits + 1 start bit + 1 stop bit), use "--binary-raw 10" + or a multiple of 10. +(This option applies to \-\-rx mode only). +.TP .B \-\-print-filter Filter the received text output, replacing any "non-printable" bytes with a '.' character. diff --git a/src/minimodem.c b/src/minimodem.c index fa91f40..5d0ccc8 100644 --- a/src/minimodem.c +++ b/src/minimodem.c @@ -358,6 +358,7 @@ usage() " --rx-one\n" " --benchmarks\n" " --binary-output\n" + " --binary-raw {nbits}\n" " --print-filter\n" " {baudmode}\n" " any_number_N Bell-like N bps --ascii\n" @@ -473,6 +474,7 @@ main( int argc, char*argv[] ) float rxnoise_factor = 0.0; int output_mode_binary = 0; + int output_mode_raw_nbits = 0; float bfsk_data_rate = 0.0; databits_encoder *bfsk_databits_encode; @@ -510,6 +512,7 @@ main( int argc, char*argv[] ) MINIMODEM_OPT_RX_ONE, MINIMODEM_OPT_BENCHMARKS, MINIMODEM_OPT_BINARY_OUTPUT, + MINIMODEM_OPT_BINARY_RAW, MINIMODEM_OPT_PRINT_FILTER, MINIMODEM_OPT_XRXNOISE, }; @@ -548,6 +551,7 @@ main( int argc, char*argv[] ) { "rx-one", 0, 0, MINIMODEM_OPT_RX_ONE }, { "benchmarks", 0, 0, MINIMODEM_OPT_BENCHMARKS }, { "binary-output", 0, 0, MINIMODEM_OPT_BINARY_OUTPUT }, + { "binary-raw", 1, 0, MINIMODEM_OPT_BINARY_RAW }, { "print-filter", 0, 0, MINIMODEM_OPT_PRINT_FILTER }, { "Xrxnoise", 1, 0, MINIMODEM_OPT_XRXNOISE }, { 0 } @@ -669,6 +673,9 @@ main( int argc, char*argv[] ) case MINIMODEM_OPT_BINARY_OUTPUT: output_mode_binary = 1; break; + case MINIMODEM_OPT_BINARY_RAW: + output_mode_raw_nbits = atoi(optarg); + break; case MINIMODEM_OPT_PRINT_FILTER: output_print_filter = 1; break; @@ -772,9 +779,15 @@ main( int argc, char*argv[] ) usage(); - if ( output_mode_binary ) + if ( output_mode_binary || output_mode_raw_nbits ) bfsk_databits_decode = databits_decode_binary; + if ( output_mode_raw_nbits ) { + bfsk_nstartbits = 0; + bfsk_nstopbits = 0; + bfsk_n_data_bits = output_mode_raw_nbits; + } + if ( bfsk_data_rate >= 400 ) { /* * Bell 202: baud=1200 mark=1200 space=2200