mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
media: bpf: add bpf function to report mouse movement
Some IR remotes have a directional pad or other pointer-like thing that can be used as a mouse. Make it possible to decode these types of IR protocols in BPF. Cc: [email protected] Signed-off-by: Sean Young <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
This commit is contained in:
parent
ca5d1a7fad
commit
01d3240a04
7 changed files with 109 additions and 23 deletions
|
|
@ -59,6 +59,28 @@ static const struct bpf_func_proto rc_keydown_proto = {
|
|||
.arg4_type = ARG_ANYTHING,
|
||||
};
|
||||
|
||||
BPF_CALL_3(bpf_rc_pointer_rel, u32*, sample, s32, rel_x, s32, rel_y)
|
||||
{
|
||||
struct ir_raw_event_ctrl *ctrl;
|
||||
|
||||
ctrl = container_of(sample, struct ir_raw_event_ctrl, bpf_sample);
|
||||
|
||||
input_report_rel(ctrl->dev->input_dev, REL_X, rel_x);
|
||||
input_report_rel(ctrl->dev->input_dev, REL_Y, rel_y);
|
||||
input_sync(ctrl->dev->input_dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct bpf_func_proto rc_pointer_rel_proto = {
|
||||
.func = bpf_rc_pointer_rel,
|
||||
.gpl_only = true,
|
||||
.ret_type = RET_INTEGER,
|
||||
.arg1_type = ARG_PTR_TO_CTX,
|
||||
.arg2_type = ARG_ANYTHING,
|
||||
.arg3_type = ARG_ANYTHING,
|
||||
};
|
||||
|
||||
static const struct bpf_func_proto *
|
||||
lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
|
||||
{
|
||||
|
|
@ -67,6 +89,8 @@ lirc_mode2_func_proto(enum bpf_func_id func_id, const struct bpf_prog *prog)
|
|||
return &rc_repeat_proto;
|
||||
case BPF_FUNC_rc_keydown:
|
||||
return &rc_keydown_proto;
|
||||
case BPF_FUNC_rc_pointer_rel:
|
||||
return &rc_pointer_rel_proto;
|
||||
case BPF_FUNC_map_lookup_elem:
|
||||
return &bpf_map_lookup_elem_proto;
|
||||
case BPF_FUNC_map_update_elem:
|
||||
|
|
|
|||
Loading…
Reference in a new issue