dakboard / Hardware-OS

DAKboard Wall Display, CPU, and Raspberry Pi
25 stars 4 forks source link

Apply Touchscreen Matrix when touchscreen is connected via USB #123

Closed cocarrig closed 2 months ago

cocarrig commented 9 months ago

Currently, the touchscreen matrix is applied to the touchscreen device on system startup, and when a sleep schedule wakes the attached display. Reports from clients have indicated that sometimes the usb touchscreen interfaces they use will disconnect and connect again outside of these conditions, and for any orientation besides landscape leave the display with the incorrect matrix.

This case has been created to investigate and build service that will complete the touchscreen routines normally completed on startup, when a touchscreen device is connected.

This event based system will need to be designed in a manner to resolve the following outstanding child cases: https://github.com/dakboard/Hardware-OS/issues/128 https://github.com/dakboard/Hardware-OS/issues/130 https://github.com/dakboard/Hardware-OS/issues/133 https://github.com/dakboard/Hardware-OS/issues/158 https://github.com/dakboard/Hardware-OS/issues/159

Dan-Peck commented 9 months ago

May / may not be helpful, INPUTDEVICES SECTION:

https://www.x.org/releases/current/doc/man/man5/xorg.conf.5.xhtml

Possibly a file like the following added into xorg.conf.d directory?

Section "InputClass"
    Identifier  "calibration"
    MatchProduct    "your product here"
    Option "TransformationMatrix" "1 0 0 0 1 0 0 0 1"
EndSection

However, it mentions for hotplugging, this may not be necessary in recent OS's that use HAL or udev backends to handle that. For that, maybe we need something added into /etc/udev/rules.d/99-touch-frame.rules, example:

ENV{ID_VENDOR_ID}=="aaec",ENV{ID_MODEL_ID}=="c021",ENV{WL_OUTPUT}="DVI1",ENV{LIBINPUT_CALIBRATION_MATRIX}="1.16346 0 -0.0769 0 1.046150 0 0 1"
cocarrig commented 2 months ago

Due to system impact on smaller Raspberry Pis to restart the chromium process during USB Touchscreen removal/assertion, this approach will be modified to leave the chromium process running now and only reapply the matrix

Dan-Peck commented 2 months ago

Adding a reminder in here to follow up in order to see if we have tried using that xorg.conf.d config file mentioned above. If we were able to successfully create a config file like that for a given touch device(s), either preconfigured or during Settings-saves, we might not have do do any of the monitoring, restarting, and reconfiguring at all, and let X11 take care of it for us.

jatoric commented 2 months ago

Released with 4_03 - merged