View Single Post
Old 01-20-2021, 07:45 PM   #29
Georgelemental
Junior Member
Georgelemental began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Oct 2019
Device: none
Quote:
Originally Posted by NiMa View Post
@Georgelemental : this might help:
Code:
#!/usr/bin/python3
import os

# Touch mapper for Xorg/XDOTool >> Kobos
file = open("evtest-log","r")
coordinates = file.read()
file.close()
# Prevent other exit status than 0 if evtest log file is empty
if len(coordinates) <= 10:
    exit()
else:
    c1 = coordinates.split("\n")

    # Mapping x
    for item in c1:
        if "ABS_MT_POSITION_X" in item:
            c2 = item.split(" ")
            c3 = c2[-1]
    x = c3
    print("registered native x " + x)

    # Mapping y
    for item in c1:
        if "ABS_MT_POSITION_Y" in item:
            c2 = item.split(" ")
            c3 = c2[-1]
    y = c3
    print("registered native y " + y)

    # Dividing for lower resolutions
    # Originally made for Kobo Libra -> 1680x1264 / 2 = 840x632
    x = float(x)
    y = float(y)
    # Nasty hack
    x2 = y
    y2 = x
    print("converted native x to %s" % x2)
    print("converted native y to %s" % y2)

    # Passing x + y to xdotool
    os.system("DISPLAY=:0 xdotool mousemove {0} {1}".format(x2, y2))
    # Clicking mouse button
    os.system("DISPLAY=:0 xdotool click 1")

    # Done! Emptying the file
    os.system("> evtest-log")
Put it in /mnt/user/root/.utils/ while KoBox is running to replace the old xorg-kobo-touch.py
and start it in normal portrait mode
The script almost fixes it. With normal portrait mode, mouse input is reflected across the center vertical axis from the display.
Georgelemental is offline   Reply With Quote