Skip to content

Commit

Permalink
Make meta data option known
Browse files Browse the repository at this point in the history
  • Loading branch information
zuckschwerdt committed Dec 5, 2018
1 parent 31a09e1 commit cd222b7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Usage: = General options =
[-F] kv|json|csv|syslog|null Produce decoded output in given format. Not yet supported by all drivers.
Append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.
Specify host/port for syslog with e.g. -F syslog:127.0.0.1:1514
[-M level] Add metadata on modulation, frequency, RSSI, SNR, and noise to every output line.
[-K] FILE|PATH|<tag> Add an expanded token or fixed tag to every output line.
[-C] native|si|customary Convert units in decoded output.
[-T] Specify number of seconds to run
Expand Down Expand Up @@ -105,7 +106,7 @@ Supported device protocols:
[36] Efergy e2 classic
[37]* Inovalley kw9015b, TFA Dostmann 30.3161 (Rain and temperature sensor)
[38] Generic temperature sensor 1
[39] WG-PB12V1
[39] WG-PB12V1 Temperature Sensor
[40] Acurite 592TXR Temp/Humidity, 5n1 Weather Station, 6045 Lightning
[41] Acurite 986 Refrigerator / Freezer Thermometer
[42] HIDEKI TS04 Temperature, Humidity, Wind and Rain Sensor
Expand All @@ -124,7 +125,7 @@ Supported device protocols:
[55] Acurite 606TX Temperature Sensor
[56] TFA pool temperature sensor
[57] Kedsum Temperature & Humidity Sensor
[58] blyss DC5-UK-WH (433.92 MHz)
[58] Blyss DC5-UK-WH
[59] Steelmate TPMS
[60] Schrader TPMS
[61]* LightwaveRF
Expand Down
4 changes: 2 additions & 2 deletions rtl_433.example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ include_only 0
#out_block_size

# as command line option:
# [-M] Report meta, add meta data to each event
#report_meta
# [-M level] Add metadata on modulation, frequency, RSSI, SNR, and noise to every output line.
#report_meta level

# as command line option:
# [-y <code>] Verify decoding of demodulated test data (e.g. "{25}fb2dd58") with enabled devices
Expand Down
6 changes: 5 additions & 1 deletion src/rtl_433.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ static void usage(r_device *devices, unsigned num_devices, int exit_code)
"\t[-F] kv|json|csv|syslog|null Produce decoded output in given format. Not yet supported by all drivers.\n"
"\t\t Append output to file with :<filename> (e.g. -F csv:log.csv), defaults to stdout.\n"
"\t\t Specify host/port for syslog with e.g. -F syslog:127.0.0.1:1514\n"
"\t[-M level] Add metadata on modulation, frequency, RSSI, SNR, and noise to every output line.\n"
"\t[-K] FILE|PATH|<tag> Add an expanded token or fixed tag to every output line.\n"
"\t[-C] native|si|customary Convert units in decoded output.\n"
"\t[-T] Specify number of seconds to run\n"
Expand Down Expand Up @@ -1167,7 +1168,10 @@ static void parse_conf_option(struct app_cfg *cfg, int opt, char *arg)
usage(NULL, 0, 1);
break;
case 'M':
cfg->report_meta = atobv(arg, 1);
if (strcasecmp(arg, "level") == 0)
cfg->report_meta = 1;
else
cfg->report_meta = atobv(arg, 1);
break;
case 'D':
if (!arg)
Expand Down

5 comments on commit cd222b7

@frief
Copy link

@frief frief commented on cd222b7 Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If used without numeric parameter to -M it fails here. So while
sudo /usr/local/bin/rtl_433 -M 1 >> /tmp/rtl_433.log 2>&1
is fine, this one fails:
sudo /usr/local/bin/rtl_433 -M >> /tmp/rtl_433.log 2>&1

Thanks for adding this!

@zuckschwerdt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. Yes, -M will get a help page to list all the possible arguments soon!

@frief
Copy link

@frief frief commented on cd222b7 Dec 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry my post was probably somewhat too unspecific. It was less about a help page than about the Segvault in strcasecmp:
`
~/rtl_433/build/src $ ./rtl_433 -M
./rtl_433: option requires an argument -- 'M'
Trying conf file at "rtl_433.conf"...
Trying conf file at "/home/pi/.rtl_433.conf"...
Trying conf file at "/usr/local/etc/rtl_433.conf"...
Trying conf file at "/etc/rtl_433.conf"...
./rtl_433: option requires an argument -- 'M'
Speicherzugriffsfehler

gdb --args ./rtl_433 -M
r
[..]
Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0 __GI___strcasecmp (s1=, s2=) at strcasecmp.c:58
#1 0x0001fc68 in parse_conf_option.constprop ()
#2 0x00012548 in main ()
`

(Raspbian on Raspberry Pi)

Grüße,

@zuckschwerdt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh! That's bad. I'll add a check.

@zuckschwerdt
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed with 81e018f, thanks!

Please sign in to comment.