Skip to contentSkip to conversation

: ir-ctl: remove quirky -rmw command line parsing

PATCH New Sean Young 1 participant 1 message May 25, 2025 Media (V4L/DVB)

lore
Share & tools
lore

Sean Young

author
#0 lore raw

PATCH 1/1 : ir-ctl: remove quirky -rmw command line parsing

The receive option takes an optional file name, even when specified as a short option without an `='. So, ir-ctl -rmw saves the output to a file called mw. You would expect the -r, -m, and -w options to be specified.

This commit removes the file argument completely. Saving to a file is confusing and does not really have a good use-case. I've never heard of anyone using this feature.

On top of that, I'm implementing a ir-ctl compatibility mode in cir[1], and clap does not support short options with an optional value without `='; see the note[2].

[1] https://gitlab.freedesktop.org/linux-media/tools/cir
[2] https://docs.rs/clap/latest/clap/struct.Arg.html#method.default_missing_value

---
 utils/ir-ctl/ir-ctl.1.in |  9 +++-----
 utils/ir-ctl/ir-ctl.c    | 46 ++++++++++++----------------------------
 2 files changed, 17 insertions(+), 38 deletions(-)
utils/ir-ctl/ir-ctl.1.in +3 -6
index f1ed2640..8fe74675 100644
@@ -18,7 +18,7 @@ ir\-ctl \- a swiss\-knife tool to handle raw IR and to set lirc options
 [\fIOPTION\fR]... \fI\-\-keycode\fR [\fIkeycode to send\fR]
 .br
 .B ir\-ctl
-[\fIOPTION\fR]... \fI\-\-receive\fR [\fIsave to file\fR]
+[\fIOPTION\fR]... \fI\-\-receive\fR
 .SH DESCRIPTION
 ir\-ctl is a tool that allows one to list the features of a lirc device,
 set its options, receive raw IR, and send IR.
@@ -36,9 +36,8 @@ lirc device to control, /dev/lirc0 by default
 \fB\-f\fR, \fB\-\-features\fR
 List the features of the lirc device.
 .TP
-\fB\-r\fR, \fB\-\-receive\fR[=\fIFILE\fR]
-Receive IR and print to standard output if no file is specified, else
-save to the filename.
+\fB\-r\fR, \fB\-\-receive\fR
+Receive IR and print to standard output.
 .TP
 \fB\-s\fR, \fB\-\-send\fR=\fIFILE\fR
 Send IR in text file. It must be in the format described below. If this
@@ -238,8 +237,6 @@ To show the IR of the first button press on a remote in learning mode:
 .br
 	\fBir\-ctl \-r \-m \-w\fR
 .PP
-Note that \fBir\-ctl \-rmw\fR would receive to a file called \fBmw\fR.
-.PP
 To restore the normal (longer distance) receiver:
 .br
 	\fBir\-ctl \-n \-M\fR
utils/ir-ctl/ir-ctl.c +14 -32

128 lines not on this page · raw message

Signature · 1 line
2.49.0