0001
0002
0003
0004
0005
0006 #include <linux/bpf.h>
0007 #include <linux/lirc.h>
0008 #include <bpf/bpf_helpers.h>
0009
0010 SEC("lirc_mode2")
0011 int bpf_decoder(unsigned int *sample)
0012 {
0013 if (LIRC_IS_PULSE(*sample)) {
0014 unsigned int duration = LIRC_VALUE(*sample);
0015
0016 if (duration & 0x10000)
0017 bpf_rc_keydown(sample, 0x40, duration & 0xffff, 0);
0018 if (duration & 0x20000)
0019 bpf_rc_pointer_rel(sample, (duration >> 8) & 0xff,
0020 duration & 0xff);
0021 }
0022
0023 return 0;
0024 }
0025
0026 char _license[] SEC("license") = "GPL";