summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2020-04-16 13:04:05 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2020-04-16 06:10:25 +0000
commitd107d58cd25c0e322d3d0a7d68feddcdb9e5e58f (patch)
tree5f310ff52ccdc339f70202fc26aeeb2fc75fb0a0 /tools
parente48a316c02ab7108ce5afe8101fe7b6a54f81296 (diff)
downloadlibinput-d107d58cd25c0e322d3d0a7d68feddcdb9e5e58f.tar.gz
tools: per-slot-delta: skip the extra evbit indirection
e.code is the evbit anyway, we don't have to convert it Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/libinput-analyze-per-slot-delta.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/tools/libinput-analyze-per-slot-delta.py b/tools/libinput-analyze-per-slot-delta.py
index 5c0b6714..78e2de7d 100755
--- a/tools/libinput-analyze-per-slot-delta.py
+++ b/tools/libinput-analyze-per-slot-delta.py
@@ -208,17 +208,16 @@ def main(argv):
for evdev in event['evdev']:
s = slots[slot]
e = InputEvent(evdev)
- evbit = libevdev.evbit(e.evtype, e.evcode)
- if evbit in tool_bits:
- tool_bits[evbit] = e.value
+ if e.code in tool_bits:
+ tool_bits[e.code] = e.value
if args.use_st:
# Note: this relies on the EV_KEY events to come in before the
# x/y events, otherwise the last/first event in each slot will
# be wrong.
- if (evbit == libevdev.EV_KEY.BTN_TOOL_FINGER or
- evbit == libevdev.EV_KEY.BTN_TOOL_PEN):
+ if (e.code == libevdev.EV_KEY.BTN_TOOL_FINGER or
+ e.code == libevdev.EV_KEY.BTN_TOOL_PEN):
slot = 0
s = slots[slot]
s.dirty = True
@@ -226,7 +225,7 @@ def main(argv):
s.state = SlotState.BEGIN
else:
s.state = SlotState.END
- elif evbit == libevdev.EV_KEY.BTN_TOOL_DOUBLETAP:
+ elif e.code == libevdev.EV_KEY.BTN_TOOL_DOUBLETAP:
if len(slots) > 1:
slot = 1
s = slots[slot]
@@ -235,18 +234,18 @@ def main(argv):
s.state = SlotState.BEGIN
else:
s.state = SlotState.END
- elif evbit == libevdev.EV_ABS.ABS_X:
+ elif e.code == libevdev.EV_ABS.ABS_X:
if s.state == SlotState.UPDATE:
s.dx = e.value - s.x
s.x = e.value
s.dirty = True
- elif evbit == libevdev.EV_ABS.ABS_Y:
+ elif e.code == libevdev.EV_ABS.ABS_Y:
if s.state == SlotState.UPDATE:
s.dy = e.value - s.y
s.y = e.value
s.dirty = True
else:
- if evbit == libevdev.EV_ABS.ABS_MT_SLOT:
+ if e.code == libevdev.EV_ABS.ABS_MT_SLOT:
slot = e.value
s = slots[slot]
s.dirty = True
@@ -254,7 +253,7 @@ def main(argv):
# our current slot number was used
for sl in slots[:slot + 1]:
sl.used = True
- elif evbit == libevdev.EV_ABS.ABS_MT_TRACKING_ID:
+ elif e.code == libevdev.EV_ABS.ABS_MT_TRACKING_ID:
if e.value == -1:
s.state = SlotState.END
else:
@@ -262,18 +261,18 @@ def main(argv):
s.dx = 0
s.dy = 0
s.dirty = True
- elif evbit == libevdev.EV_ABS.ABS_MT_POSITION_X:
+ elif e.code == libevdev.EV_ABS.ABS_MT_POSITION_X:
if s.state == SlotState.UPDATE:
s.dx = e.value - s.x
s.x = e.value
s.dirty = True
- elif evbit == libevdev.EV_ABS.ABS_MT_POSITION_Y:
+ elif e.code == libevdev.EV_ABS.ABS_MT_POSITION_Y:
if s.state == SlotState.UPDATE:
s.dy = e.value - s.y
s.y = e.value
s.dirty = True
- if evbit == libevdev.EV_SYN.SYN_REPORT:
+ if e.code == libevdev.EV_SYN.SYN_REPORT:
if last_time is None:
last_time = e.sec * 1000000 + e.usec
tdelta = 0