minor: print cleanup
This commit is contained in:
parent
1d3a795bd7
commit
f0233a3dbe
5 changed files with 37 additions and 34 deletions
|
@ -68,7 +68,7 @@ static int em1000_callback(r_device *decoder, bitbuffer_t *bitbuffer)
|
|||
return DECODE_FAIL_MIC;
|
||||
}
|
||||
|
||||
//for (i = 0; i < bytes; i++) fprintf(stderr, "%02X ", dec[i]); fprintf(stderr, "\n");
|
||||
// bitrow_print(dec, bytes * 8);
|
||||
|
||||
// based on 15_CUL_EM.pm
|
||||
//char *subtype = dec[0] >= 1 && dec[0] <= 3 ? types[dec[0] - 1] : "?";
|
||||
|
|
|
@ -346,11 +346,7 @@ static int parse_insteon_pkt(r_device *decoder, bitbuffer_t *bits, unsigned int
|
|||
//fprintf(stderr, "%s: pkt_type: %02X \n", __func__, pkt_type);
|
||||
|
||||
if (decoder->verbose > 1) {
|
||||
fprintf(stderr, "type %s\n", pkt_type_str);
|
||||
for (int j = 0; j < min_pkt_len; j++) {
|
||||
fprintf(stderr, "%d:%02X ", j, results[j]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
bitrow_printf(results, min_pkt_len * 8, "type %s : ", pkt_type_str);
|
||||
}
|
||||
|
||||
// Format data
|
||||
|
|
|
@ -223,11 +223,9 @@ int _decode_v2_half(bitbuffer_t *bits, uint8_t roll_array[], bitbuffer_t *fixed_
|
|||
}
|
||||
|
||||
if (verbose) {
|
||||
fprintf(stderr, "%s : roll_array : (%d) ", __func__, part_id);
|
||||
for (int i = 0; i < 9; i++) {
|
||||
fprintf(stderr, "%d ", roll_array[i]);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
fprintf(stderr, "%s : roll_array : (%d) %d %d %d %d %d %d %d %d %d\n", __func__, part_id,
|
||||
roll_array[0], roll_array[1], roll_array[2], roll_array[3],
|
||||
roll_array[4], roll_array[5], roll_array[6], roll_array[7], roll_array[8]);
|
||||
}
|
||||
|
||||
// SANITY check trinary valuse, 00/01/10 are valid, 11 is not
|
||||
|
|
10
src/r_api.c
10
src/r_api.c
|
@ -237,9 +237,13 @@ void register_protocol(r_cfg_t *cfg, r_device *r_dev, char *arg)
|
|||
{
|
||||
// use arg of 'v', 'vv', 'vvv' as device verbosity
|
||||
int dev_verbose = 0;
|
||||
if (arg && arg[0] == 'v' && (!arg[1] || (arg[1] == 'v' && (!arg[2] || arg[2] == 'v')))) {
|
||||
dev_verbose = strlen(arg);
|
||||
arg = NULL;
|
||||
if (arg && *arg == 'v') {
|
||||
for (; *arg == 'v'; ++arg) {
|
||||
dev_verbose++;
|
||||
}
|
||||
if (*arg) {
|
||||
arg++; // skip separator
|
||||
}
|
||||
}
|
||||
|
||||
// use any other arg as device parameter
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "data.h"
|
||||
#include "r_util.h"
|
||||
#include "optparse.h"
|
||||
#include "abuf.h"
|
||||
#include "fileformat.h"
|
||||
#include "samp_grab.h"
|
||||
#include "am_analyze.h"
|
||||
|
@ -1341,28 +1342,32 @@ int main(int argc, char **argv) {
|
|||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "Registered %zu out of %d device decoding protocols",
|
||||
demod->r_devs.len, cfg->num_r_devices);
|
||||
|
||||
if (!cfg->verbosity) {
|
||||
// print registered decoder ranges
|
||||
fprintf(stderr, " [");
|
||||
for (void **iter = demod->r_devs.elems; iter && *iter; ++iter) {
|
||||
r_device *r_dev = *iter;
|
||||
unsigned num = r_dev->protocol_num;
|
||||
if (num == 0)
|
||||
continue;
|
||||
while (iter[1]
|
||||
&& r_dev->protocol_num + 1 == ((r_device *)iter[1])->protocol_num)
|
||||
r_dev = *++iter;
|
||||
if (num == r_dev->protocol_num)
|
||||
fprintf(stderr, " %u", num);
|
||||
else
|
||||
fprintf(stderr, " %u-%u", num, r_dev->protocol_num);
|
||||
{
|
||||
char decoders_str[1024];
|
||||
decoders_str[0] = '\0';
|
||||
if (!cfg->verbosity) {
|
||||
abuf_t p = {0};
|
||||
abuf_init(&p, decoders_str, sizeof(decoders_str));
|
||||
// print registered decoder ranges
|
||||
abuf_printf(&p, " [");
|
||||
for (void **iter = demod->r_devs.elems; iter && *iter; ++iter) {
|
||||
r_device *r_dev = *iter;
|
||||
unsigned num = r_dev->protocol_num;
|
||||
if (num == 0)
|
||||
continue;
|
||||
while (iter[1]
|
||||
&& r_dev->protocol_num + 1 == ((r_device *)iter[1])->protocol_num)
|
||||
r_dev = *++iter;
|
||||
if (num == r_dev->protocol_num)
|
||||
abuf_printf(&p, " %u", num);
|
||||
else
|
||||
abuf_printf(&p, " %u-%u", num, r_dev->protocol_num);
|
||||
}
|
||||
abuf_printf(&p, " ]");
|
||||
}
|
||||
fprintf(stderr, " ]");
|
||||
fprintf(stderr, "Registered %zu out of %d device decoding protocols%s\n",
|
||||
demod->r_devs.len, cfg->num_r_devices, decoders_str);
|
||||
}
|
||||
fprintf(stderr, "\n");
|
||||
|
||||
char const **well_known = well_known_output_fields(cfg);
|
||||
start_outputs(cfg, well_known);
|
||||
|
|
Loading…
Add table
Reference in a new issue