diff --git a/include/rtl_433.h b/include/rtl_433.h index a9426177..16e2af84 100644 --- a/include/rtl_433.h +++ b/include/rtl_433.h @@ -86,6 +86,7 @@ typedef struct r_cfg { int no_default_devices; struct r_device *devices; uint16_t num_r_devices; + char *output_key; char *output_tag; list_t output_handler; struct dm_state *demod; diff --git a/src/r_api.c b/src/r_api.c index f8a5b461..8318443e 100644 --- a/src/r_api.c +++ b/src/r_api.c @@ -269,8 +269,8 @@ char const **well_known_output_fields(r_cfg_t *cfg) if (cfg->verbose_bits) *p++ = "bits"; - if (cfg->output_tag) - *p++ = "tag"; + if (cfg->output_key) + *p++ = cfg->output_key; if (cfg->report_protocol) *p++ = "protocol"; if (cfg->report_description) @@ -679,7 +679,7 @@ void data_acquired_handler(r_device *r_dev, data_t *data) output_tag = file_basename(cfg->in_filename); } data = data_prepend(data, - "tag", "Tag", DATA_STRING, output_tag, + cfg->output_key, "", DATA_STRING, output_tag, NULL); } diff --git a/src/rtl_433.c b/src/rtl_433.c index 1b58e78c..0e03bada 100644 --- a/src/rtl_433.c +++ b/src/rtl_433.c @@ -131,7 +131,7 @@ static void usage(int exit_code) " Append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.\n" " Specify host/port for syslog with e.g. -F syslog:127.0.0.1:1514\n" " [-M time[:<options>] | protocol | level | stats | bits | help] Add various meta data to each output.\n" - " [-K FILE | PATH | <tag>] Add an expanded token or fixed tag to every output line.\n" + " [-K FILE | PATH | <tag> | <key>=<value>] Add an expanded token or fixed tag to every output line.\n" " [-C native | si | customary] Convert units in decoded output.\n" " [-T <seconds>] Specify number of seconds to run, also 12:34 or 1h23m45s\n" " [-E hop | quit] Hop/Quit after outputting successful event(s)\n" @@ -1034,6 +1034,11 @@ static void parse_conf_option(r_cfg_t *cfg, int opt, char *arg) break; case 'K': cfg->output_tag = arg; + cfg->output_key = asepc(&cfg->output_tag, '='); + if (!cfg->output_tag) { + cfg->output_tag = cfg->output_key; + cfg->output_key = "tag"; + } break; case 'C': if (!arg)