mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Input: Minor cleanups (#7542)
* TimeVal: Log the results of the COARSE probes in debug logs * GestureDetector: Print details of failed clock probes in debug logs * GestureDetector: Skip the BOOTTIME probe when CLOCK_BOOTTIME is unsupported. * Input: Decode ABS_DISTANCE events in debug logs * Get rid of duplicated <linux/input.h> constants, use the FFI module everywhere (re #7536) * Kobo: Get rid of the `touch_alyssum_protocol` quirk. Replace it by setting `main_finger_slot` to `1`, like on the H2O.
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
describe("input module", function()
|
||||
local Input
|
||||
local ffi, C
|
||||
setup(function()
|
||||
require("commonrequire")
|
||||
ffi = require("ffi")
|
||||
C = ffi.C
|
||||
require("ffi/linux_input_h")
|
||||
Input = require("device/input")
|
||||
end)
|
||||
|
||||
@@ -40,36 +44,36 @@ Event: time 1510346969.076908, -------------- SYN_REPORT ------------
|
||||
it("should set cur_slot correctly", function()
|
||||
local ev
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 57,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_TRACKING_ID,
|
||||
value = 1,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(1, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 48,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_TOUCH_MAJOR,
|
||||
value = 1,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(1, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 50,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_WIDTH_MAJOR,
|
||||
value = 1,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(1, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 53,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_POSITION_X,
|
||||
value = 1012,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(1, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 54,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_POSITION_Y,
|
||||
value = 914,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
@@ -79,8 +83,8 @@ Event: time 1510346969.076908, -------------- SYN_REPORT ------------
|
||||
-- depends on gesture_detector
|
||||
--[[
|
||||
ev = {
|
||||
type = 0,
|
||||
code = 0,
|
||||
type = C.EV_SYN,
|
||||
code = C.SYN_REPORT,
|
||||
value = 0,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
@@ -89,36 +93,36 @@ Event: time 1510346969.076908, -------------- SYN_REPORT ------------
|
||||
|
||||
-- this value=2 stuff doesn't happen IRL, just testing logic
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 57,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_TRACKING_ID,
|
||||
value = 2,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(2, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 48,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_TOUCH_MAJOR,
|
||||
value = 2,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(2, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 50,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_WIDTH_MAJOR,
|
||||
value = 2,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(2, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 53,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_POSITION_X,
|
||||
value = 1012,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
assert.is_equal(2, Input.cur_slot)
|
||||
ev = {
|
||||
type = 3,
|
||||
code = 54,
|
||||
type = C.EV_ABS,
|
||||
code = C.ABS_MT_POSITION_Y,
|
||||
value = 914,
|
||||
}
|
||||
Input:handleTouchEvPhoenix(ev)
|
||||
|
||||
Reference in New Issue
Block a user