[git:v4l-utils/master] keytable: fix command line processing
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix command line processing Author: Sean Young Date:Tue May 14 09:41:47 2024 +0100 Remove --test-keymap since the command line processing is broken if --test-keymap is specified with other arguments. A keymap can simply be tested by loading it. Also ensure `--auto-load` properly excludes other options. Signed-off-by: Sean Young utils/keytable/keytable.c | 17 + 1 file changed, 1 insertion(+), 16 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=7d55dd435be30c47bf4766ec264ace1c0ffb06e5 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index dac99f5e7534..b6474d5cfa75 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -273,7 +273,6 @@ static const struct argp_option options[] = { {"delay", 'D',N_("DELAY"),0, N_("Sets the delay before repeating a keystroke"), 0}, {"period", 'P',N_("PERIOD"), 0, N_("Sets the period to repeat a keystroke"), 0}, {"auto-load", 'a',N_("CFGFILE"), 0, N_("Auto-load keymaps, based on a configuration file. Only works with --sysdev."), 0}, - {"test-keymap", 1, N_("KEYMAP"), 0, N_("Test if keymap is valid"), 0}, {"help",'?',0, 0, N_("Give this help list"), -1}, {"usage", -3, 0, 0, N_("Give a short usage message")}, {"version", 'V',0, 0, N_("Print program version"), -1}, @@ -290,7 +289,6 @@ int debug = 0; static int test = 0; static int delay = -1; static int period = -1; -static int test_keymap = 0; static enum sysfs_protocols ch_proto = 0; struct bpf_protocol { @@ -697,16 +695,6 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) p = strtok(NULL, ":="); } while (p); break; - case 1: - test_keymap++; - struct keymap *map ; - - rc = parse_keymap(arg, &map, debug); - if (rc) - argp_error(state, _("Failed to read table file %s"), arg); - add_keymap(map, arg); - free_keymap(map); - break; case '?': argp_state_help(state, state->out_stream, ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG @@ -2070,9 +2058,6 @@ int main(int argc, char *argv[]) argp_parse(&argp, argc, argv, ARGP_NO_HELP, 0, 0); - if (test_keymap) - return 0; - /* Just list all devices */ if (!clear && !readtable && !keytable && !ch_proto && !cfg.next && !test && delay < 0 && period < 0 && !bpf_protocol) { if (show_sysfs_attribs(&rc_dev, devclass)) @@ -2084,7 +2069,7 @@ int main(int argc, char *argv[]) if (!devclass) devclass = "rc0"; - if (cfg.next && (clear || keytable || ch_proto)) { + if (cfg.next && (clear || keytable || ch_proto || bpf_protocol || test)) { fprintf (stderr, _("Auto-mode can be used only with --read, --verbose and --sysdev options\n")); return -1; }
[git:v4l-utils/master] ir-ctl: encode rc6 mode 0 can have 43 edges
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: encode rc6 mode 0 can have 43 edges Author: Sean Young Date:Mon Apr 22 11:16:31 2024 +0100 Ensure we allocate enough space. Signed-off-by: Sean Young utils/common/ir-encode.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=398e82c3ccaf035a87102c4b5dbe1c79972f7b57 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index 069e7feb6d54..c05718791518 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -390,7 +390,7 @@ static const struct { [RC_PROTO_NECX] = { "necx", 0xff, 67, 38000, nec_encode }, [RC_PROTO_NEC32] = { "nec32", 0x, 67, 38000, nec_encode }, [RC_PROTO_SANYO] = { "sanyo", 0x1f, 87, 38000, sanyo_encode }, - [RC_PROTO_RC6_0] = { "rc6_0", 0x, 41, 36000, rc6_encode }, + [RC_PROTO_RC6_0] = { "rc6_0", 0x, 43, 36000, rc6_encode }, [RC_PROTO_RC6_6A_20] = { "rc6_6a_20", 0xf, 52, 36000, rc6_encode }, [RC_PROTO_RC6_6A_24] = { "rc6_6a_24", 0xff, 60, 36000, rc6_encode }, [RC_PROTO_RC6_6A_32] = { "rc6_6a_32", 0x, 76, 36000, rc6_encode },
[git:v4l-utils/master] keytable: fix stdout/stderr inconsistency
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix stdout/stderr inconsistency Author: Vince Ricosti Date:Sat Apr 20 17:01:14 2024 +0200 This patch fix the keytable inconsistency about stdout/stderr. Signed-off-by: Vince Ricosti Signed-off-by: Sean Young utils/keytable/keytable.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e71a9b0c8f17c08036fbfd6336b3ec27271d3468 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 9f7575d6953b..dac99f5e7534 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1714,7 +1714,7 @@ static int set_rate(int fd, unsigned int delay, unsigned int period) return -1; } - printf(_("Changed Repeat delay to %d ms and repeat period to %d ms\n"), delay, period); + fprintf(stderr, _("Changed Repeat delay to %d ms and repeat period to %d ms\n"), delay, period); return 0; } @@ -1728,7 +1728,7 @@ static int get_rate(int fd, unsigned int *delay, unsigned int *period) } *delay = rep[0]; *period = rep[1]; - printf(_("Repeat delay: %d ms, repeat period: %d ms\n"), *delay, *period); + fprintf(stderr, _("Repeat delay: %d ms, repeat period: %d ms\n"), *delay, *period); return 0; } @@ -1736,7 +1736,7 @@ static void show_evdev_attribs(int fd) { unsigned int delay, period; - printf("\t"); + fprintf(stderr, "\t"); get_rate(fd, &delay, &period); } @@ -1839,10 +1839,10 @@ static void show_bpf(const char *lirc_name) goto error; } - printf(_("\tAttached BPF protocols: ")); + fprintf(stderr, _("\tAttached BPF protocols: ")); for (i=0; i\n")); + fprintf(stderr, _("\tExtra capabilities: \n")); } } }
[git:v4l-utils/master] ir-ctl: fix encoding pulse_length bpf encoder
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: fix encoding pulse_length bpf encoder Author: Sean Young Date:Tue Apr 23 17:53:06 2024 +0100 Transmitting pulse_length is broken and never worked. The most common user of this protocol is Sony, which already has its own encoder. Signed-off-by: Sean Young utils/ir-ctl/bpf_encoder.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3944af31f58db873129d25db42a7a39c1ac3942d diff --git a/utils/ir-ctl/bpf_encoder.c b/utils/ir-ctl/bpf_encoder.c index 886f046f4b6d..2bc7b5417cff 100644 --- a/utils/ir-ctl/bpf_encoder.c +++ b/utils/ir-ctl/bpf_encoder.c @@ -61,24 +61,25 @@ static void encode_pulse_length(struct keymap *map, uint32_t scancode, int *buf, if (keymap_param(map, "reverse", 0)) { for (i = 0; i < bits; i++) { if (scancode & (1 << i)) - buf[len++] = keymap_param(map, "bit_1_space", 1625); + buf[len++] = keymap_param(map, "bit_1_pulse", 1625); else - buf[len++] = keymap_param(map, "bit_0_space", 375); + buf[len++] = keymap_param(map, "bit_0_pulse", 375); - buf[len++] = keymap_param(map, "bit_pulse", 625); + buf[len++] = keymap_param(map, "bit_space", 625); } } else { for (i = bits - 1; i >= 0; i--) { if (scancode & (1 << i)) - buf[len++] = keymap_param(map, "bit_1_space", 1625); + buf[len++] = keymap_param(map, "bit_1_pulse", 1625); else - buf[len++] = keymap_param(map, "bit_0_space", 375); + buf[len++] = keymap_param(map, "bit_0_pulse", 375); - buf[len++] = keymap_param(map, "bit_pulse", 625); + buf[len++] = keymap_param(map, "bit_space", 625); } } - *length = len; + /* drop trailing space */ + *length = len - 1; } static void manchester_advance_space(int *buf, int *len, unsigned length) @@ -121,8 +122,8 @@ static void encode_manchester(struct keymap *map, uint32_t scancode, int *buf, i } } - /* drop any trailing pulse */ -*length = (len % 2) ? len : len + 1; + /* drop any trailing space */ + *length = (len % 2) ? len : len + 1; } bool encode_bpf_protocol(struct keymap *map, uint32_t scancode, int *buf, int *length)
[git:v4l-utils/master] ir-ctl: add optional header to manchester encoding
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: add optional header to manchester encoding Author: Sean Young Date:Tue Apr 23 17:53:41 2024 +0100 The optional header was not included when transmitting. Signed-off-by: Sean Young utils/ir-ctl/bpf_encoder.c | 8 1 file changed, 8 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=9b21a19217468103fb36331021cc915713ea382f diff --git a/utils/ir-ctl/bpf_encoder.c b/utils/ir-ctl/bpf_encoder.c index 1d075d94e4f3..886f046f4b6d 100644 --- a/utils/ir-ctl/bpf_encoder.c +++ b/utils/ir-ctl/bpf_encoder.c @@ -101,6 +101,14 @@ static void encode_manchester(struct keymap *map, uint32_t scancode, int *buf, i { int len = 0, bits, i; + int header_pulse = keymap_param(map, "header_pulse", 0); + int header_space = keymap_param(map, "header_space", 0); + + if (header_pulse > 0) { + manchester_advance_pulse(buf, &len, header_pulse); + manchester_advance_space(buf, &len, header_space); + } + bits = keymap_param(map, "bits", 14); for (i = bits - 1; i >= 0; i--) {
[git:v4l-utils/stable-1.26] ir-ctl: correct max_size for rc5 and rc5_sz
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: correct max_size for rc5 and rc5_sz Author: Sean Young Date:Fri Apr 19 10:29:01 2024 +0100 These protocols can produce more edges. Signed-off-by: Sean Young (cherry picked from commit 0fed77f778b8ae2f3bc5ec264e73b1b7d065b228) utils/common/ir-encode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b349f7b63687dd56e1dfa8b1e0b59a7a37c26185 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index 4d43eb9d2e55..069e7feb6d54 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -379,9 +379,9 @@ static const struct { } protocols[] = { [RC_PROTO_UNKNOWN] = { "unknown" }, [RC_PROTO_OTHER] = { "other" }, - [RC_PROTO_RC5] = { "rc5", 0x1f7f, 24, 36000, rc5_encode }, + [RC_PROTO_RC5] = { "rc5", 0x1f7f, 25, 36000, rc5_encode }, [RC_PROTO_RC5X_20] = { "rc5x_20", 0x1f7f3f, 40, 36000, rc5_encode }, - [RC_PROTO_RC5_SZ] = { "rc5_sz", 0x2fff, 26, 36000, rc5_encode }, + [RC_PROTO_RC5_SZ] = { "rc5_sz", 0x2fff, 27, 36000, rc5_encode }, [RC_PROTO_SONY12] = { "sony12", 0x1f007f, 25, 4, sony_encode }, [RC_PROTO_SONY15] = { "sony15", 0xff007f, 31, 4, sony_encode }, [RC_PROTO_SONY20] = { "sony20", 0x1fff7f, 41, 4, sony_encode }, @@ -390,7 +390,7 @@ static const struct { [RC_PROTO_NECX] = { "necx", 0xff, 67, 38000, nec_encode }, [RC_PROTO_NEC32] = { "nec32", 0x, 67, 38000, nec_encode }, [RC_PROTO_SANYO] = { "sanyo", 0x1f, 87, 38000, sanyo_encode }, - [RC_PROTO_RC6_0] = { "rc6_0", 0x, 24, 36000, rc6_encode }, + [RC_PROTO_RC6_0] = { "rc6_0", 0x, 41, 36000, rc6_encode }, [RC_PROTO_RC6_6A_20] = { "rc6_6a_20", 0xf, 52, 36000, rc6_encode }, [RC_PROTO_RC6_6A_24] = { "rc6_6a_24", 0xff, 60, 36000, rc6_encode }, [RC_PROTO_RC6_6A_32] = { "rc6_6a_32", 0x, 76, 36000, rc6_encode },
[git:v4l-utils/master] ir-ctl: correct max_size for rc5 and rc5_sz
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: correct max_size for rc5 and rc5_sz Author: Sean Young Date:Fri Apr 19 10:29:01 2024 +0100 These protocols can produce more edges. Signed-off-by: Sean Young utils/common/ir-encode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=0fed77f778b8ae2f3bc5ec264e73b1b7d065b228 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index 4d43eb9d2e55..069e7feb6d54 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -379,9 +379,9 @@ static const struct { } protocols[] = { [RC_PROTO_UNKNOWN] = { "unknown" }, [RC_PROTO_OTHER] = { "other" }, - [RC_PROTO_RC5] = { "rc5", 0x1f7f, 24, 36000, rc5_encode }, + [RC_PROTO_RC5] = { "rc5", 0x1f7f, 25, 36000, rc5_encode }, [RC_PROTO_RC5X_20] = { "rc5x_20", 0x1f7f3f, 40, 36000, rc5_encode }, - [RC_PROTO_RC5_SZ] = { "rc5_sz", 0x2fff, 26, 36000, rc5_encode }, + [RC_PROTO_RC5_SZ] = { "rc5_sz", 0x2fff, 27, 36000, rc5_encode }, [RC_PROTO_SONY12] = { "sony12", 0x1f007f, 25, 4, sony_encode }, [RC_PROTO_SONY15] = { "sony15", 0xff007f, 31, 4, sony_encode }, [RC_PROTO_SONY20] = { "sony20", 0x1fff7f, 41, 4, sony_encode }, @@ -390,7 +390,7 @@ static const struct { [RC_PROTO_NECX] = { "necx", 0xff, 67, 38000, nec_encode }, [RC_PROTO_NEC32] = { "nec32", 0x, 67, 38000, nec_encode }, [RC_PROTO_SANYO] = { "sanyo", 0x1f, 87, 38000, sanyo_encode }, - [RC_PROTO_RC6_0] = { "rc6_0", 0x, 24, 36000, rc6_encode }, + [RC_PROTO_RC6_0] = { "rc6_0", 0x, 41, 36000, rc6_encode }, [RC_PROTO_RC6_6A_20] = { "rc6_6a_20", 0xf, 52, 36000, rc6_encode }, [RC_PROTO_RC6_6A_24] = { "rc6_6a_24", 0xff, 60, 36000, rc6_encode }, [RC_PROTO_RC6_6A_32] = { "rc6_6a_32", 0x, 76, 36000, rc6_encode },
[git:v4l-utils/master] ir-ctl: clear errno before strtol
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: clear errno before strtol Author: Vince Ricosti Date:Fri Mar 8 12:39:35 2024 + Since strtol does not update errno except for overflow conditions it's better to set it to 0 first, since we always check the value of errno after strtol. Signed-off-by: Vince Ricosti Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 1 + 1 file changed, 1 insertion(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=a18611d8960ff0aefb1c57f15396f4e948e9df3f diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index c480a2b1734d..e662651e4261 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -413,6 +413,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL (keyword[0] == '/' && keyword[1] == '/')) break; + errno = 0; value = strtol(keyword, &p, 10); if (errno || *p) { fprintf(stderr, _("%s:%d: error: expected integer, got `%s'\n"),
[git:v4l-utils/master] keytable: meson: Restrict the installation of 50-rc_keymap.conf
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: meson: Restrict the installation of 50-rc_keymap.conf Author: Fabio Estevam Date:Fri Jan 12 00:17:14 2024 -0300 Currently, meson tries to install 50-rc_keymap.conf even if systemd is not used. Commit 01f2c6c58e6f ("keytable: restrict installation of 50-rc_keymap.conf"), only allowed 50-rc_keymap.conf to be installed when both BPF and systemd were used. Apply the same logic in meson to fix the problem. Signed-off-by: Fabio Estevam Signed-off-by: Sean Young utils/keytable/meson.build | 4 1 file changed, 4 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=a21924ec424c4744af6f2a794e0677eba35dd168 diff --git a/utils/keytable/meson.build b/utils/keytable/meson.build index 4130a4bea514..76ce329eae8e 100644 --- a/utils/keytable/meson.build +++ b/utils/keytable/meson.build @@ -69,6 +69,8 @@ ir_keytable_udev_rules = files( install_data(ir_keytable_udev_rules, install_dir : ir_keytable_system_dir / 'rules.d') +if ir_bpf_enabled +if dep_systemd.found() if have_udevdsyscallfilter ir_keytable_systemd_files = files( '50-rc_keymap.conf', @@ -76,6 +78,8 @@ if have_udevdsyscallfilter install_data(ir_keytable_systemd_files, install_dir : systemd_systemdir / 'systemd-udevd.service.d') endif +endif +endif # Install non-existing directory to create empty directory structure # See: https://github.com/mesonbuild/meson/issues/2904 ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.26] keytable: fix segfault when reading legacy keymaps
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix segfault when reading legacy keymaps Author: Matthias Reichl Date:Wed Dec 20 17:00:03 2023 +0100 Since commit ae1492611432 ("keytable: remove line length limits") ir-keytable crashes when reading keymaps in legacy (non-toml) format and valgrind reports an UMR: valgrind ir-keytable -w /etc/rc_keymaps/hiastest ... ==83788== Conditional jump or move depends on uninitialised value(s) ==83788==at 0x48E8B8C: getdelim (iogetdelim.c:59) ==83788==by 0x1105C6: getline (stdio.h:120) ==83788==by 0x1105C6: parse_plain_keymap (keymap.c:98) ==83788==by 0x1105C6: parse_keymap (keymap.c:533) ==83788==by 0x112798: parse_opt (keytable.c:569) ==83788==by 0x4986E50: group_parse (argp-parse.c:257) ==83788==by 0x4986E50: parser_parse_opt (argp-parse.c:747) ==83788==by 0x4986E50: parser_parse_next (argp-parse.c:867) ==83788==by 0x4986E50: argp_parse (argp-parse.c:921) ==83788==by 0x10E470: main (keytable.c:2071) Fix this by properly initializing line to NULL so getline will allocate a buffer instead of using some random memory locations. Signed-off-by: Matthias Reichl Signed-off-by: Sean Young (cherry picked from commit f105c1eff03489f9e317009c4d9f56a61171ee5f) utils/common/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=5fa4eb45ee2fd447c102b35da61c0b8920398b20 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 04c5ef54723c..21c1c0b5d581 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -75,7 +75,7 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb { FILE *fin; int line_no = 0; - char *scancode, *keycode, *line; + char *scancode, *keycode, *line = NULL; size_t line_size; struct scancode_entry *se; struct keymap *map; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: fix segfault when reading legacy keymaps
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix segfault when reading legacy keymaps Author: Matthias Reichl Date:Wed Dec 20 17:00:03 2023 +0100 Since commit ae1492611432 ("keytable: remove line length limits") ir-keytable crashes when reading keymaps in legacy (non-toml) format and valgrind reports an UMR: valgrind ir-keytable -w /etc/rc_keymaps/hiastest ... ==83788== Conditional jump or move depends on uninitialised value(s) ==83788==at 0x48E8B8C: getdelim (iogetdelim.c:59) ==83788==by 0x1105C6: getline (stdio.h:120) ==83788==by 0x1105C6: parse_plain_keymap (keymap.c:98) ==83788==by 0x1105C6: parse_keymap (keymap.c:533) ==83788==by 0x112798: parse_opt (keytable.c:569) ==83788==by 0x4986E50: group_parse (argp-parse.c:257) ==83788==by 0x4986E50: parser_parse_opt (argp-parse.c:747) ==83788==by 0x4986E50: parser_parse_next (argp-parse.c:867) ==83788==by 0x4986E50: argp_parse (argp-parse.c:921) ==83788==by 0x10E470: main (keytable.c:2071) Fix this by properly initializing line to NULL so getline will allocate a buffer instead of using some random memory locations. Signed-off-by: Matthias Reichl Signed-off-by: Sean Young utils/common/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=f105c1eff03489f9e317009c4d9f56a61171ee5f diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 04c5ef54723c..21c1c0b5d581 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -75,7 +75,7 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb { FILE *fin; int line_no = 0; - char *scancode, *keycode, *line; + char *scancode, *keycode, *line = NULL; size_t line_size; struct scancode_entry *se; struct keymap *map; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: meson not passing rc_keymaps system directory
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: meson not passing rc_keymaps system directory Author: Rudi Heitbaum Date:Sat Dec 9 21:14:18 2023 + In the meson build ir_keytable_system_dir is used as the parent directory for both rc_keymaps and rules.d, whereas udevrulesdir was defined sepeartely in the configure script. Update the -DIR_KEYTABLE_SYSTEM_DIR to include the rc_keymaps subdirectory aligning with the install_data functions. Signed-off-by: Rudi Heitbaum Signed-off-by: Sean Young utils/keytable/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=7823e3dc0dcf88f114514b42b945941cc4d0729d diff --git a/utils/keytable/meson.build b/utils/keytable/meson.build index 0ca08a183d1d..4130a4bea514 100644 --- a/utils/keytable/meson.build +++ b/utils/keytable/meson.build @@ -17,7 +17,7 @@ ir_keytable_system_dir = udevdir ir_keytable_user_dir = get_option('sysconfdir') / 'rc_keymaps' ir_keytable_c_args = [ -'-DIR_KEYTABLE_SYSTEM_DIR="@0@"'.format(ir_keytable_system_dir), +'-DIR_KEYTABLE_SYSTEM_DIR="@0@"'.format(ir_keytable_system_dir / 'rc_keymaps'), '-DIR_KEYTABLE_USER_DIR="@0@"'.format(ir_keytable_user_dir), ] ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: remove line length limits
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: remove line length limits Author: Sean Young Date:Mon Dec 4 08:53:10 2023 + By using getline() rather than fgets(), there is no limit on the line length. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1014887 Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 20 1 file changed, 12 insertions(+), 8 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=f7e4ee2b571505102328cb3c76bbd44ddb3c9c90 diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 3c389bd9e09f..c480a2b1734d 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -58,8 +58,6 @@ #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 "; @@ -218,7 +216,8 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn { bool expect_pulse = true; int lineno = 0, lastspace = 0; - char line[LINE_SIZE]; + char *line = NULL; + size_t line_size; int len = 0; static const char whitespace[] = " \n\r\t"; struct send *f; @@ -232,7 +231,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn f->carrier = UNSET; f->fname = fname; - while (fgets(line, sizeof(line), input)) { + while (getline(&line, &line_size, input) > 0) { char *p, *saveptr; lineno++; char *keyword = strtok_r(line, whitespace, &saveptr); @@ -364,6 +363,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn } } + free(line); fclose(input); if (len == 0) { @@ -386,7 +386,8 @@ 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[LINE_SIZE]; + char *line = NULL; + size_t line_size; int len = 0; static const char whitespace[] = " \n\r\t,"; struct send *f; @@ -401,7 +402,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL f->carrier = UNSET; f->fname = fname; - while (fgets(line, sizeof(line), input)) { + while (getline(&line, &line_size, input) > 0) { long int value; char *p, *saveptr; lineno++; @@ -457,6 +458,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL } } + free(line); fclose(input); if (len == 0) { @@ -479,14 +481,15 @@ 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[LINE_SIZE]; + char *line = NULL; + size_t line_size; if (!input) { fprintf(stderr, _("%s: could not open: %m\n"), fname); return NULL; } - while (fgets(line, sizeof(line), input)) { + while (getline(&line, &line_size, input) > 0) { int start = 0; while (isspace(line[start])) @@ -510,6 +513,7 @@ static struct send *read_file(struct arguments *args, const char *fname) } } + free(line); fclose(input); fprintf(stderr, _("%s: file is empty\n"), fname); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: remove line length limits
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: remove line length limits Author: Sean Young Date:Mon Dec 4 14:39:41 2023 + Use getline() rather than fgets(). Signed-off-by: Sean Young utils/common/keymap.c | 16 +++-- utils/keytable/keytable.c | 60 +-- 2 files changed, 52 insertions(+), 24 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=ae1492611432bb158e3be292ed10ed95541893b4 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 47d36152be15..04c5ef54723c 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -74,8 +74,9 @@ void free_keymap(struct keymap *map) static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verbose) { FILE *fin; - int line = 0; - char *scancode, *keycode, s[2048]; + int line_no = 0; + char *scancode, *keycode, *line; + size_t line_size; struct scancode_entry *se; struct keymap *map; @@ -94,13 +95,13 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb return EINVAL; } - while (fgets(s, sizeof(s), fin)) { - char *p = s; + while (getline(&line, &line_size, fin) >= 0) { + char *p = line; - line++; + line_no++; while (*p == ' ' || *p == '\t') p++; - if (line==1 && p[0] == '#') { + if (line_no==1 && p[0] == '#') { p++; p = strtok(p, "\n\t =:"); do { @@ -168,6 +169,7 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb map->scancode = se; } fclose(fin); + free(line); if (!map->protocol) { fprintf(stderr, _("Missing protocol in %s\n"), fname); @@ -181,7 +183,7 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb err_einval: free_keymap(map); fprintf(stderr, _("Invalid parameter on line %d of %s\n"), - line, fname); + line_no, fname); return EINVAL; } diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 62f4531e0ba5..9f7575d6953b 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -459,9 +459,9 @@ static int add_keymap(struct keymap *map, const char *fname) static error_t parse_cfgfile(char *fname) { FILE *fin; - int line = 0; - char s[2048]; - char *driver, *table, *filename; + int line_no = 0; + char *driver, *table, *filename, *line = NULL; + size_t line_size; struct cfgfile *nextcfg = &cfg; if (debug) @@ -473,10 +473,10 @@ static error_t parse_cfgfile(char *fname) return errno; } - while (fgets(s, sizeof(s), fin)) { - char *p = s; + while (getline(&line, &line_size, fin) > 0) { + char *p = line; - line++; + line_no++; while (*p == ' ' || *p == '\t') p++; @@ -511,17 +511,22 @@ static error_t parse_cfgfile(char *fname) nextcfg->next = calloc(1, sizeof(*nextcfg)); if (!nextcfg->next) { perror("parse_cfgfile"); + fclose(fin); + free(line); return ENOMEM; } nextcfg = nextcfg->next; } fclose(fin); + free(line); return 0; err_einval: + free(line); + fclose(fin); fprintf(stderr, _("Invalid parameter on line %d of %s\n"), - line, fname); + line_no, fname); return EINVAL; } @@ -825,7 +830,8 @@ static struct uevents *read_sysfs_uevents(char *dname) { FILE*fp; struct uevents *next, *uevent; - char*event = "uevent", *file, s[4096]; + char*event = "uevent", *file, *line = NULL; + size_t line_size; next = uevent = calloc(1, sizeof(*uevent)); @@ -843,13 +849,15 @@ static struct uevents *read_sysfs_uevents(char *dname) free(file); return NULL; } - while (fgets(s, sizeof(s), fp)) { - char *p = strtok(s, "="); + while (getline(&line, &line_size, fp) > 0) { + char *p = strtok(line, "="); if (!p) continue; n
[git:v4l-utils/master] keytable: fix repeat formatting
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix repeat formatting Author: Vince Ricosti Date:Sun Nov 5 20:23:04 2023 + Here is a dump of ir-keytable output: Found /sys/class/rc/rc0/ with: Name: gpio_ir_recv Driver: gpio_ir_recv Default keymap: rc-rc6-mce Input device: /dev/input/event0 LIRC device: /dev/lirc1 Attached BPF protocols: Operation non permise Supported kernel protocols: lirc rc-5 rc-5-sz jvc sony nec sanyo mce_kbd rc-6 sharp xmp imon Enabled kernel protocols: lirc sony bus: 25, vendor/product: 0001:0001, version: 0x0100 Repeat delay = 500 ms, repeat period = 125 ms The last line does not respect the key: value syntax because we have Repeat delay = 500 ms, repeat period = 125 ms instead of Repeat delay: 500 ms, repeat period: 125 ms Signed-off-by: Vince Ricosti Signed-off-by: Sean Young utils/keytable/keytable.c | 2 +- v4l-utils-po/ca.po | 2 +- v4l-utils-po/de.po | 4 ++-- v4l-utils-po/fr.po | 2 +- v4l-utils-po/pt_BR.po | 4 ++-- v4l-utils-po/uk.po | 2 +- v4l-utils-po/v4l-utils.pot | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=fcf62ab17d69bc9ddb59e8d0ee7a8b56d9eba336 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 3d5a3c51afa8..62f4531e0ba5 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1702,7 +1702,7 @@ static int get_rate(int fd, unsigned int *delay, unsigned int *period) } *delay = rep[0]; *period = rep[1]; - printf(_("Repeat delay = %d ms, repeat period = %d ms\n"), *delay, *period); + printf(_("Repeat delay: %d ms, repeat period: %d ms\n"), *delay, *period); return 0; } diff --git a/v4l-utils-po/ca.po b/v4l-utils-po/ca.po index bbe35f385951..b93bd6f6e552 100644 --- a/v4l-utils-po/ca.po +++ b/v4l-utils-po/ca.po @@ -506,7 +506,7 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" msgstr "" #: utils/keytable/keytable.c:1725 diff --git a/v4l-utils-po/de.po b/v4l-utils-po/de.po index 22a093e783de..cd7dc5bf8012 100644 --- a/v4l-utils-po/de.po +++ b/v4l-utils-po/de.po @@ -563,8 +563,8 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" -msgstr "Wiederholungsverzögerung = %d ms, Wiederholungsperiode = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" +msgstr "Wiederholungsverzögerung: %d ms, Wiederholungsperiode: %d ms\n" #: utils/keytable/keytable.c:1725 #, c-format diff --git a/v4l-utils-po/fr.po b/v4l-utils-po/fr.po index 94e59d9eda76..a966caf99b4b 100644 --- a/v4l-utils-po/fr.po +++ b/v4l-utils-po/fr.po @@ -550,7 +550,7 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" msgstr "" #: utils/keytable/keytable.c:1725 diff --git a/v4l-utils-po/pt_BR.po b/v4l-utils-po/pt_BR.po index eeaa1bef9054..f7314b88ca29 100644 --- a/v4l-utils-po/pt_BR.po +++ b/v4l-utils-po/pt_BR.po @@ -566,8 +566,8 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" -msgstr "Intervalo de repetição = %d ms, perÃodo de repetição = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" +msgstr "Intervalo de repetição: %d ms, perÃodo de repetição: %d ms\n" #: utils/keytable/keytable.c:1725 #, c-format diff --git a/v4l-utils-po/uk.po b/v4l-utils-po/uk.po index 673b6c32ab4c..5e6576c69321 100644 --- a/v4l-utils-po/uk.po +++ b/v4l-utils-po/uk.po @@ -509,7 +509,7 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" msgstr "" #: utils/keytable/keytable.c:1725 diff --git a/v4l-utils-po/v4l-utils.pot b/v4l-utils-po/v4l-utils.pot index 4f82291a297c..aec9f6e1a235 100644 --- a/v4l-utils-po/v4l-utils.pot +++ b/v4l-utils-po/v4l-utils.pot @@ -506,7 +506,7 @@ msgstr "" #: utils/keytable/keytable.c:1706 #, c-format -msgid "Repeat delay = %d ms, repeat period = %d ms\n" +msgid "Repeat delay: %d ms, repeat period: %d ms\n" msgstr "" #: utils/keytable/keytable.c:1725 ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: fix sharp encoding
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: fix sharp encoding Author: Sean Young Date:Fri Oct 6 15:28:17 2023 +0100 The Sharp protocol[1] encoding has incorrect timings for bit space. [1] https://www.sbprojects.net/knowledge/ir/sharp.php Reported-by: Joe Ferner Closes: https://sourceforge.net/p/lirc/mailman/message/38604507/ Signed-off-by: Sean Young utils/common/ir-encode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e77d513ecff8d085c388f95894363f946f92a3fe diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index b3757e12287b..4d43eb9d2e55 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -144,9 +144,9 @@ static void sharp_add_bits(unsigned **buf, int bits, int count) *(*buf)++ = NS_TO_US(sharp_unit * 8); if (bits & (1 << i)) - *(*buf)++ = NS_TO_US(sharp_unit * 50); + *(*buf)++ = NS_TO_US(sharp_unit * 42); else - *(*buf)++ = NS_TO_US(sharp_unit * 25); + *(*buf)++ = NS_TO_US(sharp_unit * 17); } } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.24] keytable: open lirc for read/write for attaching/detaching bpf programs
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: open lirc for read/write for attaching/detaching bpf programs Author: Sean Young Date:Thu Apr 13 13:27:55 2023 +0100 Signed-off-by: Sean Young utils/keytable/keytable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=adbe57c563be8b9b597f89bcbb7b960b3b6dd344 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 6cd1244fc86a..c694f977471f 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1753,7 +1753,7 @@ static bool attach_bpf(const char *lirc_name, const char *bpf_prog, struct proto struct rlimit rl; int fd, ret; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return false; @@ -1844,7 +1844,7 @@ static void clear_bpf(const char *lirc_name) unsigned int features, i; int ret, prog_fd, fd; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: open lirc for read/write for attaching/detaching bpf programs
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: open lirc for read/write for attaching/detaching bpf programs Author: Sean Young Date:Thu Apr 13 13:27:55 2023 +0100 Signed-off-by: Sean Young utils/keytable/keytable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=680a70b7d0e957ff677793c58336df4dc02933b5 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index c47211fae6ef..3d5a3c51afa8 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1752,7 +1752,7 @@ static bool attach_bpf(const char *lirc_name, const char *bpf_prog, struct proto struct rlimit rl; int fd, ret; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return false; @@ -1843,7 +1843,7 @@ static void clear_bpf(const char *lirc_name) unsigned int features, i; int ret, prog_fd, fd; - fd = open(lirc_name, O_RDONLY); + fd = open(lirc_name, O_RDWR); if (fd == -1) { perror(lirc_name); return; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: Add -fno-stack-protector compilation option
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: Add -fno-stack-protector compilation option Author: Laurent Pinchart Date:Sun Feb 12 00:14:01 2023 +0200 clang may come with stack protector enabled by default, which caused compilation errors for BPF programs: FAILED: utils/keytable/bpf_protocols/grundig.o /usr/lib/llvm/15/bin/clang -idirafter /usr/lib/llvm/15/bin/../../../../lib/clang/15.0.6/include -idirafter /usr/local/include -idirafter /usr/include -D__linux__ -target bpf -O2 -c ../../utils/keytable/bpf_protocols/grundig.c -o utils/keytable/bpf_protocols/grundig.o ../../utils/keytable/bpf_protocols/grundig.c:50:5: error: A call to built-in function '__stack_chk_fail' is not supported. int bpf_decoder(unsigned int *sample) ^ 1 error generated. Disable the stack protector to fix this, as recommended in [1]. [1] https://www.spinics.net/lists/netdev/msg556400.html Signed-off-by: Laurent Pinchart Signed-off-by: Sean Young utils/keytable/bpf_protocols/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=077a5d57be58fb8bcddb0cda288d98d3f504ca02 diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am index 13be2794791b..6096c0de5813 100644 --- a/utils/keytable/bpf_protocols/Makefile.am +++ b/utils/keytable/bpf_protocols/Makefile.am @@ -8,7 +8,7 @@ CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - &1 \ | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }') %.o: %.c bpf_helpers.h - $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $< + $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -fno-stack-protector -O2 -c $< PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: Convert deprecated libbpf API
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: Convert deprecated libbpf API Author: Sudip Mukherjee Date:Tue Nov 1 20:25:28 2022 + The libbpf APIs bpf_load_program_xattr(), bpf_create_map_node() and bpf_create_map_in_map_node() have been deprecated since v0.7. Convert them to use bpf_prog_load() and bpf_map_create(). Also, modify config script to add a check for libbpf version. Signed-off-by: Sudip Mukherjee Signed-off-by: Sean Young configure.ac | 2 +- utils/keytable/bpf_load.c | 59 ++- 2 files changed, 34 insertions(+), 27 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dce0e3e1e4ea91d3e46098362a880371ec5afe1b diff --git a/configure.ac b/configure.ac index 0529898177d3..9b7c371d84d2 100644 --- a/configure.ac +++ b/configure.ac @@ -564,7 +564,7 @@ AM_CONDITIONAL([WITH_V4L2_CTL_32], [test x${enable_v4l2_ctl_32} = xyes]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE], [test x$ac_cv_func_fork = xyes]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes]) -PKG_CHECK_MODULES([LIBBPF], [libbpf], [bpf_pc=yes], [bpf_pc=no]) +PKG_CHECK_MODULES([LIBBPF], [libbpf >= 0.7], [bpf_pc=yes], [bpf_pc=no]) AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang -a x$bpf_pc = xyes]) # append -static to libtool compile and link command to enforce static libs diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index 7c633dac3893..06098fc3e3b0 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -63,19 +63,17 @@ struct bpf_file { static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, struct bpf_insn *prog, int size) { - struct bpf_load_program_attr load_attr; - int fd, err; + LIBBPF_OPTS(bpf_prog_load_opts, opts); + int fd, err, insn_cnt; - memset(&load_attr, 0, sizeof(struct bpf_load_program_attr)); + insn_cnt = size / sizeof(struct bpf_insn); - load_attr.prog_type = BPF_PROG_TYPE_LIRC_MODE2; - load_attr.expected_attach_type = BPF_LIRC_MODE2; - load_attr.name = bpf_file->name; - load_attr.insns = prog; - load_attr.insns_cnt = size / sizeof(struct bpf_insn); - load_attr.license = bpf_file->license; + opts.expected_attach_type = BPF_LIRC_MODE2; + opts.log_buf = bpf_log_buf; + opts.log_size = LOG_BUF_SIZE; - fd = bpf_load_program_xattr(&load_attr, bpf_log_buf, LOG_BUF_SIZE); + fd = bpf_prog_load(BPF_PROG_TYPE_LIRC_MODE2, bpf_file->name, + bpf_file->license, prog, insn_cnt, &opts); if (fd < 0) { printf("bpf_load_program() err=%m\n%s", bpf_log_buf); return -1; @@ -95,6 +93,9 @@ static int build_raw_map(struct bpf_map_data *map, struct raw_entry *raw, int nu int no_patterns, value_size, fd, key, i; struct raw_entry *e; struct raw_pattern *p; + LIBBPF_OPTS(bpf_map_create_opts, opts, + .map_flags = map->def.map_flags, + ); no_patterns = 0; @@ -110,14 +111,13 @@ static int build_raw_map(struct bpf_map_data *map, struct raw_entry *raw, int nu value_size = sizeof(struct raw_pattern) + max_length * sizeof(short); - fd = bpf_create_map_node(map->def.type, -map->name, -map->def.key_size, -value_size, -no_patterns, -map->def.map_flags, -numa_node); - + opts.numa_node = numa_node; + fd = bpf_map_create(map->def.type, + map->name, + map->def.key_size, + value_size, + no_patterns, + &opts); if (fd < 0) { printf(_("failed to create a map: %d %s\n"), errno, strerror(errno)); @@ -174,27 +174,34 @@ static int load_maps(struct bpf_file *bpf_file, struct raw_entry *raw) if (maps[i].def.type == BPF_MAP_TYPE_ARRAY_OF_MAPS || maps[i].def.type == BPF_MAP_TYPE_HASH_OF_MAPS) { - int inner_map_fd = bpf_file->map_fd[maps[i].def.inner_map_idx]; + LIBBPF_OPTS(bpf_map_create_opts, opts, + .inner_map_fd = bpf_file->map_fd[maps[i].def.inner_map_idx], + .ma
[git:v4l-utils/master] keytable: provide configuration for empty keymap
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: provide configuration for empty keymap Author: Sean Young Date:Mon Sep 26 17:26:17 2022 +0100 The lirc documentation contains some drastic measures for disabling in-kernel decoding. Provide a simpler method of disabling kernel decoding: simply set /etc/rc_maps.cfg to: * * empty.toml Signed-off-by: Sean Young utils/keytable/keytable.c | 23 ++- utils/keytable/rc_keymaps_userspace/empty.toml | 2 ++ 2 files changed, 12 insertions(+), 13 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=a588a16a57a6819ceda9845c85b21d6848c41006 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 248493a94ac0..6cd1244fc86a 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -382,14 +382,16 @@ static int add_keymap(struct keymap *map, const char *fname) protocol = parse_sysfs_protocol(map->protocol, false); if (protocol == SYSFS_INVALID) { - struct bpf_protocol *b; - - b = malloc(sizeof(*b)); - b->name = strdup(map->protocol); - b->param = map->param; - /* steal param */ - map->param = NULL; - add_bpf_protocol(b); + if (strcmp(map->protocol, "none")) { + struct bpf_protocol *b; + + b = malloc(sizeof(*b)); + b->name = strdup(map->protocol); + b->param = map->param; + /* steal param */ + map->param = NULL; + add_bpf_protocol(b); + } } else { ch_proto |= protocol; } @@ -2105,11 +2107,6 @@ int main(int argc, char *argv[]) } add_keymap(map, fname); free_keymap(map); - if (!keytable) { - fprintf(stderr, _("Empty keymap %s\n"), fname); - free(fname); - return -1; - } free(fname); clear = 1; matches++; diff --git a/utils/keytable/rc_keymaps_userspace/empty.toml b/utils/keytable/rc_keymaps_userspace/empty.toml new file mode 100644 index ..0c0b5e693371 --- /dev/null +++ b/utils/keytable/rc_keymaps_userspace/empty.toml @@ -0,0 +1,2 @@ +[[protocols]] +protocol = "none" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] v4l-utils: sync with latest media staging tree
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: v4l-utils: sync with latest media staging tree Author: Sean Young Date:Fri Jan 28 15:23:17 2022 + This merges the latest lirc.h changes. Signed-off-by: Sean Young include/linux/bpf.h| 165 - include/linux/lirc.h | 15 ++- utils/keytable/rc_keymaps/ct_90405.toml| 55 + utils/keytable/rc_keymaps/mecool_kii_pro.toml | 51 utils/keytable/rc_keymaps/mecool_kiii_pro.toml | 49 5 files changed, 325 insertions(+), 10 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=d18ba0d8984639ac2c5c8eeca53467d4f7919d98 diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 0c3a514a35b3..af474c44a579 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1342,8 +1342,10 @@ union bpf_attr { /* or valid module BTF object fd or 0 to attach to vmlinux */ __u32 attach_btf_obj_fd; }; - __u32 :32;/* pad */ + __u32 core_relo_cnt; /* number of bpf_core_relo */ __aligned_u64 fd_array; /* array of FDs */ + __aligned_u64 core_relos; + __u32 core_relo_rec_size; /* sizeof(struct bpf_core_relo) */ }; struct { /* anonymous struct used by BPF_OBJ_* commands */ @@ -1744,7 +1746,7 @@ union bpf_attr { * if the maximum number of tail calls has been reached for this * chain of programs. This limit is defined in the kernel by the * macro **MAX_TAIL_CALL_CNT** (not accessible to user space), - * which is currently set to 32. + * which is currently set to 33. * Return * 0 on success, or a negative error in case of failure. * @@ -4938,6 +4940,84 @@ union bpf_attr { * **-ENOENT** if symbol is not found. * * **-EPERM** if caller does not have permission to obtain kernel address. + * + * long bpf_find_vma(struct task_struct *task, u64 addr, void *callback_fn, void *callback_ctx, u64 flags) + * Description + * Find vma of *task* that contains *addr*, call *callback_fn* + * function with *task*, *vma*, and *callback_ctx*. + * The *callback_fn* should be a static function and + * the *callback_ctx* should be a pointer to the stack. + * The *flags* is used to control certain aspects of the helper. + * Currently, the *flags* must be 0. + * + * The expected callback signature is + * + * long (\*callback_fn)(struct task_struct \*task, struct vm_area_struct \*vma, void \*callback_ctx); + * + * Return + * 0 on success. + * **-ENOENT** if *task->mm* is NULL, or no vma contains *addr*. + * **-EBUSY** if failed to try lock mmap_lock. + * **-EINVAL** for invalid **flags**. + * + * long bpf_loop(u32 nr_loops, void *callback_fn, void *callback_ctx, u64 flags) + * Description + * For **nr_loops**, call **callback_fn** function + * with **callback_ctx** as the context parameter. + * The **callback_fn** should be a static function and + * the **callback_ctx** should be a pointer to the stack. + * The **flags** is used to control certain aspects of the helper. + * Currently, the **flags** must be 0. Currently, nr_loops is + * limited to 1 << 23 (~8 million) loops. + * + * long (\*callback_fn)(u32 index, void \*ctx); + * + * where **index** is the current index in the loop. The index + * is zero-indexed. + * + * If **callback_fn** returns 0, the helper will continue to the next + * loop. If return value is 1, the helper will skip the rest of + * the loops and return. Other return values are not used now, + * and will be rejected by the verifier. + * + * Return + * The number of loops performed, **-EINVAL** for invalid **flags**, + * **-E2BIG** if **nr_loops** exceeds the maximum number of loops. + * + * long bpf_strncmp(const char *s1, u32 s1_sz, const char *s2) + * Description + * Do strncmp() between **s1** and **s2**. **s1** doesn't need + * to be null-terminated and **s1_sz** is the maximum storage + * size of **s1**. **s2** must be a read-only string. + * Return + * An integer less than, equal to, or greater than zero + * if the first **s1_sz** bytes of **s1** is found to be + * less than, to match, or be greater than **s2**. + * + * long bpf_get_func_arg(void *ctx, u32
[git:v4l-utils/master] ir-ctl: report ir overflow
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: report ir overflow Author: Sean Young Date:Fri Jan 21 10:51:16 2022 + Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=d124ef52870a0f627d206db31c1b1a59f4c876ed diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 27c309f9449d..240a37524905 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -1197,13 +1197,18 @@ int lirc_receive(struct arguments *args, int fd, unsigned features) case LIRC_MODE2_FREQUENCY: fprintf(out, "carrier %u\n", val); break; + case LIRC_MODE2_OVERFLOW: + fprintf(out, "overflow\n"); + leading_space = true; + break; } } else { switch (msg) { case LIRC_MODE2_TIMEOUT: - fprintf(out, "-%u\n", val); if (carrier) - fprintf(out, " # carrier %uHz, timeout %u\n", carrier, val); + fprintf(out, "-%u # carrier %uHz\n", val, carrier); + else + fprintf(out, "-%u\n", val); leading_space = true; carrier = 0; break; @@ -1216,6 +1221,14 @@ int lirc_receive(struct arguments *args, int fd, unsigned features) case LIRC_MODE2_FREQUENCY: carrier = val; break; + case LIRC_MODE2_OVERFLOW: + if (carrier) + fprintf(out, "# carrier %uHz, overflow\n", carrier); + else + fprintf(out, "# overflow\n"); + leading_space = true; + carrier = 0; + break; } } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: allow for different gaps to be specified
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: allow for different gaps to be specified Author: Sean Young Date:Mon Dec 6 17:38:59 2021 + For example: ir-ctl --send=part1 --gap=1 --send=part2 --gap=2 --send=part3 This would introduce a gap of 1 microseconds between part1 and part2, and 2 microseconds between part2 and part3. Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 126 +- 1 file changed, 63 insertions(+), 63 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b22fc9e53051a7da903b3906826a527ee57ba92c diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 34cde11e45b2..27c309f9449d 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -66,14 +66,20 @@ const char *argp_program_version = "IR ctl version " V4L_UTILS_VERSION; const char *argp_program_bug_address = "Sean Young "; +enum send_ty { + SEND_RAW, + SEND_SCANCODE, + SEND_KEYCODE, + SEND_GAP, +}; + /* * Since this program drives the lirc interface, use the same terminology */ struct send { struct send *next; const char *fname; - bool is_scancode; - bool is_keycode; + enum send_ty ty; union { struct { unsigned carrier; @@ -84,7 +90,8 @@ struct send { unsigned scancode; unsigned protocol; }; - charkeycode[1]; + char keycode[1]; + unsigned gap; }; }; @@ -223,8 +230,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn fprintf(stderr, _("Failed to allocate memory\n")); return NULL; } - f->is_scancode = false; - f->is_keycode = false; + f->ty = SEND_RAW; f->carrier = UNSET; f->fname = fname; @@ -393,8 +399,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL fclose(input); return NULL; } - f->is_scancode = false; - f->is_keycode = false; + f->ty = SEND_RAW; f->carrier = UNSET; f->fname = fname; @@ -549,14 +554,33 @@ static struct send *read_scancode(const char *name) return NULL; } - f->is_scancode = true; - f->is_keycode = false; + f->ty = SEND_SCANCODE; f->scancode = scancode; f->protocol = proto; return f; } +static void add_to_send_list(struct arguments *arguments, struct send *send) +{ + send->next = NULL; + + if (arguments->send == NULL) + arguments->send = send; + else { + // introduce gap + struct send *gap = malloc(sizeof(*gap)); + gap->ty = SEND_GAP; + gap->fname= NULL; + gap->gap = arguments->gap; + gap->next = send; + + struct send *p = arguments->send; + while (p->next) p = p->next; + p->next = gap; + } +} + static error_t parse_opt(int k, char *arg, struct argp_state *state) { struct arguments *arguments = state->input; @@ -664,14 +688,7 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) if (s == NULL) exit(EX_DATAERR); - s->next = NULL; - if (arguments->send == NULL) - arguments->send = s; - else { - struct send *p = arguments->send; - while (p->next) p = p->next; - p->next = s; - } + add_to_send_list(arguments, s); break; case 'S': if (arguments->receive || arguments->features) @@ -680,14 +697,7 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) if (s == NULL) exit(EX_DATAERR); - s->next = NULL; - if (arguments->send == NULL) - arguments->send = s; - else { - struct send *p = arguments->send; - while (p->next) p = p->next; - p->next = s; - } + add_to_send_list(arguments, s); break; case 'K': @@ -696,18 +706,10 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) s = malloc(sizeof(*s) + strlen(arg)); if (s == NULL) exit(EX_DATAERR); - -
[git:v4l-utils/master] ir-ctl: increase the size of the buffer used to read raw files
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: increase the size of the buffer used to read raw files Author: Sean Young Date:Wed Sep 15 17:26:30 2021 +0100 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 Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=1874b2d0dfbb8a38b0c8b75a23a4b9a60e52fd6a diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 3c3bcca15e36..34cde11e45b2 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 "; @@ -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); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: Revert "ir-ctl: print correct transmitter count"
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: Revert "ir-ctl: print correct transmitter count" Author: Sean Young Date:Mon Jul 5 09:33:24 2021 +0100 This change was totally wrong. All the existing drivers (except rc-loopback) return the number of transmitters, not what would be a valid mask. The documentation also says so. This reverts commit eb47c00736586329a2043512dacb10fcf95aa58a. Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=6ffc5248dede6285d76c5ec5680c316f68ff98ca diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 66a257a78c38..3c3bcca15e36 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -933,7 +933,7 @@ static int lirc_options(struct arguments *args, int fd, unsigned features) if (features & LIRC_CAN_SET_TRANSMITTER_MASK) { rc = ioctl(fd, LIRC_SET_TRANSMITTER_MASK, &args->emitters); if (rc > 0) - fprintf(stderr, _("warning: %s: failed to set send transmitters: only %d available\n"), dev, ffs(~rc) - 1); + fprintf(stderr, _("warning: %s: failed to set send transmitters: only %d available\n"), dev, rc); else if (rc < 0) fprintf(stderr, _("warning: %s: failed to set send transmitters: %m\n"), dev); } else @@ -1026,11 +1026,8 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) fprintf(stderr, _("warning: %s: device supports setting transmitter mask but returns 0 as number of transmitters\n"), dev); else if (rc < 0) fprintf(stderr, _("warning: %s: device supports setting transmitter mask but returns: %m\n"), dev); - else { - unsigned count = ffs(~rc) - 1; - - printf(_(" - Set transmitter (%d available)\n"), count); - } + else + printf(_(" - Set transmitter (%d available)\n"), rc); } } else if (features & LIRC_CAN_SEND_LIRCCODE) { printf(_(" - Device can send using device dependent LIRCCODE mode (not supported)\n")); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: print correct transmitter count
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: print correct transmitter count Author: Sean Young Date:Sat Jul 3 15:58:48 2021 +0100 Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=eb47c00736586329a2043512dacb10fcf95aa58a diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 3c3bcca15e36..66a257a78c38 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -933,7 +933,7 @@ static int lirc_options(struct arguments *args, int fd, unsigned features) if (features & LIRC_CAN_SET_TRANSMITTER_MASK) { rc = ioctl(fd, LIRC_SET_TRANSMITTER_MASK, &args->emitters); if (rc > 0) - fprintf(stderr, _("warning: %s: failed to set send transmitters: only %d available\n"), dev, rc); + fprintf(stderr, _("warning: %s: failed to set send transmitters: only %d available\n"), dev, ffs(~rc) - 1); else if (rc < 0) fprintf(stderr, _("warning: %s: failed to set send transmitters: %m\n"), dev); } else @@ -1026,8 +1026,11 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) fprintf(stderr, _("warning: %s: device supports setting transmitter mask but returns 0 as number of transmitters\n"), dev); else if (rc < 0) fprintf(stderr, _("warning: %s: device supports setting transmitter mask but returns: %m\n"), dev); - else - printf(_(" - Set transmitter (%d available)\n"), rc); + else { + unsigned count = ffs(~rc) - 1; + + printf(_(" - Set transmitter (%d available)\n"), count); + } } } else if (features & LIRC_CAN_SEND_LIRCCODE) { printf(_(" - Device can send using device dependent LIRCCODE mode (not supported)\n")); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: ensure BPF IR decoders use correct section name
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: ensure BPF IR decoders use correct section name Author: Sean Young Date:Wed Jun 16 11:48:08 2021 +0100 The convention is to have the type ("lirc_mode2/") prefixed so the BPF loader knows what type it is. Signed-off-by: Sean Young utils/keytable/bpf_load.c | 29 --- utils/keytable/bpf_protocols/grundig.c| 6 +++--- utils/keytable/bpf_protocols/imon_rsc.c | 6 +++--- utils/keytable/bpf_protocols/manchester.c | 6 +++--- utils/keytable/bpf_protocols/pulse_distance.c | 6 +++--- utils/keytable/bpf_protocols/pulse_length.c | 6 +++--- utils/keytable/bpf_protocols/raw.c| 8 utils/keytable/bpf_protocols/rc_mm.c | 6 +++--- utils/keytable/bpf_protocols/samsung36.c | 6 +++--- utils/keytable/bpf_protocols/xbox-dvd.c | 6 +++--- 10 files changed, 50 insertions(+), 35 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=150de0ac2d15b82d874937fcca59675f8b24a13f diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index ec6eb98e8c4b..7c633dac3893 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -58,16 +58,24 @@ struct bpf_file { int strtabidx; Elf_Data *symbols; struct protocol_param *param; + char name[128]; }; static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, struct bpf_insn *prog, int size) { -size_t insns_cnt = size / sizeof(struct bpf_insn); + struct bpf_load_program_attr load_attr; int fd, err; - fd = bpf_load_program(BPF_PROG_TYPE_LIRC_MODE2, prog, insns_cnt, - bpf_file->license, 0, - bpf_log_buf, LOG_BUF_SIZE); + memset(&load_attr, 0, sizeof(struct bpf_load_program_attr)); + + load_attr.prog_type = BPF_PROG_TYPE_LIRC_MODE2; + load_attr.expected_attach_type = BPF_LIRC_MODE2; + load_attr.name = bpf_file->name; + load_attr.insns = prog; + load_attr.insns_cnt = size / sizeof(struct bpf_insn); + load_attr.license = bpf_file->license; + + fd = bpf_load_program_xattr(&load_attr, bpf_log_buf, LOG_BUF_SIZE); if (fd < 0) { printf("bpf_load_program() err=%m\n%s", bpf_log_buf); return -1; @@ -78,6 +86,7 @@ static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, struct bpf_in printf("bpf_prog_attach: err=%m\n"); return -1; } + return 0; } @@ -260,7 +269,7 @@ static int parse_relo_and_apply(struct bpf_file *bpf_file, GElf_Shdr *shdr, } if (match) { - insn[insn_idx].src_reg = BPF_PSEUDO_MAP_FD; + insn[insn_idx].src_reg = BPF_PSEUDO_MAP_FD; insn[insn_idx].imm = bpf_file->map_data[map_idx].fd; continue; } @@ -427,7 +436,7 @@ static int load_elf_maps_section(struct bpf_file *bpf_file) } int load_bpf_file(const char *path, int lirc_fd, struct protocol_param *param, - struct raw_entry *raw) + struct raw_entry *raw) { struct bpf_file bpf_file = { .param = param }; int fd, i, ret; @@ -469,7 +478,8 @@ int load_bpf_file(const char *path, int lirc_fd, struct protocol_param *param, if (strcmp(shname, "license") == 0) { bpf_file.processed_sec[i] = true; memcpy(bpf_file.license, data->d_buf, data->d_size); - } else if (strcmp(shname, "maps") == 0) { + } else if (strcmp(shname, "lirc_mode2/maps") == 0 || + strcmp(shname, "maps") == 0) { int j; bpf_file.maps_shidx = i; @@ -530,6 +540,11 @@ int load_bpf_file(const char *path, int lirc_fd, struct protocol_param *param, !(shdr_prog.sh_flags & SHF_EXECINSTR)) continue; + if (strncmp(shname_prog, "lirc_mode2/", 11)) + strncpy(bpf_file.name, shname_prog, sizeof(bpf_file.name) - 1); + else + strncpy(bpf_file.name, shname_prog + 11, sizeof(bpf_file.name) - 1); + insns = (struct bpf_insn *) data_prog->d_buf; bpf_file.processed_sec[i] = true; /* relo section */ diff --git a/utils/keytable/bpf_protocols/grundig.c b/utils/keytable/bpf_protocols/grundig.c index 4d8cc4b92a23..cdd551f93985 100644 --- a/utils/
[git:v4l-utils/master] ir-ctl: include timeout in raw IR and parse timeout in pulse-space file
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: include timeout in raw IR and parse timeout in pulse-space file Author: Sean Young Date:Sat May 1 09:49:25 2021 +0100 Reported-by: Luca Di Gregorio Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=4631ee0a158524b90608326cd86ded4a02031e93 diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index bae160504892..3c3bcca15e36 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -314,7 +314,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn continue; } - if (strcmp(keyword, "space") == 0) { + if (!strcmp(keyword, "space") || !strcmp(keyword, "timeout")) { if (arg == 0) { fprintf(stderr, _("warning: %s:%d: invalid argument to space '%d'\n"), fname, lineno, arg); continue; @@ -331,7 +331,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn } lastspace = lineno; expect_pulse = true; - } else if (strcmp(keyword, "pulse") == 0) { + } else if (!strcmp(keyword, "pulse")) { if (arg == 0) { fprintf(stderr, _("warning: %s:%d: invalid argument to pulse '%d'\n"), fname, lineno, arg); continue; @@ -341,7 +341,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn else f->buf[len++] = arg; expect_pulse = false; - } else if (strcmp(keyword, "carrier") == 0) { + } else if (!strcmp(keyword, "carrier")) { if (f->carrier != UNSET && f->carrier != arg) { fprintf(stderr, _("warning: %s:%d: carrier already specified\n"), fname, lineno); } else { @@ -1200,10 +1200,9 @@ int lirc_receive(struct arguments *args, int fd, unsigned features) } else { switch (msg) { case LIRC_MODE2_TIMEOUT: + fprintf(out, "-%u\n", val); if (carrier) - fprintf(out, "# carrier %uHz, timeout %u\n", carrier, val); - else - fprintf(out, "# timeout %u\n", val); + fprintf(out, " # carrier %uHz, timeout %u\n", carrier, val); leading_space = true; carrier = 0; break; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: restrict installation of 50-rc_keymap.conf
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: restrict installation of 50-rc_keymap.conf Author: Ulrich Ölmann Date:Thu Mar 4 14:23:40 2021 +0100 It is only needed if BPF is effectively used and the package is compiled for a systemd based target. Signed-off-by: Ulrich Ölmann Signed-off-by: Sean Young utils/keytable/Makefile.am | 4 1 file changed, 4 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=01f2c6c58e6f4441df7df8e27eb7919f1f01e310 diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index c5eb414acf2f..eee61f0e0551 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -3,9 +3,13 @@ man_MANS = ir-keytable.1 rc_keymap.5 sysconf_DATA = rc_maps.cfg keytablesystem_DATA = $(srcdir)/rc_keymaps/* udevrules_DATA = 70-infrared.rules +if WITH_BPF +if HAVE_SYSTEMD if HAVE_UDEVDSYSCALLFILTER systemdsystemunit_DATA = 50-rc_keymap.conf endif +endif +endif ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] configure.ac: autodetect availability of systemd
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: configure.ac: autodetect availability of systemd Author: Ulrich Ölmann Date:Thu Mar 4 14:23:39 2021 +0100 Import systemd's official suggestion [1] how this should be handled in packages using autoconf. A side effect of this is the removal of the hardcoded fallback path "/lib/systemd/system" which leaks build host information when cross compiling v4l-utils and therefore defeats reproducible builds. [1] https://www.freedesktop.org/software/systemd/man/daemon.html#Installing%20systemd%20Service%20Files Signed-off-by: Ulrich Ölmann Signed-off-by: Sean Young configure.ac | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3f61e353424fb9ea3dce742022b94dfd7ea1ed9f diff --git a/configure.ac b/configure.ac index 727730c5ccf4..8470116df4b1 100644 --- a/configure.ac +++ b/configure.ac @@ -388,7 +388,15 @@ AC_ARG_WITH(udevdir, AC_ARG_WITH(systemdsystemunitdir, AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [set systemd system unit directory]), [], - [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd || echo /lib/systemd/system`]) + [with_systemdsystemunitdir=auto]) +AS_IF([test "x$with_systemdsystemunitdir" = "xyes" -o "x$with_systemdsystemunitdir" = "xauto"], + [def_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd) + AS_IF([test "x$def_systemdsystemunitdir" = "x"], + [AS_IF([test "x$with_systemdsystemunitdir" = "xyes"], +[AC_MSG_ERROR([systemd support requested but pkg-config unable to query systemd package])]) + with_systemdsystemunitdir=no], + [with_systemdsystemunitdir="$def_systemdsystemunitdir"])]) +AM_CONDITIONAL([HAVE_SYSTEMD], [test "x$with_systemdsystemunitdir" != "xno"]) # Generic check: works with most distributions def_gconv_dir=`for i in /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib; do if @<:@ -d \$i/gconv @:>@; then echo \$i/gconv; break; fi; done` ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: fix typo
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix typo Author: Ulrich Ölmann Date:Wed Mar 3 11:30:12 2021 +0100 Signed-off-by: Ulrich Ölmann Signed-off-by: Sean Young utils/keytable/50-rc_keymap.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=cb3bc5054b3e42019821c40728422dc6ef1ac5db diff --git a/utils/keytable/50-rc_keymap.conf b/utils/keytable/50-rc_keymap.conf index 6066c50c6476..dc871d739a39 100644 --- a/utils/keytable/50-rc_keymap.conf +++ b/utils/keytable/50-rc_keymap.conf @@ -1,3 +1,3 @@ -# ir-keytable needs access to bpf in order load BPF decoders +# ir-keytable needs access to bpf in order to load BPF decoders [Service] SystemCallFilter=bpf ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] v4l-utils: sync with latest media kernel
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: v4l-utils: sync with latest media kernel Author: Sean Young Date:Sat Mar 6 15:32:09 2021 + Sync with 5.12-rc1 Signed-off-by: Sean Young contrib/freebsd/include/linux/input.h | 2 +- include/linux/bpf.h| 123 ++--- utils/keytable/rc_keymaps/adstech_dvb_t_pci.toml | 1 + utils/keytable/rc_keymaps/af9005.toml | 1 + utils/keytable/rc_keymaps/alink_dtu_m.toml | 1 + utils/keytable/rc_keymaps/anysee.toml | 1 + utils/keytable/rc_keymaps/apac_viewcomp.toml | 1 + utils/keytable/rc_keymaps/astrometa_t2hybrid.toml | 1 + utils/keytable/rc_keymaps/asus_pc39.toml | 1 + utils/keytable/rc_keymaps/asus_ps3_100.toml| 1 + .../keytable/rc_keymaps/ati_tv_wonder_hd_600.toml | 1 + utils/keytable/rc_keymaps/ati_x10.toml | 1 + utils/keytable/rc_keymaps/avermedia.toml | 1 + utils/keytable/rc_keymaps/avermedia_a16d.toml | 1 + utils/keytable/rc_keymaps/avermedia_cardbus.toml | 1 + utils/keytable/rc_keymaps/avermedia_dvbt.toml | 1 + utils/keytable/rc_keymaps/avermedia_m135a.toml | 1 + .../keytable/rc_keymaps/avermedia_m733a_rm_k6.toml | 1 + utils/keytable/rc_keymaps/avermedia_rm_ks.toml | 1 + utils/keytable/rc_keymaps/avertv_303.toml | 1 + utils/keytable/rc_keymaps/az6027.toml | 1 + utils/keytable/rc_keymaps/azurewave_ad_tu700.toml | 1 + utils/keytable/rc_keymaps/beelink_gs1.toml | 1 + utils/keytable/rc_keymaps/behold.toml | 1 + utils/keytable/rc_keymaps/behold_columbus.toml | 1 + utils/keytable/rc_keymaps/budget_ci_old.toml | 1 + utils/keytable/rc_keymaps/cec.toml | 1 + utils/keytable/rc_keymaps/cinergy.toml | 1 + utils/keytable/rc_keymaps/cinergy_1400.toml| 1 + utils/keytable/rc_keymaps/cinergyt2.toml | 1 + utils/keytable/rc_keymaps/d680_dmb.toml| 1 + utils/keytable/rc_keymaps/delock_61959.toml| 1 + utils/keytable/rc_keymaps/dib0700_nec.toml | 1 + utils/keytable/rc_keymaps/dib0700_rc5.toml | 1 + utils/keytable/rc_keymaps/dibusb.toml | 1 + utils/keytable/rc_keymaps/digitalnow_tinytwin.toml | 1 + utils/keytable/rc_keymaps/digittrade.toml | 1 + utils/keytable/rc_keymaps/digitv.toml | 1 + utils/keytable/rc_keymaps/dm1105_nec.toml | 1 + utils/keytable/rc_keymaps/dntv_live_dvb_t.toml | 1 + utils/keytable/rc_keymaps/dntv_live_dvbt_pro.toml | 1 + utils/keytable/rc_keymaps/dtt200u.toml | 1 + utils/keytable/rc_keymaps/dvbsky.toml | 1 + utils/keytable/rc_keymaps/dvico_mce.toml | 1 + utils/keytable/rc_keymaps/dvico_portable.toml | 1 + utils/keytable/rc_keymaps/em_terratec.toml | 1 + utils/keytable/rc_keymaps/encore_enltv.toml| 1 + utils/keytable/rc_keymaps/encore_enltv2.toml | 1 + utils/keytable/rc_keymaps/encore_enltv_fm53.toml | 1 + utils/keytable/rc_keymaps/evga_indtube.toml| 1 + utils/keytable/rc_keymaps/eztv.toml| 1 + utils/keytable/rc_keymaps/flydvb.toml | 1 + utils/keytable/rc_keymaps/flyvideo.toml| 1 + utils/keytable/rc_keymaps/fusionhdtv_mce.toml | 1 + utils/keytable/rc_keymaps/gadmei_rm008z.toml | 1 + utils/keytable/rc_keymaps/geekbox.toml | 1 + utils/keytable/rc_keymaps/genius_tvgo_a11mce.toml | 1 + utils/keytable/rc_keymaps/gotview7135.toml | 1 + utils/keytable/rc_keymaps/haupp.toml | 1 + utils/keytable/rc_keymaps/hauppauge.toml | 1 + utils/keytable/rc_keymaps/hisi_poplar.toml | 1 + utils/keytable/rc_keymaps/hisi_tv_demo.toml| 1 + utils/keytable/rc_keymaps/imon_mce.toml| 1 + utils/keytable/rc_keymaps/imon_pad.toml| 1 + utils/keytable/rc_keymaps/iodata_bctv7e.toml | 1 + utils/keytable/rc_keymaps/it913x_v1.toml | 1 + utils/keytable/rc_keymaps/it913x_v2.toml | 1 + utils/keytable/rc_keymaps/kaiomy.toml | 1 + utils/keytable/rc_keymaps/khadas.toml | 1 + utils/keytable/rc_keymaps/khamsin.toml | 1 + utils/keytable/rc_keymaps/kii_pro.toml | 1 + utils/keytable/rc_keymaps/kworld_315u.toml | 1 + utils/keytable/rc_keymaps/kworld_pc150u.toml | 1 + .../keytable/rc_keymaps/kworld_plus_tv_analog.toml | 1 + utils/keytable/rc_keymaps/leadtek_y04g0051.toml| 1 + utils/keytable/rc_keymaps/lme2510.toml | 1 + utils/keytable/rc_keymaps/manli.toml | 1 + utils/keytable/rc_keymaps/medion_x10.toml
[git:v4l-utils/master] keytable: Add source information in generated keymaps
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: Add source information in generated keymaps Author: Bastien Nocera Date:Tue Jan 26 18:45:14 2021 +0100 Add comments to mention that keymap files are generated, and list which tool was used to generate them and the kernel source filename. This should make it less likely that generated files are used as examples to contribute keymaps from, and more likely that upstream changes are channeled through the right source tree. Signed-off-by: Bastien Nocera Signed-off-by: Sean Young utils/keytable/gen_keytables.pl | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=786b776ae95916f352ab1745c5d55f0eaa21cdd4 diff --git a/utils/keytable/gen_keytables.pl b/utils/keytable/gen_keytables.pl index c14aded32da9..32f9cfd409d1 100755 --- a/utils/keytable/gen_keytables.pl +++ b/utils/keytable/gen_keytables.pl @@ -36,10 +36,14 @@ sub flush($$) my $filename = shift; my $legacy = shift; my $defined; + my $relative_filename = $filename; return if (!$keyname || !$out); - print "Creating $dir/$keyname.toml\n"; + $relative_filename =~ s/^$kernel_dir//; + $relative_filename =~ s/^\///; + print "Creating $dir/$keyname.toml from $relative_filename\n"; open OUT, ">$dir/$keyname.toml"; + print OUT "# Generated with gen_keytables.pl from $relative_filename\n"; print OUT "[[protocols]]\n"; print OUT "name = \"$keyname\"\n"; print OUT "protocol = \"$type\"\n"; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] Build with libbpf, remove local sources
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Build with libbpf, remove local sources Author: Luca Boccassi Date:Fri Jan 8 23:36:08 2021 + libbpf is nowadays widely available in all distros that enable BPF, and it is a standalone library with a release cycle and a stable API. Remove the old sync of bpf.c/bpf.h and check for the library via pkg-config and use it instead. Only a minor modification is needed to make it compile. Signed-off-by: Luca Boccassi Signed-off-by: Sean Young configure.ac | 3 +- utils/keytable/Makefile.am | 5 +- utils/keytable/bpf.c | 491 - utils/keytable/bpf.h | 110 -- utils/keytable/bpf_load.c | 15 +- utils/keytable/bpf_load.h | 2 - utils/keytable/keytable.c | 2 +- 7 files changed, 14 insertions(+), 614 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=39374ef223e490c4fee4827146011e839ffaeae2 diff --git a/configure.ac b/configure.ac index c59d247e4495..5290fa015177 100644 --- a/configure.ac +++ b/configure.ac @@ -556,7 +556,8 @@ AM_CONDITIONAL([WITH_V4L2_CTL_32], [test x${enable_v4l2_ctl_32} = xyes]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE], [test x$ac_cv_func_fork = xyes]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno]) AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes]) -AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang]) +PKG_CHECK_MODULES([LIBBPF], [libbpf], [bpf_pc=yes], [bpf_pc=no]) +AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang -a x$bpf_pc = xyes]) # append -static to libtool compile and link command to enforce static libs AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index a057eb894ad5..c5eb414acf2f 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -10,14 +10,15 @@ endif ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h if WITH_BPF -ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h +ir_keytable_SOURCES += bpf_load.c bpf_load.h endif ir_keytable_LDADD = @LIBINTL@ ir_keytable_LDFLAGS = $(ARGP_LIBS) if WITH_BPF -ir_keytable_LDFLAGS += $(LIBELF_LIBS) +ir_keytable_LDFLAGS += $(LIBELF_LIBS) $(LIBBPF_LIBS) +ir_keytable_CFLAGS = $(LIBBPF_CFLAGS) SUBDIRS = bpf_protocols endif diff --git a/utils/keytable/bpf.c b/utils/keytable/bpf.c deleted file mode 100644 index 69ba190dd349.. --- a/utils/keytable/bpf.c +++ /dev/null @@ -1,491 +0,0 @@ -// SPDX-License-Identifier: LGPL-2.1 - -/* - * common eBPF ELF operations. - * - * Copyright (C) 2013-2015 Alexei Starovoitov - * Copyright (C) 2015 Wang Nan - * Copyright (C) 2015 Huawei Inc. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; - * version 2.1 of the License (not later!) - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, see <http://www.gnu.org/licenses> - */ - -#include -#include -#include -#include -#include -#include "bpf.h" -#include - -/* - * When building perf, unistd.h is overridden. __NR_bpf is - * required to be defined explicitly. - */ -#ifndef __NR_bpf -# if defined(__i386__) -# define __NR_bpf 357 -# elif defined(__x86_64__) -# define __NR_bpf 321 -# elif defined(__aarch64__) -# define __NR_bpf 280 -# elif defined(__sparc__) -# define __NR_bpf 349 -# elif defined(__s390__) -# define __NR_bpf 351 -# else -# error __NR_bpf not defined. libbpf does not support your arch. -# endif -#endif - -#ifndef min -#define min(x, y) ((x) < (y) ? (x) : (y)) -#endif - -static inline __u64 ptr_to_u64(const void *ptr) -{ - return (__u64) (unsigned long) ptr; -} - -static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, - unsigned int size) -{ - return syscall(__NR_bpf, cmd, attr, size); -} - -int bpf_create_map_xattr(const struct bpf_create_map_attr *create_attr) -{ - __u32 name_len = create_attr->name ? strlen(create_attr->name) : 0; - union bpf_attr attr = {}; - - attr.map_type = create_attr->map_type; -
[git:dtv-scan-tables/master] dtv-scan-tables: DVB-C for the City of Munich, Germany, operated by Vodafone
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: dtv-scan-tables: DVB-C for the City of Munich, Germany, operated by Vodafone Author: Volker Schmidt Date:Wed Sep 2 10:31:03 2020 +0100 Signed-off-by: Sean Young dvb-c/de-Vodafone_Muenchen | 275 + 1 file changed, 275 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3899e3173ca4c15cc45aa0de413aca8139938d86 diff --git a/dvb-c/de-Vodafone_Muenchen b/dvb-c/de-Vodafone_Muenchen new file mode 100644 index ..d67c28f6a42b --- /dev/null +++ b/dvb-c/de-Vodafone_Muenchen @@ -0,0 +1,275 @@ +# Vodafone Muenchen - ex-Kabel Deutschland Network +# Created from https://helpdesk.vodafonekabelforum.de/sendb/belegung-16.html +# +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 12200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/64 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 33000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 33800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 34600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 35400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 36200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 37000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 37800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 38600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 39400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 40200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 41000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 41800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 42600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 43400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 44200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 45000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 45800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 46600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 47400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 48200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 49000 + SYMBOL_RATE = 690
[git:dtv-scan-tables/master] dtv-scan-tables: add table for Slovenia
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: dtv-scan-tables: add table for Slovenia Author: Anton Luka Šijanec Date:Tue Jul 7 00:22:07 2020 +0200 I have fixed the dtv-scan-tables/dvb-t/si-Ljubljana file for new frequences in the center region. Signed-off-by: Anton Luka Šijanec Signed-off-by: Sean Young dvb-t/si-Ljubljana | 39 ++- 1 file changed, 38 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=0a6a02e7da1d72d55e70f07876c806dcc2266a86 diff --git a/dvb-t/si-Ljubljana b/dvb-t/si-Ljubljana index e1d3e8bebce5..37b6d98cad51 100644 --- a/dvb-t/si-Ljubljana +++ b/dvb-t/si-Ljubljana @@ -1,6 +1,8 @@ -# Slovenia / Ljubljana +# Slovenia / Ljubljana - center # MULTIPLEX A #-- +# i believe this is the old specification. keeping in case I am wrong. +# po mojem so to stare frekvence. puščam notri v kolikor nimam prav. [CHANNEL] DELIVERY_SYSTEM = DVBT FREQUENCY = 60200 @@ -25,3 +27,38 @@ HIERARCHY = NONE INVERSION = AUTO +# Slovenia / Ljubljana - center +# reference: https://dvb-t.svetidej.com/drzave/slovenija.html + +# MULTIPLEX A - national stations: +# SLO 1 HD, SLO 2 HD, SLO 3 HD, TV Maribor, TV Koper, Vaš kanal + +[CHANNEL] + DELIVERY_SYSTEM = DVBT + FREQUENCY = 56200 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = 2/3 + CODE_RATE_LP = NONE + MODULATION = QAM/64 + TRANSMISSION_MODE = 8K + GUARD_INTERVAL = 1/8 + HIERARCHY = NONE + INVERSION = AUTO + + +# MULTIPLEX C - commercial stations: +# TV3 Medias, Golica TV, Nora24TV + +[CHANNEL] + DELIVERY_SYSTEM = DVBT + FREQUENCY = 61000 + BANDWIDTH_HZ = 800 + CODE_RATE_HP = 2/3 + CODE_RATE_LP = NONE + MODULATION = QAM/64 + TRANSMISSION_MODE = 8K + GUARD_INTERVAL = 1/8 + HIERARCHY = NONE + INVERSION = AUTO + + ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:dtv-scan-tables/master] dtv-scan-tables: frequency updates for Finland
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: dtv-scan-tables: frequency updates for Finland Author: Olli Salonen Date:Tue Jun 9 13:05:46 2020 +0300 The VHF DVB-T2 muxes were terminated by their operator DNA end of 2019. Update also the UHF frequency muxes operated by Digita. Signed-off-by: Olli Salonen Signed-off-by: Sean Young dvb-t/fi-DNA-Espoo| 38 -- dvb-t/fi-DNA-Eurajoki | 38 -- dvb-t/fi-DNA-Hameenlinna | 38 -- dvb-t/fi-DNA-Hamina | 38 -- dvb-t/fi-DNA-Hausjarvi| 38 -- dvb-t/fi-DNA-Helsinki | 38 -- dvb-t/fi-DNA-Jokioinen| 38 -- dvb-t/fi-DNA-Jyvaskyla| 38 -- dvb-t/fi-DNA-Kaarina | 38 -- dvb-t/fi-DNA-Kajaani | 38 -- dvb-t/fi-DNA-Kangasala| 38 -- dvb-t/fi-DNA-Karkkila | 38 -- dvb-t/fi-DNA-Kiiminki | 38 -- dvb-t/fi-DNA-Kokkola | 38 -- dvb-t/fi-DNA-Kontiolahti | 38 -- dvb-t/fi-DNA-Kouvola | 38 -- dvb-t/fi-DNA-Kuopio | 38 -- dvb-t/fi-DNA-Lahti| 38 -- dvb-t/fi-DNA-Lappeenranta | 38 -- dvb-t/fi-DNA-Lohja| 38 -- dvb-t/fi-DNA-Loviisa | 38 -- dvb-t/fi-DNA-Mikkeli | 38 -- dvb-t/fi-DNA-Nousiainen | 38 -- dvb-t/fi-DNA-Nurmijarvi | 38 -- dvb-t/fi-DNA-Porvoo | 38 -- dvb-t/fi-DNA-Salo | 38 -- dvb-t/fi-DNA-Savonlinna | 38 -- dvb-t/fi-DNA-Seinajoki| 38 -- dvb-t/fi-DNA-Tyrnava | 38 -- dvb-t/fi-DNA-Ulvila | 38 -- dvb-t/fi-DNA-Vaasa| 38 -- dvb-t/fi-DNA-Valkeakoski | 38 -- dvb-t/fi-DNA-Vesilahti| 38 -- dvb-t/fi-DNA-Ylivieska| 38 -- dvb-t/fi-Espoo| 11 --- dvb-t/fi-Fiskars | 10 ++ dvb-t/fi-Haapavesi| 26 ++ dvb-t/fi-Kilpisjarvi | 2 +- dvb-t/fi-Lahti| 7 ++- dvb-t/fi-Nokia| 14 +++--- dvb-t/fi-Nokia_Siuro | 14 +++--- dvb-t/fi-Oulu | 7 ++- dvb-t/fi-Tammela | 7 ++- dvb-t/fi-Tampere | 29 - dvb-t/fi-Tampere_Pyynikki | 7 ++- dvb-t/fi-Turku| 7 ++- 46 files changed, 81 insertions(+), 1352 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b0c13ce86c64c2f4d0bd5c7d40583ac5779b925e diff --git a/dvb-t/fi-DNA-Espoo b/dvb-t/fi-DNA-Espoo deleted file mode 100644 index 7d74fc134723.. --- a/dvb-t/fi-DNA-Espoo +++ /dev/null @@ -1,38 +0,0 @@ -# 2014-03-08 Olli Salonen -# generated from http://www.dna.fi/tuki-antenniverkon-nakyvyysalueet -[CHANNEL] - DELIVERY_SYSTEM = DVBT2 - FREQUENCY = 18450 - BANDWIDTH_HZ = 700 - CODE_RATE_HP = AUTO - CODE_RATE_LP = AUTO - MODULATION = QAM/AUTO - TRANSMISSION_MODE = 32K - GUARD_INTERVAL = 19/256 - HIERARCHY = AUTO - INVERSION = AUTO - -[CHANNEL] - DELIVERY_SYSTEM = DVBT2 - FREQUENCY = 19850 - BANDWIDTH_HZ = 700 - CODE_RATE_HP = AUTO - CODE_RATE_LP = AUTO - MODULATION = QAM/AUTO - TRANSMISSION_MODE = 32K - GUARD_INTERVAL = 19/256 - HIERARCHY = AUTO - INVERSION = AUTO - -[CHANNEL] - DELIVERY_SYSTEM = DVBT2 - FREQUENCY = 17750 - BANDWIDTH_HZ = 700 - CODE_RATE_HP = AUTO - CODE_RATE_LP = AUTO - MODULATION = QAM/AUTO - TRANSMISSION_MODE = 32K - GUARD_INTERVAL = 19/256 - HIERARCHY = AUTO - INVERSION = AUTO - diff --git a/dvb-t/fi-DNA-Eurajoki b/dvb-t/fi-DNA-Eurajoki deleted file mode 100644 index 31de9350d209.. --- a/dvb-t/fi-DNA-Eurajoki +++ /dev/null @@ -1,38 +0,0 @@ -# 2014-03-08 Olli Salonen -# generated from http://www.dna.fi/tuki
[git:dtv-scan-tables/master] Update dvb-t scan files for Ireland (ie-*)
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Update dvb-t scan files for Ireland (ie-*) Author: Jonathan McCrohan Date:Fri Feb 14 23:26:20 2020 + Frequency changes as a result of 700Mhz migration. Signed-off-by: Jonathan McCrohan Signed-off-by: Sean Young dvb-t/ie-CairnHill | 2 +- dvb-t/ie-ClermontCarn | 10 +- dvb-t/ie-Dungarvan | 2 +- dvb-t/ie-HolywellHill | 10 +- dvb-t/ie-Kippure | 10 +- dvb-t/ie-Maghera | 6 +++--- dvb-t/ie-MountLeinster | 2 +- dvb-t/ie-Mullaghanish | 2 +- dvb-t/ie-SpurHill | 6 +++--- dvb-t/ie-ThreeRock | 2 +- dvb-t/ie-Truskmore | 10 +- dvb-t/ie-WoodcockHill | 2 +- 12 files changed, 32 insertions(+), 32 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=cc5626102e6b612e3cee3b24a814ed3f433e1639 diff --git a/dvb-t/ie-CairnHill b/dvb-t/ie-CairnHill index d3a5dc5a77b8..928436febedc 100644 --- a/dvb-t/ie-CairnHill +++ b/dvb-t/ie-CairnHill @@ -1,5 +1,5 @@ # Ireland, Cairn Hill -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx +# Generated from https://www.2rn.ie/wp-content/uploads/2019/09/2RN-DTT-Television-Transmission-Network-Sept-2019-Rev.1.2.pdf [CH47: Saorview MUX1] DELIVERY_SYSTEM = DVBT FREQUENCY = 68200 diff --git a/dvb-t/ie-ClermontCarn b/dvb-t/ie-ClermontCarn index 81f17d24c368..1e9893826304 100644 --- a/dvb-t/ie-ClermontCarn +++ b/dvb-t/ie-ClermontCarn @@ -1,8 +1,8 @@ # Ireland, Clermont Carn -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx -[CH52: Saorview MUX1] +# Generated from https://www.2rn.ie/wp-content/uploads/2019/09/2RN-DTT-Television-Transmission-Network-Sept-2019-Rev.1.2.pdf +[CH42: Saorview MUX1] DELIVERY_SYSTEM = DVBT - FREQUENCY = 72200 + FREQUENCY = 64200 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE @@ -12,9 +12,9 @@ HIERARCHY = NONE INVERSION = AUTO -[CH56: Saorview MUX2] +[CH45: Saorview MUX2] DELIVERY_SYSTEM = DVBT - FREQUENCY = 75400 + FREQUENCY = 66600 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE diff --git a/dvb-t/ie-Dungarvan b/dvb-t/ie-Dungarvan index 1c2ccd8815ba..1cc129a7933e 100644 --- a/dvb-t/ie-Dungarvan +++ b/dvb-t/ie-Dungarvan @@ -1,5 +1,5 @@ # Ireland, Dungarvan -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx +# Generated from https://www.2rn.ie/wp-content/uploads/2019/09/2RN-DTT-Television-Transmission-Network-Sept-2019-Rev.1.2.pdf [CH55: Saorview MUX1] DELIVERY_SYSTEM = DVBT FREQUENCY = 74600 diff --git a/dvb-t/ie-HolywellHill b/dvb-t/ie-HolywellHill index 5bb2c585a423..dae9326effd8 100644 --- a/dvb-t/ie-HolywellHill +++ b/dvb-t/ie-HolywellHill @@ -1,8 +1,8 @@ # Ireland, Holywell Hill -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx -[CH30: Saorview MUX1] +# Generated from https://www.2rn.ie/wp-content/uploads/2019/09/2RN-DTT-Television-Transmission-Network-Sept-2019-Rev.1.2.pdf +[CH22: Saorview MUX1] DELIVERY_SYSTEM = DVBT - FREQUENCY = 54600 + FREQUENCY = 48200 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE @@ -12,9 +12,9 @@ HIERARCHY = NONE INVERSION = AUTO -[CH33: Saorview MUX2] +[CH25: Saorview MUX2] DELIVERY_SYSTEM = DVBT - FREQUENCY = 57000 + FREQUENCY = 50600 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE diff --git a/dvb-t/ie-Kippure b/dvb-t/ie-Kippure index 8a7a3be0a7a6..e283d23d6597 100644 --- a/dvb-t/ie-Kippure +++ b/dvb-t/ie-Kippure @@ -1,8 +1,8 @@ # Ireland, Kippure -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx -[CH54: Saorview MUX1] +# Generated from https://www.2rn.ie/wp-content/uploads/2019/09/2RN-DTT-Television-Transmission-Network-Sept-2019-Rev.1.2.pdf +[CH34: Saorview MUX1] DELIVERY_SYSTEM = DVBT - FREQUENCY = 73800 + FREQUENCY = 57800 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE @@ -12,9 +12,9 @@ HIERARCHY = NONE INVERSION = AUTO -[CH58: Saorview MUX2] +[CH35: Saorview MUX2] DELIVERY_SYSTEM = DVBT - FREQUENCY = 77000 + FREQUENCY = 58600 BANDWIDTH_HZ = 800 CODE_RATE_HP = 3/4 CODE_RATE_LP = NONE diff --git a/dvb-t/ie-Maghera b/dvb-t/ie-Maghera index e87acd9a648b..f88e6423f095 100644 --- a/dvb-t/ie-Maghera +++ b/dvb-t/ie-Maghera @@ -1,5 +1,5 @@ # Ireland, Maghera -# Generated from http://www.comreg.ie/_fileupload/Broadcast_Technical_Parameters.xlsx +# Generated from https://www.2rn.ie/wp-content
[git:dtv-scan-tables/master] dtv-scan-tables: add Dorfnetz for Liechtenstein
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: dtv-scan-tables: add Dorfnetz for Liechtenstein Author: Thomas Kaiser Date:Sun Mar 15 20:37:17 2020 +0100 Added the initial scan file for cable provider Dorfnetz from Liechtenstein. Signed-off-by: Thomas Kaiser Signed-off-by: Sean Young dvb-c/li-kabel-Dorfnetz | 247 1 file changed, 247 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c9ac20dabb3274d684c0468808d17e9c6fafa645 diff --git a/dvb-c/li-kabel-Dorfnetz b/dvb-c/li-kabel-Dorfnetz new file mode 100644 index ..a1ef90c4d8f5 --- /dev/null +++ b/dvb-c/li-kabel-Dorfnetz @@ -0,0 +1,247 @@ +# DVB-C transponder/muxes scan +# Dorfnetz provided ny TV-COM AG, Liechtenstein +# www.orfnetz.li +# Network ID: 335 +# 2020-03-15 + +# freq sr fec modComment +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 50600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 34600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 35400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 36200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 37000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 37800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 38600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 39400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 40200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 44200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 45000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 45800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 46600 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 51400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 52200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 53000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 53800 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 55400 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 56200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 60200 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_A + FREQUENCY = 61000 + SYMBOL_RATE = 690 + INNER_FEC = NONE + MODULATION = QAM/256 + INVERSION = AUTO
[git:dtv-scan-tables/master] Add atsc/kr-Cable-8VSB
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Add atsc/kr-Cable-8VSB Author: Hyunwoo Park Date:Sun Jun 28 22:21:56 2020 +0900 8VSB modulation is used in korean cable DTV with standard cable frequencies. Signed-off-by: Sean Young atsc/kr-Cable-8VSB | 961 + 1 file changed, 961 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=ca45a179fc81a6d03d873beb94aec5f209fde17c diff --git a/atsc/kr-Cable-8VSB b/atsc/kr-Cable-8VSB new file mode 100644 index ..ed9da4ab001f --- /dev/null +++ b/atsc/kr-Cable-8VSB @@ -0,0 +1,961 @@ +# Korean cable frequency. +# Modified from us-Cable-Standard-center-frequencies-QAM256 + +#2 +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 5700 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 6300 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 6900 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 7900 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 8500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 17700 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 18300 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 18900 + MODULATION = VSB/8 + INVERSION = AUTO + +#10 +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 19500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 20100 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 20700 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 21300 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 123012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 129012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 135012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 14100 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 14700 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 15300 + MODULATION = VSB/8 + INVERSION = AUTO + +#20 +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 15900 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 16500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 17100 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 21900 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 22500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 231012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 237012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 243012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 249012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 255012500 + MODULATION = VSB/8 + INVERSION = AUTO + +#30 +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 261012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 267012500 + MODULATION = VSB/8 + INVERSION = AUTO + +[CHANNEL] + DELIVERY_SYSTEM = DVBC/ANNEX_B + FREQUENCY = 273012500 + MODULATION = VSB/8 + INVERSION = AUTO
[git:v4l-utils/master] Move sync-with-kernel into dedicated shell script ./sync-with-kernel.sh
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Move sync-with-kernel into dedicated shell script ./sync-with-kernel.sh Author: Sean Young Date:Fri Jun 19 22:42:50 2020 +0100 The make sync-with-kernel target is a collection of shell fragments scattered over the tree. Collect all of them into a single shell script. This makes it is easier to see what sync-with-kernel does, and makes the move away from autotools to meson possible. Reviewed-by: Ariel D'Alessandro Signed-off-by: Sean Young Makefile.am | 58 ++ README | 4 +- configure.ac| 2 +- contrib/freebsd/Makefile.am | 14 - contrib/test/Makefile.am| 9 --- contrib/test/gen_ioctl_list.pl | 4 +- contrib/test/ioctl-test.h | 2 +- contrib/test/ioctl_32.h | 2 +- contrib/test/ioctl_64.h | 2 +- contrib/xc3028-firmware/Makefile.am | 9 --- lib/libdvbv5/Makefile.am| 3 - sync-with-kernel.sh | 119 utils/keytable/Makefile.am | 13 13 files changed, 131 insertions(+), 110 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c7f03287bbd64c168975e7ff3192e6fd3b507686 diff --git a/Makefile.am b/Makefile.am index 52eb8af933eb..3237ab49cff5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,60 +7,10 @@ if WITH_V4LUTILS SUBDIRS += utils contrib endif -EXTRA_DIST = android-config.h bootstrap.sh doxygen_libdvbv5.cfg include COPYING.libv4l \ -COPYING.libdvbv5 README.libv4l README.lib-multi-threading TODO.libdvbv5 \ -doc/libdvbv5-index.doc +EXTRA_DIST = android-config.h sync-with-kernel.sh bootstrap.sh \ + doxygen_libdvbv5.cfg include COPYING.libv4l \ + COPYING.libdvbv5 README.libv4l README.lib-multi-threading \ + TODO.libdvbv5 doc/libdvbv5-index.doc include $(top_srcdir)/aminclude.am -# custom targets - -sync-with-kernel: - @if [ ! -f $(KERNEL_DIR)/usr/include/linux/videodev2.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/fb.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-controls.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-common.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-subdev.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/v4l2-mediabus.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/ivtv.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/dvb/frontend.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/lirc.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/bpf.h -o \ - ! -f $(KERNEL_DIR)/usr/include/linux/bpf_common.h ]; then \ - echo "Error you must set KERNEL_DIR to point to an extracted kernel source dir"; \ - echo "and run 'make headers_install' in \$$KERNEL_DIR."; \ - exit 1; \ - fi - cp -a $(KERNEL_DIR)/usr/include/linux/videodev2.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/fb.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-controls.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-common.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-subdev.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/v4l2-mediabus.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/media-bus-format.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/media.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/ivtv.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/dvb/frontend.h $(top_srcdir)/include/linux/dvb - cp $(top_srcdir)/include/linux/dvb/frontend.h $(top_srcdir)/lib/include/libdvbv5/dvb-frontend.h - cp -a $(KERNEL_DIR)/usr/include/linux/dvb/dmx.h $(top_srcdir)/include/linux/dvb - cp -a $(KERNEL_DIR)/usr/include/linux/lirc.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/bpf.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/bpf_common.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/cec.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/usr/include/linux/cec-funcs.h $(top_srcdir)/include/linux - cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c $(top_srcdir)/utils/common - cp -a $(KERNEL_DIR)/drivers/media/common/v4l2-tpg/v4l2-tpg-colors.c $(top_srcdir)/utils/common - cp -a $(KERNEL_DIR)/include/media/tpg/v4l2-tpg.h $(top_srcdir)/utils/common - cp -a $(KERNEL_DIR)/include/medi
[git:v4l-utils/master] Use standard integer types
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Use standard integer types Author: Hans Petter Selasky Date:Tue Jul 21 12:53:42 2020 +0200 Fixes compilation under FreeBSD. Signed-off-by: Hans Petter Selasky Signed-off-by: Sean Young utils/common/keymap.h | 10 ++ utils/keytable/keytable.c | 24 2 files changed, 18 insertions(+), 16 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e502874d9755f71ccb8acbd04c2e7c0d9fffa0f6 diff --git a/utils/common/keymap.h b/utils/common/keymap.h index 998338275446..dc198bc1 100644 --- a/utils/common/keymap.h +++ b/utils/common/keymap.h @@ -2,6 +2,8 @@ #ifndef __KEYMAP_H #define __KEYMAP_H +#include + struct keymap { struct keymap *next; char *name; @@ -20,16 +22,16 @@ struct protocol_param { struct scancode_entry { struct scancode_entry *next; - u_int64_t scancode; + uint64_t scancode; char *keycode; }; struct raw_entry { struct raw_entry *next; - u_int64_t scancode; - u_int32_t raw_length; + uint64_t scancode; + uint32_t raw_length; char *keycode; - u_int32_t raw[1]; + uint32_t raw[1]; }; void free_keymap(struct keymap *map); diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 3df5fcf203ed..cb91f1f0543c 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -55,11 +55,11 @@ struct input_keymap_entry_v2 { #define KEYMAP_BY_INDEX(1 << 0) - u_int8_t flags; - u_int8_t len; - u_int16_t index; - u_int32_t keycode; - u_int8_t scancode[32]; + uint8_t flags; + uint8_t len; + uint16_t index; + uint32_t keycode; + uint8_t scancode[32]; }; #ifndef input_event_sec @@ -82,7 +82,7 @@ struct input_keymap_entry_v2 { struct keytable_entry { // 64 bit int which can printed with %llx unsigned long long scancode; - u_int32_t keycode; + uint32_t keycode; struct keytable_entry *next; }; @@ -1376,7 +1376,7 @@ static int get_input_protocol_version(int fd) static void clear_table(int fd) { int i, j; - u_int32_t codes[2]; + uint32_t codes[2]; struct input_keymap_entry_v2 entry; /* Clears old table */ @@ -1463,7 +1463,7 @@ static void display_proto(struct rc_device *rc_dev) } -static char *get_event_name(struct parse_event *event, u_int16_t code) +static char *get_event_name(struct parse_event *event, uint16_t code) { struct parse_event *p; @@ -1647,14 +1647,14 @@ static void display_table_v2(struct rc_device *rc_dev, int fd) if (ioctl(fd, EVIOCGKEYCODE_V2, &entry) == -1) break; - if (entry.len == sizeof(u_int32_t)) { - u_int32_t temp; + if (entry.len == sizeof(uint32_t)) { + uint32_t temp; memcpy(&temp, entry.scancode, sizeof(temp)); scancode = temp; - } else if (entry.len == sizeof(u_int64_t)) { - u_int64_t temp; + } else if (entry.len == sizeof(uint64_t)) { + uint64_t temp; memcpy(&temp, entry.scancode, sizeof(temp)); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.20] keytable: Fix missing inclusion of argp.h
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: Fix missing inclusion of argp.h Author: Ismael Luceno Date:Thu Jul 9 19:48:31 2020 +0200 error_t is only defined by argp.h on non-glibc systems. Signed-off-by: Ismael Luceno Signed-off-by: Sean Young utils/keytable/bpf_load.c | 1 + 1 file changed, 1 insertion(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=f413d6e45eb68d02a445eb910433161903476c99 diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index 9f64cf4e91e8..7ae9af4a57be 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "keymap.h" #include "bpf.h" #include "bpf_load.h" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: Fix missing inclusion of argp.h
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: Fix missing inclusion of argp.h Author: Ismael Luceno Date:Thu Jul 9 19:48:31 2020 +0200 error_t is only defined by argp.h on non-glibc systems. Signed-off-by: Ismael Luceno Signed-off-by: Sean Young utils/keytable/bpf_load.c | 1 + 1 file changed, 1 insertion(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=12e59bb30f24c1dcb9e5303b4a53514c22552823 diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index 9f64cf4e91e8..7ae9af4a57be 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "keymap.h" #include "bpf.h" #include "bpf_load.h" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] lircd2toml: add option to keep lirc codes as they are
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: lircd2toml: add option to keep lirc codes as they are Author: Sean Young Date:Sun Jun 14 13:06:49 2020 +0100 When keymaps are only used for sending, they do not have to look like KEY_*. Keeping the existing lirc names might be preferable. Signed-off-by: Sean Young contrib/lircd2toml.py | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e804a6fd46ffab8972461ae6005c809d7471cec7 diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index ba4b14ec4fd3..897ad7651a04 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -13,10 +13,11 @@ import math import argparse class LircdParser: -def __init__(self, filename, encoding): +def __init__(self, filename, encoding, rename): self.lineno=0 self.filename=filename self.encoding=encoding +self.rename=rename def getline(self): while True: @@ -126,7 +127,7 @@ class LircdParser: k = a.pop(0) if k == 'end': return codes -if not k.startswith('KEY_'): +if self.rename and not k.startswith('KEY_'): k = 'KEY_' + k.upper() for s in a: if s[0] == '#': @@ -153,7 +154,7 @@ class LircdParser: if codes: raw_codes.append({ 'keycode': name, 'raw': codes }) name = line.split(maxsplit=2)[1] -if not name.startswith('KEY_'): +if self.rename and not name.startswith('KEY_'): name = 'KEY_' + name.upper() codes = [] elif a[0] == 'end': @@ -642,12 +643,14 @@ can be include with the package.""") parser.add_argument('input', metavar='INPUT', help='lircd.conf file') parser.add_argument('-o', '--output', metavar='OUTPUT', help='toml output file') parser.add_argument('--encoding', default='utf-8-sig', help='Encoding of lircd.conf') +parser.add_argument('--preserve-codes', const=False, default=True, +dest='rename', action='store_const', help='Do not rename codes to KEY_*') args = parser.parse_args() remoteNo=1 tomls=[] -remotes=LircdParser(args.input, args.encoding).parse() +remotes=LircdParser(args.input, args.encoding, args.rename).parse() if remotes == None: sys.exit(1) for remote in remotes: ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.18] keytable: "-p all" should not attempt BPF decodes that don't exist
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: "-p all" should not attempt BPF decodes that don't exist Author: Sean Young Date:Fri May 8 10:44:59 2020 +0100 Currently we only have a BPF decoder for xbox_dvd. Other decoders should not be attempted. Reported-by: Ralf Schmidt Signed-off-by: Sean Young utils/keytable/keytable.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dea6d59b4719eb247aaad1ec386c39197ddb3f61 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 6cb0217a9a73..a97530063fe6 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -940,12 +940,21 @@ static struct sysfs_names *find_device(char *name) return names; } +/* + * If an rcdev does not have a decoder for a protocol, try to load a bpf + * replacement. + */ static enum sysfs_protocols load_bpf_for_unsupported(enum sysfs_protocols protocols, enum sysfs_protocols supported) { const struct protocol_map_entry *pme; struct bpf_protocol *b; for (pme = protocol_map; pme->name; pme++) { + // So far, we only have a replacement for the xbox_dvd + // protocol + if (pme->sysfs_protocol != SYSFS_XBOX_DVD) + continue; + if (!(protocols & pme->sysfs_protocol) || (supported & pme->sysfs_protocol)) continue; @@ -1151,7 +1160,7 @@ static int v2_set_protocols(struct rc_device *rc_dev) if (!stat(name, &st) && !(st.st_mode & 0222)) { fprintf(stderr, _("Protocols for device can not be changed\n")); - return 0; + return EINVAL; } fp = fopen(name, "w"); @@ -1318,8 +1327,7 @@ static int set_proto(struct rc_device *rc_dev) int rc = 0; if (rc_dev->version == VERSION_2) { - rc = v2_set_protocols(rc_dev); - return rc; + return v2_set_protocols(rc_dev); } rc_dev->current &= rc_dev->supported; @@ -2102,9 +2110,7 @@ int main(int argc, char *argv[]) rc_dev.current = load_bpf_for_unsupported(ch_proto, rc_dev.supported); - if (set_proto(&rc_dev)) - fprintf(stderr, _("Couldn't change the IR protocols\n")); - else { + if (!set_proto(&rc_dev)) { fprintf(stderr, _("Protocols changed to ")); write_sysfs_protocols(rc_dev.current, stderr, "%s "); fprintf(stderr, "\n"); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: "-p all" should not attempt BPF decodes that don't exist
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: "-p all" should not attempt BPF decodes that don't exist Author: Sean Young Date:Fri May 8 10:44:59 2020 +0100 Currently we only have a BPF decoder for xbox_dvd. Other decoders should not be attempted. Reported-by: Ralf Schmidt Signed-off-by: Sean Young utils/keytable/keytable.c | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e1ebb3049327802d3bc962ef6496ced8d43182e6 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 4db91267cad9..3df5fcf203ed 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -945,12 +945,21 @@ static struct sysfs_names *find_device(char *name) return names; } +/* + * If an rcdev does not have a decoder for a protocol, try to load a bpf + * replacement. + */ static enum sysfs_protocols load_bpf_for_unsupported(enum sysfs_protocols protocols, enum sysfs_protocols supported) { const struct protocol_map_entry *pme; struct bpf_protocol *b; for (pme = protocol_map; pme->name; pme++) { + // So far, we only have a replacement for the xbox_dvd + // protocol + if (pme->sysfs_protocol != SYSFS_XBOX_DVD) + continue; + if (!(protocols & pme->sysfs_protocol) || (supported & pme->sysfs_protocol)) continue; @@ -1156,7 +1165,7 @@ static int v2_set_protocols(struct rc_device *rc_dev) if (!stat(name, &st) && !(st.st_mode & 0222)) { fprintf(stderr, _("Protocols for device can not be changed\n")); - return 0; + return EINVAL; } fp = fopen(name, "w"); @@ -1323,8 +1332,7 @@ static int set_proto(struct rc_device *rc_dev) int rc = 0; if (rc_dev->version == VERSION_2) { - rc = v2_set_protocols(rc_dev); - return rc; + return v2_set_protocols(rc_dev); } rc_dev->current &= rc_dev->supported; @@ -2151,9 +2159,7 @@ int main(int argc, char *argv[]) rc_dev.current = load_bpf_for_unsupported(ch_proto, rc_dev.supported); - if (set_proto(&rc_dev)) - fprintf(stderr, _("Couldn't change the IR protocols\n")); - else { + if (!set_proto(&rc_dev)) { fprintf(stderr, _("Protocols changed to ")); write_sysfs_protocols(rc_dev.current, stderr, "%s "); fprintf(stderr, "\n"); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: allow unmodulated signal to be sent
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: allow unmodulated signal to be sent Author: Sean Young Date:Wed May 6 11:18:07 2020 +0100 Some drivers like gpio-ir-tx and mceusb allow unmodulated signal to be sent by setting the carrier to 0. Likewise the timeout can be set to 0. Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 69 --- 1 file changed, 43 insertions(+), 26 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c39488120a52f88b730c406e2c6abf3176f5d06f diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index ba454619dab7..bae160504892 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -59,6 +59,7 @@ /* See drivers/media/rc/lirc_dev.c line 22 */ #define LIRCBUF_SIZE 1024 #define IR_DEFAULT_TIMEOUT 125000 +#define UNSET UINT32_MAX const char *argp_program_version = "IR ctl version " V4L_UTILS_VERSION; const char *argp_program_bug_address = "Sean Young "; @@ -158,17 +159,18 @@ static const char doc[] = N_( "Note that most lirc setting have global state, i.e. the device will remain\n" "in this state until set otherwise."); -static int strtoint(const char *p, const char *unit) +static bool strtoint(const char *p, const char *unit, unsigned *ret) { char *end; long arg = strtol(p, &end, 10); if (end == NULL || (end[0] != 0 && strcasecmp(end, unit) != 0)) - return 0; + return false; - if (arg <= 0 || arg >= 0xff) - return 0; + if (arg < 0 || arg >= 0xff) + return false; - return arg; + *ret = arg; + return true; } static bool strtoscancode(const char *p, unsigned *ret) @@ -221,7 +223,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn } f->is_scancode = false; f->is_keycode = false; - f->carrier = 0; + f->carrier = UNSET; f->fname = fname; while (fgets(line, sizeof(line), input)) { @@ -300,8 +302,8 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn continue; } - int arg = strtoint(p, ""); - if (arg == 0) { + unsigned int arg; + if (!strtoint(p, "", &arg)) { fprintf(stderr, _("warning: %s:%d: invalid argument '%s'\n"), fname, lineno, p); continue; } @@ -313,6 +315,10 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn } if (strcmp(keyword, "space") == 0) { + if (arg == 0) { + fprintf(stderr, _("warning: %s:%d: invalid argument to space '%d'\n"), fname, lineno, arg); + continue; + } if (expect_pulse) { if (len == 0) { fprintf(stderr, _("warning: %s:%d: leading space ignored\n"), @@ -326,13 +332,17 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn lastspace = lineno; expect_pulse = true; } else if (strcmp(keyword, "pulse") == 0) { + if (arg == 0) { + fprintf(stderr, _("warning: %s:%d: invalid argument to pulse '%d'\n"), fname, lineno, arg); + continue; + } if (!expect_pulse) f->buf[len-1] += arg; else f->buf[len++] = arg; expect_pulse = false; } else if (strcmp(keyword, "carrier") == 0) { - if (f->carrier && f->carrier != arg) { + if (f->carrier != UNSET && f->carrier != arg) { fprintf(stderr, _("warning: %s:%d: carrier already specified\n"), fname, lineno); } else { f->carrier = arg; @@ -383,7 +393,7 @@ static struct send *read_file_raw(struct arguments *args, const char *fname, FIL } f->is_scancode = false; f->is_keycode = false; - f->carrier = 0; + f->carrier = UNSET; f->fname = fname; while (fgets(line, sizeof(line), input)) { @@ -619,8 +629,7 @@ static error_t parse_
[git:v4l-utils/master] ir-ctl: removed nested functions to support building with clang
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: removed nested functions to support building with clang Author: Sean Young Date:Thu Apr 16 08:22:13 2020 +0100 This does not make the code any prettier, but clang has no support for nested functions. Signed-off-by: Sean Young utils/common/ir-encode.c | 336 +++-- utils/ir-ctl/bpf_encoder.c | 40 +++--- 2 files changed, 190 insertions(+), 186 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=2984938795a23e4bdf5a4b75c12a4245a2e0daff diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index e4fde403d081..b3757e12287b 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -29,23 +29,24 @@ #define NS_TO_US(x) (((x)+500)/1000) +static const int nec_unit = 562500; + +static void nec_add_byte(unsigned *buf, int *n, unsigned bits) +{ + int i; + for (i=0; i<8; i++) { + buf[(*n)++] = NS_TO_US(nec_unit); + if (bits & (1 << i)) + buf[(*n)++] = NS_TO_US(nec_unit * 3); + else + buf[(*n)++] = NS_TO_US(nec_unit); + } +} + static int nec_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) { - const int nec_unit = 562500; int n = 0; - void add_byte(unsigned bits) - { - int i; - for (i=0; i<8; i++) { - buf[n++] = NS_TO_US(nec_unit); - if (bits & (1 << i)) - buf[n++] = NS_TO_US(nec_unit * 3); - else - buf[n++] = NS_TO_US(nec_unit); - } - } - buf[n++] = NS_TO_US(nec_unit * 16); buf[n++] = NS_TO_US(nec_unit * 8); @@ -53,22 +54,22 @@ static int nec_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) default: return 0; case RC_PROTO_NEC: - add_byte(scancode >> 8); - add_byte(~(scancode >> 8)); - add_byte(scancode); - add_byte(~scancode); + nec_add_byte(buf, &n, scancode >> 8); + nec_add_byte(buf, &n, ~(scancode >> 8)); + nec_add_byte(buf, &n, scancode); + nec_add_byte(buf, &n, ~scancode); break; case RC_PROTO_NECX: - add_byte(scancode >> 16); - add_byte(scancode >> 8); - add_byte(scancode); - add_byte(~scancode); + nec_add_byte(buf, &n, scancode >> 16); + nec_add_byte(buf, &n, scancode >> 8); + nec_add_byte(buf, &n, scancode); + nec_add_byte(buf, &n, ~scancode); break; case RC_PROTO_NEC32: - add_byte(scancode >> 16); - add_byte(scancode >> 24); - add_byte(scancode); - add_byte(scancode >> 8); + nec_add_byte(buf, &n, scancode >> 16); + nec_add_byte(buf, &n, scancode >> 24); + nec_add_byte(buf, &n, scancode); + nec_add_byte(buf, &n, scancode >> 8); break; } @@ -104,102 +105,103 @@ static int jvc_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) return 35; } -static int sanyo_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) +static const int sanyo_unit = 562500; + +static void sanyo_add_bits(unsigned **buf, int bits, int count) { - const int sanyo_unit = 562500; - - void add_bits(int bits, int count) - { - int i; - for (i=0; i> 8, 13); - add_bits(~(scancode >> 8), 13); - add_bits(scancode, 8); - add_bits(~scancode, 8); + sanyo_add_bits(&buf, scancode >> 8, 13); + sanyo_add_bits(&buf, ~(scancode >> 8), 13); + sanyo_add_bits(&buf, scancode, 8); + sanyo_add_bits(&buf, ~scancode, 8); *buf = NS_TO_US(sanyo_unit); return 87; } -static int sharp_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) +static const int sharp_unit = 4; + +static void sharp_add_bits(unsigned **buf, int bits, int count) { - const int sharp_unit = 4; - - void add_bits(int bits, int count) - { - int i; - for (i=0; i> 8, 5); - add_bits(scancode, 8); - add_bits(1, 2); +static int sharp_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) +{ + sharp_add_bits(&buf, scancode >> 8, 5); + sharp_add_bits(&buf, scancode, 8); + sharp_add_bits(&buf, 1, 2);
[git:v4l-utils/master] keytable: add compatibility for input_event_sec
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: add compatibility for input_event_sec Author: Rosen Penev Date:Tue Apr 7 18:13:44 2020 -0700 Linux 4.16 added support for this macro. When it is not available, define it back to the previous value. Signed-off-by: Rosen Penev Signed-off-by: Sean Young utils/keytable/keytable.c | 4 1 file changed, 4 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8b7e6ce9367fe09ca9398b5f3cc75bba2598b162 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index bc890394a7c3..4db91267cad9 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -62,6 +62,10 @@ struct input_keymap_entry_v2 { u_int8_t scancode[32]; }; +#ifndef input_event_sec +#define input_event_sec time.tv_sec +#define input_event_usec time.tv_usec +#endif #define IR_PROTOCOLS_USER_DIR IR_KEYTABLE_USER_DIR "/protocols" #define IR_PROTOCOLS_SYSTEM_DIR IR_KEYTABLE_SYSTEM_DIR "/protocols" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: use input_event properly
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: use input_event properly Author: Rosen Penev Date:Mon Mar 30 14:24:34 2020 -0700 It does not use time_t under musl when time_t is 64-bit. The struct has compatibility defines. Instead of using time_t directly, use those defines. Fixes compilation under musl 1.2.0 under 32-bit OSes. Signed-off-by: Rosen Penev Signed-off-by: Sean Young utils/keytable/keytable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=38f4ce74275ae4625463f7eec78764715a0b6246 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index aad993eaaa4c..bc890394a7c3 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1551,7 +1551,7 @@ static void test_event(struct rc_device *rc_dev, int fd) for (i = 0; i < rd / sizeof(struct input_event); i++) { printf(_("%ld.%06ld: event type %s(0x%02x)"), - ev[i].time.tv_sec, ev[i].time.tv_usec, + ev[i].input_event_sec, ev[i].input_event_usec, get_event_name(events_type, ev[i].type), ev[i].type); switch (ev[i].type) { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: new samsung36 bpf decoder
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: new samsung36 bpf decoder Author: Sean Young Date:Tue Jan 28 22:01:34 2020 + Signed-off-by: Sean Young utils/keytable/bpf_protocols/Makefile.am | 2 +- utils/keytable/bpf_protocols/samsung36.c | 136 +++ 2 files changed, 137 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=6c05f42737642d5daa77d37f6c72c843a654b511 diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am index 3423aba1224a..13be2794791b 100644 --- a/utils/keytable/bpf_protocols/Makefile.am +++ b/utils/keytable/bpf_protocols/Makefile.am @@ -10,7 +10,7 @@ CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - &1 \ %.o: %.c bpf_helpers.h $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $< -PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o +PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o all: $(PROTOCOLS) diff --git a/utils/keytable/bpf_protocols/samsung36.c b/utils/keytable/bpf_protocols/samsung36.c new file mode 100644 index ..1b09365fcb67 --- /dev/null +++ b/utils/keytable/bpf_protocols/samsung36.c @@ -0,0 +1,136 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Remote protocol used by some Samsung remotes. It has 36 bits and the +// 16th bit is not really a bit, but a marker to distinguish it from +// shorter samsung protocols. +// +// http://www.hifi-remote.com/wiki/index.php/DecodeIR#Samsung36 +// Copyright (C) 2020 Sean Young + +#include +#include + +#include "bpf_helpers.h" + +enum state { + STATE_INACTIVE, + STATE_HEADER_SPACE, + STATE_BITS_SPACE, + STATE_BITS_PULSE, + STATE_TRAILER, +}; + +struct decoder_state { + unsigned long bits; + enum state state; + unsigned int count; +}; + +struct bpf_map_def SEC("maps") decoder_state_map = { + .type = BPF_MAP_TYPE_ARRAY, + .key_size = sizeof(unsigned int), + .value_size = sizeof(struct decoder_state), + .max_entries = 1, +}; + +// These values can be overridden in the rc_keymap toml +// +// We abuse elf relocations. We cast the address of these variables to +// an int, so that the compiler emits a mov immediate for the address +// but uses it as an int. The bpf loader replaces the relocation with the +// actual value (either overridden or taken from the data segment). +int margin = 300; +int rc_protocol = 69; + +#define BPF_PARAM(x) (int)(&(x)) + +static inline int eq_margin(unsigned d1, unsigned d2) +{ + return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin; +} + +SEC("samsung36") +int bpf_decoder(unsigned int *sample) +{ + unsigned int key = 0; + struct decoder_state *s = bpf_map_lookup_elem(&decoder_state_map, &key); + + if (!s) + return 0; + + switch (*sample & LIRC_MODE2_MASK) { + case LIRC_MODE2_SPACE: + case LIRC_MODE2_PULSE: + case LIRC_MODE2_TIMEOUT: + break; + default: + // not a timing events + return 0; + } + + int duration = LIRC_VALUE(*sample); + int pulse = LIRC_IS_PULSE(*sample); + + switch (s->state) { + case STATE_INACTIVE: + if (pulse && eq_margin(duration, 4500)) { + s->bits = 0; + s->state = STATE_HEADER_SPACE; + s->count = 0; + } + break; + case STATE_HEADER_SPACE: + if (!pulse && eq_margin(duration, 4500)) + s->state = STATE_BITS_PULSE; + else + s->state = STATE_INACTIVE; + break; + case STATE_BITS_PULSE: + if (pulse && eq_margin(duration, 500)) + s->state = STATE_BITS_SPACE; + else + s->state = STATE_INACTIVE; + break; + case STATE_BITS_SPACE: + if (pulse) { + s->state = STATE_INACTIVE; + break; + } + + s->count++; + + if (s->count == 17) { + if (eq_margin(duration, 4450)) { + s->state = STATE_BITS_PULSE; + } else { + s->state = STATE_INACTIVE; + } + break; + } + + s->bits <<= 1; + + if (eq_margin(duration, 1600)) { + s->bits
[git:v4l-utils/master] keytable: support 64 bit scancodes
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: support 64 bit scancodes Author: Sean Young Date:Tue Jan 21 16:30:55 2020 + Signed-off-by: Sean Young utils/common/keymap.c | 4 +-- utils/common/keymap.h | 4 +-- utils/keytable/keytable.c | 80 --- 3 files changed, 59 insertions(+), 29 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=0ac19363566e82d6975ee5df14c28013b059689f diff --git a/utils/common/keymap.c b/utils/common/keymap.c index df953d7c59b2..fa8f256ff29e 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -162,7 +162,7 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb return ENOMEM; } - se->scancode = strtoul(scancode, NULL, 0); + se->scancode = strtoull(scancode, NULL, 0); se->keycode = strdup(keycode); se->next = map->scancode; map->scancode = se; @@ -447,7 +447,7 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot return ENOMEM; } - se->scancode = strtoul(scancode, NULL, 0); + se->scancode = strtoull(scancode, NULL, 0); se->keycode = keycode; *next = se; next = &se->next; diff --git a/utils/common/keymap.h b/utils/common/keymap.h index f2b296327f93..998338275446 100644 --- a/utils/common/keymap.h +++ b/utils/common/keymap.h @@ -20,13 +20,13 @@ struct protocol_param { struct scancode_entry { struct scancode_entry *next; - u_int32_t scancode; + u_int64_t scancode; char *keycode; }; struct raw_entry { struct raw_entry *next; - u_int32_t scancode; + u_int64_t scancode; u_int32_t raw_length; char *keycode; u_int32_t raw[1]; diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index e2a1bfe1535d..aad993eaaa4c 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -76,7 +76,8 @@ struct input_keymap_entry_v2 { #endif struct keytable_entry { - u_int32_t scancode; + // 64 bit int which can printed with %llx + unsigned long long scancode; u_int32_t keycode; struct keytable_entry *next; }; @@ -400,7 +401,7 @@ static int add_keymap(struct keymap *map, const char *fname) if (value == -1) { value = strtol(se->keycode, &p, 0); if (errno || *p) { - fprintf(stderr, _("%s: keycode `%s' not recognised, no mapping for scancode %d\n"), fname, se->keycode, se->scancode); + fprintf(stderr, _("%s: keycode `%s' not recognised, no mapping for scancode 0x04%llx\n"), fname, se->keycode, (unsigned long long)se->scancode); continue; } } @@ -589,7 +590,7 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) return ENOMEM; } - ke->scancode = strtoul(p, NULL, 0); + ke->scancode = strtoull(p, NULL, 0); if (errno) { free(ke); argp_error(state, _("Invalid scancode: %s"), p); @@ -616,7 +617,7 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) ke->keycode = key; if (debug) - fprintf(stderr, _("scancode 0x%04x=%u\n"), + fprintf(stderr, _("scancode 0x%04llx=%u\n"), ke->scancode, ke->keycode); ke->next = keytable; @@ -722,21 +723,21 @@ static struct argp argp = { .doc = doc, }; -static void prtcode(int *codes) +static void prtcode(unsigned long long scancode, int keycode) { struct parse_event *p; for (p = key_events; p->name != NULL; p++) { - if (p->value == (unsigned)codes[1]) { - printf(_("scancode 0x%04x = %s (0x%02x)\n"), codes[0], p->name, codes[1]); + if (p->value == keycode) { + printf(_("scancode 0x%04llx = %s (0x%02x)\n"), scancode, p->name, keycode); return; } } - if (isprint (codes[1])) - printf(_("scancode 0x%04x = '%c' (0x
[git:v4l-utils/master] Add keymap for Samsung AK59-00125A remote
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Add keymap for Samsung AK59-00125A remote Author: Sean Young Date:Wed Jan 29 10:22:06 2020 + Signed-off-by: Sean Young .../rc_keymaps_userspace/samsung_ak59_00125a.toml | 69 ++ 1 file changed, 69 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=351531d33dc7345478f86bc242f72b4ba0eccbe6 diff --git a/utils/keytable/rc_keymaps_userspace/samsung_ak59_00125a.toml b/utils/keytable/rc_keymaps_userspace/samsung_ak59_00125a.toml new file mode 100644 index ..488c6237b7b0 --- /dev/null +++ b/utils/keytable/rc_keymaps_userspace/samsung_ak59_00125a.toml @@ -0,0 +1,69 @@ +[[protocols]] +name = 'Samsung AK59-00125A' +protocol = 'pulse_distance' +header_pulse = 4500 +header_space = 4500 +bit_pulse = 600 +bit_0_space = 500 +bit_1_space = 1600 +bits = 32 +margin = 300 +trailer_pulse = 600 +[protocols.scancodes] +0xe0e040bf = "KEY_POWER2" +# input +0xe0e0807f = "KEY_VIDEO" +0xe0e0e01f = "KEY_VOLUMEUP" +0xe0e0d02f = "KEY_VOLUMEDOWN" +0xe0e0f00f = "KEY_MUTE" +0xe0e048b7 = "KEY_CHANNELUP" +0xe0e008f7 = "KEY_CHANNELDOWN" +[[protocols]] +protocol = 'samsung36' +[protocols.scancodes] +0x400e00ff = "KEY_POWER" +# bonus view +0x400ecc33 = "KEY_VENDOR" +0x400e807f = "KEY_EJECTCD" +0x400e40bf = "KEY_NUMERIC_1" +0x400ec03f = "KEY_NUMERIC_2" +0x400e20df = "KEY_NUMERIC_3" +0x400ea05f = "KEY_NUMERIC_4" +0x400e609f = "KEY_NUMERIC_5" +0x400ee01f = "KEY_NUMERIC_6" +0x400e10ef = "KEY_NUMERIC_7" +0x400e906f = "KEY_NUMERIC_8" +0x400e50af = "KEY_NUMERIC_9" +0x400ed02f = "KEY_NUMERIC_0" +0x400ea45b = "KEY_AUDIO" +0x400e649b = "KEY_SUBTITLE" +0x400eb04f = "KEY_PREVIOUS" +0x400e8877 = "KEY_NEXT" +0x400e48b7 = "KEY_FASTREVERSE" +0x400ea857 = "KEY_FASTFORWARD" +0x400ec837 = "KEY_STOP" +0x400e28d7 = "KEY_PLAY" +0x400e4cb3 = "KEY_PAUSE" +# disc menu +0x400eb847 = "KEY_ROOT_MENU" +0x400e6897 = "KEY_MENU" +# title menu/popup +0x400e04fb = "KEY_TITLE" +# tools +0x400e5ca3 = "KEY_CONFIG" +0x400e7887 = "KEY_INFO" +0x400e18e7 = "KEY_UP" +0x400ed827 = "KEY_LEFT" +0x400e58a7 = "KEY_RIGHT" +0x400e9867 = "KEY_DOWN" +0x400e38c7 = "KEY_ENTER" +0x400ee817 = "KEY_ESC" +0x400ed42b = "KEY_EXIT" +0x400e847b = "KEY_RED" +0x400e44bb = "KEY_GREEN" +0x400ec43b = "KEY_YELLOW" +0x400e24db = "KEY_BLUE" +# smart/hub +0x400e1ce3 = "KEY_VENDOR" +0x400ebc43 = "KEY_SEARCH" +0x400ee41b = "KEY_MEDIA_REPEAT" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] Fix build failure on s390x
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: Fix build failure on s390x Author: Sean Young Date:Sun Feb 16 09:18:39 2020 + See: https://bugzilla.redhat.com/show_bug.cgi?id=1800228 /usr/bin/ld: .libs/libdvbv5_la-dvb-fe.o:(.bss+0x8): multiple definition of `delivery_system_name'; .libs/libdvbv5_la-dvb-v5.o:/builddir/build/BUILD/v4l-utils-1.18.0/lib/libdvbv5/dvb-v5.h:29: first defined here /usr/bin/ld: .libs/libdvbv5_la-dvb-fe.o:(.bss+0xa8): multiple definition of `dvb_v5_name'; .libs/libdvbv5_la-dvb-v5.o:/builddir/build/BUILD/v4l-utils-1.18.0/lib/libdvbv5/dvb-v5.h:28: first defined here /usr/bin/ld: .libs/libdvbv5_la-dvb-fe.o:(.rodata+0x3ec): multiple definition of `fe_bandwidth_name'; .libs/libdvbv5_la-dvb-v5.o:/builddir/build/BUILD/v4l-utils-1.18.0/lib/libdvbv5/dvb-v5.h:20: first defined here delivery_system_name etc are being defined both in lib/libdvbv5/dvb-v5.c and lib/libdvbv5/dvb-v5.h. Signed-off-by: Sean Young Acked-by: Sakari Ailus lib/libdvbv5/gen_dvb_structs.pl | 3 +++ 1 file changed, 3 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=4e555017a19834db66d4772f62c5b382fb374dea diff --git a/lib/libdvbv5/gen_dvb_structs.pl b/lib/libdvbv5/gen_dvb_structs.pl index 7e1d645c4889..d15d1fc3bc66 100755 --- a/lib/libdvbv5/gen_dvb_structs.pl +++ b/lib/libdvbv5/gen_dvb_structs.pl @@ -419,6 +419,9 @@ sub output_arrays($) } printf OUT " %s[%i]", $name, $size; } else { +if ($decl) { + printf OUT "extern "; +} printf OUT "const %s%s[%i]", $type, $name, $size + 1; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: a bpf protocol can have parameters and no scancodes
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: a bpf protocol can have parameters and no scancodes Author: Sean Young Date:Wed Jan 29 10:37:22 2020 + Currently a protocol without scancodes does not get its parameters parsed. Signed-off-by: Sean Young utils/common/keymap.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=c4a62f26c5c3ecd856ca10cf2f0d35d100283d7f diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 6ca33745cbef..df953d7c59b2 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -389,13 +389,6 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot return EINVAL; } - scancodes = toml_table_in(proot, "scancodes"); - if (!scancodes) { - if (verbose) - fprintf(stderr, _("%s: no [protocols.scancodes] section\n"), fname); - return 0; - } - for (i = 0; (key = toml_key_in(proot, i)) != NULL; i++) { int64_t value; @@ -413,6 +406,13 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot } } + scancodes = toml_table_in(proot, "scancodes"); + if (!scancodes) { + if (verbose) + fprintf(stderr, _("%s: no [protocols.scancodes] section\n"), fname); + return 0; + } + struct scancode_entry **next = &map->scancode; i = 0; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] rc_keymap.5: improve wording around using rc_keymaps for sending
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: rc_keymap.5: improve wording around using rc_keymaps for sending Author: Sean Young Date:Thu Jan 23 09:29:13 2020 + Signed-off-by: Sean Young utils/keytable/rc_keymap.5.in | 21 +++-- 1 file changed, 11 insertions(+), 10 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e7402fb758fd106955c3b7d5a5e961d1cb606f4a diff --git a/utils/keytable/rc_keymap.5.in b/utils/keytable/rc_keymap.5.in index 1a3f00b54aaa..4c3da8342692 100644 --- a/utils/keytable/rc_keymap.5.in +++ b/utils/keytable/rc_keymap.5.in @@ -3,7 +3,7 @@ rc_keymap \- toml file describing remote control keymap .SH DESCRIPTION An rc_keymap describes a remote control. It list the protocols used, and the -mapping from decoded IR to linux input events. This file is used by +mapping from decoded IR to linux input keycodes. This file is used by ir\-keytable(1) for IR decoding, and by ir-ctl(1) for sending IR. .PP The file format is toml. Since a remote control can use multiple protocols, @@ -15,8 +15,8 @@ For each protocol the remote uses, there should be one entry in the top level \fBprotocols\fR array. .SS Name Field Each protocols entry has a \fBname\fR field. The name is not used by -ir\-keytable, but can be used to give the remote control a more descriptive -name than the file name, e.g. the model number. +ir\-keytable or ir\-ctl, but can be used to give the remote control a more +descriptive name than the file name, e.g. the model number. .SS Protocol Field The \fBprotocol\fR field specifies the protocol. This can either be one of the linux kernel decoders, in which case it is \fBnec\fR, \fBrc\-5\fR, \fBrc\-6\fR, @@ -34,8 +34,7 @@ for how to write your own. .SS Variant Field The \fBvariant\fR field specifies which variant a particular protocol uses. The \fBsony\fR, \fBrc-5\fR, \fBrc-6\fR protocols have different bit length -variants, for example. This field is not currently used. However, this is -needed should the keymap be used for sending IR, rather than decoding it. +variants, for example. This field is used by ir\-ctl when sending IR. .PP The following variants are currently defined: .PP @@ -52,20 +51,22 @@ Protocol \fBrc\-mm\fR has variants \fBrc-mm-12\fR, \fBrc-mm-24\fR, and \fBrc-mm-32\fR. .SS Scancodes field The \fBscancodes\fR table list the scancodes and the mapping to linux input -key events. Multiple scancodes can map to the same key event. This field +keycode. Multiple scancodes can map to the same keycode. The scancodes field is not present for \fBraw\fR protocols. .PP If the scancode start with 0x, it is interpreted as a hexadecimal number. If it starts with a 0, it is interpreted as an octal number. .PP -The key events are listed in the \fBinput-event-codes.h\fR header file. +Valid keycodes are listed in the \fBinput-event-codes.h\fR header file. Examples are \fBKEY_ENTER\fR, \fBKEY_ESC\fR or \fBBTN_LEFT\fR for the left -mouse button. +mouse button. Note that if the keymap is only used for sending IR, then +the key does not have to be a valid linux keycode. It can be any string +without whitespace. .SS Raw field If the protocol is \fBraw\fR, the \fBraw\fR field is an array of keycode to raw mapping. For each entry, there is a \fBkeycode\fR field and \fBraw\fR -field. The \fBkeycode\fR is a linux input event, as explained the scancodes -section. +field. The \fBkeycode\fR is a linux input keycode, as explained in the +scancodes field above. .PP The \fBraw\fR field is an string, which lists pulse and space values, separated by whitespace. The first is a pulse value microseconds, and ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: keymap without protocol is invalid
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: keymap without protocol is invalid Author: Sean Young Date:Tue Jan 21 16:48:12 2020 + Without a protocol, keymap cannot be loaded and causes a segfault. Reported-by: Camden Lindsay Signed-off-by: Sean Young utils/common/keymap.c | 5 + 1 file changed, 5 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=63b02ae9492f89ec2ea5f12e322761361dd28233 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index d06deb593ea5..6ca33745cbef 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -169,6 +169,11 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb } fclose(fin); + if (!map->protocol) { + fprintf(stderr, _("Missing protocol in %s\n"), fname); + return EINVAL; + } + *keymap = map; return 0; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.16.8] keytable: ensure we have enough memlock pages
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: ensure we have enough memlock pages Author: Sean Young Date:Wed Sep 4 11:03:24 2019 +0100 Since kernel v5.2, BPF maps and programs are charged against RLIMT_MEMLOCK. By default this limit is 64KB however all of these are already taken (16 pages on x86) by the time we've booted on Fedora. This results in a permission denied error. The error message is confusing since it happens when running as root. systemd works around this problem by setting setrlimit(RLIMIT_MEMLOCK) to 64MB. Do the the same. Signed-off-by: Sean Young (cherry picked from commit 7530ca0b53c921f681af9d02a1f1958185dce2d2) utils/keytable/keytable.c | 14 ++ 1 file changed, 14 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=21bbb1a5723f0f60e800408175f0a62e82946971 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 46074ee9ef41..b0727e5a326d 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1852,9 +1853,14 @@ static void device_info(int fd, char *prepend) #ifdef HAVE_BPF #define MAX_PROGS 64 +// This value is what systemd sets PID 1 to, see: +// https://github.com/systemd/systemd/blob/master/src/basic/def.h#L60 +#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL) + static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) { unsigned int features; + struct rlimit rl; int fd; fd = open(lirc_name, O_RDONLY); @@ -1875,6 +1881,14 @@ static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_ return; } + // BPF programs are charged against RLIMIT_MEMLOCK. We'll need pages + // for the state, program text, and any raw IR. None of these are + // particularly large. However, the kernel defaults to 64KB + // memlock, which is only 16 pages which are mostly used by the + // time we are trying to load our BPF program. + rl.rlim_cur = rl.rlim_max = HIGH_RLIMIT_MEMLOCK; + (void) setrlimit(RLIMIT_MEMLOCK, &rl); + load_bpf_file(bpf_prog, fd, toml); close(fd); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.16.8] keytable: do not install bpf protocols decoders with execute permission
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: do not install bpf protocols decoders with execute permission Author: Sean Young Date:Fri Nov 23 11:39:30 2018 + The rpm packaging system will try to extract debug information, which fails since there is no build id. This can be avoided by removing the execute permission. BPF relocatable files are executable anyway so this is the right thing to do. See: https://github.com/rpm-software-management/rpm/pull/604 Signed-off-by: Sean Young utils/keytable/bpf_protocols/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=392fac431814ed59a8be2c818980a888d12f09ee diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am index ba79742c9ca7..56b0eb7cefe4 100644 --- a/utils/keytable/bpf_protocols/Makefile.am +++ b/utils/keytable/bpf_protocols/Makefile.am @@ -21,4 +21,4 @@ EXTRA_DIST = $(PROTOCOLS:%.o=%.c) bpf_helpers.h install-data-local: $(install_sh) -d "$(DESTDIR)$(keytableuserdir)/protocols" $(install_sh) -d "$(DESTDIR)$(keytablesystemdir)/protocols" - $(install_sh) $(PROTOCOLS) "$(DESTDIR)$(keytablesystemdir)/protocols" + $(install_sh) -m 0644 $(PROTOCOLS) "$(DESTDIR)$(keytablesystemdir)/protocols" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.16.8] ir-ctl: show user how scancodes should be presented
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: show user how scancodes should be presented Author: Sean Young Date:Mon Jul 22 06:15:37 2019 +0100 Currently ir-ctl just says the scancode is invalid, which is not very clear. Signed-off-by: Sean Young (cherry picked from commit be940713a6e29652d4440cebc78e8381606646bd) utils/common/ir-encode.c | 66 ++-- utils/common/ir-encode.h | 2 +- utils/ir-ctl/ir-ctl.c| 10 ++-- 3 files changed, 56 insertions(+), 22 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=46109204b2df117126a03321996601002df8aa24 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index ccc7503251ee..175a86503788 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -423,22 +424,61 @@ unsigned protocol_scancode_mask(enum rc_proto proto) return protocols[proto].scancode_mask; } -bool protocol_scancode_valid(enum rc_proto p, unsigned s) +void protocol_scancode_valid(enum rc_proto *p, unsigned *s) { - if (s & ~protocols[p].scancode_mask) - return false; - - if (p == RC_PROTO_NECX) { - return (((s >> 16) ^ ~(s >> 8)) & 0xff) != 0; - } else if (p == RC_PROTO_NEC32) { - return (((s >> 24) ^ ~(s >> 16)) & 0xff) != 0; - } else if (p == RC_PROTO_RC6_MCE) { - return (s & 0x) == 0x800f; - } else if (p == RC_PROTO_RC6_6A_32) { - return (s & 0x) != 0x800f; + enum rc_proto p2 = *p; + unsigned s2 = *s; + + // rc6_mce is rc6_6a_32 with vendor code 0x800f and + if (*p == RC_PROTO_RC6_MCE && (*s & 0x) != 0x800f) { + p2 = RC_PROTO_RC6_6A_32; + } else if (*p == RC_PROTO_RC6_6A_32 && (*s & 0x) == 0x800f) { + p2 = RC_PROTO_RC6_MCE; + } else if (*p == RC_PROTO_NEC || *p == RC_PROTO_NECX || *p == RC_PROTO_NEC32) { + // nec scancodes may repeat the address and command + // in inverted form; the inverted values are not in the + // scancode. + + // can 24 bit scancode be represented as 16 bit scancode + if (*s > 0x && *s <= 0x00ff) { + if *s >> 16) ^ ~(*s >> 8)) & 0xff) != 0) { + // is it necx + p2 = RC_PROTO_NECX; + } else { + // or regular nec + s2 = ((*s >> 8) & 0xff00) | (*s & 0x00ff); + p2 = RC_PROTO_NEC; + } + // can 32 bit scancode be represented as 24 or 16 bit scancode + } else if (*s > 0x00ff) { + if (*s >> 24) ^ ~(*s >> 16)) & 0xff) == 0) && + *s >> 8) ^ ~(*s >> 0)) & 0xff) == 0)) { + // is it nec + s2 = ((*s >> 16) & 0xff00) | +((*s >> 8) & 0x00ff); + p2 = RC_PROTO_NEC; + } else if (*s >> 24) ^ ~(*s >> 16)) & 0xff) != 0) && + *s >> 8) ^ ~(*s >> 0)) & 0xff) == 0)) { + // is it nec-x + s2 = (*s >> 8) & 0xff; + p2 = RC_PROTO_NECX; + } else { + // or it has to be nec32 + p2 = RC_PROTO_NEC32; + } + } } - return true; + s2 &= protocols[p2].scancode_mask; + + if (*p != p2 || *s != s2) { + fprintf(stderr, + "warning: `%s:0x%x' will be decoded as `%s:0x%x'\n", + protocol_name(*p), *s, protocol_name(p2), s2); + + *p = p2; + *s = s2; + } } bool protocol_encoder_available(enum rc_proto proto) diff --git a/utils/common/ir-encode.h b/utils/common/ir-encode.h index 7202c2d8c97c..df595354a962 100644 --- a/utils/common/ir-encode.h +++ b/utils/common/ir-encode.h @@ -7,7 +7,7 @@ bool protocol_match(const char *name, enum rc_proto *proto); unsigned protocol_carrier(enum rc_proto proto); unsigned protocol_max_size(enum rc_proto proto); -bool protocol_scancode_valid(enum rc_proto proto, unsigned scancode); +void protocol_scancode_valid(enum rc_proto *proto,
[git:v4l-utils/v4l-utils-1.16.8] libdvbv5: fix double free in dvb_fe_open_fname
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: libdvbv5: fix double free in dvb_fe_open_fname Author: André Roth Date:Sat Jul 7 07:20:55 2018 -0400 Since parms and fname is allocated outside of the function, do not free it. Use dvb_v5_free for freeing parms, it will free fname if required. Signed-off-by: André Roth Signed-off-by: Mauro Carvalho Chehab lib/libdvbv5/dvb-fe.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=78057aaa784a922b4ac6af9f323b828f7a834581 diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 514a187987f9..7f63476612d7 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -179,7 +179,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, ret = dvb_fe_open_fname(parms, dvb_dev->path, flags); if (ret < 0) { - free(parms); + dvb_v5_free(parms); return NULL; } @@ -202,9 +202,7 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (xioctl(fd, FE_GET_INFO, &parms->p.info) == -1) { dvb_perror("FE_GET_INFO"); - dvb_v5_free(parms); close(fd); - free(fname); return -errno; } @@ -291,7 +289,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, } if (!parms->p.num_systems) { dvb_logerr(_("delivery system not detected")); - dvb_v5_free(parms); close(fd); return -EINVAL; } @@ -302,7 +299,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, dtv_prop.props = parms->dvb_prop; if (xioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { dvb_perror("FE_GET_PROPERTY"); - dvb_v5_free(parms); close(fd); return -errno; } @@ -312,7 +308,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (parms->p.num_systems == 0) { dvb_logerr(_("driver returned 0 supported delivery systems!")); - dvb_v5_free(parms); close(fd); return -EINVAL; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keymap.h needs sys/types.h and argp.h with musl
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keymap.h needs sys/types.h and argp.h with musl Author: Peter Seiderer Date:Wed Dec 18 22:10:16 2019 +0100 Fixes: keymap.h:23:2: error: unknown type name ‘u_int32_t’ keymap.h:36:1: error: unknown type name ‘error_t’ Signed-off-by: Peter Seiderer Signed-off-by: Sean Young utils/common/keymap.c | 2 ++ utils/ir-ctl/bpf_encoder.c | 1 + 2 files changed, 3 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=976a2f681b4e4e16edffd972d53a623b895c5646 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index f574f24fd6e4..d06deb593ea5 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -9,6 +9,8 @@ #include #include #include +#include +#include #include "keymap.h" #include "toml.h" diff --git a/utils/ir-ctl/bpf_encoder.c b/utils/ir-ctl/bpf_encoder.c index 82d12cc049d3..e3e705e798c8 100644 --- a/utils/ir-ctl/bpf_encoder.c +++ b/utils/ir-ctl/bpf_encoder.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "keymap.h" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.16] ir-ctl: show user how scancodes should be presented
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: show user how scancodes should be presented Author: Sean Young Date:Mon Jul 22 06:15:37 2019 +0100 Currently ir-ctl just says the scancode is invalid, which is not very clear. Signed-off-by: Sean Young (cherry picked from commit be940713a6e29652d4440cebc78e8381606646bd) utils/common/ir-encode.c | 66 ++-- utils/common/ir-encode.h | 2 +- utils/ir-ctl/ir-ctl.c| 10 ++-- 3 files changed, 56 insertions(+), 22 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=46109204b2df117126a03321996601002df8aa24 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index ccc7503251ee..175a86503788 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -423,22 +424,61 @@ unsigned protocol_scancode_mask(enum rc_proto proto) return protocols[proto].scancode_mask; } -bool protocol_scancode_valid(enum rc_proto p, unsigned s) +void protocol_scancode_valid(enum rc_proto *p, unsigned *s) { - if (s & ~protocols[p].scancode_mask) - return false; - - if (p == RC_PROTO_NECX) { - return (((s >> 16) ^ ~(s >> 8)) & 0xff) != 0; - } else if (p == RC_PROTO_NEC32) { - return (((s >> 24) ^ ~(s >> 16)) & 0xff) != 0; - } else if (p == RC_PROTO_RC6_MCE) { - return (s & 0x) == 0x800f; - } else if (p == RC_PROTO_RC6_6A_32) { - return (s & 0x) != 0x800f; + enum rc_proto p2 = *p; + unsigned s2 = *s; + + // rc6_mce is rc6_6a_32 with vendor code 0x800f and + if (*p == RC_PROTO_RC6_MCE && (*s & 0x) != 0x800f) { + p2 = RC_PROTO_RC6_6A_32; + } else if (*p == RC_PROTO_RC6_6A_32 && (*s & 0x) == 0x800f) { + p2 = RC_PROTO_RC6_MCE; + } else if (*p == RC_PROTO_NEC || *p == RC_PROTO_NECX || *p == RC_PROTO_NEC32) { + // nec scancodes may repeat the address and command + // in inverted form; the inverted values are not in the + // scancode. + + // can 24 bit scancode be represented as 16 bit scancode + if (*s > 0x && *s <= 0x00ff) { + if *s >> 16) ^ ~(*s >> 8)) & 0xff) != 0) { + // is it necx + p2 = RC_PROTO_NECX; + } else { + // or regular nec + s2 = ((*s >> 8) & 0xff00) | (*s & 0x00ff); + p2 = RC_PROTO_NEC; + } + // can 32 bit scancode be represented as 24 or 16 bit scancode + } else if (*s > 0x00ff) { + if (*s >> 24) ^ ~(*s >> 16)) & 0xff) == 0) && + *s >> 8) ^ ~(*s >> 0)) & 0xff) == 0)) { + // is it nec + s2 = ((*s >> 16) & 0xff00) | +((*s >> 8) & 0x00ff); + p2 = RC_PROTO_NEC; + } else if (*s >> 24) ^ ~(*s >> 16)) & 0xff) != 0) && + *s >> 8) ^ ~(*s >> 0)) & 0xff) == 0)) { + // is it nec-x + s2 = (*s >> 8) & 0xff; + p2 = RC_PROTO_NECX; + } else { + // or it has to be nec32 + p2 = RC_PROTO_NEC32; + } + } } - return true; + s2 &= protocols[p2].scancode_mask; + + if (*p != p2 || *s != s2) { + fprintf(stderr, + "warning: `%s:0x%x' will be decoded as `%s:0x%x'\n", + protocol_name(*p), *s, protocol_name(p2), s2); + + *p = p2; + *s = s2; + } } bool protocol_encoder_available(enum rc_proto proto) diff --git a/utils/common/ir-encode.h b/utils/common/ir-encode.h index 7202c2d8c97c..df595354a962 100644 --- a/utils/common/ir-encode.h +++ b/utils/common/ir-encode.h @@ -7,7 +7,7 @@ bool protocol_match(const char *name, enum rc_proto *proto); unsigned protocol_carrier(enum rc_proto proto); unsigned protocol_max_size(enum rc_proto proto); -bool protocol_scancode_valid(enum rc_proto proto, unsigned scancode); +void protocol_scancode_valid(enum rc_proto *proto,
[git:v4l-utils/master] lircd2toml: warn when scancode has duplicate definitions
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: lircd2toml: warn when scancode has duplicate definitions Author: Sean Young Date:Tue Dec 31 18:24:05 2019 + In lircd.conf files, it is possible that the same scancode has multiple key definitions. In our rc keymap toml format, one scancode can only have one key definition. Possibly we should allow alternate names for scancode for transmitting; however, as a first step, we should warn if there are multiple definitions for the same scancode. Signed-off-by: Sean Young contrib/lircd2toml.py | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=934a1b9bebccf9b9e4b390c3ba0198374e4a9199 diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index 54ea12fccce6..ba4b14ec4fd3 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -131,7 +131,11 @@ class LircdParser: for s in a: if s[0] == '#': break -codes[int(s, 0)] = k +scancode = int(s, 0) +if scancode in codes: +self.warning("scancode 0x{:x} has duplicate definition {} and {}".format(scancode, codes[scancode], k)) + +codes[scancode] = k def read_raw_codes(self): raw_codes = [] ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] 50-rc_keymap.conf prevents debian testing from booting
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: 50-rc_keymap.conf prevents debian testing from booting Author: Sean Young Date:Mon Oct 28 14:17:41 2019 + If SystemCallFilter is not set for systemd-udevd, then 50-rc_keymap.conf restricts the service to _only_ the bpf syscall, preventing the system from booting. Tested-by: Hans Verkuil Reported-by: Hans Verkuil Signed-off-by: Sean Young configure.ac | 6 ++ utils/keytable/Makefile.am | 2 ++ 2 files changed, 8 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=6c415a11fceb32067cdb5c2e33f90dbf018182a4 diff --git a/configure.ac b/configure.ac index 01a24a286d00..8585a79d1939 100644 --- a/configure.ac +++ b/configure.ac @@ -521,6 +521,12 @@ AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgcon AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])]) AS_IF([test x$enable_libv4l = xno], [AC_SUBST([ENFORCE_LIBV4L_STATIC], ["-static"])]) +# Since systemd v239, udevd is not allowed to execute BPF systems calls; +# add an override to allow bpf(2) in that case. On earlier versions, the +# override will restrict udevd to bpf syscall only and will stop the system +# from booting. This is also true on current debian versions. +AM_CONDITIONAL([HAVE_UDEVDSYSCALLFILTER], [grep -s SystemCallFilter $with_systemdsystemunitdir/systemd-udevd.service]) + # misc if test "x$linux_os" = "xyes"; then diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index dfcd76099c2c..4724897e592a 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -3,7 +3,9 @@ man_MANS = ir-keytable.1 rc_keymap.5 sysconf_DATA = rc_maps.cfg keytablesystem_DATA = $(srcdir)/rc_keymaps/* udevrules_DATA = 70-infrared.rules +if HAVE_UDEVDSYSCALLFILTER systemdsystemunit_DATA = 50-rc_keymap.conf +endif ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] sync v4l-utils.spec with the fedora repo
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: sync v4l-utils.spec with the fedora repo Author: Sean Young Date:Thu Oct 24 16:09:38 2019 +0100 https://src.fedoraproject.org/rpms/v4l-utils/blob/master/f/v4l-utils.spec Signed-off-by: Sean Young v4l-utils.spec.in | 374 -- 1 file changed, 279 insertions(+), 95 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=ecbee1fefac32a3b9bc4c303bf5f3bf840935d9d diff --git a/v4l-utils.spec.in b/v4l-utils.spec.in index f1dd04214fc5..d9d467062d5f 100644 --- a/v4l-utils.spec.in +++ b/v4l-utils.spec.in @@ -1,21 +1,33 @@ Name: v4l-utils Version:@PACKAGE_VERSION@ -Release:1%{?dist} +Release:2%{?dist} Summary:Utilities for video4linux and DVB devices -Group: Applications/System -# ir-keytable and v4l2-sysfs-path are GPLv2 only +# libdvbv5, dvbv5 utils, ir-keytable and v4l2-sysfs-path are GPLv2 only License:GPLv2+ and GPLv2 URL:http://www.linuxtv.org/downloads/v4l-utils/ + Source0: http://linuxtv.org/downloads/v4l-utils/v4l-utils-%{version}.tar.bz2 -Source1:qv4l2.desktop -Source2:qv4l2.svg -Source3:qvidcap.desktop -Source4:qvidcap.svg -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: qt5-qtbase-devel libsysfs-devel kernel-headers desktop-file-utils elfutils-libelf-devel clang -# For /etc/udev/rules.d ownership + +BuildRequires: alsa-lib-devel +BuildRequires: desktop-file-utils +BuildRequires: doxygen +BuildRequires: gettext +BuildRequires: kernel-headers +BuildRequires: libjpeg-devel +BuildRequires: qt5-qtbase-devel +BuildRequires: systemd-devel + +# BPF decoder dependencies + +%define with_bpf 1 + +%if %{with_bpf} +BuildRequires: elfutils-libelf-devel clang +%endif + +# For /lib/udev/rules.d ownership Requires: udev -Requires: libv4l = %{version}-%{release} +Requires: libv4l%{?_isa} = %{version}-%{release} %description v4l-utils is a collection of various video4linux (V4L) and DVB utilities. The @@ -27,7 +39,7 @@ v4l2-ctl and v4l2-sysfs-path. Summary:Utilities for v4l2 / DVB driver development and debugging # decode_tm6000 is GPLv2 only License:GPLv2+ and GPLv2 -Requires: libv4l = %{version}-%{release} +Requires: libv4l%{?_isa} = %{version}-%{release} %descriptiondevel-tools Utilities for v4l2 / DVB driver authors: decode_tm6000, v4l2-compliance and @@ -37,26 +49,14 @@ v4l2-dbg. %package -n qv4l2 Summary:QT v4l2 test control and streaming test application License:GPLv2+ -Requires: libv4l = %{version}-%{release} +Requires: libv4l%{?_isa} = %{version}-%{release} %description -n qv4l2 QT v4l2 test control and streaming test application. -%package -n qvidcap -Summary:QT v4l2 video capture application -License:GPLv2+ -Requires: libv4l = %{version}-%{release} - -%description -n qvidcap -QT v4l2 video capture application for capturing from a video device, but also -from a file, from a v4l2-ctl compliant network stream, or from a test pattern -generator. - - %package -n libv4l Summary:Collection of video4linux support libraries -Group: System Environment/Libraries # Some of the decompression helpers are GPLv2, the rest is LGPLv2+ License:LGPLv2+ and GPLv2 URL:http://hansdegoede.livejournal.com/3636.html @@ -79,125 +79,309 @@ libv4l2 offers the v4l2 API on top of v4l2 devices, while adding for the application transparent libv4lconvert conversion where necessary. +%package -n libdvbv5 +Summary:Libraries to control, scan and zap on Digital TV channels +License:GPLv2 + +%description -n libdvbv5 +Libraries to control, scan and zap on Digital TV channels + %package -n libv4l-devel Summary:Development files for libv4l -Group: Development/Libraries License:LGPLv2+ URL:http://hansdegoede.livejournal.com/3636.html -Requires: libv4l = %{version}-%{release} +Requires: libv4l%{?_isa} = %{version}-%{release} %description -n libv4l-devel The libv4l-devel package contains libraries and header files for developing applications that use libv4l. -%prep -%setup -q - - -%build -make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" \ - PREFIX=%{_prefix} LIBDIR=%{_libdir} - - -%install -rm -rf $RPM_BUILD_ROOT -make install PREFIX=%{_prefix} LIBDIR=%{_libdir} DESTDIR=$RPM_BUILD_ROOT -# below is the desktop file and icon stuff. -mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications -desktop-file-install --dir $RPM_BUILD_ROOT%{_datadir}/applications \ - %{SOURCE1} -mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps -install
[git:v4l-utils/master] keytable: cannot load BPF decoders from udevd
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: cannot load BPF decoders from udevd Author: Sean Young Date:Wed Oct 23 21:21:58 2019 +0100 By default udevd is not allowed to execute BPF syscalls. Implement workaround as suggested in: https://github.com/systemd/systemd/issues/13787 Signed-off-by: Sean Young configure.ac | 6 ++ utils/keytable/50-rc_keymap.conf | 3 +++ utils/keytable/Makefile.am | 3 ++- v4l-utils.spec.in| 2 ++ 4 files changed, 13 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=7be954b74136a6bf31fc025c24d4f1db03630cea diff --git a/configure.ac b/configure.ac index c84067aeb8b7..01a24a286d00 100644 --- a/configure.ac +++ b/configure.ac @@ -362,6 +362,11 @@ AC_ARG_WITH(udevdir, [], [with_udevdir=`$PKG_CONFIG --variable=udevdir udev || echo /lib/udev`]) +AC_ARG_WITH(systemdsystemunitdir, + AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [set systemd system unit directory]), + [], + [with_systemdsystemunitdir=`$PKG_CONFIG --variable=systemdsystemunitdir systemd || echo /lib/systemd/system`]) + # Generic check: works with most distributions def_gconv_dir=`for i in /lib64 /usr/lib64 /usr/local/lib64 /lib /usr/lib /usr/local/lib; do if @<:@ -d \$i/gconv @:>@; then echo \$i/gconv; break; fi; done` @@ -384,6 +389,7 @@ AC_SUBST([libv4lconvertprivdir], [$libdir/$with_libv4lconvertsubdir]) AC_SUBST([keytablesystemdir], [$with_udevdir/rc_keymaps]) AC_SUBST([keytableuserdir], [$sysconfdir/rc_keymaps]) AC_SUBST([udevrulesdir], [$with_udevdir/rules.d]) +AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir/systemd-udevd.service.d/]) AC_SUBST([pkgconfigdir], [$libdir/pkgconfig]) AC_SUBST([gconvsysdir], [$with_gconvdir]) diff --git a/utils/keytable/50-rc_keymap.conf b/utils/keytable/50-rc_keymap.conf new file mode 100644 index ..6066c50c6476 --- /dev/null +++ b/utils/keytable/50-rc_keymap.conf @@ -0,0 +1,3 @@ +# ir-keytable needs access to bpf in order load BPF decoders +[Service] +SystemCallFilter=bpf diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index d7b30e2c8697..dfcd76099c2c 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -3,6 +3,7 @@ man_MANS = ir-keytable.1 rc_keymap.5 sysconf_DATA = rc_maps.cfg keytablesystem_DATA = $(srcdir)/rc_keymaps/* udevrules_DATA = 70-infrared.rules +systemdsystemunit_DATA = 50-rc_keymap.conf ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h @@ -18,7 +19,7 @@ ir_keytable_LDFLAGS += $(LIBELF_LIBS) SUBDIRS = bpf_protocols endif -EXTRA_DIST = 70-infrared.rules rc_keymaps rc_keymaps_userspace gen_input_events.pl gen_keytables.pl ir-keytable.1 rc_maps.cfg rc_keymap.5 +EXTRA_DIST = 70-infrared.rules 50-rc_keymap.conf rc_keymaps rc_keymaps_userspace gen_input_events.pl gen_keytables.pl ir-keytable.1 rc_maps.cfg rc_keymap.5 check: @$(foreach keymap,$(wildcard $(keytablesystem_DATA)),./ir-keytable --test-keymap=$(keymap);) diff --git a/v4l-utils.spec.in b/v4l-utils.spec.in index d9d467062d5f..a368d3fe8650 100644 --- a/v4l-utils.spec.in +++ b/v4l-utils.spec.in @@ -121,6 +121,7 @@ make doxygen-run %install %{!?_udevrulesdir: %global _udevrulesdir /lib/udev/rules.d} +%{!?_systemdsystemunitdir: %global _systemdsystemunitdir /lib/systemd/system} %make_install find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' rm -f $RPM_BUILD_ROOT%{_libdir}/{v4l1compat.so,v4l2convert.so} @@ -142,6 +143,7 @@ desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/qv4l2.desktop %config(noreplace) %{_sysconfdir}/rc_maps.cfg %{_udevrulesdir}/70-infrared.rules %{_udevrulesdir}/../rc_keymaps/* +%{_systemdsystemunitdir}/50-rc_keymap.conf %{_bindir}/cx18-ctl %{_bindir}/cec* %{_bindir}/dvb* ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-keytable: bpf: improve rsc imon pointer decoder
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-keytable: bpf: improve rsc imon pointer decoder Author: Sean Young Date:Sun Oct 20 15:51:48 2019 +0100 Sometimes the remotes sends 4 bits rather than 5. This makes the pointer much more reliable. Signed-off-by: Sean Young utils/keytable/bpf_protocols/imon_rsc.c | 66 + 1 file changed, 35 insertions(+), 31 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3e4eb8fbfcada0c7f3d1b5a7ee69270ee83bfc07 diff --git a/utils/keytable/bpf_protocols/imon_rsc.c b/utils/keytable/bpf_protocols/imon_rsc.c index e395b09ca40e..14c4ec37cac9 100644 --- a/utils/keytable/bpf_protocols/imon_rsc.c +++ b/utils/keytable/bpf_protocols/imon_rsc.c @@ -9,7 +9,6 @@ enum state { STATE_INACTIVE, - STATE_HEADER_SPACE, STATE_BITS_SPACE, STATE_BITS_PULSE, }; @@ -33,7 +32,7 @@ struct bpf_map_def SEC("maps") decoder_state_map = { // an int, so that the compiler emits a mov immediate for the address // but uses it as an int. The bpf loader replaces the relocation with the // actual value (either overridden or taken from the data segment). -int margin = 250; +int margin = 325; #define BPF_PARAM(x) (int)(&(x)) @@ -68,7 +67,7 @@ int bpf_decoder(unsigned int *sample) case STATE_INACTIVE: if (pulse && (eq_margin(duration, 2000) || eq_margin(duration, 3250))) { - s->state = STATE_HEADER_SPACE; + s->state = STATE_BITS_SPACE; s->bits = 0; s->count = 0; } @@ -80,48 +79,53 @@ int bpf_decoder(unsigned int *sample) else s->state = STATE_INACTIVE; break; - case STATE_HEADER_SPACE: - if (!pulse && eq_margin(duration, 1875)) { - s->state = STATE_BITS_PULSE; - break; - } + case STATE_BITS_SPACE: if (pulse) { s->state = STATE_INACTIVE; break; } - if (s->count == 4) { + if (duration > 2400) { int x = 0, y = 0; - switch (s->bits) { - case 0: x = 0; y = -4; break; - case 8: x = 0; y = 4; break; - case 4: x = 4; y = 0; break; - case 12: x = -4; y = 0; break; - - case 2: x = 4; y = -4; break; - case 10: x = -4; y = 4; break; - case 6: x = 4; y = 4; break; - case 14: x = -4; y = -4; break; - - case 1: x = 4; y = -2; break; - case 9: x = -4; y = 2; break; - case 5: x = 2; y = 4; break; - case 13: x = -2; y = -4; break; - - case 3: x = 2; y = -4; break; - case 11: x = -2; y = 4; break; - case 7: x = 4; y = 2; break; - case 15: x = -4; y = -2; break; + + if (!(s->count == 5 || s->count == 4)) { + s->state = STATE_INACTIVE; + break; } + + switch (s->bits & 0x0f) { + case 0x0: x = 0; y = -4; break; + case 0x1: x = 0; y = 4; break; + case 0x2: x = 4; y = 0; break; + case 0x3: x = -4; y = 0; break; + + case 0x4: x = 4; y = -4; break; + case 0x5: x = -4; y = 4; break; + case 0x6: x = 4; y = 4; break; + case 0x7: x = -4; y = -4; break; + + case 0xc: x = 4; y = -2; break; + case 0xd: x = -4; y = 2; break; + case 0xe: x = 2; y = 4; break; + case 0xf: x = -2; y = -4; break; + + case 0x8: x = 2; y = -4; break; + case 0x9: x = -2; y = 4; break; + case 0xa: x = 4; y = 2; break; + case 0xb: x = -4; y = -2; break; + } + bpf_rc_pointer_rel(sample, x, y); s->state = STATE_INACTIVE; break; } - if (eq_margin(duration, 1700)) - s->bits |= 1 << s->count; + s->bits <<= 1; + + if (eq_margin(duration, 1800)) +
[git:v4l-utils/master] keytable: do not warn if keymap not found in IR_KEYTABLE_USER_DIR
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: do not warn if keymap not found in IR_KEYTABLE_USER_DIR Author: Sean Young Date:Mon Oct 14 11:46:31 2019 +0100 The following error is logged even though imon_rsc.toml is found at /lib/udev/rc_keymaps/imon_rsc.toml: $ ir-keytable -a /etc/rc_maps.cfg /etc/rc_keymaps/imon_rsc.toml: error: cannot open: No such file or directory Signed-off-by: Sean Young utils/keytable/keytable.c | 81 --- 1 file changed, 48 insertions(+), 33 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dbe149b988bbad2e7eb73fbb04d3b8fd41d924c2 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 6cb0217a9a73..e2a1bfe1535d 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1954,6 +1954,38 @@ int bpf_param(struct protocol_param *protocol_param, const char *name, int *val) return -ENOENT; } +char* keymap_to_filename(const char *fname) +{ + struct stat st; + char *p; + + if (fname[0] == '/' || ((fname[0] == '.') && strchr(fname, '/'))) + return strdup(fname); + + if (asprintf(&p, IR_KEYTABLE_USER_DIR "/%s", fname) < 0) { + fprintf(stderr, _("asprintf failed: %m\n")); + return NULL; + } + + if (!stat(p, &st)) + return p; + + free(p); + if (asprintf(&p, IR_KEYTABLE_SYSTEM_DIR "/%s", fname) < 0) { + fprintf(stderr, _("asprintf failed: %m\n")); + return NULL; + } + + if (!stat(p, &st)) + return p; + + free(p); + + fprintf(stderr, _("error: Unable to find keymap %s in %s or %s\n"), fname, IR_KEYTABLE_USER_DIR, IR_KEYTABLE_SYSTEM_DIR); + + return NULL; +} + int main(int argc, char *argv[]) { int dev_from_class = 0, write_cnt; @@ -2003,6 +2035,7 @@ int main(int argc, char *argv[]) if (cfg.next) { struct cfgfile *cur; + struct keymap *map; char *fname; int rc; int matches = 0; @@ -2014,53 +2047,35 @@ int main(int argc, char *argv[]) continue; if (debug) - fprintf(stderr, _("Table for %s, %s is on %s file.\n"), + fprintf(stderr, _("Keymap for %s, %s is on %s file.\n"), rc_dev.drv_name, rc_dev.keytable_name, cur->fname); - if (cur->fname[0] == '/' || ((cur->fname[0] == '.') && strchr(cur->fname, '/'))) { - struct keymap *map; - fname = cur->fname; - rc = parse_keymap(fname, &map, debug); - if (rc < 0) { - fprintf(stderr, _("Can't load %s table\n"), fname); - return -1; - } - add_keymap(map, fname); - free_keymap(map); - } else { - struct keymap *map; - fname = malloc(strlen(cur->fname) + strlen(IR_KEYTABLE_USER_DIR) + 2); - strcpy(fname, IR_KEYTABLE_USER_DIR); - strcat(fname, "/"); - strcat(fname, cur->fname); - rc = parse_keymap(fname, &map, debug); - if (rc != 0) { - fname = malloc(strlen(cur->fname) + strlen(IR_KEYTABLE_SYSTEM_DIR) + 2); - strcpy(fname, IR_KEYTABLE_SYSTEM_DIR); - strcat(fname, "/"); - strcat(fname, cur->fname); - rc = parse_keymap(fname, &map, debug); - } - if (rc != 0) { - fprintf(stderr, _("Can't load %s table from %s or %s\n"), cur->fname, IR_KEYTABLE_USER_DIR, IR_KEYTABLE_SYSTEM_DIR); - return -1; - } + fname = keymap_to_filename(cur->fname); + if (!fname) + return -1; - add_keymap(map, fname); -
[git:v4l-utils/master] ir-ctl: report timeout when it cannot be modified
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: report timeout when it cannot be modified Author: Sean Young Date:Thu Oct 3 11:39:48 2019 +0100 There are many IR devices which cannot modify their timeout, but do have a timeout which should be reported (e.g. mtk_cir). Signed-off-by: Sean Young utils/ir-ctl/ir-ctl.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=3c2135cc09115d8aca8a69d546582e13203a95b2 diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 8aead6e08df8..ef3998083455 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -966,13 +966,16 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) printf(_(" - Use wideband receiver\n")); if (features & LIRC_CAN_MEASURE_CARRIER) printf(_(" - Can measure carrier\n")); + + // This ioctl is only supported from kernel 4.18 onwards + unsigned timeout; + int rc = ioctl(fd, LIRC_GET_REC_TIMEOUT, &timeout); + if (rc == 0) + printf(_(" - Receiving timeout %u microseconds\n"), timeout); + if (features & LIRC_CAN_SET_REC_TIMEOUT) { - unsigned min_timeout, max_timeout, timeout; + unsigned min_timeout, max_timeout; - // This ioctl is only supported from kernel 4.18 onwards - int rc = ioctl(fd, LIRC_GET_REC_TIMEOUT, &timeout); - if (rc == 0) - printf(_(" - Receiving timeout %u microseconds\n"), timeout); rc = ioctl(fd, LIRC_GET_MIN_TIMEOUT, &min_timeout); if (rc) { fprintf(stderr, _("warning: %s: device supports setting receiving timeout but LIRC_GET_MIN_TIMEOUT returns: %m\n"), dev); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: fix memory leaks and incorrect messages
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: fix memory leaks and incorrect messages Author: Sean Young Date:Mon Sep 9 12:43:55 2019 +0100 Signed-off-by: Sean Young utils/common/keymap.c | 7 +-- utils/ir-ctl/ir-ctl.c | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=78953a1166aba23e9a7c40e597a741c7d71a847c diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 1252646186e2..f574f24fd6e4 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -323,11 +323,13 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot raw = toml_raw_in(proot, "protocol"); if (!raw) { fprintf(stderr, _("%s: protocol missing\n"), fname); + free_keymap(map); return EINVAL; } if (toml_rtos(raw, &p)) { fprintf(stderr, _("%s: bad value `%s' for protocol\n"), fname, raw); + free_keymap(map); return EINVAL; } @@ -419,6 +421,7 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot raw = toml_raw_in(scancodes, scancode); if (!raw) { fprintf(stderr, _("%s: invalid value `%s'\n"), fname, scancode); + free_keymap(map); return EINVAL; } @@ -466,14 +469,14 @@ static error_t parse_toml_keymap(char *fname, struct keymap **keymap, bool verbo root = toml_parse_file(fin, buf, sizeof(buf)); fclose(fin); if (!root) { - fprintf(stderr, _("%s: failed to parse toml: %s\n"), fname, buf); + fprintf(stderr, _("%s: error: %s\n"), fname, buf); return EINVAL; } arr = toml_array_in(root, "protocols"); if (!arr) { fprintf(stderr, _("%s: missing [protocols] section\n"), fname); - return EINVAL; + goto out; } struct keymap *map = NULL; diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 586461ace086..8aead6e08df8 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -60,7 +60,7 @@ #define LIRCBUF_SIZE 1024 #define IR_DEFAULT_TIMEOUT 125000 -const char *argp_program_version = "IR raw version " V4L_UTILS_VERSION; +const char *argp_program_version = "IR ctl version " V4L_UTILS_VERSION; const char *argp_program_bug_address = "Sean Young "; /* @@ -251,7 +251,7 @@ static struct send *read_file_pulse_space(struct arguments *args, const char *fn scancodestr = strchr(p, ':'); if (!scancodestr) { - fprintf(stderr, _("error: %s:%d: scancode argument '%s' should in protocol:scancode format\n"), fname, lineno, p); + fprintf(stderr, _("error: %s:%d: scancode argument '%s' should be in protocol:scancode format\n"), fname, lineno, p); fclose(input); free(f); return NULL; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/stable-1.16] keytable: ensure we have enough memlock pages
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: ensure we have enough memlock pages Author: Sean Young Date:Wed Sep 4 11:03:24 2019 +0100 Since kernel v5.2, BPF maps and programs are charged against RLIMT_MEMLOCK. By default this limit is 64KB however all of these are already taken (16 pages on x86) by the time we've booted on Fedora. This results in a permission denied error. The error message is confusing since it happens when running as root. systemd works around this problem by setting setrlimit(RLIMIT_MEMLOCK) to 64MB. Do the the same. Signed-off-by: Sean Young (cherry picked from commit 7530ca0b53c921f681af9d02a1f1958185dce2d2) utils/keytable/keytable.c | 14 ++ 1 file changed, 14 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=21bbb1a5723f0f60e800408175f0a62e82946971 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 46074ee9ef41..b0727e5a326d 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1852,9 +1853,14 @@ static void device_info(int fd, char *prepend) #ifdef HAVE_BPF #define MAX_PROGS 64 +// This value is what systemd sets PID 1 to, see: +// https://github.com/systemd/systemd/blob/master/src/basic/def.h#L60 +#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL) + static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) { unsigned int features; + struct rlimit rl; int fd; fd = open(lirc_name, O_RDONLY); @@ -1875,6 +1881,14 @@ static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_ return; } + // BPF programs are charged against RLIMIT_MEMLOCK. We'll need pages + // for the state, program text, and any raw IR. None of these are + // particularly large. However, the kernel defaults to 64KB + // memlock, which is only 16 pages which are mostly used by the + // time we are trying to load our BPF program. + rl.rlim_cur = rl.rlim_max = HIGH_RLIMIT_MEMLOCK; + (void) setrlimit(RLIMIT_MEMLOCK, &rl); + load_bpf_file(bpf_prog, fd, toml); close(fd); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: improve error message if bpf loading fails
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: improve error message if bpf loading fails Author: Sean Young Date:Fri Sep 6 23:23:00 2019 +0100 Signed-off-by: Sean Young utils/keytable/bpf_load.c | 2 +- utils/keytable/keytable.c | 21 - 2 files changed, 13 insertions(+), 10 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=73405d0ba358d8404108ddc467c34a7d81a6bd2f diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index e301aa97604e..818dedef6245 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -66,7 +66,7 @@ static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, const char *n name, bpf_file->license, 0, bpf_log_buf, BPF_LOG_BUF_SIZE); if (fd < 0) { - printf("bpf_load_program() err=%d\n%s", errno, bpf_log_buf); + printf("bpf_load_program() err=%m\n%s", bpf_log_buf); return -1; } diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index ff0a6c8c9d89..6cb0217a9a73 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1703,28 +1703,28 @@ static void device_info(int fd, char *prepend) // https://github.com/systemd/systemd/blob/master/src/basic/def.h#L60 #define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL) -static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) +static bool attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) { unsigned int features; struct rlimit rl; - int fd; + int fd, ret; fd = open(lirc_name, O_RDONLY); if (fd == -1) { perror(lirc_name); - return; + return false; } if (ioctl(fd, LIRC_GET_FEATURES, &features)) { perror(lirc_name); close(fd); - return; + return false; } if (!(features & LIRC_CAN_REC_MODE2)) { fprintf(stderr, _("%s: not a raw IR receiver\n"), lirc_name); close(fd); - return; + return false; } // BPF programs are charged against RLIMIT_MEMLOCK. We'll need pages @@ -1735,8 +1735,10 @@ static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct proto rl.rlim_cur = rl.rlim_max = HIGH_RLIMIT_MEMLOCK; (void) setrlimit(RLIMIT_MEMLOCK, &rl); - load_bpf_file(bpf_prog, fd, param, rawtable); + ret = load_bpf_file(bpf_prog, fd, param, rawtable); close(fd); + + return ret == 0; } static void show_bpf(const char *lirc_name) @@ -1843,9 +1845,10 @@ static void clear_bpf(const char *lirc_name) fprintf(stderr, _("BPF protocols removed\n")); } #else -static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) +static bool attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) { fprintf(stderr, _("error: ir-keytable was compiled without BPF support\n")); + return false; } static void show_bpf(const char *lirc_name) {} static void clear_bpf(const char *lirc_name) {} @@ -2119,8 +2122,8 @@ int main(int argc, char *argv[]) char *fname = find_bpf_file(b->name); if (fname) { - attach_bpf(rc_dev.lirc_name, fname, b->param); - fprintf(stderr, _("Loaded BPF protocol %s\n"), b->name); + if (attach_bpf(rc_dev.lirc_name, fname, b->param)) + fprintf(stderr, _("Loaded BPF protocol %s\n"), b->name); free(fname); } } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: support sending protocols decoded by BPF decoders
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: support sending protocols decoded by BPF decoders Author: Sean Young Date:Fri Sep 6 13:45:41 2019 +0100 Encode keymaps using xbox-dvd, pulse_distance, pulse_length and manchester protocols, matching what the BPF decoders decode. The kernel has no idea how to encode them so this must be done in userspace. Signed-off-by: Sean Young utils/common/ir-encode.c | 26 - utils/common/keymap.c | 1 + utils/ir-ctl/Makefile.am | 2 +- utils/ir-ctl/bpf_encoder.c | 137 + utils/ir-ctl/bpf_encoder.h | 7 +++ utils/ir-ctl/ir-ctl.c | 31 +++--- 6 files changed, 193 insertions(+), 11 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=995ad54ce8bc1bde36f44d035dba805b1b2ea011 diff --git a/utils/common/ir-encode.c b/utils/common/ir-encode.c index 47e294b1d9de..e4fde403d081 100644 --- a/utils/common/ir-encode.c +++ b/utils/common/ir-encode.c @@ -342,6 +342,30 @@ static int rc6_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) return (n % 2) ? n : n + 1; } +static int xbox_dvd_encode(enum rc_proto proto, unsigned scancode, unsigned *buf) +{ + int len = 0; + + buf[len++] = 4000; + buf[len++] = 3900; + + scancode &= 0xfff; + scancode |= (~scancode << 12) & 0xfff000; + + for (int i=23; i >=0; i--) { + buf[len++] = 550; + + if (scancode & (1 << i)) + buf[len++] = 1900; + else + buf[len++] = 900; + } + + buf[len++]= 550; + + return len; +} + static const struct { char name[10]; unsigned scancode_mask; @@ -376,7 +400,7 @@ static const struct { [RC_PROTO_RCMM12] = { "rc-mm-12", 0x0fff }, [RC_PROTO_RCMM24] = { "rc-mm-24", 0xff }, [RC_PROTO_RCMM32] = { "rc-mm-32", 0x }, - [RC_PROTO_XBOX_DVD] = { "xbox-dvd", 0xfff }, + [RC_PROTO_XBOX_DVD] = { "xbox-dvd", 0xfff, 68, 38000, xbox_dvd_encode }, }; static bool str_like(const char *a, const char *b) diff --git a/utils/common/keymap.c b/utils/common/keymap.c index e3a162abfd5a..20026cc4dc0b 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -404,6 +404,7 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot } struct scancode_entry **next = &map->scancode; + i = 0; for (;;) { struct scancode_entry *se; diff --git a/utils/ir-ctl/Makefile.am b/utils/ir-ctl/Makefile.am index df53a9655e40..ad90b84e6c98 100644 --- a/utils/ir-ctl/Makefile.am +++ b/utils/ir-ctl/Makefile.am @@ -1,6 +1,6 @@ bin_PROGRAMS = ir-ctl man_MANS = ir-ctl.1 -ir_ctl_SOURCES = ir-ctl.c ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h +ir_ctl_SOURCES = ir-ctl.c ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h bpf_encoder.c bpf_encoder.h ir_ctl_LDADD = @LIBINTL@ ir_ctl_LDFLAGS = $(ARGP_LIBS) diff --git a/utils/ir-ctl/bpf_encoder.c b/utils/ir-ctl/bpf_encoder.c new file mode 100644 index ..82d12cc049d3 --- /dev/null +++ b/utils/ir-ctl/bpf_encoder.c @@ -0,0 +1,137 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#include +#include +#include +#include +#include + +#include "keymap.h" + +// Some keymaps use BPF decoders, so the kernel has no idea how to encode +// them. We need user-space encoders for these. +// +// This encoders should match what the BPF decoders in +// utils/keytable/bpf_protocols/*.c decode. + +static void encode_pulse_distance(struct keymap *map, uint32_t scancode, int *buf, int *length) +{ + int len = 0, bits, i; + + buf[len++] = keymap_param(map, "header_pulse", 2125); + buf[len++] = keymap_param(map, "header_space", 1875); + + bits = keymap_param(map, "bits", 4); + + if (keymap_param(map, "reverse", 0)) { + for (i = 0; i < bits; i++) { + buf[len++] = keymap_param(map, "bit_pulse", 625); + + if (scancode & (1 << i)) + buf[len++] = keymap_param(map, "bit_1_space", 1625); + else + buf[len++] = keymap_param(map, "bit_0_space", 375); + } + } else { + for (i = bits - 1; i >= 0; i--) { + buf[len++] = keymap_param(map, "bit_pulse", 625); + + if (scancode & (1 << i)) + buf[len++] = keymap_param(map, "bit_1_space", 1625); + else + buf[len++] = key
[git:v4l-utils/master] ir-ctl: print error message if file cannot be opened
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: print error message if file cannot be opened Author: Sean Young Date:Sat Sep 7 21:40:23 2019 +0100 ir-ctl -k foo -K FOO says nothing if foo is not found. Signed-off-by: Sean Young utils/common/keymap.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b972d2d6cea558c6fc304938b56518281c953185 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 20026cc4dc0b..1252646186e2 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -88,7 +88,8 @@ static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verb fin = fopen(fname, "r"); if (!fin) { - return errno; + fprintf(stderr, _("%s: error: cannot open: %m\n"), fname); + return EINVAL; } while (fgets(s, sizeof(s), fin)) { @@ -457,8 +458,10 @@ static error_t parse_toml_keymap(char *fname, struct keymap **keymap, bool verbo fprintf(stderr, _("Parsing %s keycode file as toml\n"), fname); fin = fopen(fname, "r"); - if (!fin) - return errno; + if (!fin) { + fprintf(stderr, _("%s: error: cannot open: %m\n"), fname); + return EINVAL; + } root = toml_parse_file(fin, buf, sizeof(buf)); fclose(fin); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: kernel v5.2 does not like - in BPF name
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: kernel v5.2 does not like - in BPF name Author: Sean Young Date:Sat Sep 7 21:34:57 2019 +0100 Replace with _. Signed-off-by: Sean Young utils/keytable/bpf_protocols/xbox-dvd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=f14633618f891de77243c7e5a64262f9082503bd diff --git a/utils/keytable/bpf_protocols/xbox-dvd.c b/utils/keytable/bpf_protocols/xbox-dvd.c index 91b7d02e7628..18225453e30c 100644 --- a/utils/keytable/bpf_protocols/xbox-dvd.c +++ b/utils/keytable/bpf_protocols/xbox-dvd.c @@ -51,7 +51,7 @@ static inline int eq_margin(unsigned d1, unsigned d2) return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin; } -SEC("xbox-dvd") +SEC("xbox_dvd") int bpf_decoder(unsigned int *sample) { unsigned int key = 0; ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: fix memory leaks
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: fix memory leaks Author: Sean Young Date:Wed Sep 4 15:06:50 2019 +0100 Signed-off-by: Sean Young utils/common/keymap.c | 49 +++ utils/common/keymap.h | 2 +- utils/ir-ctl/ir-ctl.c | 33 --- utils/keytable/keytable.c | 10 +- 4 files changed, 56 insertions(+), 38 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dd79397d3abf1be875224aad3b62efab53457a73 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index d9980676c9d1..e3a162abfd5a 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -69,7 +69,7 @@ void free_keymap(struct keymap *map) } } -static error_t parse_plain_keyfile(char *fname, struct keymap **keymap, bool verbose) +static error_t parse_plain_keymap(char *fname, struct keymap **keymap, bool verbose) { FILE *fin; int line = 0; @@ -79,7 +79,7 @@ static error_t parse_plain_keyfile(char *fname, struct keymap **keymap, bool ver map = calloc(1, sizeof(*map)); if (!map) { - perror("parse_keyfile"); + perror("parse_keymap"); return ENOMEM; } @@ -154,7 +154,7 @@ static error_t parse_plain_keyfile(char *fname, struct keymap **keymap, bool ver se = calloc(1, sizeof(*se)); if (!se) { free_keymap(map); - perror("parse_keyfile"); + perror("parse_keymap"); fclose(fin); return ENOMEM; } @@ -180,16 +180,17 @@ err_einval: static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry **entry) { struct raw_entry *re; + const char sep[] = "\n\r\t\v ,"; const char *p; char *copy; int i, size = 0; // First do one scan so that we know the length copy = strdup(str); - p = strtok(copy, "\n\t\v ,"); + p = strtok(copy, sep); while (p) { size++; - p = strtok(NULL, "\n\t\v ,"); + p = strtok(NULL, sep); } re = calloc(1, sizeof(*re) + sizeof(re->raw[0]) * size); @@ -201,7 +202,7 @@ static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry // Second scan to extract values and validate strcpy(copy, str); - p = strtok(copy, "\n\t\v ,"); + p = strtok(copy, sep); i = 0; while (p) { long int value; @@ -212,6 +213,7 @@ static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry fprintf(stderr, _("%s: incorrect raw value `%s'"), fname, p); free(copy); + free(re); return EINVAL; } @@ -222,6 +224,7 @@ static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry fprintf(stderr, _("%s: negative raw value `%ld` at position %d only allowed for gaps/spaces"), fname, value, i); free(copy); + free(re); return EINVAL; } } @@ -230,12 +233,13 @@ static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry fprintf(stderr, _("%s: raw value %ld out of range"), fname, value); free(copy); + free(re); return EINVAL; } re->raw[i++] = value; - p = strtok(NULL, "\n\t\v ,"); + p = strtok(NULL, sep); } free(copy); @@ -285,9 +289,11 @@ static error_t parse_toml_raw_part(const char *fname, struct toml_array_t *raw, if (parse_rawir_string(fname, raw_str, &re)) { free(keycode); + free(raw_str); return EINVAL; } + free(raw_str); re->keycode = keycode; re->next = map->raw; map->raw = re; @@ -324,7 +330,7 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot return EINVAL; } - map->protocol = strdup(p); + map->protocol = p; if (!strcmp(p, "raw")) have_raw_protocol = true; @@ -332,38 +338,44 @@ static error_t par
[git:v4l-utils/master] keytable: ensure we have enough memlock pages
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: ensure we have enough memlock pages Author: Sean Young Date:Wed Sep 4 11:03:24 2019 +0100 Since kernel v5.2, BPF maps and programs are charged against RLIMT_MEMLOCK. By default this limit is 64KB however all of these are already taken (16 pages on x86) by the time we've booted on Fedora. This results in a permission denied error. The error message is confusing since it happens when running as root. systemd works around this problem by setting setrlimit(RLIMIT_MEMLOCK) to 64MB. Do the the same. Signed-off-by: Sean Young utils/keytable/keytable.c | 14 ++ 1 file changed, 14 insertions(+) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=7530ca0b53c921f681af9d02a1f1958185dce2d2 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 70fbb82282f1..986503a0aeb7 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -1698,9 +1699,14 @@ static void device_info(int fd, char *prepend) #ifdef HAVE_BPF #define MAX_PROGS 64 +// This value is what systemd sets PID 1 to, see: +// https://github.com/systemd/systemd/blob/master/src/basic/def.h#L60 +#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL) + static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) { unsigned int features; + struct rlimit rl; int fd; fd = open(lirc_name, O_RDONLY); @@ -1721,6 +1727,14 @@ static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct proto return; } + // BPF programs are charged against RLIMIT_MEMLOCK. We'll need pages + // for the state, program text, and any raw IR. None of these are + // particularly large. However, the kernel defaults to 64KB + // memlock, which is only 16 pages which are mostly used by the + // time we are trying to load our BPF program. + rl.rlim_cur = rl.rlim_max = HIGH_RLIMIT_MEMLOCK; + (void) setrlimit(RLIMIT_MEMLOCK, &rl); + load_bpf_file(bpf_prog, fd, param, rawtable); close(fd); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] lircd2toml: strip trailing space from input
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: lircd2toml: strip trailing space from input Author: Sean Young Date:Tue Sep 3 15:22:36 2019 +0100 This fixes conversion of this lirc config: https://gist.github.com/pingec/8d013f225b71c4ab727a Signed-off-by: Sean Young contrib/lircd2toml.py | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8604e228e235961bcb9002d281af5cdf54e28982 diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index cfa648ede585..54ea12fccce6 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -145,20 +145,29 @@ class LircdParser: a = line.split() if a[0] == 'name': -if len(codes) > 0: +codes = raw_codes_sanitise(codes) +if codes: raw_codes.append({ 'keycode': name, 'raw': codes }) name = line.split(maxsplit=2)[1] if not name.startswith('KEY_'): name = 'KEY_' + name.upper() codes = [] elif a[0] == 'end': -if len(codes) > 0: +codes = raw_codes_sanitise(codes) +if codes: raw_codes.append({ 'keycode': name, 'raw': codes }) return raw_codes else: for v in a: codes.append(int(v)) +def raw_codes_sanitise(codes): +if len(codes) == 0: +return None +if len(codes) % 2 == 0: +return codes[:-1] + +return codes def eq_margin(duration, expected, margin): if duration >= (expected - margin) and duration <= (expected + margin): ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable fix warning when building without BPF enabled
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable fix warning when building without BPF enabled Author: Sean Young Date:Mon Sep 2 13:53:20 2019 +0100 CC keytable.o keytable.c:1832:76: warning: ‘struct toml_table_t’ declared inside parameter list will not be visible outside of this definition or declaration 1832 | ach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) | ^~~~ keytable.c: In function ‘main’: keytable.c:2108:42: warning: passing argument 3 of ‘attach_bpf’ from incompatible pointer type [-Wincompatible-pointer-types] 2108 | attach_bpf(rc_dev.lirc_name, fname, b->param); | ~^~~ | | | struct protocol_param * keytable.c:1832:90: note: expected ‘struct toml_table_t *’ but argument is of type ‘struct protocol_param *’ 1832 | char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) |~^~~~ Signed-off-by: Sean Young utils/keytable/keytable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=32fd3b7e82e4a018e256ddfa30d4498b385c811d diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 95584449a8cb..70fbb82282f1 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1829,7 +1829,7 @@ static void clear_bpf(const char *lirc_name) fprintf(stderr, _("BPF protocols removed\n")); } #else -static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct toml_table_t *toml) +static void attach_bpf(const char *lirc_name, const char *bpf_prog, struct protocol_param *param) { fprintf(stderr, _("error: ir-keytable was compiled without BPF support\n")); } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.16.7] libdvbv5: fix double free in dvb_fe_open_fname
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: libdvbv5: fix double free in dvb_fe_open_fname Author: André Roth Date:Sat Jul 7 07:20:55 2018 -0400 Since parms and fname is allocated outside of the function, do not free it. Use dvb_v5_free for freeing parms, it will free fname if required. Signed-off-by: André Roth Signed-off-by: Mauro Carvalho Chehab lib/libdvbv5/dvb-fe.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=78057aaa784a922b4ac6af9f323b828f7a834581 diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 514a187987f9..7f63476612d7 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -179,7 +179,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, ret = dvb_fe_open_fname(parms, dvb_dev->path, flags); if (ret < 0) { - free(parms); + dvb_v5_free(parms); return NULL; } @@ -202,9 +202,7 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (xioctl(fd, FE_GET_INFO, &parms->p.info) == -1) { dvb_perror("FE_GET_INFO"); - dvb_v5_free(parms); close(fd); - free(fname); return -errno; } @@ -291,7 +289,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, } if (!parms->p.num_systems) { dvb_logerr(_("delivery system not detected")); - dvb_v5_free(parms); close(fd); return -EINVAL; } @@ -302,7 +299,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, dtv_prop.props = parms->dvb_prop; if (xioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { dvb_perror("FE_GET_PROPERTY"); - dvb_v5_free(parms); close(fd); return -errno; } @@ -312,7 +308,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (parms->p.num_systems == 0) { dvb_logerr(_("driver returned 0 supported delivery systems!")); - dvb_v5_free(parms); close(fd); return -EINVAL; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.16.7] keytable: do not install bpf protocols decoders with execute permission
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: do not install bpf protocols decoders with execute permission Author: Sean Young Date:Fri Nov 23 11:39:30 2018 + The rpm packaging system will try to extract debug information, which fails since there is no build id. This can be avoided by removing the execute permission. BPF relocatable files are executable anyway so this is the right thing to do. See: https://github.com/rpm-software-management/rpm/pull/604 Signed-off-by: Sean Young utils/keytable/bpf_protocols/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=392fac431814ed59a8be2c818980a888d12f09ee diff --git a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am index ba79742c9ca7..56b0eb7cefe4 100644 --- a/utils/keytable/bpf_protocols/Makefile.am +++ b/utils/keytable/bpf_protocols/Makefile.am @@ -21,4 +21,4 @@ EXTRA_DIST = $(PROTOCOLS:%.o=%.c) bpf_helpers.h install-data-local: $(install_sh) -d "$(DESTDIR)$(keytableuserdir)/protocols" $(install_sh) -d "$(DESTDIR)$(keytablesystemdir)/protocols" - $(install_sh) $(PROTOCOLS) "$(DESTDIR)$(keytablesystemdir)/protocols" + $(install_sh) -m 0644 $(PROTOCOLS) "$(DESTDIR)$(keytablesystemdir)/protocols" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.14.5] keytable: abi no longer set LIRC_CAN_REC_SCANCODE for raw devices
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: abi no longer set LIRC_CAN_REC_SCANCODE for raw devices Author: Sean Young Date:Tue Jan 2 22:07:44 2018 + Simplify the code; we can set LIRC_MODE_SCANCODE for receiving, and if this fails then the kernel is too old, or the device does not support receiving (in which case we would not end up in this code patch anyway). Signed-off-by: Sean Young (cherry picked from commit c2b90a15318a1ecd90e81c17e8af552cc9c6ed83) utils/keytable/keytable.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=0383064cdfabeeabb08c62a49d1737529c62cd17 diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 9a0dc0feeb2d..34a1522e972e 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -1351,28 +1351,17 @@ static void test_event(struct rc_device *rc_dev, int fd) ioctl(fd, EVIOCSCLOCKID, &mode); if (rc_dev->lirc_name) { + unsigned mode = LIRC_MODE_SCANCODE; lircfd = open(rc_dev->lirc_name, O_RDONLY | O_NONBLOCK); if (lircfd == -1) { perror(_("Can't open lirc device")); return; } - unsigned features; - if (ioctl(lircfd, LIRC_GET_FEATURES, &features)) { - perror(_("Can't get lirc features")); - return; - } - - if (!(features & LIRC_CAN_REC_SCANCODE)) { + if (ioctl(lircfd, LIRC_SET_REC_MODE, &mode)) { + /* If we can't set scancode mode, kernel is too old */ close(lircfd); lircfd = -1; } - else { - unsigned mode = LIRC_MODE_SCANCODE; - if (ioctl(lircfd, LIRC_SET_REC_MODE, &mode)) { - perror(_("Can't set lirc scancode mode")); - return; - } - } } printf (_("Testing events. Please, press CTRL-C to abort.\n")); ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/v4l-utils-1.14.5] ir-ctl: abi no longer set LIRC_CAN_SEND_SCANCODE for raw devices
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: abi no longer set LIRC_CAN_SEND_SCANCODE for raw devices Author: Sean Young Date:Tue Jan 2 22:16:55 2018 + We need to use ioctl(LIRC_SET_REC_MODE, &LIRC_MODE_SCANCODE) and ioctl(LIRC_SET_SEND_MODE, &LIRC_MODE_SCANCODE) to see if the new scancode interface is supported. Signed-off-by: Sean Young (cherry picked from commit c2cc9e17b1411865d40a0e7d3ab027204fc0cf19) utils/ir-ctl/ir-ctl.c | 48 ++-- 1 file changed, 18 insertions(+), 30 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=fd5a000ab9154ede7a801112afccd948fdcbf7a4 diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 58c48b06201d..59555a138d67 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -683,7 +683,7 @@ static int lirc_options(struct arguments *args, int fd, unsigned features) static void lirc_features(struct arguments *args, int fd, unsigned features) { const char *dev = args->device; - unsigned resolution = 0; + unsigned resolution = 0, mode = LIRC_MODE_SCANCODE; int rc; if (features & LIRC_CAN_GET_REC_RESOLUTION) { @@ -694,14 +694,13 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) fprintf(stderr, _("warning: %s: unexpected error while retrieving resolution: %m\n"), dev); } - bool can_receive = false; printf(_("Receive features %s:\n"), dev); if (features & LIRC_CAN_REC_SCANCODE) { printf(_(" - Device can receive scancodes\n")); - can_receive = true; - } - if (features & LIRC_CAN_REC_MODE2) { + } else if (features & LIRC_CAN_REC_MODE2) { printf(_(" - Device can receive raw IR\n")); + if (ioctl(fd, LIRC_SET_REC_MODE, &mode) == 0) + printf(_(" - Can report decoded scancodes and protocol\n")); if (resolution) printf(_(" - Resolution %u microseconds\n"), resolution); if (features & LIRC_CAN_SET_REC_CARRIER) @@ -729,24 +728,17 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) if (min_timeout || max_timeout) printf(_(" - Can set receiving timeout min:%u microseconds max:%u microseconds\n"), min_timeout, max_timeout); } - can_receive = true; - } - if (features & LIRC_CAN_REC_LIRCCODE) { + } else if (features & LIRC_CAN_REC_LIRCCODE) { printf(_(" - Device can receive using device dependent LIRCCODE mode (not supported)\n")); - can_receive = true; - } - - if (!can_receive) + } else { printf(_(" - Device cannot receive\n")); + } - bool can_send = false; printf(_("Send features %s:\n"), dev); - if (features & LIRC_CAN_SEND_SCANCODE) { - printf(_(" - Device can send scancodes\n")); - can_send = true; - } if (features & LIRC_CAN_SEND_PULSE) { printf(_(" - Device can send raw IR\n")); + if (ioctl(fd, LIRC_SET_SEND_MODE, &mode) == 0) + printf(_(" - IR scancode encoder\n")); if (features & LIRC_CAN_SET_SEND_CARRIER) printf(_(" - Set carrier\n")); if (features & LIRC_CAN_SET_SEND_DUTY_CYCLE) @@ -761,15 +753,11 @@ static void lirc_features(struct arguments *args, int fd, unsigned features) else printf(_(" - Set transmitter (%d available)\n"), rc); } - can_send = true; - } - if (features & LIRC_CAN_SEND_LIRCCODE) { + } else if (features & LIRC_CAN_SEND_LIRCCODE) { printf(_(" - Device can send using device dependent LIRCCODE mode (not supported)\n")); - can_send = true; - } - - if (!can_send) + } else { printf(_(" - Device cannot send\n")); + } } static int lirc_send(struct arguments *args, int fd, unsigned features, struct file *f) @@ -778,7 +766,12 @@ static int lirc_send(struct arguments *args, int fd, unsigned features, struct f int rc, mode; ssize_t ret; - if (f->is_scancode && (features & LIRC_CAN_SEND_SCANCODE)) { + if (!(features & LIRC_CAN_SEND_PULSE)) { + fprintf(stderr, _("%s: device cannot send\n"), dev); +
[git:v4l-utils/v4l-utils-1.14.5] libdvbv5: fix double free in dvb_fe_open_fname
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: libdvbv5: fix double free in dvb_fe_open_fname Author: André Roth Date:Sat Jul 7 07:20:55 2018 -0400 Since parms and fname is allocated outside of the function, do not free it. Use dvb_v5_free for freeing parms, it will free fname if required. Signed-off-by: André Roth Signed-off-by: Mauro Carvalho Chehab lib/libdvbv5/dvb-fe.c | 7 +-- 1 file changed, 1 insertion(+), 6 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=25e967319367979e24e93ef1a3c74a1f4111575f diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index 303a8916017a..97ad35b28f56 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -179,7 +179,7 @@ struct dvb_v5_fe_parms *dvb_fe_open_flags(int adapter, int frontend, ret = dvb_fe_open_fname(parms, dvb_dev->path, flags); if (ret < 0) { - free(parms); + dvb_v5_free(parms); return NULL; } @@ -200,9 +200,7 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (xioctl(fd, FE_GET_INFO, &parms->p.info) == -1) { dvb_perror("FE_GET_INFO"); - dvb_v5_free(parms); close(fd); - free(fname); return -errno; } @@ -289,7 +287,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, } if (!parms->p.num_systems) { dvb_logerr(_("delivery system not detected")); - dvb_v5_free(parms); close(fd); return -EINVAL; } @@ -300,7 +297,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, dtv_prop.props = parms->dvb_prop; if (xioctl(fd, FE_GET_PROPERTY, &dtv_prop) == -1) { dvb_perror("FE_GET_PROPERTY"); - dvb_v5_free(parms); close(fd); return -errno; } @@ -310,7 +306,6 @@ int dvb_fe_open_fname(struct dvb_v5_fe_parms_priv *parms, char *fname, if (parms->p.num_systems == 0) { dvb_logerr(_("driver returned 0 supported delivery systems!")); - dvb_v5_free(parms); close(fd); return -EINVAL; } ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: warn if keycode has multiple definitions
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: warn if keycode has multiple definitions Author: Sean Young Date:Thu Aug 29 16:09:21 2019 +0100 Signed-off-by: Sean Young utils/common/keymap.c | 6 -- utils/ir-ctl/ir-ctl.c | 52 --- 2 files changed, 33 insertions(+), 25 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=b393a5408383b7341883857dfda78537f2f85ef6 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 45d86c8c8105..d9980676c9d1 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -391,6 +391,8 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot } } + struct scancode_entry **next = &map->scancode; + for (;;) { struct scancode_entry *se; const char *scancode; @@ -420,8 +422,8 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot se->scancode = strtoul(scancode, NULL, 0); se->keycode = keycode; - se->next = map->scancode; - map->scancode = se; + *next = se; + next = &se->next; } return 0; diff --git a/utils/ir-ctl/ir-ctl.c b/utils/ir-ctl/ir-ctl.c index 28d8d97acf60..e884b4f8f4e6 100644 --- a/utils/ir-ctl/ir-ctl.c +++ b/utils/ir-ctl/ir-ctl.c @@ -727,17 +727,22 @@ static error_t parse_opt(int k, char *arg, struct argp_state *state) return 0; } -// FIXME: keymaps can have multiple definitions of the same keycode static struct send* convert_keycode(struct keymap *map, const char *keycode) { - struct send *s; + struct send *s = NULL; + int count = 0; + + for (;map; map = map->next) { + struct scancode_entry *se; + struct raw_entry *re; - while (map) { - struct raw_entry *re = map->raw; - struct scancode_entry *se = map->scancode; + for (re = map->raw; re; re = re->next) { + if (strcmp(re->keycode, keycode)) + continue; - while (re) { - if (!strcmp(re->keycode, keycode)) { + count++; + + if (!s) { s = malloc(sizeof(*s) + re->raw_length * sizeof(int)); s->len = re->raw_length; memcpy(s->buf, re->raw, s->len * sizeof(int)); @@ -745,17 +750,18 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode) s->is_keycode = false; s->carrier = keymap_param(map, "carrier", 0); s->next = NULL; - - return s; } - - re = re->next; } - while (se) { - if (!strcmp(se->keycode, keycode)) { - enum rc_proto proto; + for (se = map->scancode; se; se = se->next) { + if (strcmp(se->keycode, keycode)) + continue; + + count++; + + if (!s) { const char *proto_str; + enum rc_proto proto; proto_str = map->variant ?: map->protocol; @@ -770,17 +776,19 @@ static struct send* convert_keycode(struct keymap *map, const char *keycode) s->is_scancode = true; s->is_keycode = false; s->next = NULL; - - return s; } - - se = se->next; } + } - map = map->next; + if (!s) { + fprintf(stderr, _("error: keycode `%s' not found in keymap\n"), keycode); + return NULL; } - return NULL; + if (count > 1) + fprintf(stderr, _("warning: keycode `%s' has %d definitions in keymaps, using first\n"), keycode, count); + + return s; } static const struct argp argp = { @@ -1022,10 +1030,8 @@ static int lirc_send(struct arguments *args, int fd, unsigned features, struct s } f = convert_keycode(map, keycode); - if (!f) { - fprintf(stderr, _("error: keycode `%s' not found in keymap\n"), keycode); + if (!f) return EX_DAT
[git:v4l-utils/master] ir-ctl: fix build on 32-bit
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: fix build on 32-bit Author: Sean Young Date:Thu Aug 29 11:01:39 2019 +0100 keymap.c: In function ‘parse_toml_protocol’: keymap.c:381:23: warning: passing argument 2 of ‘toml_rtoi’ from incompatible po inter type [-Wincompatible-pointer-types] if (!toml_rtoi(raw, &value)) { ^ In file included from keymap.c:14:0: toml.h:111:17: note: expected ‘int64_t * {aka long long int *}’ but argument is of type ‘long int *’ TOML_EXTERN int toml_rtoi(const char* s, int64_t* ret); ^ Signed-off-by: Sean Young utils/common/keymap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=8b70d2878b74ae34ce9d1d3bbfcf2085e0bc2018 diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 19d636614c4d..45d86c8c8105 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -375,7 +375,7 @@ static error_t parse_toml_protocol(const char *fname, struct toml_table_t *proot } for (i = 0; (key = toml_key_in(proot, i)) != NULL; i++) { - long int value; + int64_t value; raw = toml_raw_in(proot, key); if (!toml_rtoi(raw, &value)) { ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] ir-ctl: support raw format by default
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: support raw format by default Author: Sean Young Date:Tue Aug 27 21:26:44 2019 +0100 When "ir-ctl -r" outputs data it prints one line per space and pulse. This is not very space efficient and long protocols like rc-6 are unlikely to fit on the screen. The new format is much more compact. A single IR message is printed on a single line. The pulse is prefixed with an optional + and a space is prefixed with -. The rc-5 example from the man page becomes: $ ir-ctl -r +889 -889 +1778 -1778 +889 -889 +889 -889 +889 -889 +1778 -889 +889 -889 +889 -889 +889 -889 +889 -889 +889 -1778 +889 # timeout 133889 The old behaviour can be resurrected with: ir-ctl -r --mode2 This commit also add support for sending the same format. Signed-off-by: Sean Young utils/common/keymap.c| 8 +- utils/ir-ctl/ir-ctl.1.in | 36 --- utils/ir-ctl/ir-ctl.c| 254 +++ 3 files changed, 240 insertions(+), 58 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=e9d926d7c90b1c868737b2f94679d0321b35c1be diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 9ca599a009bc..19d636614c4d 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -272,19 +272,23 @@ static error_t parse_toml_raw_part(const char *fname, struct toml_array_t *raw, if (!traw) { fprintf(stderr, _("%s: missing raw value for entry %d\n"), fname, ind); + free(keycode); return EINVAL; } if (toml_rtos(traw, &raw_str)) { fprintf(stderr, _("%s: bad value `%s' for keycode\n"), fname, traw); + free(keycode); return EINVAL; } - if (parse_rawir_string(fname, raw_str, &re)) + if (parse_rawir_string(fname, raw_str, &re)) { + free(keycode); return EINVAL; + } - re->keycode = strdup(keycode); + re->keycode = keycode; re->next = map->raw; map->raw = re; } diff --git a/utils/ir-ctl/ir-ctl.1.in b/utils/ir-ctl/ir-ctl.1.in index 7564066ad768..4b5994189446 100644 --- a/utils/ir-ctl/ir-ctl.1.in +++ b/utils/ir-ctl/ir-ctl.1.in @@ -9,7 +9,7 @@ ir\-ctl \- a swiss\-knife tool to handle raw IR and to set lirc options [\fIOPTION\fR]... \fI\-\-features\fR .br .B ir\-ctl -[\fIOPTION\fR]... \fI\-\-send\fR [\fIpulse and space file to send\fR] +[\fIOPTION\fR]... \fI\-\-send\fR [\fIfile to send\fR] .br .B ir\-ctl [\fIOPTION\fR]... \fI\-\-scancode\fR [\fIprotocol and scancode to send\fR] @@ -58,13 +58,16 @@ in\-order with a 125ms gap between them. The gap length can be modified with \fB\-\-gap\fR. .TP \fB-k\fR, \fB\-\-keymap\fR=\fIKEYMAP\fR -The rc keymap in toml format. The format is described in the rc_keymap(5) -man page. +The rc keymap file in toml format. The format is described in the rc_keymap(5) +man page. This file is used to select the \fBKEYCODE\fR from. .TP \fB\-1\fR, \fB\-\-oneshot\fR When receiving, stop receiving after the first message, i.e. after a space or timeout of more than 19ms is received. .TP +\fB\-\-mode2\fR +When receiving, output IR in mode2 format. One line per space or pulse. +.TP \fB\-w\fR, \fB\-\-wideband\fR Use the wideband receiver if available on the hardware. This is also known as learning mode. The measurements should be more precise and any @@ -118,14 +121,17 @@ Verbose output; this prints the IR before sending. \fB\-V\fR, \fB\-\-version\fR print the v4l2\-utils version .PP -.SS Format of pulse and space file -When sending IR, the format of the file should be as follows. A comment -starts with #. The carrier frequency can be specified as: +.SS Format of file +When sending or receiving raw IR, two formats can be used. The first is +a list of integers representing pulse and space values. A pulse value can be +prefixed with + and a space with -, but this is optional. The rc-5 scancode +0x1e01 is encoded so: .PP - carrier 38000 ++889 -889 +1778 -1778 +889 -889 +889 -889 +889 -889 +1778 -889 +889 -889 +889 -889 +889 -889 +889 -889 +889 -1778 +889 .PP -The file should contain alternating lines with pulse and space, followed -by length in microseconds. The following is a rc-5 encoded message: +The other format mimics the mode2 tool. This produces one line per space +or pulse. For receiving it can selected by specifying \fB\-\-mode2\fR. Here is +the same message as above, now encoded in mode2: .PP carrier 36000 .br @@ -175,9 +181,13 @@ by length in microseconds. The fol
[git:v4l-utils/master] toml: update to tomlc99 commit f12c8f00b457defaae1495773d76dfb9ff1bf4c8
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: toml: update to tomlc99 commit f12c8f00b457defaae1495773d76dfb9ff1bf4c8 Author: Sean Young Date:Tue Aug 27 13:48:58 2019 +0100 The toml reader has a few updates - sync. Signed-off-by: Sean Young utils/common/toml.c | 1584 +++ utils/common/toml.h | 50 +- 2 files changed, 892 insertions(+), 742 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=dece02f862f38d8f866230ca9f1015cb93ddfac4 diff --git a/utils/common/toml.c b/utils/common/toml.c index e4b57190af68..2a9f3daccbe8 100644 --- a/utils/common/toml.c +++ b/utils/common/toml.c @@ -1,7 +1,7 @@ /* MIT License -Copyright (c) 2017 CK Tan +Copyright (c) 2017 - 2019 CK Tan https://github.com/cktan/tomlc99 Permission is hereby granted, free of charge, to any person obtaining a copy @@ -39,8 +39,8 @@ char* strndup(const char* s, size_t n) size_t len = strnlen(s, n); char* p = malloc(len+1); if (p) { - memcpy(p, s, len); - p[len] = 0; +memcpy(p, s, len); +p[len] = 0; } return p; } @@ -61,76 +61,78 @@ int toml_utf8_to_ucs(const char* orig, int len, int64_t* ret) 0xxx */ if (0 == (i >> 7)) { - if (len < 1) return -1; - v = i; - return *ret = v, 1; +if (len < 1) return -1; +v = i; +return *ret = v, 1; } /* 0x0080 - 0x07FF: 110x 10xx */ if (0x6 == (i >> 5)) { - if (len < 2) return -1; - v = i & 0x1f; - i = *(++buf); - if (0x2 != (i >> 6)) return -1; - v = (v << 6) | (i & 0x3f); - return *ret = v, (const char*) buf - orig; +if (len < 2) return -1; +v = i & 0x1f; +for (int j = 0; j < 1; j++) { +i = *buf++; +if (0x2 != (i >> 6)) return -1; +v = (v << 6) | (i & 0x3f); +} +return *ret = v, (const char*) buf - orig; } /* 0x0800 - 0x: 1110 10xx 10xx */ if (0xE == (i >> 4)) { - if (len < 3) return -1; - v = i & 0x0F; - for (int j = 0; j < 2; j++) { - i = *(++buf); - if (0x2 != (i >> 6)) return -1; - v = (v << 6) | (i & 0x3f); - } - return *ret = v, (const char*) buf - orig; +if (len < 3) return -1; +v = i & 0x0F; +for (int j = 0; j < 2; j++) { +i = *buf++; +if (0x2 != (i >> 6)) return -1; +v = (v << 6) | (i & 0x3f); +} +return *ret = v, (const char*) buf - orig; } /* 0x0001 - 0x001F: 0xxx 10xx 10xx 10xx */ if (0x1E == (i >> 3)) { - if (len < 4) return -1; - v = i & 0x07; - for (int j = 0; j < 3; j++) { - i = *(++buf); - if (0x2 != (i >> 6)) return -1; - v = (v << 6) | (i & 0x3f); - } - return *ret = v, (const char*) buf - orig; +if (len < 4) return -1; +v = i & 0x07; +for (int j = 0; j < 3; j++) { +i = *buf++; +if (0x2 != (i >> 6)) return -1; +v = (v << 6) | (i & 0x3f); +} +return *ret = v, (const char*) buf - orig; } /* 0x0020 - 0x03FF: 10xx 10xx 10xx 10xx 10xx */ if (0x3E == (i >> 2)) { - if (len < 5) return -1; - v = i & 0x03; - for (int j = 0; j < 4; j++) { - i = *(++buf); - if (0x2 != (i >> 6)) return -1; - v = (v << 6) | (i & 0x3f); - } - return *ret = v, (const char*) buf - orig; +if (len < 5) return -1; +v = i & 0x03; +for (int j = 0; j < 4; j++) { +i = *buf++; +if (0x2 != (i >> 6)) return -1; +v = (v << 6) | (i & 0x3f); +} +return *ret = v, (const char*) buf - orig; } /* 0x0400 - 0x7FFF: 110x 10xx 10xx 10xx 10xx 10xx */ if (0x7e == (i >> 1)) { - if (len < 6) return -1; - v = i & 0x01; - for (int j = 0; j < 5; j++) { - i = *(++buf); - if (0x2 != (i >> 6)) return -1; - v = (v << 6) | (i & 0x3f); - } - return *ret = v, (const char*) buf - orig; +if (len < 6) return -1; +v = i & 0x01; +for (int j = 0; j < 5; j++) { +i = *buf++; +if (0x2 != (i >> 6)) return -1; +v = (v << 6) | (i & 0x3f); +} +
[git:v4l-utils/master] rc_keymap: change raw format to much more common raw string
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: rc_keymap: change raw format to much more common raw string Author: Sean Young Date:Tue Aug 27 13:18:37 2019 +0100 Many programs and documentation lists raw IR a list of ints: +8800 –4400 +550 –1650 +550 –1650 +550 –1650 +550 –550 +550 One example of many: http://hifi-remote.com/wiki/index.php/Infrared_Protocol_Primer The + and - are optional and are there for readability. I think this is much nicer format that 1) toml arrays and 2) lirc pulse space format. As a first start, let's update the toml rc keymap format; the existing toml raw array has not been in a release. Now the Fisher Price C0108 remote looks like: [[protocols]] name = 'Fisher_Price_C0108' protocol = 'raw' [[protocols.raw]] keycode = 'KEY_NOTA' raw = '+121 -839 +864 -824 +864 -821 +864 -822 +891' Signed-off-by: Sean Young contrib/lircd2toml.py | 16 +++--- utils/common/keymap.c | 126 -- utils/keytable/rc_keymap.5.in | 9 +-- 3 files changed, 96 insertions(+), 55 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=d72b76f6abafae9a23458946761e25896c5a7a8c diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index 057292398221..cfa648ede585 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -604,16 +604,16 @@ def writeTOMLFile(fh, remote): elif 'raw' in remote: for raw in remote['raw']: print('[[protocols.raw]]', file=fh) -print('keycode = {}\nraw = ['.format(escapeString(raw['keycode'])), file=fh, end='') -first = True -for v in raw['raw']: -if first: -print(' {}'.format(v), file=fh, end='') +print('keycode = {}\nraw = \''.format(escapeString(raw['keycode'])), file=fh, end='') +for i, v in enumerate(raw['raw']): +if i == 0: +print('+{}'.format(v), file=fh, end='') +elif i % 2 == 1: +print(' -{}'.format(v), file=fh, end='') else: -print(', {}'.format(v), file=fh, end='') -first = False +print(' +{}'.format(v), file=fh, end='') -print(' ]', file=fh) +print('\'', file=fh) return True diff --git a/utils/common/keymap.c b/utils/common/keymap.c index 9c49b442ee85..9ca599a009bc 100644 --- a/utils/common/keymap.c +++ b/utils/common/keymap.c @@ -177,73 +177,113 @@ err_einval: return EINVAL; } +static error_t parse_rawir_string(const char *fname, char *str, struct raw_entry **entry) +{ + struct raw_entry *re; + const char *p; + char *copy; + int i, size = 0; + + // First do one scan so that we know the length + copy = strdup(str); + p = strtok(copy, "\n\t\v ,"); + while (p) { + size++; + p = strtok(NULL, "\n\t\v ,"); + } + + re = calloc(1, sizeof(*re) + sizeof(re->raw[0]) * size); + if (!re) { + fprintf(stderr, _("Failed to allocate memory")); + free(copy); + return EINVAL; + } + + // Second scan to extract values and validate + strcpy(copy, str); + p = strtok(copy, "\n\t\v ,"); + i = 0; + while (p) { + long int value; + char *q; + + value = strtoll(p, &q, 10); + if (*q || value == 0 || errno) { + fprintf(stderr, _("%s: incorrect raw value `%s'"), + fname, p); + free(copy); + return EINVAL; + } + + if (value < 0) { + if (i % 2) + value = -value; + else { + fprintf(stderr, _("%s: negative raw value `%ld` at position %d only allowed for gaps/spaces"), + fname, value, i); + free(copy); + return EINVAL; + } + } + + if (value <= 0 || value > USHRT_MAX) { + fprintf(stderr, _("%s: raw value %ld out of range"), + fname, value); + free(copy); + return EINVAL; + } + + re-
[git:v4l-utils/master] keytable: move keymap parsing into its own file
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: move keymap parsing into its own file Author: Sean Young Date:Sat Aug 24 21:06:39 2019 +0100 We would like to reuse keymap parsing for transmitting IR based on keymap in ir-ctl. This also reduces the size of our huge keytable.c, and keeps knowledge toml localised to the keymap parser. Signed-off-by: Sean Young utils/keytable/Makefile.am| 2 +- utils/keytable/bpf_load.c | 21 +- utils/keytable/bpf_load.h | 4 +- utils/keytable/keymap.c | 459 +++ utils/keytable/keymap.h | 26 ++ utils/keytable/keytable.c | 545 +- utils/keytable/rc_keymap.5.in | 4 +- 7 files changed, 612 insertions(+), 449 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=83bfb96dc35e103854ef9494dd996b85261bb449 diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index 18e6574e14f0..58c94a47ced0 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -4,7 +4,7 @@ sysconf_DATA = rc_maps.cfg keytablesystem_DATA = $(srcdir)/rc_keymaps/* udevrules_DATA = 70-infrared.rules -ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.h +ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.c keymap.h if WITH_BPF ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index b6032ed1e9c7..e301aa97604e 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -13,7 +13,6 @@ #include #include #include -#include "toml.h" #include "keymap.h" #include "bpf.h" #include "bpf_load.h" @@ -55,7 +54,7 @@ struct bpf_file { Elf_Data *data; int strtabidx; Elf_Data *symbols; - struct toml_table_t *toml; + struct protocol_param *param; }; static int load_and_attach(int lirc_fd, struct bpf_file *bpf_file, const char *name, struct bpf_insn *prog, int size) @@ -271,23 +270,11 @@ static int parse_relo_and_apply(struct bpf_file *bpf_file, GElf_Shdr *shdr, const char *raw = NULL; int value = 0; - if (!bpf_param(sym_name, &value)) { - // done - } else if (bpf_file->toml && - (raw = toml_raw_in(bpf_file->toml, sym_name)) != NULL) { - int64_t val64; - - if (toml_rtoi(raw, &val64)) { - printf(_("variable %s not a integer: %s\n"), sym_name, raw); - return 1; - } - + if (!bpf_param(bpf_file->param, sym_name, &value)) { if (value < INT_MIN && value > UINT_MAX) { printf(_("variable %s out of range: %s\n"), sym_name, raw); return 1; } - - value = val64; } else if (sym.st_shndx == bpf_file->dataidx) { // Value is not overridden on command line // or toml file. For the raw decoder, the @@ -436,10 +423,10 @@ static int load_elf_maps_section(struct bpf_file *bpf_file) return nr_maps; } -int load_bpf_file(const char *path, int lirc_fd, struct toml_table_t *toml, +int load_bpf_file(const char *path, int lirc_fd, struct protocol_param *param, struct raw_entry *raw) { - struct bpf_file bpf_file = { .toml = toml }; + struct bpf_file bpf_file = { .param = param }; int fd, i, ret; Elf *elf; GElf_Ehdr ehdr; diff --git a/utils/keytable/bpf_load.h b/utils/keytable/bpf_load.h index 4ec0a9344f63..47b57b25d91f 100644 --- a/utils/keytable/bpf_load.h +++ b/utils/keytable/bpf_load.h @@ -36,8 +36,8 @@ struct bpf_map_data { * * returns zero on success */ -int load_bpf_file(const char *path, int lirc_fd, struct toml_table_t *toml, struct raw_entry *raw); +int load_bpf_file(const char *path, int lirc_fd, struct protocol_param *param, struct raw_entry *raw); -int bpf_param(const char *name, int *val); +int bpf_param(struct protocol_param *param, const char *name, int *val); #endif diff --git a/utils/keytable/keymap.c b/utils/keytable/keymap.c new file mode 100644 index ..bb193131164a --- /dev/null +++ b/utils/keytable/keymap.c @@ -0,0 +1,459 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +// Read a toml keymap or plain text keymap (ir-keytable 1.14 or earl
[git:v4l-utils/master] ir-ctl: send keys based on keymap
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: ir-ctl: send keys based on keymap Author: Sean Young Date:Mon Aug 26 11:52:35 2019 +0100 ir-ctl can now send keys based on rc keymaps. The keymap file must be specified and the keys to be sent: ir-ctl -k /lib/udev/rc_keymaps/hauppauge.toml -K KEY_VOLUMEUP Signed-off-by: Sean Young utils/common/keymap.c| 469 utils/common/keymap.h| 39 + utils/common/toml.c | 1903 + utils/common/toml.h | 110 +++ utils/ir-ctl/Makefile.am |2 +- utils/ir-ctl/ir-ctl.1.in | 26 +- utils/ir-ctl/ir-ctl.c| 126 ++- utils/ir-ctl/keymap.c|1 + utils/ir-ctl/keymap.h|1 + utils/ir-ctl/toml.c |1 + utils/ir-ctl/toml.h |1 + utils/keytable/keymap.c | 460 +-- utils/keytable/keymap.h | 39 +- utils/keytable/toml.c| 1904 +- utils/keytable/toml.h| 111 +-- 15 files changed, 2677 insertions(+), 2516 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=5effec906412efa6e4ba4726e8baf46cc8711a2b ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] v4l-utils: sync with media_tree master
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: v4l-utils: sync with media_tree master Author: Sean Young Date:Wed Aug 14 10:35:23 2019 +0100 Signed-off-by: Sean Young utils/keytable/parse.h| 9 - utils/keytable/rc_keymaps/imon_rsc.toml | 4 ++-- utils/keytable/rc_keymaps_userspace/imon_rsc.toml | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=59d6c0b4a5605b4dbb4020f3b9cba7de87d9fdce diff --git a/utils/keytable/parse.h b/utils/keytable/parse.h index a78d86dcfddc..e08dfbc657fe 100644 --- a/utils/keytable/parse.h +++ b/utils/keytable/parse.h @@ -151,6 +151,7 @@ struct parse_event key_events[] = { {"KEY_SCALE", 120}, {"KEY_KPCOMMA", 121}, {"KEY_HANGEUL", 122}, + {"KEY_HANGUEL", 122}, {"KEY_HANJA", 123}, {"KEY_YEN", 124}, {"KEY_LEFTMETA", 125}, @@ -181,7 +182,9 @@ struct parse_event key_events[] = { {"KEY_WWW", 150}, {"KEY_MSDOS", 151}, {"KEY_COFFEE", 152}, + {"KEY_SCREENLOCK", 152}, {"KEY_ROTATE_DISPLAY", 153}, + {"KEY_DIRECTION", 153}, {"KEY_CYCLEWINDOWS", 154}, {"KEY_MAIL", 155}, {"KEY_BOOKMARKS", 156}, @@ -268,8 +271,10 @@ struct parse_event key_events[] = { {"KEY_VIDEO_PREV", 242}, {"KEY_BRIGHTNESS_CYCLE", 243}, {"KEY_BRIGHTNESS_AUTO", 244}, + {"KEY_BRIGHTNESS_ZERO", 244}, {"KEY_DISPLAY_OFF", 245}, {"KEY_WWAN", 246}, + {"KEY_WIMAX", 246}, {"KEY_RFKILL", 247}, {"KEY_MICMUTE", 248}, {"BTN_MISC", 0x100}, @@ -363,9 +368,11 @@ struct parse_event key_events[] = { {"KEY_SUBTITLE", 0x172}, {"KEY_ANGLE", 0x173}, {"KEY_FULL_SCREEN", 0x174}, + {"KEY_ZOOM", 0x174}, {"KEY_MODE", 0x175}, {"KEY_KEYBOARD", 0x176}, {"KEY_ASPECT_RATIO", 0x177}, + {"KEY_SCREEN", 0x177}, {"KEY_PC", 0x178}, {"KEY_TV", 0x179}, {"KEY_TV2", 0x17a}, @@ -422,6 +429,7 @@ struct parse_event key_events[] = { {"KEY_ADDRESSBOOK", 0x1ad}, {"KEY_MESSENGER", 0x1ae}, {"KEY_DISPLAYTOGGLE", 0x1af}, + {"KEY_BRIGHTNESS_TOGGLE", 0x1af}, {"KEY_SPELLCHECK", 0x1b0}, {"KEY_LOGOFF", 0x1b1}, {"KEY_DOLLAR", 0x1b2}, @@ -582,7 +590,6 @@ struct parse_event key_events[] = { {"BTN_TRIGGER_HAPPY38", 0x2e5}, {"BTN_TRIGGER_HAPPY39", 0x2e6}, {"BTN_TRIGGER_HAPPY40", 0x2e7}, - {"KEY_MAX", 0x2ff}, { NULL, 0} }; struct parse_event rel_events[] = { diff --git a/utils/keytable/rc_keymaps/imon_rsc.toml b/utils/keytable/rc_keymaps/imon_rsc.toml index 4f20a54e50a7..173028c7a494 100644 --- a/utils/keytable/rc_keymaps/imon_rsc.toml +++ b/utils/keytable/rc_keymaps/imon_rsc.toml @@ -18,7 +18,7 @@ variant = "necx" 0x80105c = "KEY_NUMERIC_9" 0x801081 = "KEY_SCREEN" 0x80105d = "KEY_NUMERIC_0" -0x801082 = "KEY_MAX" +0x801082 = "KEY_ZOOM" 0x801048 = "KEY_ESC" 0x80104b = "KEY_MEDIA" 0x801083 = "KEY_MENU" @@ -45,6 +45,6 @@ variant = "necx" 0x80104e = "KEY_STOP" 0x801052 = "KEY_REWIND" 0x801053 = "KEY_FASTFORWARD" -0x801089 = "KEY_ZOOM" +0x801089 = "KEY_FULL_SCREEN" [[protocols]] protocol = "imon_rsc" diff --git a/utils/keytable/rc_keymaps_userspace/imon_rsc.toml b/utils/keytable/rc_keymaps_userspace/imon_rsc.toml index 4f20a54e50a7..173028c7a494 100644 --- a/utils/keytable/rc_keymaps_userspace/imon_rsc.toml +++ b/utils/keytable/rc_keymaps_userspace/imon_rsc.toml @@ -18,7 +18,7 @@ variant = "necx" 0x80105c = "KEY_NUMERIC_9" 0x801081 = "KEY_SCREEN" 0x80105d = "KEY_NUMERIC_0" -0x801082 = "KEY_MAX" +0x801082 = "KEY_ZOOM" 0x801048 = "KEY_ESC" 0x80104b = "KEY_MEDIA" 0x801083 = "KEY_MENU" @@ -45,6 +45,6 @@ variant = "necx" 0x80104e = "KEY_STOP" 0x801052 = "KEY_REWIND" 0x801053 = "KEY_FASTFORWARD" -0x801089 = "KEY_ZOOM" +0x801089 = "KEY_FULL_SCREEN" [[protocols]] protocol = "imon_rsc" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: fix build on ubuntu
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix build on ubuntu Author: Sean Young Date:Sun Aug 11 05:24:19 2019 +0100 Signed-off-by: Sean Young utils/keytable/bpf_load.h | 7 --- utils/keytable/bpf_protocols/bitmap.h | 2 -- 2 files changed, 9 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=d0510b308625975808dd396bfc1813d1b9ef583b diff --git a/utils/keytable/bpf_load.h b/utils/keytable/bpf_load.h index 471600bb6ee5..4ec0a9344f63 100644 --- a/utils/keytable/bpf_load.h +++ b/utils/keytable/bpf_load.h @@ -24,13 +24,6 @@ struct bpf_map_data { struct bpf_load_map_def def; }; -struct raw_entry { - struct raw_entry *next; - u_int32_t scancode; - u_int32_t raw_length; - u_int32_t raw[1]; -}; - /* parses elf file compiled by llvm .c->.o * . parses 'maps' section and creates maps via BPF syscall * . parses 'license' section and passes it to syscall diff --git a/utils/keytable/bpf_protocols/bitmap.h b/utils/keytable/bpf_protocols/bitmap.h index e3d731ad7ab1..11a6dc72758f 100644 --- a/utils/keytable/bpf_protocols/bitmap.h +++ b/utils/keytable/bpf_protocols/bitmap.h @@ -2,8 +2,6 @@ #ifndef __BITMAP_H__ #define __BITMAP_H__ -#include "string.h" - #define BITS_PER_LONG 64 #define BITS_TO_LONG(n) \ (((n) + BITS_PER_LONG - 1) / BITS_PER_LONG) ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: fix building without HAVE_BPF
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: fix building without HAVE_BPF Author: Sean Young Date:Sat Aug 10 17:09:29 2019 +0100 The struct raw_entry was defined in a BPF header file which was not included. Spin it out to its own header file. Signed-off-by: Sean Young utils/keytable/Makefile.am | 2 +- utils/keytable/bpf_load.c | 1 + utils/keytable/keymap.h| 12 utils/keytable/keytable.c | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=edea79a653acfc9aab6331296abd850a5a6873b0 diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index 2f265f126f43..18e6574e14f0 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -4,7 +4,7 @@ sysconf_DATA = rc_maps.cfg keytablesystem_DATA = $(srcdir)/rc_keymaps/* udevrules_DATA = 70-infrared.rules -ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h +ir_keytable_SOURCES = keytable.c parse.h ir-encode.c ir-encode.h toml.c toml.h keymap.h if WITH_BPF ir_keytable_SOURCES += bpf.c bpf_load.c bpf.h bpf_load.h diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c index 3187b9889f21..b6032ed1e9c7 100644 --- a/utils/keytable/bpf_load.c +++ b/utils/keytable/bpf_load.c @@ -14,6 +14,7 @@ #include #include #include "toml.h" +#include "keymap.h" #include "bpf.h" #include "bpf_load.h" diff --git a/utils/keytable/keymap.h b/utils/keytable/keymap.h new file mode 100644 index ..645a9bd06340 --- /dev/null +++ b/utils/keytable/keymap.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __KEYMAP_H +#define __KEYMAP_H + +struct raw_entry { + struct raw_entry *next; + u_int32_t scancode; + u_int32_t raw_length; + u_int32_t raw[1]; +}; + +#endif diff --git a/utils/keytable/keytable.c b/utils/keytable/keytable.c index 4a7da63ddf97..3c4031b034b3 100644 --- a/utils/keytable/keytable.c +++ b/utils/keytable/keytable.c @@ -34,6 +34,7 @@ #include "ir-encode.h" #include "parse.h" #include "toml.h" +#include "keymap.h" #ifdef HAVE_BPF #include "bpf.h" ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] lircd2toml: do not fail on unexpected input
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: lircd2toml: do not fail on unexpected input Author: Sean Young Date:Fri Aug 9 08:23:38 2019 +0100 The lircd daemon just warns on this. For example: https://sourceforge.net/p/lirc-remotes/code/ci/master/tree/remotes/bang&olufsen/Beo4.lircd.conf Signed-off-by: Sean Young contrib/lircd2toml.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=55dd66ee1c18d72d84f1987c93878e0103eb0871 diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index 5a60cfaae273..057292398221 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -55,8 +55,8 @@ class LircdParser: break a = line.split(maxsplit=2) if a[0] != 'begin' or a[1] != 'remote': -self.error("expected 'begin remote', got '{} {}'".format(a[0], a[1])) -return None +self.warning("expected 'begin remote', got '{} {}'".format(a[0], a[1])) +continue if len(a) > 2 and a[2][0] != '#': self.error("unexpected {}".format(a[2])) return None ___ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
[git:v4l-utils/master] keytable: add support for keymap with raw literals
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: add support for keymap with raw literals Author: Sean Young Date:Tue Jul 30 14:58:28 2019 +0900 These rc keymaps look like: [[protocols]] name = 'Beon_Colour_TV' protocol = 'raw' [[protocols.raw]] keycode = 'KEY_POWER' raw = [ 1324, 842, 6697, 26400, 1324, 842, 6697 ] [[protocols.raw]] keycode = 'KEY_MUTE' raw = [ 1305, 865, 2357, 931, 3411, 26400, 1305, 865, 2357, 931, 3411 ] So the incoming IR will be literally compared against the IR given, and only if the entire array matches with no leading or trailing IR will the keycode be reported. This is analogous to lircd raw_codes support, so lircd2toml.py can also convert raw_codes lircd.conf files. This means that the vast majority of lircd files can now be converted. This feature requires loops in BPF programs so this is only supported in kernel 5.3 onwards. Signed-off-by: Sean Young contrib/lircd2toml.py| 76 +++- utils/keytable/bpf_load.c| 108 +- utils/keytable/bpf_load.h| 9 +- utils/keytable/bpf_protocols/Makefile.am | 2 +- utils/keytable/bpf_protocols/bitmap.h| 36 utils/keytable/bpf_protocols/raw.c | 149 +++ utils/keytable/keytable.c| 139 +++- utils/keytable/rc_keymap.5.in| 18 +++- 8 files changed, 505 insertions(+), 32 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=73f8f2f0acdce9f9ad91da9aa5390c5c7a6ddfd2 diff --git a/contrib/lircd2toml.py b/contrib/lircd2toml.py index 9b93f198490f..5a60cfaae273 100755 --- a/contrib/lircd2toml.py +++ b/contrib/lircd2toml.py @@ -146,14 +146,14 @@ class LircdParser: a = line.split() if a[0] == 'name': if len(codes) > 0: -raw_codes.append({ 'name': name, 'codes': codes }) +raw_codes.append({ 'keycode': name, 'raw': codes }) name = line.split(maxsplit=2)[1] if not name.startswith('KEY_'): name = 'KEY_' + name.upper() codes = [] elif a[0] == 'end': if len(codes) > 0: -raw_codes.append({ 'name': name, 'codes': codes }) +raw_codes.append({ 'keycode': name, 'raw': codes }) return raw_codes else: for v in a: @@ -224,6 +224,8 @@ class Converter: return self.convert_rcmm() elif 'space_enc' in flags: return self.convert_space_enc() +elif 'raw_codes' in flags: +return self.convert_raw_codes() else: self.error('Cannot convert remote with flags: {}'.format('|'.join(flags))) @@ -237,7 +239,7 @@ class Converter: res = { 'protocol': 'pulse_distance', 'params': {}, -'map': {} +'scancodes': {} } res['name'] = self.remote['name'] @@ -338,7 +340,7 @@ class Converter: elif v != variant: variant = "" -res['map'][n] = self.remote['codes'][s] +res['scancodes'][n] = self.remote['codes'][s] if variant: res['params']['variant'] = "'" + variant + "'" @@ -374,14 +376,14 @@ class Converter: elif v != variant: variant = "" -res['map'][n] = self.remote['codes'][s] +res['scancodes'][n] = self.remote['codes'][s] if variant: res['params']['variant'] = "'" + variant + "'" else: for s in self.remote['codes']: p = (s<> 16 -res['map'][d] = self.remote['codes'][s] +res['scancodes'][d] = self.remote['codes'][s] if bits == 16: res['params']['variant'] = "'rc-6-0'" @@ -494,7 +496,7 @@ class Converter: res = { 'protocol': 'manchester', 'params': { }, -'map': { } +'scancodes': { } }
[git:v4l-utils/master] keytable: generate missing keys like KEY_ZOOM
This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree: Subject: keytable: generate missing keys like KEY_ZOOM Author: Sean Young Date:Wed Jul 31 13:10:56 2019 +0900 The input-event-codes.h now contains lines like: #define KEY_ZOOMKEY_FULL_SCREEN Ensure these parsed correctly. Signed-off-by: Sean Young utils/keytable/Makefile.am | 40 +--- utils/keytable/gen_input_events.pl | 94 ++ utils/keytable/parse.h | 9 +++- 3 files changed, 103 insertions(+), 40 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=28be49b4e9d72c5866188cf5ba408541c665c921 diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am index 0a8f59369c2e..2f265f126f43 100644 --- a/utils/keytable/Makefile.am +++ b/utils/keytable/Makefile.am @@ -33,45 +33,7 @@ sync-with-kernel: exit 1; \ fi @echo generating $(srcdir)/parse.h - @printf "struct parse_event {\n\tchar *name;\n\tunsigned int value;\n};\n" > $(srcdir)/parse.h - - @printf "struct parse_event events_type[] = {\n" >> $(srcdir)/parse.h - @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \ - -e 'if (m/^\#define\s+(EV_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2 if ($$1 ne "EV_VERSION"); }' \ - >> $(srcdir)/parse.h - @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h - - @printf "struct parse_event msc_events[] = {\n" >> $(srcdir)/parse.h - @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \ - -e 'if (m/^\#define\s+(MSC_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \ - >> $(srcdir)/parse.h - @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h - - @printf "struct parse_event key_events[] = {\n" >> $(srcdir)/parse.h - @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \ - -e 'if (m/^\#define\s+(KEY_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \ - -e 'if (m/^\#define\s+(BTN_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \ - >> $(srcdir)/parse.h - @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h - - @printf "struct parse_event rel_events[] = {\n" >> $(srcdir)/parse.h - @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \ - -e 'if (m/^\#define\s+(REL_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \ - >> $(srcdir)/parse.h - @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h - - @printf "struct parse_event abs_events[] = {\n" >> $(srcdir)/parse.h - @more $(KERNEL_DIR)/usr/include/linux/input-event-codes.h | perl -n \ - -e 'if (m/^\#define\s+(ABS_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) ' \ - -e '{ printf "\t{\"%s\", %s},\n",$$1,$$2; }' \ - >> $(srcdir)/parse.h - @printf "\t{ NULL, 0}\n};\n" >> $(srcdir)/parse.h - + @./gen_input_events.pl < $(KERNEL_DIR)/usr/include/linux/input-event-codes.h > $(srcdir)/parse.h @-mkdir -p $(srcdir)/rc_keymaps @-rm $(srcdir)/rc_keymaps/* @echo storing existing keymaps at $(srcdir)/rc_keymaps/ diff --git a/utils/keytable/gen_input_events.pl b/utils/keytable/gen_input_events.pl new file mode 100755 index ..01d6165eac54 --- /dev/null +++ b/utils/keytable/gen_input_events.pl @@ -0,0 +1,94 @@ +#!/usr/bin/perl +use strict; + +my @ev; +my @msc; +my @key; +my @key; +my @rel; +my @abs; + +my %key_hash; + +while (<>) { + if (m/^\#define\s+(EV_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) { + next if ($1 eq "EV_VERSION"); + my @e = ($1, $2); + push(@ev, \@e); + } + + if (m/^\#define\s+(MSC_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) { + my @e = ($1, $2); + push(@msc, \@e); + } + + if (m/^\#define\s+(KEY_[^\s]+)\s+(0x[\d\w]+|[\d]+)/) { + next if ($1 eq "KEY_MAX"); + $key_hash{$1} = $2; + my @e = ($1, $2); + push(@key, \@e); + } + + if (m/^\#define\s+(KEY_[^\s]+)\s+(KEY_[^\s]+)/) { + next if ($1 eq "KEY_MIN_INTERESTING"); + my @e = ($1, $key_hash{$2}); + push(@key, \@e); + } + +