Forum
  • Search
  • Member List
  • Calendar
Hello There, Guest! Login Register — Login with Facebook

[PROBLEM] {Problem} RPI3
Thank you for your donation

Thread Closed 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Threaded Mode | Linear Mode
Problem: {Problem} RPI3
16th Nov, 2016, 07:34 AM
Post: #5
Adam Pristel Offline
Registered
Posts: 6
Joined: Nov 2016
Reputation: 0
RE: {Problem} RPI3
(16th Nov, 2016 04:33 AM)Nachteule Wrote:  Kodi v17 reads directly from /dev/input...

So it should not make any difference if touch is connected via USB or GPIO. But you have to set values in advancedsettings.xml. And this is a lot of try and error Sad

When I run the command below I find my touchscreen is event3 not 0..
cat /dev/input/event0

NOTE** (It's event3 when I have my mouse and KB plugged in. If I unplug those and reboot and run the stuff over SSH it is event0... I've tried both ways)

So I use:
TSLIB_TSDEVICE=/dev/input/event3 ts_calibrate

But then the calibration app ts_calibrate doesn't see my touches.

Any ideas?


Code:
Setting up the touchscreen for Kodi

Now you have a calibrated X input device, so the Desktop works nicely, but Kodi still does not. When starting it from X, there is a cursor, but the calibration is way off. When starting it standalone, there is not even touch input...
Fix this by installing tslib and evtest:

sudo apt-get install evtest tslib libts-bin  
  
Additionally you will need Then calibrate the touchscreen using:

TSLIB_TSDEVICE=/dev/input/event0 ts_calibrate

Touch the 5 crosses and you're done. You can test the calibration using:

TSLIB_TSDEVICE=/dev/input/event0 ts_test

You might also need to add the "kodi" user to the "input" user group:

sudo usermod -a -G input kodi

If you have Kodi version >= 17 ("Krypton") you cannow set up scale factors for the display so the cursor is properly displayed.

Setting display scale factors in Kodi >= v17

Test if Kodi can use touch input now. Start Kodi and touch the upper left corner of the screen. You will see a cursor and can move it, but only in 1/5th of the screen. The problem is that the coordinates /dev/input/event0 sends are touch device coordinates (in the range you see in the calibration values above), but Kodi expects pixel screen coordinates (0-800,0-480). Kodi starts to support touchscreen calibration out-of-the-box as of v17 aka "Krypton".
Edit the file advancedsettings.xml in your users userdata folder, e.g. /home/kodi/.kodi/userdata. If it does not exist, create it and add the following entries:

<advancedsettings>
    <touchscreen>
        <x_offset>-32</x_offset> <!-- cursor pixel x offset
        <y_offset>-35</y_offset> <!-- cursor pixel y offset
        <x_stretch_factor>0.209</x_stretch_factor> <!-- stretch factor
        <y_stretch_factor>0.131</y_stretch_factor> <!-- stretch factor
    </touchscreen>
</advancedsettings>

Good start values can be calculated by dividing the screen resolution by the calibration values above (e.g. for x: 800/3982=~0.2 and 480/3883=~0.124). You have to restart Kodi after editing the values.

Installing a touchscreen calibration fix

When you have an older Kodi version and can not use advancedsettings.xml, there are also ways to properly calibrate your screen. Read here about using a tslib fork and ts_uinput_touch for this.

Fixing the double-click issue

A remaining problem is that Kodi wants a double-click to activate a function. This is not good as we want to activate functions with a single click or tap. We can change this by editing the file /usr/share/kodi/system/keymaps/mouse.xml. Change the entries in the mouse section to:

<mouse>
  <leftclick>leftclick</leftclick>
  <rightclick>rightclick</rightclick>
  <middleclick>middleclick</middleclick>
  <doubleclick id="0">noop</doubleclick>
  <longclick id="0">contextmenu</longclick>
  <wheeldown>wheeldown</wheeldown>
  <wheelup>wheelup</wheelup>
  <mousedrag>mousedrag</mousedrag>
  <mousedragend>leftclick</mousedragend>
  <mousemove>noop</mousemove>
</mouse>


P.S. Find out how to hide the cursor here.
P.P.S. You can also add backlight control to the screen...
Find all posts by this user
« Next Oldest | Next Newest »
Thread Closed 


Messages In This Thread
{Problem} RPI3 - Adam Pristel - 16th Nov, 2016, 03:56 AM
RE: {Problem} RPI3 - Nachteule - 16th Nov, 2016, 04:13 AM
RE: {Problem} RPI3 - Adam Pristel - 16th Nov, 2016, 04:22 AM
RE: {Problem} RPI3 - Nachteule - 16th Nov, 2016, 04:33 AM
RE: {Problem} RPI3 - Adam Pristel - 16th Nov, 2016 07:34 AM
RE: {Problem} RPI3 - Adam Pristel - 16th Nov, 2016, 09:10 AM
RE: {Problem} RPI3 - Nachteule - 16th Nov, 2016, 09:31 AM
RE: {Problem} RPI3 - Adam Pristel - 16th Nov, 2016, 09:52 AM
RE: {Problem} RPI3 - Adam Pristel - 17th Nov, 2016, 01:40 PM

  • View a Printable Version
  • Send this Thread to a Friend
  • Subscribe to this thread
Forum Jump:

Current time: 23rd May, 2025, 03:36 AM Powered By MyBB, © 2002-2025 MyBB Group.