Trouble in porting tc1126/tcm1680/cn1100 ts driver, no btn_touch event?

Benjamin Tissoires benjamin.tissoires at gmail.com
Mon Dec 18 10:22:27 UTC 2017


Hi,

Foreword: I apologies if I am rude in the reply, there will be nothing
against you personally.

On Mon, Dec 18, 2017 at 9:43 AM, far5893 <far5893 at iperbole.bologna.it> wrote:
> I'm trying to port old 3.4 (Allwinner BSP) ts1126 driver to 4.14. manline
> kernel ,
> here git of effort
>
> https://github.com/miky2k/tc1126
>
> Driver is in file cn1100.c  and input reporting is in
> Report_Coordinate_Wait4_SingleTime function.
>
> it semmes partially working(see logs) but no mouse move or click under x11.
>
> here X log:
>
>
>> [    16.073] (II) config/udev: Adding input device tc1126_ts
>> (/dev/input/event2)
>> [    16.073] (**) tc1126_ts: Applying InputClass "evdev touchscreen
>> catchall"
>>
>> [    16.073] (II) Using input driver 'evdev' for 'tc1126_ts'
>> [    16.073] (**) tc1126_ts: always reports core events
>> [    16.073] (**) evdev: tc1126_ts: Device: "/dev/input/event2"
>> [    16.074] (--) evdev: tc1126_ts: Vendor 0 Product 0
>> [    16.074] (--) evdev: tc1126_ts: Found absolute axes
>> [    16.074] (--) evdev: tc1126_ts: Found absolute multitouch axes
>> [    16.074] (II) evdev: tc1126_ts: No buttons found, faking one.
>> [    16.074] (--) evdev: tc1126_ts: Found x and y absolute axes
>> [    16.074] (--) evdev: tc1126_ts: Found absolute touchscreen
>>
>> [    16.074] (II) evdev: tc1126_ts: Configuring as touchscreen
>> [    16.074] (**) evdev: tc1126_ts: YAxisMapping: buttons 4 and 5
>> [    16.074] (**) evdev: tc1126_ts: EmulateWheelButton: 4,
>> EmulateWheelInertia: 10, EmulateWheelTimeout: 200
>> [    16.074] (**) Option "config_info"
>> "udev:/sys/devices/virtual/input/input2/event2"
>> [    16.075] (II) XINPUT: Adding extended input device "tc1126_ts" (type:
>> TOUCHSCREEN, id 10)
>> [    16.075] (II) evdev: tc1126_ts: initialized for absolute axes.
>> [    16.076] (**) tc1126_ts: (accel) keeping acceleration scheme 1
>> [    16.076] (**) tc1126_ts: (accel) acceleration profile 0
>> [    16.076] (**) tc1126_ts: (accel) acceleration factor: 2.000
>> [    16.076] (**) tc1126_ts: (accel) acceleration threshold: 4
>> [    16.077] (II) config/udev: Adding input device tc1126_ts
>> (/dev/input/mouse0)
>> [    16.077] (II) No input driver specified, ignoring this device.
>> [    16.078] (II) This device may have been added with another device
>> file.
>
>
> and here evtest output:
>
>> Available devices:
>> /dev/input/event0:    1c22800.lradc
>> /dev/input/event1:    axp20x-pek
>> /dev/input/event2:    tc1126_ts
>> /dev/input/event3:      USB Keyboard
>> /dev/input/event4:      USB Keyboard
>> Select the device event number [0-4]: 2
>> Input driver version is 1.0.1
>> Input device ID: bus 0x18 vendor 0x0 product 0x0 version 0x0
>> Input device name: "tc1126_ts"
>> 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      0
>>       Min        0
>>       Max     1024
>>     Event code 1 (ABS_Y)
>>       Value      0
>>       Min        0
>>       Max      600
>>     Event code 47 (ABS_MT_SLOT)
>>       Value      0
>>       Min        0
>>       Max        0
>>     Event code 53 (ABS_MT_POSITION_X)
>>       Value      0
>>       Min        0
>>       Max     1024
>>     Event code 54 (ABS_MT_POSITION_Y)
>>       Value      0
>>       Min        0
>>       Max      600
>>     Event code 57 (ABS_MT_TRACKING_ID)
>>       Value      0
>>       Min        0
>>       Max       10
>> Properties:
>> Testing ... (interrupt to exit)
>> Event: time 1513351359.883920, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.883920, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.883920, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.883920, type 3 (EV_ABS), code 0 (ABS_X), value 851
>> Event: time 1513351359.883920, type 3 (EV_ABS), code 1 (ABS_Y), value 178
>> Event: time 1513351359.883920, -------------- SYN_REPORT ------------
>> Event: time 1513351359.902363, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.902363, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.902363, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.902363, -------------- SYN_REPORT ------------
>> Event: time 1513351359.920729, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.920729, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.920729, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.920729, -------------- SYN_REPORT ------------
>> Event: time 1513351359.939115, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.939115, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.939115, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.939115, -------------- SYN_REPORT ------------
>> Event: time 1513351359.957507, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.957507, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.957507, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.957507, -------------- SYN_REPORT ------------
>> Event: time 1513351359.975899, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.975899, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.975899, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.975899, -------------- SYN_REPORT ------------
>> Event: time 1513351359.994288, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351359.994288, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351359.994288, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351359.994288, -------------- SYN_REPORT ------------
>> Event: time 1513351360.012650, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351360.012650, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351360.012650, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351360.012650, -------------- SYN_REPORT ------------
>> Event: time 1513351360.031048, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351360.031048, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 851
>> Event: time 1513351360.031048, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 178
>> Event: time 1513351360.031048, -------------- SYN_REPORT ------------
>> Event: time 1513351364.740335, type 3 (EV_ABS), code 57
>> (ABS_MT_TRACKING_ID), value 0
>> Event: time 1513351364.740335, type 3 (EV_ABS), code 53
>> (ABS_MT_POSITION_X), value 837
>> Event: time 1513351364.740335, type 3 (EV_ABS), code 54
>> (ABS_MT_POSITION_Y), value 216
>> Event: time 1513351364.740335, type 3 (EV_ABS), code 0 (ABS_X), value 837
>> Event: time 1513351364.740335, type 3 (EV_ABS), code 1 (ABS_Y), value 216
>
>
>
> on /dev/input/mouse0 i read :
>
>> Device open OK
>> right-click to set absolute x,y coordinates origin (0,0)
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 129  ry=127
>> Absolute coords from TOP_LEFT= 130 -127
>> 18 81 7F 00 50 9B F8 B6 2C 01 00 00 00 00 00 00
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 129  ry=127
>> Absolute coords from TOP_LEFT= 259 -254
>> 18 81 7F 00 50 9B F8 B6 2C 01 00 00 00 00 00 00
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 129  ry=113
>> Absolute coords from TOP_LEFT= 388 -367
>> 18 81 71 00 50 9B F8 B6 2C 01 00 00 00 00 00 00
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 160  ry=0
>> Absolute coords from TOP_LEFT= 548 -367
>> 18 A0 00 00 50 9B F8 B6 2C 01 00 00 00 00 00 00
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 12  ry=239
>> Absolute coords from TOP_LEFT= 560 -606
>> 28 0C EF 00 50 9B F8 B6 2C 01 00 00 00 00 00 00
>> bLEFT:0, bMIDDLE: 0, bRIGHT: 0, rx: 6  ry=244
>> Absolute coords from TOP_LEFT= 566 -850
>
>
>
>
>
> I'm not a kernel developer so troubleshooting is quite  difficult for me
> (there is a lot of documentation),
> can someone give me a hit on what to check ?

