linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] v4l-utils: ir-ctl: deal with consecutive pulses or spaces correctly
@ 2016-09-19 22:21 Sean Young
  0 siblings, 0 replies; only message in thread
From: Sean Young @ 2016-09-19 22:21 UTC (permalink / raw)
  To: Mauro Carvalho Chehab; +Cc: linux-media

When sending a pulse-space file with consecutive spaces or pulses, add them
together correctly. For example:

pulse 100
space 150
space 100
pulse 150
pulse 200

Would send pulse 100, space 250, and pulse 350.

Signed-off-by: Sean Young <sean@mess.org>
---
 utils/ir-ctl/ir-ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index 229330e..2f85e6d 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -211,7 +211,7 @@ static struct file *read_file(const char *fname)
 					fprintf(stderr, _("warning: %s:%d: leading space ignored\n"),
 						fname, lineno);
 				} else {
-					f->buf[len] += arg;
+					f->buf[len-1] += arg;
 				}
 			} else {
 				f->buf[len++] = arg;
@@ -220,7 +220,7 @@ static struct file *read_file(const char *fname)
 			expect_pulse = true;
 		} else if (strcmp(keyword, "pulse") == 0) {
 			if (!expect_pulse)
-				f->buf[len] += arg;
+				f->buf[len-1] += arg;
 			else
 				f->buf[len++] = arg;
 			expect_pulse = false;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-09-19 22:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-19 22:21 [PATCH] v4l-utils: ir-ctl: deal with consecutive pulses or spaces correctly Sean Young

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).