Posts by NewToLinux

    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.

    I originally tried the waveshare drivers because after reading here, that's what mine displayed as. However, I could never get it to work. I figured the device was simply displaying the wrong information even though it had 'eGalax' in the description.


    After much frustration, changing the PID in the waveshare driver and what not, I tried the 2 generic drivers, set the TOUCHSCREEN_NAME and noticed that the 'tslib to uinput daemon' was running when I did evtest. However, it was pointed to the wrong device(post #203) so I forced the device for testing purposes and the touchscreen worked! I then used your recommendation with the $ and all is good. Long story short, my touchscreen must not be a waveshare device. Got it from someone on eBay dealing straight from China, no documentation.


    Mod note: added hyperlink to post #93.

    i got it to finally work. For some reason my touchscreen lists 2 items. When I run evtest, this is what I get...

    Code
    No device specified, trying to scan all of /dev/input/event*
    Available devices:
    /dev/input/event0:    eGalax Inc. USB TouchController Pen
    /dev/input/event1:    eGalax Inc. USB TouchController
    /dev/input/event2:    tslib to uinput daemon
    Select the device event number [0-2]:

    I get touchscreen inputs only from /dev/input/event1. When I put the name from /dev/input/event1 into ts_env.sh as such...

    Code
     TOUCHSCREEN_NAME="eGalax Inc. USB TouchController"

    It didn't work. After a lot of experimenting, I saw this when I ran

    systemctl status service.touchscreen -l

    If you'll notice the second to last line, it's reading from /dev/input/event0, the wrong on. it was always picking up the previous input. I plugged in a bluetooth module which moved everything down but again, it was always off by the previous one. My guess is that there is something wrong with the comparison in the TSLIB_TSDEVICE= line in ts_env.sh.

    I got it to work by commenting out the line in ts_env.sh that tries to discover the device by name and added this line under it.

    Code
    TOUCHSCREEN_NAME="eGalax Inc. USB TouchController"
    
    # TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_NAME="$TOUCHSCREEN_NAME" '$0 ~ TS_NAME {print $1; exit}')
    TSLIB_TSDEVICE=/dev/input/event1

    I basically forced TSLIB_TSDEVICE for testing purposes and it worked. It's not a permanent fix because things move around depending what's plugged into the USB but at least it's a start.

    I changed the PID=0001 (waveshare driver) in ts_env.sh to get the touchscreen calibration addon working. But again, I'm not getting any input on the touchscreen itself to calibrate it. How can I tell if the service.touchscreen is running?

    My touchscreen doesn't work, not even the top left "small area", nothing at all.


    It's a resistive "waveshare" touchscreen (it shows up as "d-wav..."). It works in Raspbian but not in LibreELEC.


    I've downloaded and installed Libreelec(version 8.0.3) since it doesn't need complied anymore. Then I searched for the Touchscreen service (service.touchscreen-8.1.100.100) & System Tools addon and installed them. I've copied ts.conf-waveshare to ts.conf and ts_env.sh-waveshare to ts_env.sh. I'm not sure exactly what directory to put these, I put them in /storage/.kodi/userdata/addon_data/service.touchscreen. Through tweaking, I've even got the Touchscreen addon to display (not just the loading spinner) but I can't press the cross-hairs because there's no touchscreen inputs. Running evtest does give me output when I touch the screen.


    I believe the problem is the service.touchscreen isn't running...probably because it's error-ed off.
    Where are the logs to see why the daemon isn't running?


    Please help.