libts / tslib

Touchscreen access library
GNU Lesser General Public License v2.1
596 stars 290 forks source link

ts_test works, ts_test_mt does not #176

Closed JonnyMe closed 4 years ago

JonnyMe commented 4 years ago

Hi!

I'm working on a driver for my device's touchscreen and I'm encountering a strange behaviour..If I run ts_calibrate and ts_test I can perform all the calibrations and tests but if I run ts_test_mt it seems not recording the touches.

Furthermore I noticed that if I run ts_test_mt without having touched the screen before I got this behaviour: assuming I touched the device once and then released, if I press again with one finger I don't get the touch but if I press with another finger (keeping the other pressed) it gets the second touch and so on incrementally.

Here is an evtest log for a single tap:

No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:  pm8941_pwrkey
/dev/input/event1:  himax-touchscreen
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "himax-touchscreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 158 (KEY_BACK)
    Event code 172 (KEY_HOMEPAGE)
    Event code 217 (KEY_SEARCH)
    Event code 330 (BTN_TOUCH)
    Event code 580 (KEY_APPSELECT)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    359
      Min        0
      Max      719
    Event code 1 (ABS_Y)
      Value    644
      Min        0
      Max     1279
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      200
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        4
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      200
    Event code 50 (ABS_MT_WIDTH_MAJOR)
      Value      0
      Min        0
      Max      200
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      719
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     1279
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max      200
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1586629821.166108, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 320
Event: time 1586629821.166108, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 272
Event: time 1586629821.166108, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 922
Event: time 1586629821.166108, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1586629821.166108, type 3 (EV_ABS), code 0 (ABS_X), value 272
Event: time 1586629821.166108, type 3 (EV_ABS), code 1 (ABS_Y), value 922
Event: time 1586629821.166108, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 100
Event: time 1586629821.166108, -------------- SYN_REPORT ------------
Event: time 1586629821.189210, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 921
Event: time 1586629821.189210, type 3 (EV_ABS), code 1 (ABS_Y), value 921
Event: time 1586629821.189210, -------------- SYN_REPORT ------------
Event: time 1586629821.201387, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 920
Event: time 1586629821.201387, type 3 (EV_ABS), code 1 (ABS_Y), value 920
Event: time 1586629821.201387, -------------- SYN_REPORT ------------
Event: time 1586629821.212390, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 919
Event: time 1586629821.212390, type 3 (EV_ABS), code 1 (ABS_Y), value 919
Event: time 1586629821.212390, -------------- SYN_REPORT ------------
Event: time 1586629821.224608, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 918
Event: time 1586629821.224608, type 3 (EV_ABS), code 1 (ABS_Y), value 918
Event: time 1586629821.224608, -------------- SYN_REPORT ------------
Event: time 1586629821.235549, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 917
Event: time 1586629821.235549, type 3 (EV_ABS), code 1 (ABS_Y), value 917
Event: time 1586629821.235549, -------------- SYN_REPORT ------------
Event: time 1586629821.258697, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 916
Event: time 1586629821.258697, type 3 (EV_ABS), code 1 (ABS_Y), value 916
Event: time 1586629821.258697, -------------- SYN_REPORT ------------
Event: time 1586629821.281858, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 915
Event: time 1586629821.281858, type 3 (EV_ABS), code 1 (ABS_Y), value 915
Event: time 1586629821.281858, -------------- SYN_REPORT ------------
Event: time 1586629821.616356, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1586629821.616356, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1586629821.616356, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1586629821.616356, -------------- SYN_REPORT ------------

And here a test adding fingers up to three and then releasing progressively:

