to load the touchscreen driver you need to add the following to the /boot/config.txt:
Code:
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
display_rotate=0
to make the touch work i had to create the advancedsettings.xml file with the following contents:
xml:
<advancedsettings>
<touchscreen>
<x_offset>-50</x_offset> <!-- set pixel x offset to align it to the used display-->
<y_offset>-50</y_offset> <!-- set pixel y offset to align it to the used display-->
<x_stretch_factor>0.216392</x_stretch_factor> <!-- stretch/compress the touch x axis-->
<y_stretch_factor>0.132523</y_stretch_factor> <!-- stretch/compress the touch y axis-->
</touchscreen>
</advancedsettings>
adding a mouse.xml to the keymaps folder with the following contents is also beneficial:
xml:
<keymap>
<global>
<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>
</global>
</keymap>
if your screen is calibrated differently you can work out the factors for kodi by taking the min and max values for each axis in the config.txt file, eg:
xmin=200,xmax=3900,ymin=200,ymax=3900
the resolution:
W=800, H=480
xstretch=W/(xmax-xmin)
xoffset=xmin*xstretch
yxstretch=H/(ymax-ymin)
yoffset=ymin*ystretch