There are so many things wrong in this driver that I really think it
should be rewritten from scratch based on the information you have
here.
Unfortunately, if you are not a kernel developer, things will tend to
be quite hard to implement.

In the out of order list of things that are simply wrong and tell me
that you should not continue on this code base:
- there is no license attached to this repo, nor to the one you forked
(seems to be https://github.com/xchetah/tc1126-sunxi), nor to the
original one (https://github.com/yangsong2512/TCMCode)
  -> this is plain wrong and tell me you shouldn't use this as a base
code as you have no idea what can legally happen next
- the driver is completely wrong: it says it's SPI but I see
everywhere that it is a I2C driver
- the driver obviously doesn't know how to use the Linux Multitouch
protocol (which explains why your device doesn't work). The slots are
not used, not even initialized and the single touch emulation that
libinput/Xorg expect simply can't work
- there is no git history shared between the 3 repos (yours, the one
you forked, the original), so you can not basically fix something in
one repo and fix it in the other ones
- the driver is not following the usual device model (it will  support
only one touchscreen), and the init process is just garbage (it
registers the device while in the init, where it should just register
the driver)
 -> actually this might not be entirely the case, but it's clear that
it was written until it worked and then people stopped touching it in
fear of breaking it
- full of commented out parts, we don't know if they have been
removed/written by mistake or not.

Anyway, my advice would be to turn over to the sunxi community (if
this is a touchscreen usually connected to AllWinner SoCs) and require
help from them. Maybe someone will help you there, but IMO, the effort
needed to have a working driver doesn't even match the price of the
device, so I'd just buy something new and supported.

Cheers,
Benjamin


More information about the Input-tools mailing list