Touchscreen calibration on OSMC still fails

I have an egalax touchscreen connected to a raspberry pi running osmc alpha 4 and can’t get it calibrated.

In the top left corner it is nearly correct, but the further I move away the more the cursor deviates. This might be caused by the screen being recognized as 1280x720 while only being 1024x640. I was unable to change anything about that using the hdmi settings or tvservice

$ tvservice -s
state 0x12001a [HDMI CEA (4) RGB lim 16:9], 1280x720 @ 60.00Hz, progressive

kodi looks just right though, nothing is missing on the edges.

I installed ts_lib to create a pointercal file which works just fine using ts_test. Though the only way to get this file working in osmc seems to be using the uimapper python program, which slows down the machine to a degree not usable anymore. Furthermore it doesn’t seem properly calibrated either. But the delay between touching something and the arrow moving is so humongous, it’s hard to tell. I started the uimapper by creating a systemd service file as follows:

[Unit]
Description=uimapper
[Service]
Type=forking
ExecStart=/usr/local/bin/uimapper_startup
Restart=on-failure
TimeoutStopSec=1
[Install]
WantedBy=multi-user.target

as proposed here: OSMC Forums

Well, even if the script is running, and slowing down everything, the calibration is still off.

Also I’ve tried to add this to /usr/bin/kodi to get TSLIB working using SDL:

export LD_LIBRARY_PATH=/usr/local/lib
export TSLIB_CONSOLEDEVICE=none
export TSLIB_FBDEVICE=/dev/fb0
#NOTE: Change '/dev/input/event2', to find event# use 'ls -l /dev/input/by-id'
export TSLIB_TSDEVICE=/dev/input/event3
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/lib/ts
export SDL_MOUSEDRV=TSLIB
export SDL_MOUSEDEV=$TSLIB_TSDEVICE

as proposed here: SDL Development - ArmadeusWiki

Bottom line is, I have tried everything that has been proposed in any forum or tutorial I have found on the net and it just doesn’t work.

Something like what was proposed in the first post of the forum.osmc link would be perfect. Just transform the touchscreen coordinates using the calibration values from for instance ts_calibrate or something like that would be perfect.

Can it really be that hard to just get this done? I was full of hope after you stated:

"But we knew we could do even better. We started by listening to your
feedback and your wishes. We’ve improved the update system to make it
more dependable, we’ve made things a lot snappier and we’ve given you
heaps more features without compromising on stability."

I thought, surely they must have incorporated a touch screen calibration tool, or at least a half way decent way to get it done. I am failing to get it done though for multiple days. And the huge load of forum posts and tutorials all fail. Does anyone have any more ideas on how to solve this or is there any proper alternative for OSMC that has this trivial problem solved?

Kind regards
Max

I eventually got it to work based on this tutorial:

http://www.markamc.co.uk/raspberry-pi-2-osmc-egalax-touchscreen/

I think the other systemd service file made a difference…

I also got it to work by following that guide, but there was some extra work needed to get the offset right. After calibrating, the scaling was right (that is the pointer moves the same distance as my finger), but the offset was wrong (pointer was about 465 pixels to the right and 125 down from where I touched). Note that the pointer was more-or-less correct in ts_test but not in Kodi.

I’m using an 800x600 screen and I made sure that config.txt has

hdmi_group=2
hdmi_mode=9

So OSMC starts in the right resolution. I did all the calibration using ts_calibrate (via ts_calib.sh as provided in the guide) while the screen was in the right resolution. When I couldn’t get it to calibrate the offset properly I resorted to editing the /etc/pointercal directly using information from here. My /etc/pointercal file now looks like this

12923 -121 -30500000 -127 9709 -8200000 65536 800 600 0

I initially guessed the x/y offsets and multiplied them by the scale value (65536), then set those values for the offset positions in /etc/pointercal (3rd and 6th numbers) and tweaked them until they were right, stopping and restarting Kodi and the UI mapper each time like this:

sudo systemctl stop mediacenter
sudo systemctl stop uimapper.service
sudo systemctl start uimapper.service
sudo systemctl start mediacenter

Now my pointer is correct, but is still very laggy because of the UI Mapper.