No device specified, trying to scan all of /dev/input/event*
Not running as root, no devices may be available.
Available devices:
/dev/input/event0:  pm8941_pwrkey
/dev/input/event1:  himax-touchscreen
Select the device event number [0-1]: 1
Input driver version is 1.0.1
Input device ID: bus 0x0 vendor 0x0 product 0x0 version 0x0
Input device name: "himax-touchscreen"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 158 (KEY_BACK)
    Event code 172 (KEY_HOMEPAGE)
    Event code 217 (KEY_SEARCH)
    Event code 330 (BTN_TOUCH)
    Event code 580 (KEY_APPSELECT)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value    127
      Min        0
      Max      719
    Event code 1 (ABS_Y)
      Value    885
      Min        0
      Max     1279
    Event code 24 (ABS_PRESSURE)
      Value      0
      Min        0
      Max      200
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        4
    Event code 48 (ABS_MT_TOUCH_MAJOR)
      Value      0
      Min        0
      Max      200
    Event code 50 (ABS_MT_WIDTH_MAJOR)
      Value      0
      Min        0
      Max      200
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max      719
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     1279
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
    Event code 58 (ABS_MT_PRESSURE)
      Value      0
      Min        0
      Max      200
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)
Event: time 1586629995.927558, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 325
Event: time 1586629995.927558, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 105
Event: time 1586629995.927558, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 919
Event: time 1586629995.927558, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 1
Event: time 1586629995.927558, type 3 (EV_ABS), code 0 (ABS_X), value 105
Event: time 1586629995.927558, type 3 (EV_ABS), code 1 (ABS_Y), value 919
Event: time 1586629995.927558, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 100
Event: time 1586629995.927558, -------------- SYN_REPORT ------------
Event: time 1586629996.958543, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 1
Event: time 1586629996.958543, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 326
Event: time 1586629996.958543, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 321
Event: time 1586629996.958543, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 874
Event: time 1586629996.958543, -------------- SYN_REPORT ------------
Event: time 1586629997.143685, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 0
Event: time 1586629997.143685, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 104
Event: time 1586629997.143685, type 3 (EV_ABS), code 0 (ABS_X), value 104
Event: time 1586629997.143685, -------------- SYN_REPORT ------------
Event: time 1586629997.166619, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 103
Event: time 1586629997.166619, type 3 (EV_ABS), code 0 (ABS_X), value 103
Event: time 1586629997.166619, -------------- SYN_REPORT ------------
Event: time 1586629997.189964, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 102
Event: time 1586629997.189964, type 3 (EV_ABS), code 0 (ABS_X), value 102
Event: time 1586629997.189964, -------------- SYN_REPORT ------------
Event: time 1586629997.213112, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 101
Event: time 1586629997.213112, type 3 (EV_ABS), code 0 (ABS_X), value 101
Event: time 1586629997.213112, -------------- SYN_REPORT ------------
Event: time 1586629998.116942, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 918
Event: time 1586629998.116942, type 3 (EV_ABS), code 1 (ABS_Y), value 918
Event: time 1586629998.116942, -------------- SYN_REPORT ------------
Event: time 1586629998.140150, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 917
Event: time 1586629998.140150, type 3 (EV_ABS), code 1 (ABS_Y), value 917
Event: time 1586629998.140150, -------------- SYN_REPORT ------------
Event: time 1586629998.150524, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 2
Event: time 1586629998.150524, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value 327
Event: time 1586629998.150524, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 488
Event: time 1586629998.150524, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 971
Event: time 1586629998.150524, -------------- SYN_REPORT ------------
Event: time 1586629998.163315, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 0
Event: time 1586629998.163315, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 916
Event: time 1586629998.163315, type 3 (EV_ABS), code 1 (ABS_Y), value 916
Event: time 1586629998.163315, -------------- SYN_REPORT ------------
Event: time 1586629998.533589, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 100
Event: time 1586629998.533589, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 915
Event: time 1586629998.533589, type 3 (EV_ABS), code 0 (ABS_X), value 100
Event: time 1586629998.533589, type 3 (EV_ABS), code 1 (ABS_Y), value 915
Event: time 1586629998.533589, -------------- SYN_REPORT ------------
Event: time 1586629998.556781, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 99
Event: time 1586629998.556781, type 3 (EV_ABS), code 0 (ABS_X), value 99
Event: time 1586629998.556781, -------------- SYN_REPORT ------------
Event: time 1586629998.682800, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 2
Event: time 1586629998.682800, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 489
Event: time 1586629998.682800, -------------- SYN_REPORT ------------
Event: time 1586629998.705951, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 490
Event: time 1586629998.705951, -------------- SYN_REPORT ------------
Event: time 1586629998.729097, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 491
Event: time 1586629998.729097, -------------- SYN_REPORT ------------
Event: time 1586629998.752253, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 492
Event: time 1586629998.752253, -------------- SYN_REPORT ------------
Event: time 1586629998.775414, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 493
Event: time 1586629998.775414, -------------- SYN_REPORT ------------
Event: time 1586629998.914300, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 0
Event: time 1586629998.914300, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 98
Event: time 1586629998.914300, type 3 (EV_ABS), code 0 (ABS_X), value 98
Event: time 1586629998.914300, -------------- SYN_REPORT ------------
Event: time 1586629998.950194, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 97
Event: time 1586629998.950194, type 3 (EV_ABS), code 0 (ABS_X), value 97
Event: time 1586629998.950194, -------------- SYN_REPORT ------------
Event: time 1586629999.365919, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 2
Event: time 1586629999.365919, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1586629999.365919, -------------- SYN_REPORT ------------
Event: time 1586630000.001890, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 0
Event: time 1586630000.001890, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 96
Event: time 1586630000.001890, type 3 (EV_ABS), code 0 (ABS_X), value 96
Event: time 1586630000.001890, -------------- SYN_REPORT ------------
Event: time 1586630000.025030, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 95
Event: time 1586630000.025030, type 3 (EV_ABS), code 0 (ABS_X), value 95
Event: time 1586630000.025030, -------------- SYN_REPORT ------------
Event: time 1586630000.047927, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 94
Event: time 1586630000.047927, type 3 (EV_ABS), code 0 (ABS_X), value 94
Event: time 1586630000.047927, -------------- SYN_REPORT ------------
Event: time 1586630000.082840, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 1
Event: time 1586630000.082840, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1586630000.082840, -------------- SYN_REPORT ------------
Event: time 1586630000.637057, type 3 (EV_ABS), code 47 (ABS_MT_SLOT), value 0
Event: time 1586630000.637057, type 3 (EV_ABS), code 57 (ABS_MT_TRACKING_ID), value -1
Event: time 1586630000.637057, type 1 (EV_KEY), code 330 (BTN_TOUCH), value 0
Event: time 1586630000.637057, type 3 (EV_ABS), code 24 (ABS_PRESSURE), value 0
Event: time 1586630000.637057, -------------- SYN_REPORT ------------

