Skip to contentSkip to conversation

v4l-utils: ir-ctl: deal with consecutive pulses or spaces correctly

PATCH New Sean Young 1 participant 1 message Sep 19, 2016 Media (V4L/DVB)

lore
Share & tools
lore

Sean Young

author
#0 lore raw

PATCH 1/1 v4l-utils: ir-ctl: deal with consecutive pulses or spaces correctly

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.

---
 utils/ir-ctl/ir-ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
utils/ir-ctl/ir-ctl.c +2 -2
index 229330e..2f85e6d 100644
@@ -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;
Signature · 1 line
2.7.4