[PATCH 1/2] ir-ctl: fix multiple scancodes in one file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



A file with contents:

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

Will produce bogus results.

Reported-by: Matthias Reichl <hias@xxxxxxxxx>
Signed-off-by: Sean Young <sean@xxxxxxxx>
---
 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




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux