Kodi Community Forum

Full Version: fix tslib integration
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9
Don't use -d because I want to see the output when you touch the screen (4 points top/left, top/right, bottom/right, bottom/left).
Ok. I didn't realize there would be output... Here we go. I touched the four corners (top left, top right, bottom right, bottom left):

Code:
root@raspberrypi:~# ts_uinput_touch

ts_uinput_touch environment variables:
       TSLIB_TSDEVICE: '/dev/input/event1'
      TSLIB_PLUGINDIR: '/usr/local/lib/ts'
  TSLIB_CONSOLEDEVICE: 'none'
       TSLIB_FBDEVICE: '/dev/fb0'
      TSLIB_CALIBFILE: '/etc/pointercal'
       TSLIB_CONFFILE: '/etc/ts/ts.conf'
          TSLIB_RES_X: '(null)'
          TSLIB_RES_Y: '(null)'
TSLIB_TOUCH_HOME_TIME: '(null)'

using fb device: /dev/fb0
resolution: 1024x768
using touch device: /dev/input/event1
1450004240.311966:    -17    -38    255  touched
1450004240.359943:    -17    -38    255  touched
1450004240.383956:    -17    -38    255  touched
1450004240.407953:    -17    -38    255  touched
1450004240.423961:    -17    -38    255  touched
1450004240.495964:    -17    -38    255  touched
1450004240.527965:    -17    -38      0  released
1450004242.360191:    -17    -38    255  touched
1450004242.424192:    -17    -38    255  touched
1450004242.448196:    -17    -38    255  touched
1450004242.472196:    -17    -38    255  touched
1450004242.480198:    -17    -38      0  released
1450004243.520348:    -17    -38    255  touched
1450004243.584341:    -17    -38    255  touched
1450004243.608349:    -17    -38    255  touched
1450004243.632353:    -17    -38    255  touched
1450004243.656353:    -17    -38    255  touched
1450004243.672355:    -17    -38    255  touched
1450004243.696359:    -17    -38    255  touched
1450004243.704369:    -17    -38      0  released
1450004245.000534:    -17    -38    255  touched
1450004245.064523:    -17    -38    255  touched
1450004245.112533:    -17    -38    255  touched
1450004245.160537:    -17    -38      0  released
Since those values didn't look too good, I changed ts.conf back to using module_raw input instead of module_raw galax grab_events=1. Here's the output:

Code:
root@raspberrypi:~# ts_uinput_touch

ts_uinput_touch environment variables:
       TSLIB_TSDEVICE: '/dev/input/event1'
      TSLIB_PLUGINDIR: '/usr/local/lib/ts'
  TSLIB_CONSOLEDEVICE: 'none'
       TSLIB_FBDEVICE: '/dev/fb0'
      TSLIB_CALIBFILE: '/etc/pointercal'
       TSLIB_CONFFILE: '/etc/ts/ts.conf'
          TSLIB_RES_X: '(null)'
          TSLIB_RES_Y: '(null)'
TSLIB_TOUCH_HOME_TIME: '(null)'

using fb device: /dev/fb0
resolution: 1024x768
using touch device: /dev/input/event1
1450004551.023593:     44     35    255  touched
1450004551.087582:     43     35    255  touched
1450004551.135593:     43     36    255  touched
1450004551.159593:     43     36    255  touched
1450004551.175593:     42     36    255  touched
1450004551.183593:     42     36      0  released
1450004552.831805:    978     40    255  touched
1450004552.871796:    978     40    255  touched
1450004552.895804:    977     40    255  touched
1450004552.919808:    977     40    255  touched
1450004552.943807:    977     40    255  touched
1450004552.991810:    976     40      0  released
1450004553.991943:    996    739    255  touched
1450004554.039937:    996    739    255  touched
1450004554.063947:    996    740    255  touched
1450004554.079946:    996    740    255  touched
1450004554.103948:    996    740    255  touched
1450004554.127954:    995    741    255  touched
1450004554.183959:    995    741      0  released
1450004555.152077:     42    727    255  touched
1450004555.192069:     42    727    255  touched
1450004555.216079:     42    727    255  touched
1450004555.240079:     42    727    255  touched
1450004555.264081:     42    728    255  touched
1450004555.288085:     42    728    255  touched
1450004555.312085:     42    729      0  released

To me, this looks good. Then when I run kodi (with daemon running), the touch screen is not calibrated (even tough I successfully ran ts_calibrate beforehand). When I run the calibration plugin and try to touch the crosshairs, the pointer appears (offset), but the touch is not detected by the calibration software.
Ok, the second output is good.
Stop kodi and start ts_uinput_touch as before in one console. Then start kodi in another console. Start calibration addon and show me the output from ts_uinput_touch.
Code:
root@raspberrypi:/home/pi# ts_uinput_touch

