questions about new -D option

36 views
Skip to first unread message

Greg Troxel

unread,
May 13, 2025, 8:43:49 AMMay 13
to rtl433
I have long had issues where if the USB connector is bumped there is a
read error or something and rtl_433 exits, and I need to restart. It
seems the newish -D option helps with that. Trying to understand it,
questions/comments:

1) The help does not give the default:
[-D restart | pause | quit | manual] Input device run mode options.
Further, the order does not match the enum:
typedef enum {
DEVICE_MODE_QUIT,
DEVICE_MODE_RESTART,
DEVICE_MODE_PAUSE,
DEVICE_MODE_MANUAL,
} device_mode_t;
and while quit and restart are intuitive, pause and manual are not.

There is help with -D help (or anything else invalid), and it would
be good to give a clue in the -h output. I can then understand
pause, sort of, but not really. I still don't understand manual.

2) Reading src/rtl_433.c:

case 'D':
if (!arg)
help_device_mode();

if (strcmp(arg, "quit") == 0) {
cfg->dev_mode = DEVICE_MODE_RESTART;
}
else if (strcmp(arg, "restart") == 0) {
cfg->dev_mode = DEVICE_MODE_RESTART;
}
else if (strcmp(arg, "pause") == 0) {
cfg->dev_mode = DEVICE_MODE_PAUSE;
}
else if (strcmp(arg, "manual") == 0) {
cfg->dev_mode = DEVICE_MODE_MANUAL;
}
else {
fprintf(stderr, "Invalid input device run mode: %s\n", arg);
help_device_mode();
}
break;

It seems
- quit is mapped to restart, an obvious bug
- I find no initialization, which seems to rely on QUIT being 0 in
the enum and the field being zero, because it is a global.


So I would like to:

fix -D quit to use the right enum value

add a comment about the value when there isn't -D, or really I'd
like to add a 'set defaults' section and assign it. This is too hard
to follow and too fragile.

add -D help to the -h output

specify what is the default in the -h and -D help output

sort help to be in the same order as the enum

Christian Z.

unread,
May 13, 2025, 9:59:35 AMMay 13
to rtl_433
The quit option setting is fixed, thanks! And the help text now is
  [-D quit | restart | pause | manual] Input device run mode options (default: quit).

The pause and manual options are only useful if you are controlling rtl_433 with the HTTP-API. rtl_433 will keep running even without live input.
Reply all
Reply to author
Forward
0 new messages