Skip to content

Commit

Permalink
[remux] better flood event selection
Browse files Browse the repository at this point in the history
  • Loading branch information
okay committed Feb 18, 2024
1 parent 0bb771b commit a353524
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/remux/launcher.cpy
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@
#include "config.h"

#ifdef REMARKABLE
#define TOUCH_FLOOD_EVENT ABS_DISTANCE
#define DRAW_APP_BEHIND_MODAL
#define READ_XOCHITL_DATA
#define GRAB_INPUT
#define SUSPENDABLE
#elif KOBO
#define TOUCH_FLOOD_EVENT ABS_MT_DISTANCE
#define DYNAMIC_BPP
#define HAS_ROTATION
#define PORTRAIT_ONLY
Expand Down Expand Up @@ -775,18 +773,35 @@ class App: public IApp:
if write(fd, &ev, sizeof(ev)) != sizeof(ev):
debug "COULDNT WRITE EV", errno

// Figures out what event is supported for flooding
uint16_t get_flood_event():
vector<uint16_t> features = { ABS_DISTANCE, ABS_MT_DISTANCE, ABS_PRESSURE }
vector<string> names = { "ABS_DISTANCE", "ABS_MT_DISTANCE", "ABS_PRESSURE" }

unsigned long bit[EV_MAX]
fd := ui::MainLoop::in.touch.fd
ioctl(fd, EVIOCGBIT(0, EV_MAX), bit)
for i := 0; i < len(features); i++:
if input::check_bit_set(fd, EV_ABS, features[i]):
debug "SETTING FLOOD EVENT TO", names[i], features[i]
return features[i]

// return ABS_DISTANCE by default
return ABS_DISTANCE


input_event* build_touch_flood():
n := 512 * 8
num_inst := 4
input_event *ev = (input_event*) malloc(sizeof(struct input_event) * n * num_inst)
memset(ev, 0, sizeof(input_event) * n * num_inst)
flood_event := get_flood_event()

i := 0
while i < n:
ev[i++] = input_event{ type:EV_ABS, code:TOUCH_FLOOD_EVENT, value:1 }
ev[i++] = input_event{ type:EV_ABS, code:flood_event, value:1 }
ev[i++] = input_event{ type:EV_SYN, code:0, value:0 }
ev[i++] = input_event{ type:EV_ABS, code:TOUCH_FLOOD_EVENT, value:2 }
ev[i++] = input_event{ type:EV_ABS, code:flood_event, value:2 }
ev[i++] = input_event{ type:EV_SYN, code:0, value:0 }

return ev
Expand Down

0 comments on commit a353524

Please sign in to comment.