ts_uinput_touch environment variables:
       TSLIB_TSDEVICE: '/dev/input/event1'
      TSLIB_PLUGINDIR: '/usr/local/lib/ts'
  TSLIB_CONSOLEDEVICE: 'none'
       TSLIB_FBDEVICE: '/dev/fb0'
      TSLIB_CALIBFILE: '/etc/pointercal'
       TSLIB_CONFFILE: '/etc/ts/ts.conf'
          TSLIB_RES_X: '(null)'
          TSLIB_RES_Y: '(null)'
TSLIB_TOUCH_HOME_TIME: '(null)'

using fb device: /dev/fb0
resolution: 1024x768
using touch device: /dev/input/event1
signal handler 10, current calibration_mode=1
5216.005216: 1191708 1191708 1191708  touched
calibration mode started
trying to connect
connected
getting sample for: Top left
signal handler 12, current calibration_mode=0
Top left: X =    4 Y =    3
calibration mode finished, reload plugins

the output stops at "getting sample for: Top Left". Then I touch, but nothing happens. I exit the plugin and get the rest of the output.
Then I don't know what could be wrong.

Are you using grab_events=1 with module_raw input? If not try with this.
grab_events=1 did the trick! Thank you!

Now the touchscreen works, and the calibration plugin, too.

