(Multi) Touch gestures

  • Hi,

    thanks to the help of vpeter over in this thread, I was able to calibrate my touchscreen with LibreELEC. I'm currently using the estouchy skin, but noticed that i cant drag lists or use any gesture except a simple click at all. Worst example is the home list on the left hand side (music, pictures, videos etc.) which scrolls down on its own when holding a click on the lower end of the list, but it doesnt scroll back up when i do the same near the top.

    On the kodi wiki there are two more global gestures, but those dont work either, are there extra steps necessary to get gestures to work?

  • Like I told you there gestures will not work with my addon. You need to grab slider and move it.

    To get gestures in play you need to remove addon and use pure kodi for this.

  • Oh, i thought your addon is purely for calibration and not for touchscreen support itself. So i either get multitouch without your addon or a calibrated screen with your addon?

  • libreelec uses a very old version and heavily patched version of tslib. tslib 1.15 is soon to be released. It includes a full multitouch API and some of the features of your patches: The "ts_uinput" daemon program, see the README.md documentation, for example. If you use this "ts_uinput" daemon, you have multitouch support automatically.

    You also add one "module_raw", but we can easily add that to upstream tslib too.

    What else do you add to tslib? I'm sure you could shrink, if not completely remove your patches against tslib, by doing 1-2 pull requests, a minor change in libreelec to use tslib's uinput daemon, and bump tslib from 1.1 to 1.15. At the same time you have multitouch support too.

    Oh. Also, a recent version of tslib does automatic touchscreen device detection. You would also not need to use evtest to find that.

    Edited once, last by merge (November 28, 2017 at 3:29 PM).

  • When I wrote my daemon there was nothing like this in tslib. And at that time is was not "very old" ;)

    All written things was on my todo list for long time. But it newer come to realization. And not sure if even will ever come for different reasons. The only real customer is happy with current implementation (he is using 40" touch) and I don't really have pleasure to continue development. And all this for only few users. My time is more important than doing bunch of free things for nothing (christmas is coming and gifts must be bough somehow).

    One big difference between my daemon and tslib's uinput daemon is communication with python code in kodi's addon.

    Kodi already using build-in calibration and my addon is not even needed in most cases. But sadly kodi devs forgot to expose raw touch coordinates so that calibration addon could be written. Or it could be included in kodi itself. I wrote about this in PR but no one respond.

    Maybe today kodi has more support for touch on linux. But I didn't even follow the progress.

    And I was following tslib progress :)

  • I see. I remember seeing you at the tslib project :) Well. In case you need calibration+multitouch one day, you know you can easily have it, and it will reduce your codebase. I might pick up your "module_raw" and include it in tslib if I have time, and who knows, maybe I'll have a look at how you "communicate with python" one day too...

  • Quick question: You add the "st1232" module_raw. It this really only "input" plus the invert_y option? If so, we could think about creating afilter module "invert" that takes parameters like "x0=XXX" and "y0=YYY" that defines the point around which the inversion takes place.

    I think it's not needed when you use the normal ts_calibrate calibration and linear filter, but there might be cases where manual calibration is not desired and exactly such an inversion is needed.

  • It was so long time when I was working on this. It was mainly proof of concept but I finished to working addon.

    I'm not really sure why I wrote separate module st1232. There are some notes at the top.

    About inverting axes: I think all combinations should be possible and separate module for this would be good I think. Just few days there was a guy who needed inverted x axe only :) But as I wrote above I don't have much desire to implement this. Which means he is out of luck with his setup.

  • Thanks. Yes, the one is reporting the inverted axis over at tslib project just now. And I start liking the idea of and "invert" module.

    As I see you also have a custom written "calibration" program: In tslib itself there is also a new option to build the "ts_calibrate" program SDL2-based. I'm not sure why you have your own program, but in case it's because you can't simply draw to the framebuffer and need a standalone program, this might be able to simply replace your program...

    It seems like almost all features you need are in tslib's package already by now:

    * device detection

    * standalone portable SDL2 graphics version of "ts_calibrate"

    * ts_uinput daemon (creates a touchscreen device with same properties as the original one, only offers tslib-filtered values)

    * multitouch (at least this thread is about multitouch)

    * TODO: "invert" filter (tdb in tslib) with "module_raw input" instead of "st1232+invert parameter". This would be tricky, because it would break your users' config files

  • Regarding calibration: The idea was to use kodi's addon to calibrate and not external program (ts_calibrate or anything else). Remember: LibreELEC just start kodi and nothing else. When kodi would start first time it should open calibration addon. Just like LibreELEC settings addon. Obviously calibration addon should start before settings addon. But this part was newer finished.

    My ts_uinput_touch addon daemon has two functions: 1) is making new uinput device and 2) is calibration. Because kodi doesn't expose absolute touch coordinate I only send event from kodi's addon (python code) to ts_uinput_touch daemon to read current touch coordinate and then creating calibration file.

    Obviously everything could be rewritten from scratch but touchscreen newer got much attention. That's why it is not on my very priority list.

    Sadly I don't have much pleasure working on LibreELEC anymore.

  • Sure. The way we do it, is simply check whether the calibfile exists, and if it doesn't, call ts_calibrate. This is done quite early in userspace, before the application starts. This way, users can trigger re-calibration by deleting the calibfile.

  • So I build my addon with tslib-1.15-rc2 but noticed that ts_uinput daemon it doesn't work as mine. It only reports x/y coordinates but no pressure. But even with modifying ts.conf to report pressure I still can't select anything in Kodi.

  • If ts_uinput doesn't report pressure, it is a bug. Just record evtest output from the original event device and ts_uinput's and write a bugreport so that we can fix it. It should of course report pressure and does so for all our touchscreen devices.