Touchscreen events integration with X11?

custom_board

#1

Hi,

Kernel: 4.14.53
Rootfs: #225

DSI panel driver & dsi node entry in device tree allowing me to get display on LCD screen.
Touchscreen controller driver is up. I have added debug logs to print x & y axis pixel value every time for finger touch.

xinput list-out Capacitive touchscreen device in Virtual core pointer.
xinput list-props Capacitive touchscreen properly with device node.
evtest also working and detecting finger touch & swipe.

Question:
1-> Why touchscreen getting identified as “evdev tablet catchall” & Xinput identifying touchscreen device as type:MOUSE?

2-> Created xorg.conf, i have disable Section Inputclass tablet & touchscreen in 10-evdev.conf. i’m getting following logs but Still display works fine and touchscreen doesn’t interface with X.

[    21.383] (II) config/udev: Adding input device Capacitive Touchscreenn
 (/dev/input/event0)
[    21.383] (II) No input driver specified, ignoring this device.
[    21.383] (II) This device may have been added with another device file.

How to go ahead?


#2

Why do you think your touchscreen is getting identified as "evdev tablet catchall”? It looks to me like it is getting identified as “Capacitive Touchscreenn”.

“evdev tablet catchall”, that is just the name of the InputClass rule that bridges udev information into the X server. Ideally you would fix the udev rules.

Try:

It shows both how to construct a suitable InputClass for a “Capacitive Touchscreenn” and shows how to debug udev rules (if you don’t fix the udev rules you’ll just hit this problem again when/if you update to wayland).


#3

I have followed the guide but still i’m struck.

In /lib/udev/rules.d/60-persistent-input.rules, I have added following rule which make sure it detect touchscreen but xserver evdev driver configuring device as mouse.

KERNEL=="event*", ATTRS{name}=="*Capacitive*", ENV{.INPUT_CLASS}="touchscreen", ENV{ID_INPUT_TOUCHSCREEN}="1", ENV{ID_INPUT_TABLET}="", SYMLINK+="input/event0"

evtest output:
>
> 820:~# evtest
> No device specified, trying to scan all of /dev/input/event*
> Available devices:
> /dev/input/event0: Capacitive Touchscreen
> /dev/input/event1: pm8941_pwrkey
> /dev/input/event2: pm8941_pwrkey
> /dev/input/event3: gpio_keys
> /dev/input/event4: Logitech USB Receiver
> /dev/input/event5: Logitech USB Receiver
> Select the device event number [0-5]: 0
> Input driver version is 1.0.1
> Input device ID: bus 0x18 vendor 0x416 product 0x23bb version 0x28bb
> Input device name: “Capacitive Touchscreen”
> Supported events:
> Event type 0 (EV_SYN)
> Event type 1 (EV_KEY)
> Event code 330 (BTN_TOUCH)
> Event code 331 (BTN_STYLUS)
> Event code 332 (BTN_STYLUS2)
> Event type 3 (EV_ABS)
> Event code 47 (ABS_MT_SLOT)
> Value 0
> Min 0
> Max 15
> Event code 48 (ABS_MT_TOUCH_MAJOR)
> Value 0
> Min 0
> Max 1024
> Event code 53 (ABS_MT_POSITION_X)
> Value 0
> Min 0
> Max 479
> Event code 54 (ABS_MT_POSITION_Y)
> Value 0
> Min 0
> Max 853
> Event code 55 (ABS_MT_TOOL_TYPE)
> Value 0
> Min 0
> Max 2
> Event code 57 (ABS_MT_TRACKING_ID)
> Value 0
> Min 0
> Max 5
> Event code 58 (ABS_MT_PRESSURE)
> Value 0
> Min 0
> Max 1024
> Properties:
> Property type 1 (INPUT_PROP_DIRECT)
> Testing … (interrupt to exit)
> Event: time 1548227606.134406, type 3 (EV_ABS), code 53 (ABS_MT_POSITION_X), value 253
> Event: time 1548227606.134406, type 3 (EV_ABS), code 54 (ABS_MT_POSITION_Y), value 609

in /var/log/Xorg.0.log