Here is ts.conf file:

# Access plugins
################

# Uncomment if you wish to use the linux input layer event interface
module_raw input

# For other driver modules, see the ts.conf man page

# Filter plugins
################

# Uncomment if first or last samples are unreliable
# module skip nhead=1 ntail=1

# Uncomment if needed for devices that measure pressure
module pthres pmin=1

# Uncomment if needed
# module debounce drop_threshold=40

# Uncomment if needed to filter spikes
# module median depth=5

# Uncomment to enable smoothing of fraction N/D
# module iir N=6 D=10

# Uncomment if needed
# module lowpass factor=0.1 threshold=1

# Uncomment if needed to filter noise samples
module dejitter delta=100

# Uncomment to define threshold in number of events from device
# module evthres N=5

# Uncomment and adjust if you need to invert an axis or both
# module invert x0=800 y0=480

# Uncomment to use ts_calibrate's settings
module linear

Also running ts_verify I get this:

tslib 1.21 / libts ABI version 0 (0x000A03)
Release-Date: 2019-10-22

===================== test run 0 =====================
TEST ts_read_mt (blocking) 1       ......   PASS
TEST ts_read_mt (blocking) 5       ......   PASS
TEST ts_read_mt (nonblocking) 1    ......   PASS
TEST ts_read_mt (nonblocking) 5    ......   PASS
TEST ts_read    (blocking) 1       ......   PASS
TEST ts_read    (blocking) 5       ......   PASS
TEST ts_read    (nonblocking) 1    ......   PASS
TEST ts_read_raw_mt (blocking) 1   ......   PASS
TEST ts_read_raw_mt (blocking) 5   ......   PASS
TEST ts_read_raw_mt (nonblocking) 1......   PASS
TEST ts_read_raw_mt (nonblocking) 5......   PASS
TEST ts_read_raw(blocking) 1       ......   PASS
TEST ts_read_raw(blocking) 5       ......   PASS
TEST ts_read_raw(nonblocking) 1    ......   PASS
TEST ts_reconfig (1)               ......   PASS
TEST ts_load_module (4)            ......   PASS
======================================================
skip
===================== test run 1 =====================
TEST ts_read_mt (blocking) 1       ......   PASS
TEST ts_read_mt (blocking) 5       ......   FAIL

And can't continue...What could be the possible cause for this behaviour? If it could be helpful here is the C source for the driver https://github.com/JonnyMe/linux/blob/49a1bfe5661510b06368c2a148a3feb7eda989a0/drivers/input/touchscreen/himax_852xES.c .

Thank you!

JonnyMe commented 4 years ago

I'm sorry I messed up with some event report. Now it seems working, I will close soon after some testing,

Thank you!

JonnyMe commented 4 years ago

Closing, for the records I was not sending correctly ABS_MT_TOUCH_MAJOR and ABS_MT_WIDTH_MAJOR...also I was firing ABS_MT_PRESSURE with a fixed value (removed ABS_MT_PRESSURE part as device does not record pressure),

Thank you again