Touchsupport

  • ts_env.sh doesnt have a line like that though... Should I just add it?

    EDIT: Found it, will report in a few minutes.

    EDIT 2: Success! Thanks a lot for your help! Do you happen to know how to hide the cursor as well? ;) Also, multitouch gestures dont seem to work, is that a skin thing?

    Edited 2 times, last by Zimeic (September 19, 2017 at 6:03 PM).

  • Do you happen to know how to hide the cursor as well?

    In file ts_env.sh (where you changed TOUCHSCREEN_NAME) at the end of file try adding

    Code
    export TSLIB_TOUCH_HOME_TIME=200

    Then cursor should disappear after 200 milliseconds. After reboot of course :)

  • Touchscreen tweak...

    I got everything working but I was disappointed with my resistive touchscreen in LibreElec. Often, even though the item I pressed actually selected (turned blue), it didn't seem to register. This was especially apparent when using the virtual keyboard, about half of what I typed was not registering. I often had to press buttons a few times until they registered. My touchscreen was calibrated and the skin was Estouchy.

    After some careful observation, I noticed what was happening. When releasing my finger from the touchscreen, the pointer would often move slightly. And if the pointer moved too much, LibreElec treated this as a "drag" event rather than a "leftclick" event and would not register the press. It helped if I quickly released my finger from the screen and at a right-angle to the screen.

    My solution is to remap the "mousedragend" event as a "leftclick" event. As long as you release your finger from the screen while still on the button you were trying to press, it would treat it as a “leftclick”. I also made a long press act as a "rightclick", this was useful when bouncing between skins to change settings. My touchscreen now works great after the remap.

    To remap, create a new file by typing the following in the terminal.

    Code
    nano ~/.kodi/userdata/keymaps/keyboard.xml

    Then paste the text below into the file, save then reboot.

    Code
    <keymap>
      <global>
        <mouse>
          <mousedragend>leftclick</mousedragend>
          <longclick id="0">rightclick</longclick>
        </mouse>
      </global>
    </keymap>

    I assume the correct fix would be to increase distance in the drag event in LibreElec, adjust it so that you have to move the pointer further to start the drag event. As it is now, it's very sensitive...just a few pixels off of the initial press coordinates and the drag event is fired.

    My concern with this is that I don’t know if changing the keyboard's drag-n-drop mapping effects LibreElec anywhere else adversely. I can still scroll items, move sliders (volume control), etc. I haven't found a problem yet but it would be if LibreElec or an addon uses the drag-n-drop feature.

  • Some things can be changed in file ts.conf with adjusting values for different modules. Default values are

    Code
    module pthres pmin=1
    module variance delta=30
    module dejitter delta=100
  • In file ts_env.sh (where you changed TOUCHSCREEN_NAME) at the end of file try adding

    Code
    export TSLIB_TOUCH_HOME_TIME=200

    Then cursor should disappear after 200 milliseconds. After reboot of course :)

    Perfect :) On the wiki, there are some default touch gestures described, but i cant use anything besides a simple left click, does multitouch need extra settings?

  • Multitouch is not supported in this addon. Only basic click. So forget on gestures :)

    Seems no one knows that Kodi itself supports touchscreens and calibration. But calibration must be done by hand in some file. Obviously this doesn't belong in this thread on this forum.

  • To invert axes you need to set in file ts.conf

    Code
    module linear swap_xy=1

    instead of just

    Code
    module linear

    Result of calibration is file /storage/.kodi/userdata/addon_data/service.touchscreen/pointercal.

  • Is the pointercal file the same file like from x_input_calibration?

    I dont want to swap axes. I need to invert only the x axe. When I move up, the cursor goes down. The y-axe is fine.

  • Is the pointercal file the same file like from x_input_calibration?

    No - this has nothing to do with x_input_calibration.

    I dont want to swap axes. I need to invert only the x axe. When I move up, the cursor goes down. The y-axe is fine.

    Ah, I misread. I don't think there is such option in tslib. But would be easy to add it to linear module.

  • What is need to do to add to the linear module?

    Can you post the content of the pointercal?

    Is the content like?

    Code
     calib_x_d=-21;calib_x_fact=0.658097686;calib_y_d=-50;calib_y_fact=0.408626561;swap_axes=0;click_confines=8
  • I think I will try to compile it by myself. Can you tell me what sources to change in tslib?

    Libreelec uses framebuffer or?

    Why in there are sources from xorg in the sources?

    Edited once, last by hevilp (November 28, 2017 at 12:25 PM).

  • Hello,

    Thanks for all the information here, so I could almost completely put my 5 "Waveshare touch display into operation.

    I document what I had to do to make it work:

    In the config.txt I have these entries for the display:

    Code
    hdmi_force_hotplug = 1
    max_usb_current = 1
    hdmi_group = 2
    hdmi_mode = 87
    hdmi_cvt = 800 480 60 6 0 0 0
    
    dtparam = spi = on
    dtparam = i2c_arm = on
    dtoverlay = ADS7846, penirq = 25, speed = 10000, keep_vref_on = 0, penirq_pull = 2, xohms = 150

    In the ts_env.sh

    Code
    TOUCHSCREEN_NAME = "ADS7846 Touchscreen"

    The ts.conf is copied from the ts.conf-waveshare.

    However, I have a problem with the calibration: In the calibration screen I do not come with the pointer to the measuring point, because there is an offset about half the diagonal of the display.

    The calibration screen shows: Resolution 800x480 skin 1280x720

    tvservice -s

    provides

    Code
    state 0x120006 [DVI DMT (87) RGB full 15: 9], 800x480 @ 59.00Hz, progressive

    I can move the mouse pointer, but I can not reach the point.

    I suspect that the sizing of the display in the settings must be adjusted, but does not know where.

    The same is mentioned here: XPT2046 Touch Screen instructions for Raspbery Pi 3 - Page 2 - Raspberry Pi Forums

    Thanks for any help

    Henry