[    22.258] (II) config/udev: Adding input device Capacitive Touchscreen(/dev/input/event0)
[    22.258] () Capacitive Touchscreen: Applying InputClass "evdev touchscreen catchall"
[    22.258] (II) Using input driver 'evdev' for 'Capacitive Touchscreen'
[    22.258] () Capacitive Touchscreen: always reports core events
[    22.258] () evdev: Capacitive Touchscreen: Device: "/dev/input/event0"
[    22.258] (--) evdev: Capacitive Touchscreen: Vendor 0x416 Product 0x23bb
[    22.258] (--) evdev: Capacitive Touchscreen: Found absolute axes
[    22.259] (--) evdev: Capacitive Touchscreen: Found absolute multitouch axes
[    22.259] (II) evdev: Capacitive Touchscreen: No buttons found, faking one.
**[    22.259] (II) evdev: Capacitive Touchscreen: Forcing relative x/y axes to exist.** 
**[    22.259] (II) evdev: Capacitive Touchscreen: Configuring as mouse**
[    22.259] () evdev: Capacitive Touchscreen: YAxisMapping: buttons 4 and 5
[    22.259] () evdev: Capacitive Touchscreen: EmulateWheelButton: 4, EmulateWheelInertia: 10, EmulateWheelTimeout: 200
[    22.259] () Option "config_info" "udev:/sys/devices/virtual/input/input0/event0"
[    22.259] (II) XINPUT: Adding extended input device "Capacitive Touchscreen" (type: MOUSE, id 11)
[    22.259] (II) evdev: Capacitive Touchscreen: initialized for relative axes.
[    22.259] (WW) evdev: Capacitive Touchscreen: ignoring absolute axes.
[    22.259] () Capacitive Touchscreen: (accel) keeping acceleration scheme 1
[    22.259] () Capacitive Touchscreen: (accel) acceleration profile 0
[    22.259] () Capacitive Touchscreen: (accel) acceleration factor: 2.000
[    22.259] () Capacitive Touchscreen: (accel) acceleration threshold: 4

touchscreen driver is ported from android.

Xserver evdev driver


#4

I have followed the guide but still i’m struck.

Perhaps it is quibbling but after re-reading you’re not still stuck! You have made some big steps forward and you are now stuck someplace new :wink: .

evtest output:

I guess you don’t have a touchscreen laptop? I think the missing clues can be found in the evtest output from a working touchscreen…

Input driver version is 1.0.1
Input device ID: bus 0x18 vendor 0x6cb product 0x1786 version 0x100
Input device name: "SYNA7813:00 06CB:1786"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 330 (BTN_TOUCH)
  Event type 3 (EV_ABS)
    Event code 0 (ABS_X)
      Value   1783
      Min        0
      Max     3860
      Resolution      12
    Event code 1 (ABS_Y)
      Value   1333
      Min        0
      Max     2180
      Resolution      13
    Event code 47 (ABS_MT_SLOT)
      Value      0
      Min        0
      Max        9
    Event code 53 (ABS_MT_POSITION_X)
      Value      0
      Min        0
      Max     3860
      Resolution      12
    Event code 54 (ABS_MT_POSITION_Y)
      Value      0
      Min        0
      Max     2180
      Resolution      13
    Event code 57 (ABS_MT_TRACKING_ID)
      Value      0
      Min        0
      Max    65535
  Event type 4 (EV_MSC)
    Event code 5 (MSC_TIMESTAMP)
Properties:
  Property type 1 (INPUT_PROP_DIRECT)
Testing ... (interrupt to exit)

Note the ABS_X and ABS_Y event codes are present… and that you can see in EvdevProbe() that these events are mandatory if the device is to recognised as a touchscreen.


#5

Hi @danielt,

Yes its true that ABS_X and ABS_Y is needed but in my case touchscreen driver doesn’t have ABS_X and ABS_Y rather it has ABS_MT_POSITION_X and ABS_MT_POSITION_Y.

Mainline driver: https://github.com/torvalds/linux/blob/master/drivers/input/touchscreen/goodix.c

I’m using goodix touchscreen and above driver is tested for another platform so i ported 820 android driver.

Regards,
parbatha


#6

Ah… yes… the development of the evdev driver was stopped some time ago and all the focus now is on the libinput driver. That is probably why it doesn’t have support for the “new” multi-touch protocol.

Try undoing the udev change you made and installing xorg-server-input-libinput instead. There is a command similar to evtest called libinput that allows you to check that libinput has recognised the touch-screen in a sane way.


#7

Hi @danielt

Thanks for your help.

I have modified my driver to add ABS_X and ABS_Y. Set abs x & y parameter value similar to ABS_MT_POSITION_X & Y.

Now my touchscreen works fine. I was able to run xinput_calibration and got proper calibration values. Finger touch events works fine.

Try undoing the udev change you made and installing xorg-server-input-libinput instead. There is a command similar to evtest called libinput that allows you to check that libinput has recognised the touch-screen in a sane way.

I will give it a try. will update how it goes.