A file with contents:

scancode sony12:0x100015
space 25000
scancode sony12:0x100015

Will produce bogus results.

Reported-by: Matthias Reichl <h...@horus.com>
Signed-off-by: Sean Young <s...@mess.org>
---
 utils/ir-ctl/ir-ctl.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index 544ad341..8538ec5d 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -230,8 +230,8 @@ static struct file *read_file(const char *fname)
                        char *scancodestr;
 
                        if (!expect_pulse) {
-                               fprintf(stderr, _("error: %s:%d: space must 
precede scancode\n"), fname, lineno);
-                               return NULL;
+                               f->buf[len++] = IR_DEFAULT_TIMEOUT;
+                               expect_pulse = true;
                        }
 
                        scancodestr = strchr(p, ':');
@@ -268,7 +268,8 @@ static struct file *read_file(const char *fname)
                        else
                                f->carrier = carrier;
 
-                       len += protocol_encode(proto, scancode, f->buf);
+                       len += protocol_encode(proto, scancode, f->buf + len);
+                       expect_pulse = false;
                        continue;
                }
 
-- 
2.14.3

Reply via email to