[Linux] fix tslib integration - Printable Version
+- Kodi Community Forum (http://forum.kodi.tv)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (/forumdisplay.php?fid=93)
+--- Thread: [Linux] fix tslib integration (/showthread.php?tid=162608)
fix tslib integration - dcallebaut - 2013-04-16 21:46
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.
RE: fix tslib integration - Ned Scott - 2013-04-17 06:57
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).
RE: fix tslib integration - dcallebaut - 2013-04-17 23:18
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!
RE: fix tslib integration - ultraman - 2015-06-21 20:11
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.
RE: fix tslib integration - dcallebaut - 2015-06-23 10:27
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
RE: fix tslib integration - ultraman - 2015-06-27 17:23
(2015-06-23 10:27)dcallebaut Wrote: It works but it could be improved as touch reaction is limited (no multitouch) and sometimes slowI don't think Kodi can be used with multitouch.
RE: fix tslib integration - dcallebaut - 2015-06-27 18:23
[/quote]I don't think Kodi can be used with multitouch.
fix tslib integration - dcallebaut - 2015-06-27 18:25
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
RE: fix tslib integration - ultraman - 2015-06-27 19:12
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.
RE: fix tslib integration - ultraman - 2015-06-30 11:49
My work is currently here: https://github.com/vpeter4/tslib/commit/2ae91258548c3682ad5df16ee22bdf28d9769bfe
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...
RE: fix tslib integration - emka1981 - 2015-07-02 22:45
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
- 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 ....
RE: fix tslib integration - ultraman - 2015-07-03 09:25
You must clone ts_uinput_touch branch
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
You also need environment variables set up. For example in /root/.bashrc add these lines
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
Then set TSLIB_TSDEVICE as
Then you need to run ts_uinput_touch daemon before Kodi is started
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.
RE: fix tslib integration - zag - 2015-07-03 11:57
Moved to the development forum
@ultraman, if you create a PR for Kodi, it will get more attention
RE: fix tslib integration - ultraman - 2015-07-03 12:07
@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.
RE: fix tslib integration - zag - 2015-07-03 12:19
OK thanks, I'll leave it in the development forum as its still some nice code that others could use