aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2021-09-15 17:26:30 +0100
committerSean Young <sean@mess.org>2021-09-15 17:26:30 +0100
commit1874b2d0dfbb8a38b0c8b75a23a4b9a60e52fd6a (patch)
treefc39c6bba853cd40a10d8bb9ce5a30ed0350ad72
parent05a468e033af0e4c775aaa10fe4d02c45de698ae (diff)
downloadv4l-utils-1874b2d0dfbb8a38b0c8b75a23a4b9a60e52fd6a.tar.gz
ir-ctl: increase the size of the buffer used to read raw files
Air conditioner codes typically have 100 pulse/space pairs (12 bytes + headers). The resulting raw IR line length is 1063, which exceeds the current 1024 byte buffer, and results in an error trying to parse the line. The buffers used to read pulse/space files are significantly larger than needed so this decreases their size, and allocates the difference to the buffer used to read raw IR files in order to keep the total size of buffers the same. Signed-off-by: Norman Rasmussen <norman@rasmussen.co.za> Signed-off-by: Sean Young <sean@mess.org>
-rw-r--r--utils/ir-ctl/ir-ctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c
index 3c3bcca1..34cde11e 100644
--- a/utils/ir-ctl/ir-ctl.c
+++ b/utils/ir-ctl/ir-ctl.c
@@ -60,6 +60,8 @@
#define LIRCBUF_SIZE 1024
#define IR_DEFAULT_TIMEOUT 125000
#define UNSET UINT32_MAX
+/* Maximum number of columns per line */
+#define LINE_SIZE 8192
const char *argp_program_version = "IR ctl version " V4L_UTILS_VERSION;
const char *argp_program_bug_address = "Sean Young <sean@mess.org>";
@@ -211,7 +213,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
{
bool expect_pulse = true;
int lineno = 0, lastspace = 0;
- char line[1024];
+ char line[LINE_SIZE];
int len = 0;
static const char whitespace[] = " \n\r\t";
struct send *f;
@@ -380,7 +382,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn
static struct send *read_file_raw(struct arguments *args, const char *fname, FILE *input)
{
int lineno = 0, lastspace = 0;
- char line[1024];
+ char line[LINE_SIZE];
int len = 0;
static const char whitespace[] = " \n\r\t,";
struct send *f;
@@ -474,7 +476,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL
static struct send *read_file(struct arguments *args, const char *fname)
{
FILE *input = fopen(fname, "r");
- char line[1024];
+ char line[LINE_SIZE];
if (!input) {
fprintf(stderr, _("%s: could not open: %m\n"), fname);