Things I still need to do:

  • The pointer graphic is massively stretched horizontally. It looks like a big arrow pointing to the right rather than a small one pointing up. So I need to change this or hide it.
  • Figure out how to make clicks work. Currently double-tap selects and long-press means back.
  • Figure out how to add a ‘back’ button. This is for a kiosk for kids, nobody will figure out that long-press is back.

Any tips in the above appreciated.

I switched to the confluence skin, it has the back and a home button on the lower right. Furthermore for me a short push is left button and a long push is the right button, bringing up the context menu. (Not sure if this is skin specific, though) (You can change things in your /usr/share/kodi/keymaps/touchscreen.xml )
Also the pointer looks much nicer with the confluence skin. the long stretched arrow seems to be a problem of the OSMC skin. Also the lag is much better with the confluence skin. Furthermore scrolling works much better.

Long story short: Confluence Skin!

Kind regards
Max

One more note for other users of the Pollin eGalax Touchscreen.

I added this to my config.txt to force the proper resolution.

hdmi_force_hotplug=1
hdmi_cvt=1024 600 60 3 0 0 0

hdmi_group=2
hdmi_mode=87

As proposed here: http://christian-brauweiler.de/howto/carpc-rpi-und-7-zoll-touchscreen-update-2015

Another note:

If you configure things using a keyboard attached, the event number may change when no keyboard is connected. If you then change the input number in uimapper.service, you need to disable and reenable the service for the symlink to be in the right target directory.

Kind regards

Max

I realise it’s late, but, just in case…

It was never that laggy initially, but as the OS’s got more sophisticated, they got more hungry!! check out ‘ps aux’ to see the hogs!! |You can always change the ‘nice’ value as described here… http://markamc.traki-iski.co.uk/raspberry-pi-2-osmc-egalax-touchscreen/#comment-13786

hope it helps
cheers markamc

Will any of these methods work for the attached touchscreen?

https://www.chalk-elec.com/?page_id=1280#!/14-HDMI-interface-LCD-with-capacitive-touchscreen/p/36248806/category=3094861

Hi there,

I have been trying for long to get this touch screen working:
SiS_HID_Touch_Controller sys-subsystem-input-devices-USBest_Technology_SiS_HID_Touch_Controller.device loaded active plugged SiS_HID_Touch_Controller

The touch screen works with OSMC out of the box, but it only reacts to the input of the upper left quadrant. So it seems as if the resolution for the touch was incorrect.

I followed the instrcution to get the uimapper.service running carefully.

Find below the output of
ts_calib.sh
xres = 1920, yres = 1080
Took 1 samples…
Top left : X = 88 Y = 191
Took 1 samples…
Top right : X = 3967 Y = 207
Took 3 samples…
Bot right : X = 3993 Y = 3935
Took 1 samples…
Bot left : X = 120 Y = 3918
Took 1 samples…
Center : X = 2056 Y = 2018
7.298584 0.469566 -0.003636
2.348755 -0.001110 0.262889
Calibration constants: 478320 30773 -238 153928 -72 17228 65536

Can you please support me with that? Many thanks!

Is nobody able to help me out?

This thread is almost three years old, but anyways i found a solution (that worked for me).

OSMC 18.5 (november 2019)@Raspberry Pi 3 // egalax touchscreen 7’)

I installed the driver hosted by egalax: http://www.eeti.com.tw/drivers_Linux.html

I installed the armhf package following the guide via ssh and confirmed the already patched kernel question.

IT WAS NO CALIBRATION NEEDED. The only trouble i had was the strangely diagonal inverted touch response. Therefore I edited the /etc/eGTouchL.ini → direction=4.
I think this may also solve the upper left corner issue.

For me this did it and it’s working smoother than before with older osmc and modified version of xinput_calibrator.

Maybe you people could test and respond if it is working for you or not.

Hello. Is it possible to have the complete description of the driver installation ? Thank you.

Touch driver

Download this either to your regular pc, use 7zip to unpack it. Then you can read the guide pdf that comes with the driver.

Should work good, unless you are going to use a vero4k, since the mixed architecture wont play nice with the installer.

Thanks. I tried to install the driver but without success. That’s why I took over the old script. I have to try again this evening with your script, hoping that the installation does not hang on line 36 “start on (input-device-added SUBSYSTEM=input)” because I believe that the system does not recognize this command.