Touchsupport

  • I think for starters I will make community builds with this feature and later we can move forward.
    I have only two special LVDS displays which are working ootb and for all others some manual config must be made.

  • A community build with tslib Integration and egalax / EETI support would be awsome! And a step by step tutorial to integrate 3rd party touchscreen drivers into the source files also.

  • Good news everyone

    I've build a community image of LibreELEC 7.0.1 for egalax touchscreens with "vpeter's" tslib approach.

    I've also build a LibreELEC 7.0.1 image for Faytech touchscreens with integrated 3rd party drivers.

    First of all, I'm not a developer I've just followed a few tutorials and was successfull

    you can download the LibreELEC 7.0.1 image with egalax support and tslib integration here

    you can download the LibreELEC 7.0.1 image with egalax support and tslib integration for Faytech touchscreens here
    -> it should work out of the box, if there is a calibration problem just go to programm section and start the calibration addon and touch the five crosses (do not plug in any keybord or other USB device before Kodi is loaded, except WiFi)

    For installation of non Faytech touchscreens follow this tutorial after the building process at the line with the beginning "Start a ssh session with your Pi2"

    here

  • Hi vpeter, I will try to describe every step from beginning:

    1.) First of all install Ubuntu Desktop LTS 16.04 beside Windows 7 for Cross-Compiling LibreELEC
          
    - Download and burn the Ubuntu Desktop LTS 16.04 Image -> download
    - Start from Ubuntu Desktop LTS 16.04 DVD in Live-Mode and open 'GParted' to downsize your Windows partition. For installing Ubuntu Desktop LTS 16.04 and Cross-
    Compiling LibreELEC we need ca. 50GB unused harddisk space.
    - Reboot, boot from Ubuntu Desktop LTS 16.04 DVD, Install Ubuntu.
    - When Ubuntu is successfully installed open a 'Terminal' to install the necessary building tools for Cross-Compiling LibreELEC:
           

    Code
    sudo apt update && sudo apt upgrade
    Code
    sudo apt-get install gcc make
    Code
    sudo apt-get install build-essential
    Code
    sudo apt-get install git
    Code
    sudo dpkg-reconfigure dash


    -> Select no, to install bash as the default
    -> Reboot


    2.) Preparing for Cross-Compiling:

    - Open a 'Terminal'

    Code
    git clone https://github.com/LibreELEC/LibreELEC.tv.git


    Now the source code files were copied to your home folder

    - Move into the source code directory

    Code
    cd ~/LibreELEC.tv

    - Choose the version (Branch/Tag) of LibreELEC to Cross-Compile

    Code
    git checkout 7.0.1


    -> The possible versions of LibreELEC you can checkout are available on Github --> here
    I chose the latest stable version 7.0.1


    3.) Cross-Compile a clean build to check possible errors:

    - The building process takes a few hours, depending on your hardware. With my hardware (quad core 4x4Ghz) ca. 2 hours.
    - The following command is for building an image for Raspberry Pi 2 & 3

    Code
    PROJECT=RPi2 ARCH=arm make image

    - After this Cross-Compiling process you should have a working LibreELEC 7.0.1 Image in the target folder -> /http://LibreELEC.tv/target
    - For a test you can unpack and install 'LibreELEC-RPi2.arm-7.0.1.img.gz' to your Rasberry Pi 2 or 3 SD-Card

    4.) In this step we intergate the 'tslib approach' from vpeter into LibreELEC to get egalax touchscreen support:

    - Download tslib --> here
    - Unzip the content and copy the tslib folder to http://LibreELEC.tv/packages
    - Now we have to edit the package.mk in http://LibreELEC.tv/packages/linux to integrate tslib into the building process

    -> Open the file http://LibreELEC.tv/packages/linux/package.mk

    - Change the line:

    Code
    PKG_DEPENDS_TARGET="toolchain cpio:host kmod:host pciutils xz:host wireless-regdb keyutils"

    to

    Code
    PKG_DEPENDS_TARGET="toolchain cpio:host kmod:host pciutils xz:host wireless-regdb keyutils tslib"


    -> Safe the file and exit

    5.) Changing kernel configuration (linux.arm.conf) to enable egalax touch support.

    - Open the file http://LibreELEC.tv/projects/RPi2/linux/linux.arm.conf
    - To enable egalax touchscreen support to your kernel you have to uncomment and set to yes the following lines:

    Code
    CONFIG_INPUT_TOUCHSCREEN=y
    CONFIG_TOUCHSCREEN_USB_COMPOSITE=y
    CONFIG_TOUCHSCREEN_USB_EGALAX=y
    CONFIG_TOUCHSCREEN_USB_GENERAL_TOUCH=y
    CONFIG_HID_MULTITOUCH=y


    -> Safe the file and exit


    6.) Cross-Compiling LibreELEC for Raspberry PI 2/3 with tslib integration and egalax touchscreen support from kernel:

    - Go to LibreELEC.tv folder and delete the 'target' folder from the test building process before.
    - Open a 'Terminal'

    Code
    sudo apt update && sudo apt upgrade
    Code
    cd ~/LibreELEC.tv
    Code
    PROJECT=RPi2 ARCH=arm make image

    -> This second Cross-Compiling process should just take ca 10-15 minutes
    -> Now you can find your image with egalax touchscreen support in the target folder --> http://LibreELEC.tv/target

    7.1) Configuring and calibrate LibreELEC/Kodi for egalax touchscreens (except Faytech touchscreens, this will described in 7.2)

    - Unpack & install your created image to your SD-Card. I've made a bundle of the needed tools for Windows ->download
    - Format your SD-Card with SDFormatter
    - Install your image with Win32DiskImager
    - Plug your SD-Card into your Raspberry PI
    -> Don't plug in anything else than your WiFi-USB-Device/LAN-Cable, keyboard and touchscreen.
    - Start your Raspberry PI and install LibreELEC, within the installation enable SSH-Support and configure your network connection
    - Checkout & remember the IP-Adress from your Raspberry PI (SYSTEM-->System info)
    - Shutdown your Raspberry PI and unplug the keyboard
    - Start Raspberry PI again


    - Start in Windows with putty a SSH-Sesion to your Raspberry PI

    ->SSH-Login: root / SSH-Password: libreelec
    - If you got a tochscreen e.g with 4:3 ratio and a resolution of 1024x768 we change first the resulution in config.txt
    (a list with more hdmi_groups & hdmi_modes you can find here )

    Code
    mount -o remount,rw /flash
    
    
    nano /flash/config.txt

    - copy the following lines at the end of config.txt

    Code
    hdmi_group=2
    hdmi_mode=16

    -> Exit with--> Ctrl+x
    -> Save with--> y
    -> Confirm with--> Enter

    Code
    mount -o remount,ro /flash
    
    
    reboot

    - Start a new SSH-Session and run the following commands:

    Code
    systemctl stop kodi
    
    
    cd /storage/.config/ts
    
    
    cp ts_env.sh-sample ts_env.sh
    
    
    cp ts.conf-generic ts.conf


    - Checkout the input/event number your touchscreen has got with 'evtest'

    Code
    evtest

    -> Choose each number and touch your screen to see if there is a output. If you get an output from your touchscreen remember the input/event number.
    -> Exit or cancel 'evtest' with--> Ctrl+c

    - Integrate the input/event number into the script 'ts_env.sh'

    Code
    sed -i 's|export TSLIB_TSDEVICE=.*|export TSLIB_TSDEVICE=/dev/input/event1|' ts_env.sh


    -> change the number from "event1" to your input/event number you have got from 'evtest'
    -> for example: sed -i 's|export TSLIB_TSDEVICE=.*|export TSLIB_TSDEVICE=/dev/input/event3|' ts_env.sh

    - Integrate the Frame Buffer Device into the script 'ts_env.sh'

    Code
    ls /dev/fb*


    -> remember the output Frame Buffer Device, for example: /dev/fb0

    Code
    sed -i 's|export TSLIB_FBDEVICE=.*|export TSLIB_FBDEVICE=/dev/fb0|g' /storage/.config/ts/ts_env.sh


    -> change the number from "/dev/fb0" to your Frame Buffer Device you have got from 'ls /dev/fb*'
    -> for example: sed -i 's|export TSLIB_FBDEVICE=.*|export TSLIB_FBDEVICE=/dev/fb3|g' /storage/.config/ts/ts_env.sh

    - Creating autostart.sh

    Code
    nano /storage/.config/autostart.sh

    copy the following lines:

    Bash
    #!/bin/sh
     (sleep 3; \
    . /usr/bin/ts_env.sh;
    ts_uinput_touch -x 1024 -y 768
     )&


    --> If you have set a different resolution before in 'config.txt' (hdmi_group & hdmi_mode) you have to use it here.

    -> Exit with--> Ctrl+x
    -> Save with--> y
    -> Confirm with--> Enter

    - Calibration

    Code
    . /usr/bin/ts_env.sh
    
    
    ts_uinput_touch -x 1024 -y 768


    -> If you have set a different resolution before in 'config.txt' (hdmi_group & hdmi_mode) you have to use it here.

    -> start with 'Putty' a second SSH-Session

    Code
    systemctl start kodi

    - Plug in your USB-Keyboard and navigate to: Programs-->Tslib/Kodi Touch Screen Calibration
    - Touch the five crosses, confirm with Enter
    - Shutdown your Raspberry PI & unplug your USB-Keyboard
    - Power on your Raspberry PI and your touchscreen should work


    7.2) Configuring and calibrate LibreELEC/Kodi for Faytech touchscreens

    (to be continued...)

    Edited once, last by Grruhn (June 19, 2016 at 3:58 PM).

  • There is no need of autostart.sh. Instead edit file /storage/.config/ts/ts_env.sh and uncomment and set TSLIB_RES_X and TSLIB_RES_Y. Everything else is done automatically.

    Also calibration should be done from Kodi itself with calibration addon. If for some reason it fails then running from console could help.

  • @ Grruhn,
    Thank you for the detailed write-up.
    Followed the steps, with a bit of tweaking, managed to setup for eGalax touchscreen successfully!! =)

    vpeter,
    Thank you. Have been following your guide since OpenElec..

  • @ Grruhn: also a big thank you from me! yesterday I compiled, today I installed Libreelec with Touchsupport on my Nuc's in the kitchen and in the bathroom - they are attached on egalax Touchscreens. everything went fine and now in every room is the same system like in the livingroom - no Kodibuntu anymore

  • _Jackson_ thats great to hear! Don't forget to thank vpeter, his work on the tslib approach and his great support to me made it possible for me to write this tutorial, in the past in openelec forum and nowerdays at this great LibreELEC project.

  • Hello,

    After a success on OE with this tslib method a few months ago, I tried it with LE.

    On the current LE master.

    There is an evtest conflict with an addon that I am not building, so I removed that extra package, keeping the one in tslib.

    I get through all the terminal motions and config without a problem.

    But when it comes to using the Program Addon for calibration... No addon is visible anywhere in Kodi.

    The calibration addon files are present in /usr/share/kodi/addons

    There is nothing about the addon in the kodi logs.

    Could it be an issue of addon incompatibility with Kodi 17?


    I can provide any requested testing and data!

    Thanks!

    Nico
    2015072201-Multimedia-Setup.pdf