aboutsummaryrefslogtreecommitdiffstats
path: root/utils/keytable
diff options
context:
space:
mode:
Diffstat (limited to 'utils/keytable')
-rw-r--r--utils/keytable/bpf_load.c29
-rw-r--r--utils/keytable/bpf_protocols/grundig.c6
-rw-r--r--utils/keytable/bpf_protocols/imon_rsc.c6
-rw-r--r--utils/keytable/bpf_protocols/manchester.c6
-rw-r--r--utils/keytable/bpf_protocols/pulse_distance.c6
-rw-r--r--utils/keytable/bpf_protocols/pulse_length.c6
-rw-r--r--utils/keytable/bpf_protocols/raw.c8
-rw-r--r--utils/keytable/bpf_protocols/rc_mm.c6
-rw-r--r--utils/keytable/bpf_protocols/samsung36.c6
-rw-r--r--utils/keytable/bpf_protocols/xbox-dvd.c6
-rw-r--r--utils/keytable/rc_keymaps/tango.toml56
-rw-r--r--utils/keytable/rc_maps.cfg3
12 files changed, 52 insertions, 92 deletions
diff --git a/utils/keytable/bpf_load.c b/utils/keytable/bpf_load.c
index ec6eb98e..7c633dac 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 4d8cc4b9..cdd551f9 100644
--- a/utils/keytable/bpf_protocols/grundig.c
+++ b/utils/keytable/bpf_protocols/grundig.c
@@ -22,7 +22,7 @@ struct decoder_state {
unsigned int last_space;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -44,9 +44,9 @@ int header_pulse = 900;
int header_space = 2900;
int leader_pulse = 1300;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
-SEC("grundig")
+SEC("lirc_mode2/grundig")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/imon_rsc.c b/utils/keytable/bpf_protocols/imon_rsc.c
index 14c4ec37..e163f217 100644
--- a/utils/keytable/bpf_protocols/imon_rsc.c
+++ b/utils/keytable/bpf_protocols/imon_rsc.c
@@ -19,7 +19,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -34,14 +34,14 @@ struct bpf_map_def SEC("maps") decoder_state_map = {
// actual value (either overridden or taken from the data segment).
int margin = 325;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("imon_rsc")
+SEC("lirc_mode2/imon_rsc")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/manchester.c b/utils/keytable/bpf_protocols/manchester.c
index 94b53fd0..0310f37e 100644
--- a/utils/keytable/bpf_protocols/manchester.c
+++ b/utils/keytable/bpf_protocols/manchester.c
@@ -13,7 +13,7 @@ struct decoder_state {
unsigned long bits;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -41,7 +41,7 @@ int bits = 14;
int scancode_mask = 0;
int rc_protocol = 66;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
@@ -79,7 +79,7 @@ static int emitBit(unsigned int *sample, struct decoder_state *s, int bit, int s
return state;
}
-SEC("manchester")
+SEC("lirc_mode2/manchester")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/pulse_distance.c b/utils/keytable/bpf_protocols/pulse_distance.c
index 9e9ea4ad..f2de8d27 100644
--- a/utils/keytable/bpf_protocols/pulse_distance.c
+++ b/utils/keytable/bpf_protocols/pulse_distance.c
@@ -22,7 +22,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -49,14 +49,14 @@ int reverse = 0;
int header_optional = 0;
int rc_protocol = 64;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("pulse_distance")
+SEC("lirc_mode2/pulse_distance")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/pulse_length.c b/utils/keytable/bpf_protocols/pulse_length.c
index e33f0899..1c9e1948 100644
--- a/utils/keytable/bpf_protocols/pulse_length.c
+++ b/utils/keytable/bpf_protocols/pulse_length.c
@@ -22,7 +22,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -49,14 +49,14 @@ int reverse = 0;
int header_optional = 0;
int rc_protocol = 67;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("pulse_length")
+SEC("lirc_mode2/pulse_length")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/raw.c b/utils/keytable/bpf_protocols/raw.c
index a0ee78b4..5084264d 100644
--- a/utils/keytable/bpf_protocols/raw.c
+++ b/utils/keytable/bpf_protocols/raw.c
@@ -27,7 +27,7 @@ struct decoder_state {
DECLARE_BITMAP(nomatch, MAX_PATTERNS);
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -40,7 +40,7 @@ struct raw_pattern {
};
// ir-keytable will load the raw patterns here
-struct bpf_map_def SEC("maps") raw_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") raw_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct raw_pattern), // this is not used
@@ -60,14 +60,14 @@ int rc_protocol = 68;
int trail_space = 1000;
int max_length = 1;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("raw")
+SEC("lirc_mode2/raw")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/rc_mm.c b/utils/keytable/bpf_protocols/rc_mm.c
index 034d39b9..117f7d62 100644
--- a/utils/keytable/bpf_protocols/rc_mm.c
+++ b/utils/keytable/bpf_protocols/rc_mm.c
@@ -21,7 +21,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -37,7 +37,7 @@ struct bpf_map_def SEC("maps") decoder_state_map = {
//
// This is why they should be accessed through the BPF_PARAM() macro.
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
int margin = 100;
int header_pulse = 417;
@@ -56,7 +56,7 @@ static inline int eq_margin(unsigned d1, unsigned d2)
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("rc_mm")
+SEC("lirc_mode2/rc_mm")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/samsung36.c b/utils/keytable/bpf_protocols/samsung36.c
index 1b09365f..a83137e4 100644
--- a/utils/keytable/bpf_protocols/samsung36.c
+++ b/utils/keytable/bpf_protocols/samsung36.c
@@ -26,7 +26,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -42,14 +42,14 @@ struct bpf_map_def SEC("maps") decoder_state_map = {
int margin = 300;
int rc_protocol = 69;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("samsung36")
+SEC("lirc_mode2/samsung36")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/bpf_protocols/xbox-dvd.c b/utils/keytable/bpf_protocols/xbox-dvd.c
index 18225453..c0b57a7c 100644
--- a/utils/keytable/bpf_protocols/xbox-dvd.c
+++ b/utils/keytable/bpf_protocols/xbox-dvd.c
@@ -21,7 +21,7 @@ struct decoder_state {
unsigned int count;
};
-struct bpf_map_def SEC("maps") decoder_state_map = {
+struct bpf_map_def SEC("lirc_mode2/maps") decoder_state_map = {
.type = BPF_MAP_TYPE_ARRAY,
.key_size = sizeof(unsigned int),
.value_size = sizeof(struct decoder_state),
@@ -44,14 +44,14 @@ int trailer_pulse = 550;
int bits = 24;
int rc_protocol = 68;
-#define BPF_PARAM(x) (int)(&(x))
+#define BPF_PARAM(x) (int)(long)(&(x))
static inline int eq_margin(unsigned d1, unsigned d2)
{
return ((d1 > (d2 - BPF_PARAM(margin))) && (d1 < (d2 + BPF_PARAM(margin))));
}
-SEC("xbox_dvd")
+SEC("lirc_mode2/xbox_dvd")
int bpf_decoder(unsigned int *sample)
{
unsigned int key = 0;
diff --git a/utils/keytable/rc_keymaps/tango.toml b/utils/keytable/rc_keymaps/tango.toml
deleted file mode 100644
index 91bbd8a7..00000000
--- a/utils/keytable/rc_keymaps/tango.toml
+++ /dev/null
@@ -1,56 +0,0 @@
-# Generated with gen_keytables.pl from drivers/media/rc/keymaps/rc-tango.c
-[[protocols]]
-name = "tango"
-protocol = "nec"
-variant = "necx"
-[protocols.scancodes]
-0x4cb4a = "KEY_POWER"
-0x4cb48 = "KEY_FILE"
-0x4cb0f = "KEY_SETUP"
-0x4cb4d = "KEY_SUSPEND"
-0x4cb4e = "KEY_VOLUMEUP"
-0x4cb44 = "KEY_EJECTCD"
-0x4cb13 = "KEY_TV"
-0x4cb51 = "KEY_MUTE"
-0x4cb52 = "KEY_VOLUMEDOWN"
-0x4cb41 = "KEY_NUMERIC_1"
-0x4cb03 = "KEY_NUMERIC_2"
-0x4cb42 = "KEY_NUMERIC_3"
-0x4cb45 = "KEY_NUMERIC_4"
-0x4cb07 = "KEY_NUMERIC_5"
-0x4cb46 = "KEY_NUMERIC_6"
-0x4cb55 = "KEY_NUMERIC_7"
-0x4cb17 = "KEY_NUMERIC_8"
-0x4cb56 = "KEY_NUMERIC_9"
-0x4cb1b = "KEY_NUMERIC_0"
-0x4cb59 = "KEY_DELETE"
-0x4cb5a = "KEY_CAPSLOCK"
-0x4cb47 = "KEY_BACK"
-0x4cb05 = "KEY_SWITCHVIDEOMODE"
-0x4cb06 = "KEY_UP"
-0x4cb43 = "KEY_LEFT"
-0x4cb01 = "KEY_RIGHT"
-0x4cb0a = "KEY_DOWN"
-0x4cb02 = "KEY_ENTER"
-0x4cb4b = "KEY_INFO"
-0x4cb09 = "KEY_HOME"
-0x4cb53 = "KEY_MENU"
-0x4cb12 = "KEY_PREVIOUS"
-0x4cb50 = "KEY_PLAY"
-0x4cb11 = "KEY_NEXT"
-0x4cb4f = "KEY_TITLE"
-0x4cb0e = "KEY_REWIND"
-0x4cb4c = "KEY_STOP"
-0x4cb0d = "KEY_FORWARD"
-0x4cb57 = "KEY_MEDIA_REPEAT"
-0x4cb16 = "KEY_ANGLE"
-0x4cb54 = "KEY_PAUSE"
-0x4cb15 = "KEY_SLOW"
-0x4cb5b = "KEY_TIME"
-0x4cb1a = "KEY_AUDIO"
-0x4cb58 = "KEY_SUBTITLE"
-0x4cb19 = "KEY_ZOOM"
-0x4cb5f = "KEY_RED"
-0x4cb1e = "KEY_GREEN"
-0x4cb5c = "KEY_YELLOW"
-0x4cb1d = "KEY_BLUE"
diff --git a/utils/keytable/rc_maps.cfg b/utils/keytable/rc_maps.cfg
index da7a3ef1..c2357ad8 100644
--- a/utils/keytable/rc_maps.cfg
+++ b/utils/keytable/rc_maps.cfg
@@ -99,6 +99,8 @@
* rc-leadtek-y04g0051 leadtek_y04g0051.toml
* rc-lme2510 lme2510.toml
* rc-manli manli.toml
+* rc-mecool-kii-pro mecool_kii_pro.toml
+* rc-mecool-kiii-pro mecool_kiii_pro.toml
* rc-medion-x10-digitainer medion_x10_digitainer.toml
* rc-medion-x10-or2x medion_x10_or2x.toml
* rc-medion-x10 medion_x10.toml
@@ -131,7 +133,6 @@
* rc-snapstream-firefly snapstream_firefly.toml
* rc-streamzap streamzap.toml
* rc-su3000 su3000.toml
-* rc-tango tango.toml
* rc-tanix-tx3mini tanix_tx3mini.toml
* rc-tanix-tx5max tanix_tx5max.toml
* rc-tbs-nec tbs_nec.toml

Privacy Policy