• 1(current)
  • 2
  • 3
  • 4
  • 5
  • 9
Linux fix tslib integration
As seen in many threads there is a long lasting issue with touchscreens. Even when working perfectly in any X window manager and through TSLIB is seems to remain an issue when trying to use on an standalone running xbmc.

Several examples of threads discussing this:

And there are several topics on plenty of other forums.

My own detailed description on the issue:

I truly believe this to be a core-xbmc issue as I have been trying for a couple of weeks already on several linux flavours (Debian, Ubuntu, Arch, Linux Mint, Raspbian, OpenELEC, etc...) and several custom build solutions and tutorials out there all with the same result.

So, if this could please be considered I'm sure a lot of touchscreen users out there will greatly appreciate.

PS: although I'm not a developer, please do reach out to me if I can help in any way.
All in good time. Android touch screen support is still being tweaked, and Windows 7/8 touch screen support finally got fixed in the most recently nightly builds (wiki) (and even then, I think it's the first time Windows got multitouch).
That's great to hear it is on the radar, even if not immediately.

Thanks for the feedback, Ned.

Let me know if I can help in any way!
I was also looking into better touchscreen support. Was using some Kodi patches for this but I'm not very satisfied. So I was start to look how whole thing actually works (like how touchscreen gets the values and send input events). I noticed that there are solutions using python script uinput-mapper. But I read it can slow down the system.

So I was looking further. I tried tslib and it's calibration and did some tests. I was very satisfied with the result. But how to add support into Kodi... Then I got an idea: why not using similar approach as used in uinput-mapper.
So I created one small application which is running as a daemon. On one side it gets events from touchscreen using tslib library. On the other end it creates one new virtual device using uinput kernel module that allows to handle the input subsystem from user land. Inside application I'm just receiving data from tslib and send correct events to uinput. Whole thing is very simple and also works very well. It behaves in a similar way than touchpad. Short tap sends button press event and long slide sends only xy coordinates.

I'm writing this post to get some feedback about this approach. And to see if this idea is actually worth something. For me it is at this time very much.

Update: I'm also working on a Kodi addon for calibration. Calibration is done in daemon itself and addon just shows five cross points on screen to touch.
Update: I also add waveshare screen support.
Hey Ultraman,

I was thrilled reading your post. I'm an absolutely noob when it comes to developing modules and daemons. So I was delighted to read that you would like to give it a go. If you need a beta-tester or anything, please do let me know. Would be happy to help.

Quote:I tried tslib and it's calibration and did some tests. I was very satisfied with the result. But how to add support into Kodi...

I've had some experience with tslib myself and I was happy to see that my touchscreen (which is a 17" eGalax USB screen) worked great with the eGalax drivers combined with tslib. The only thing that I was never able to work properly is the integration of that in Kodi (Xbmc). Again, I'm not able to code something myself...

Quote:And to see if this idea is actually worth something. For me it is at this time very much.

I want to support you in any way possible :-) so if any help needed in terms of testing, just give me a yell.

PS: I'm using that touchscreen with a Raspberry Pi (Model B) and currently a (old) Xbian that is using the uimapper "trick". I works but it could be improved as touch reaction is limited (no multitouch) and sometimes slow
(2015-06-23, 10:27)dcallebaut Wrote: It works but it could be improved as touch reaction is limited (no multitouch) and sometimes slow
I don't think Kodi can be used with multitouch.
[/quote]I don't think Kodi can be used with multitouch.
I wanted to say: no multitouch is no showstopper for me. But the current "patchy" setup I'm using does not work "fluently"..so any improvement is welcome Blush
I'm preparing OpenELEC image for Udoo system with tslib any my new daemon. Also one special image for one heavy user. If all goes well I will commit whole changes and everyone can use them. For now the daemon is very simple but doing the job it suppose to.
My work is currently here: https://github.com/vpeter4/tslib/commit/...28d9769bfe
If anyone wants to use it be my guest. And let me know the results.

Wondering where should post the news to get better attention...
Hello, i really like your work. I am running on raspbian wheezy with kodi 14.2 and now compiled your source code

- git clone https://github.com/vpeter4/tslib
- cd tslib
- ./autogen.sh
- ./configure
- make && make install

it worket perfect, i can calibrate my screen with ts_calibrate i have tested it with ts_test and its perfect. But in kodi it is still the same, the mouse is anywhere else. How can i start the daemon ts_uinput_touch ? I don't have the binary. Where can i find it ? How can i use it ?

i am really looking foreward that this calibration problem can come to an end ....

regards Martin
You must clone ts_uinput_touch branch
git clone https://github.com/vpeter4/tslib -b ts_uinput_touch

Then you will get my new binary. Also there is a folder kodi-addon which holds addon for calibration.
Whole thing will not run magically. You need to configure tslib first.

For this you need to edit file /etc/ts.conf with content like this
module_raw input grab_events=1
# or for eGalax touchscreen
#module_raw galax grab_events=1
module pthres pmin=1
module variance delta=30
module dejitter delta=100
module linear
# or use swap_xy to swap axes
#module linear swap_xy=1

You also need environment variables set up. For example in /root/.bashrc add these lines
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_PLUGINDIR=/usr/lib/ts
export TSLIB_FBDEVICE=/dev/fb0
export TSLIB_CALIBFILE=/etc/ts/pointercal
export TSLIB_CONFFILE=/etc/ts/ts.conf

To get TSLIB_TSDEVICE event# use program evtest (must be separately installed). On left you will get event number (whole path) and on right is the name of your display. If you have attached keyboard remove it and reboot your system. After the system is up attach it back. This way touchscreen will have always same event number.

The other (probably better option) is to use device by-id. Run command
ls -l /dev/input/by-id
and you will see something like
usb-eGalax_Inc._USB_TouchController-event-mouse -> ../event6


Then you need to run ts_uinput_touch daemon before Kodi is started
ts_uinput_touch -d

This depends on your distro (maybe adding to /etc/rc.local would work). After reboot ts_uinput_touch should be running and Kodi should see new input device. Then calibrate the screen with kodi addon or do it manually from console with ts_calibrate program (stop Kodi and ts_uinput_touch first).

If things would not work come to #openelec on IRC and I will explain more.

Update: I think it would be easier to set those environment variables export (TSLIB_TSDEVICE, ..) before calling ts_uinput_touch. I will add support for loading file from daemon itself in a day or two.
Moved to the development forum

@ultraman, if you create a PR for Kodi, it will get more attention
@zag: This is not Kodi thing. It is separate program which creates new virtual device which Kodi understand.
Sadly I don't understand how input system really works in Kodi to integrate tslib directly. Maybe on one rainy day I will check the code again.
OK thanks, I'll leave it in the development forum as its still some nice code that others could use Wink
  • 1(current)
  • 2
  • 3
  • 4
  • 5
  • 9

Logout Mark Read Team Forum Stats Members Help
fix tslib integration0
This forum uses Lukasz Tkacz MyBB addons.