aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2021-05-01 09:49:25 +0100
committerSean Young <sean@mess.org>2021-05-01 09:53:29 +0100
commit4631ee0a158524b90608326cd86ded4a02031e93 (patch)
tree456a16bfc01a7ddd1d0d8a0b610ef63317e4c293
parente617add8abc1dcfae46ee9a60ec4e36a7b4991a5 (diff)
ir-ctl: include timeout in raw IR and parse timeout in pulse-space file
Reported-by: Luca Di Gregorio <lucdig@gmail.com> Signed-off-by: Sean Young <sean@mess.org>
-rw-r--r--utils/ir-ctl/ir-ctl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index bae16050..3c3bcca1 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -314,7 +314,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
continue;
}
- if (strcmp(keyword, "space") == 0) {
+ if (!strcmp(keyword, "space") || !strcmp(keyword, "timeout")) {
if (arg == 0) {
fprintf(stderr, _("warning: %s:%d: invalid argument to space '%d'\n"), fname, lineno, arg);
continue;
@@ -331,7 +331,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
}
lastspace = lineno;
expect_pulse = true;
- } else if (strcmp(keyword, "pulse") == 0) {
+ } else if (!strcmp(keyword, "pulse")) {
if (arg == 0) {
fprintf(stderr, _("warning: %s:%d: invalid argument to pulse '%d'\n"), fname, lineno, arg);
continue;
@@ -341,7 +341,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
else
f->buf[len++] = arg;
expect_pulse = false;
- } else if (strcmp(keyword, "carrier") == 0) {
+ } else if (!strcmp(keyword, "carrier")) {
if (f->carrier != UNSET && f->carrier != arg) {
fprintf(stderr, _("warning: %s:%d: carrier already specified\n"), fname, lineno);
} else {
@@ -1200,10 +1200,9 @@ int lirc_receive(struct arguments *args, int fd, unsigned features)
} else {
switch (msg) {
case LIRC_MODE2_TIMEOUT:
+ fprintf(out, "-%u\n", val);
if (carrier)
- fprintf(out, "# carrier %uHz, timeout %u\n", carrier, val);
- else
- fprintf(out, "# timeout %u\n", val);
+ fprintf(out, " # carrier %uHz, timeout %u\n", carrier, val);
leading_space = true;
carrier = 0;
break;

Privacy Policy