Smile
Excellent! So this is confirmation that this small piece of sw can be used on generic distro as well.
Well done!
Hi all.
I'm trying to get Kodi touch functionality working here on a recent Raspbian with a RPi zero and a 5" 800x480 HDMI touch screen. Is there now official support in Kodi for touch screens? I am running version 15.2. Can I simple use a PPA or do I still need to do the ts_uinput_touch workaround?
If I need the workaround:
- Is there a way to compile ts_uinput_touch WITHOUT compiling the whole forked tslib? Couldn't ts_uinput_touch be included into the official repo btw?
- Where is ts.conf read from? /etc/ts.conf (that's where I find it with the default tslib) or /usr/local/share/ts.conf?
- What would be the proper way to start ts_uintput_touch BEFORE Kodi? I start kodi by editing /etc/default/kodi and setting Enabled=1...

Any info appreciated.
Kodi Jarvis (v17) has touchscreen support. To calibrate screen (if required) you need to wrote one config file.
1) You need to compile something. ts_uinput_touch is a daemon which needs tslib library. And what is wrong with a fork? To include changes in official repo you must ask original tslib maintainer. I ask and there was no response. So I assume there is no interest to do that.
2) From TSLIB_CONFFILE environment variable if set. If not from /etc/ts.conf.
3) Depends on your distro. No idea about Raspbian (don't have rpi). Maybe with some service which is started before kodi.
Thanks for your info.
(2016-06-15, 12:11)ultraman Wrote: [ -> ]Kodi Jarvis (v17) has touchscreen support. To calibrate screen (if required) you need to wrote one config file.
So with Kodi v17+ I need to do NOTHING else than adding those settings to advancedsettings.xml? If so I guess I'll wait for v17 to come out...
(2016-06-15, 12:11)ultraman Wrote: [ -> ]1) You need to compile something. ts_uinput_touch is a daemon which needs tslib library. And what is wrong with a fork? To include changes in official repo you must ask original tslib maintainer. I ask and there was no response. So I assume there is no interest to do that.
No offense to you and thanks for your work, but I don't like to use a forked library when I can use the official ones. It simply very often brakes other stuff or makes problem when upgrading... Sad that the maintainer isn't respondig! :/
Is it enough to compile ts_uinput_touch standalone with my currently installed tslib (as in "g++ ts_uinput_touch") or does it rely on any special functionality you built into your tslib fork?
(2016-06-15, 12:11)ultraman Wrote: [ -> ]2) From TSLIB_CONFFILE environment variable if set. If not from /etc/ts.conf.
Thanks.
(2016-06-15, 12:11)ultraman Wrote: [ -> ]3) Depends on your distro. No idea about Raspbian (don't have rpi). Maybe with some service which is started before kodi.
Raspbian Jessie is essentially Debian Jessie if that helps...
(2016-06-15, 18:36)bim_overbohm Wrote: [ -> ]So with Kodi v17+ I need to do NOTHING else than adding those settings to advancedsettings.xml? If so I guess I'll wait for v17 to come out...
This is how I understand. Didn't check because seems there is no calibration addon for this and also no way of getting current touch coordinates to write addon myself.

(2016-06-15, 18:36)bim_overbohm Wrote: [ -> ]No offense to you and thanks for your work, but I don't like to use a forked library when I can use the official ones. It simply very often brakes other stuff or makes problem when upgrading... Sad that the maintainer isn't respondig! :/
Is it enough to compile ts_uinput_touch standalone with my currently installed tslib (as in "g++ ts_uinput_touch") or does it rely on any special functionality you built into your tslib fork?
No offense taken. I did this daemon for myself and also I'm sharing it. If someone see it usable it can use it.
You can compile tslib as static without any shared library. Which means ts_uinput_touch can be static binary without interfering with system installed one.

(2016-06-15, 18:36)bim_overbohm Wrote: [ -> ]Raspbian Jessie is essentially Debian Jessie if that helps...
Sadly I don't use any other distro than LibreELEC.
Quote:No offense taken. I did this daemon for myself and also I'm sharing it. If someone see it usable it can use it.
You can compile tslib as static without any shared library. Which means ts_uinput_touch can be static binary without interfering with system installed one.
Good idea! Will try that when I find time.
I have now tried OSMC with Kodi 17 (HOW-TO) and the touchscreen works with advancedsettings.xml. There's a write-up of the process here.

I still have a slight problem though. Tapping / "Clicking" works well with a stylus, but not with a finger. Is there any way to tune some values to make it work? Also Kodi seems to need a double-click to activate buttons. This makes not much sense with a touchscreen. Is there an option for that somewhere?
This can be done by editing mouse.xml. I updated the blog entry accordingly.
I am sitting 2 days a 10 hours on the Raspberry with Rasbian and Kodi to get working the Touche function for Saint Smart 9" with eGalax USB Touch controller.


On the X Server the Touche works correct and i can calibrate it ( i did it, before it was also not working / the position of the finger with the cursor never matched)

I did all like on the first side here and the result is always this:

pi@rasp:~ $ sudo su
root@rasp:/home/pi# export LD_LIBRARY_PATH=/usr/local/lib
root@rasp:/home/pi# export TSLIB_TSDEVICE=/dev/by-id/usb-eGalax_Inc._USB_TouchController-ev$
root@rasp:/home/pi# export TSLIB_PLUGINDIR=/usr/lib/ts
root@rasp:/home/pi# export TSLIB_CONSOLEDEVICE=none
root@rasp:/home/pi# export TSLIB_FBDEVICE=/dev/fb0
root@rasp:/home/pi# export TSLIB_CALIBFILE=/etc/ts/pointercal
root@rasp:/home/pi# export TSLIB_CONFFILE=/etc/ts.conf
root@rasp:/home/pi# ts_uinput_touch -d
ts_uinput_touch environment variables:
TSLIB_TSDEVICE: '/dev/by-id/usb-eGalax_Inc._USB_TouchController-event-if00'
TSLIB_PLUGINDIR: '/usr/lib/ts'
TSLIB_CONSOLEDEVICE: 'none'
TSLIB_FBDEVICE: '/dev/fb0'
TSLIB_CALIBFILE: '/etc/ts/pointercal'
TSLIB_CONFFILE: '/etc/ts.conf'
TSLIB_RES_X: '(null)'
TSLIB_RES_Y: '(null)'
TSLIB_TOUCH_HOME_TIME: '(null)'

using fb device: /dev/fb0
resolution: 1280x720
using touch device: /dev/by-id/usb-eGalax_Inc._USB_TouchController-event-if00
ts_open: No such file or directory
root@rasp:/home/pi#

When i change the TSLIB_TSDEVICE: '/dev/by-id/usb-eGalax_Inc._USB_TouchController-event-if00'
to TSLIB_TSDEVICE: '/dev/input/event3

then the result on the raspbian 3 is this:

pi@rasp:~ $ sudo su
root@rasp:/home/pi# export LD_LIBRARY_PATH=/usr/local/lib
root@rasp:/home/pi# export TSLIB_TSDEVICE=/dev/by-id/usb-eGalax_Inc._USB_TouchController-ev$
root@rasp:/home/pi# export TSLIB_PLUGINDIR=/usr/lib/ts
root@rasp:/home/pi# export TSLIB_CONSOLEDEVICE=none
root@rasp:/home/pi# export TSLIB_FBDEVICE=/dev/fb0
root@rasp:/home/pi# export TSLIB_CALIBFILE=/etc/ts/pointercal
root@rasp:/home/pi# export TSLIB_CONFFILE=/etc/ts.conf
root@rasp:/home/pi# ts_uinput_touch -d
ts_uinput_touch environment variables:
TSLIB_TSDEVICE: '/dev/by-id/usb-eGalax_Inc._USB_TouchController-event-if00'
TSLIB_PLUGINDIR: '/usr/lib/ts'
TSLIB_CONSOLEDEVICE: 'none'
TSLIB_FBDEVICE: '/dev/fb0'
TSLIB_CALIBFILE: '/etc/ts/pointercal'
TSLIB_CONFFILE: '/etc/ts.conf'
TSLIB_RES_X: '(null)'
TSLIB_RES_Y: '(null)'
TSLIB_TOUCH_HOME_TIME: '(null)'

using fb device: /dev/fb0
resolution: 1280x720
using touch device: /dev/by-id/usb-eGalax_Inc._USB_TouchController-event-if00
ts_open: No such file or directory
root@rasp:/home/pi#

By myselfe i will for sure not find the mistake. I hope somebody can help me please.

evtest shows that the touche is found and working. But i dont become Kodi with the touch to work correctly. Is tehre an other solution maybe ?? The little calibration tool in Kodi dont work when i press Enter...
Pages: 1 2 3 4 5 6 7 8 9