libts / tslib

Touchscreen access library
GNU Lesser General Public License v2.1
625 stars 292 forks source link

USB touchscreen controller replug brokes ts_test #208

Open mosolovsa opened 1 year ago

mosolovsa commented 1 year ago

Hi! Thanks for maintaining such complex and demanded project!

I'm not sure if that's a right place to ask questions, so excuse me if it's not.

I have ARM embedded Linux board with USB touchscreen controller. It's required to run single Qt app with tslib and linuxfb plugin (without X-Server or anything similar).

To test the touchscreen I use ts_test app.

  1. Identify chardev major and minor, then create file for that chardev (I assume that file can be used by tslib (and it's so) and have constant filesystem path)
    
    # cat /proc/bus/input/devices 
    ...
    I: Bus=0003 Vendor=14c8 Product=0005 Version=0101
    N: Name="Zytronic Displays Limited Zytronic Touchscreen Controller Touchscreen"
    P: Phys=usb-1c1c400.usb-1/input0
    S: Sysfs=/devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0001/input/input1
    U: Uniq=
    H: Handlers=event1 
    B: PROP=0
    B: EV=1b
    B: KEY=420 0 0 0 0 0 0 0 0 0 0
    B: ABS=100 3
    B: MSC=10

cat /sys/devices/platform/soc/1c1c400.usb/usb5/5-1/5-1:1.0/0003:14C8:0005.0001/input/input1/event1/dev

13:65

mknod /dev/uinput c 13 65


Then run ts_test with:

TSLIB_TSDEVICE=/dev/uinput ts_test



The problem is when USB repluged - ts_test app stop receiving input from touchscreen controller. If I restart ts_test with the same command from shell - it's working like a charm up to next replug.

Is there any possibility to handle USB replug by some hack?  E.g. handle replug by udev event or something similar? Main showstopper is that I can't just restart Qt app because of complex state, that can't be serialized with ease, I have same behavior in Qt app - on USB replug Qt app stops receiving touchscreen input and all is fine if Qt app is restarted.

There is related issue:
https://github.com/libts/tslib/issues/52
That's somehow resolved by commit:
https://github.com/libts/tslib/commit/5bfde872914321f428e3d3404d1ce34f994f035a
I couldn't understand how that can help me with this case.

Is there any possibility to make things work without restarting the app on replug?