Merge pull request #9836 from heitbaum/touchscreen
Touchscreen: drop obsolete addon
@ -1,41 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
PKG_NAME="tslib"
|
||||
PKG_VERSION="1.1"
|
||||
PKG_SHA256="fe35e5f710ea933b118f710e2ce4403ac076fe69926b570333867d4de082a51c"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE="https://github.com/kergoth/tslib"
|
||||
PKG_URL="https://github.com/kergoth/tslib/releases/download/1.1/${PKG_NAME}-${PKG_VERSION}.tar.xz"
|
||||
PKG_DEPENDS_TARGET="toolchain evtest"
|
||||
PKG_LONGDESC="Touchscreen access library with ts_uinput_touch daemon."
|
||||
PKG_TOOLCHAIN="autotools"
|
||||
|
||||
TSLIB_MODULES_ENABLED="linear dejitter variance pthres ucb1x00 tatung input galax dmc touchkit st1232 waveshare"
|
||||
TSLIB_MODULES_DISABLED="arctic2 corgi collie h3600 linear_h2200 mk712 cy8mrln_palmpre"
|
||||
TSLIB_BUILD_STATIC="yes" # no .so files (easy to manage)
|
||||
|
||||
pre_configure_target() {
|
||||
local OPTS_MODULES=""
|
||||
|
||||
if [ "${TSLIB_BUILD_STATIC}" = "yes" ]; then
|
||||
OPTS_MODULES="--enable-static --disable-shared"
|
||||
for module in ${TSLIB_MODULES_ENABLED}; do
|
||||
OPTS_MODULES+=" --enable-${module}=static"
|
||||
done
|
||||
fi
|
||||
|
||||
for module in ${TSLIB_MODULES_DISABLED}; do
|
||||
OPTS_MODULES+=" --disable-${module}"
|
||||
done
|
||||
|
||||
PKG_CONFIGURE_OPTS_TARGET="${OPTS_MODULES} \
|
||||
--sysconfdir=/storage/.kodi/userdata/addon_data/service.touchscreen"
|
||||
}
|
||||
|
||||
post_makeinstall_target() {
|
||||
rm -fr ${INSTALL}/etc
|
||||
rm -fr ${INSTALL}/storage
|
||||
|
||||
debug_strip ${INSTALL}/usr/bin
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
From f60540a1e0c120dfb6a7452470b3e56bee91c7d7 Mon Sep 17 00:00:00 2001
|
||||
From: Dirk Gerdes <dirk.gerdes@googlemail.com>
|
||||
Date: Mon, 22 Dec 2014 11:07:13 +0100
|
||||
Subject: [PATCH] Added support for additional model of eGalax Touchscreen
|
||||
|
||||
---
|
||||
plugins/galax-raw.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/plugins/galax-raw.c b/plugins/galax-raw.c
|
||||
index c8689e2..6cacc56 100644
|
||||
--- a/plugins/galax-raw.c
|
||||
+++ b/plugins/galax-raw.c
|
||||
@@ -93,8 +93,9 @@ static int ts_galax_check_fd (struct tslib_galax *i)
|
||||
|
||||
if ((ioctl(ts->fd, EVIOCGID, &infos) < 0)) {
|
||||
fprintf (stderr, "tslib: warning, can not read device identifier\n");
|
||||
- } else if (infos.bustype != 3 || infos.vendor != 0x0EEF || infos.product != 0x0001) {
|
||||
- fprintf (stderr, "tslib: this is not an eGalax touchscreen (3,0x0EEF,1,0x0112)\n"
|
||||
+ } else if (infos.bustype != 3 || infos.vendor != 0x0EEF
|
||||
+ || (infos.product != 0x0001 && infos.product != 0x7200 && infos.product != 0x7201 && infos.product != 0xC000)) {
|
||||
+ fprintf (stderr, "tslib: this is not an eGalax touchscreen (3,0x0EEF,1/7200/7201/C000,0x0112)\n"
|
||||
"Your device: bus=%d, vendor=0x%X, product=0x%X, version=0x%X\n",infos.bustype, infos.vendor, infos.product, infos.version);
|
||||
return -1;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
diff -aurN a/plugins/linear.c b/plugins/linear.c
|
||||
--- a/plugins/linear.c 2013-08-08 02:23:04.000000000 +0200
|
||||
+++ b/plugins/linear.c 2015-09-04 20:21:50.376205701 +0200
|
||||
@@ -187,11 +187,11 @@
|
||||
for (index = 0; index < 7; index++)
|
||||
if (fscanf(pcal_fd, "%d", &lin->a[index]) != 1) break;
|
||||
fscanf(pcal_fd, "%d %d", &lin->cal_res_x, &lin->cal_res_y);
|
||||
-#ifdef DEBUG
|
||||
+/*#ifdef DEBUG*/
|
||||
printf("Linear calibration constants: ");
|
||||
for(index=0;index<7;index++) printf("%d ",lin->a[index]);
|
||||
printf("\n");
|
||||
-#endif /*DEBUG*/
|
||||
+/*#endif*/ /*DEBUG*/
|
||||
fclose(pcal_fd);
|
||||
}
|
||||
|
@ -1,24 +0,0 @@
|
||||
From c4c59790f3191c1a233fc1a61f8fedad85de1aeb Mon Sep 17 00:00:00 2001
|
||||
From: Peter Fink <pfink@christ-es.de>
|
||||
Date: Wed, 8 Feb 2017 14:04:45 +0100
|
||||
Subject: [PATCH] fbutils: Fix x64 execution. Call malloc not with a hardcoded
|
||||
sizeof(__u32). This caused the application to crash with segfaults on x64
|
||||
machines.
|
||||
|
||||
---
|
||||
tests/fbutils.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/tests/fbutils.c b/tests/fbutils.c
|
||||
index 8ee494bc..fd7fbfe9 100644
|
||||
--- a/tests/fbutils.c
|
||||
+++ b/tests/fbutils.c
|
||||
@@ -138,7 +138,7 @@ int open_framebuffer(void)
|
||||
memset(fbuffer,0,fix.smem_len);
|
||||
|
||||
bytes_per_pixel = (var.bits_per_pixel + 7) / 8;
|
||||
- line_addr = malloc (sizeof (__u32) * var.yres_virtual);
|
||||
+ line_addr = malloc (sizeof (line_addr) * var.yres_virtual);
|
||||
addr = 0;
|
||||
for (y = 0; y < var.yres_virtual; y++, addr += fix.line_length)
|
||||
line_addr [y] = fbuffer + addr;
|
@ -1,56 +0,0 @@
|
||||
--- a/plugins/galax-raw.c 2022-07-21 15:46:14.666220340 +0000
|
||||
+++ b/plugins/galax-raw.c 2022-07-22 01:11:26.708402821 +0000
|
||||
@@ -198,7 +198,8 @@
|
||||
samp->x = i->current_x;
|
||||
samp->y = i->current_y;
|
||||
samp->pressure = i->current_p;
|
||||
- samp->tv = ev.time;
|
||||
+ samp->tv.tv_sec = ev.input_event_sec;
|
||||
+ samp->tv.tv_usec = ev.input_event_usec;
|
||||
samp++;
|
||||
total++;
|
||||
break;
|
||||
--- a/plugins/input-raw.c 2013-08-08 00:23:04.000000000 +0000
|
||||
+++ b/plugins/input-raw.c 2022-07-22 01:30:41.417546206 +0000
|
||||
@@ -179,7 +179,8 @@
|
||||
samp->y = i->current_y;
|
||||
samp->pressure = i->current_p;
|
||||
}
|
||||
- samp->tv = ev.time;
|
||||
+ samp->tv.tv_sec = ev.input_event_sec;
|
||||
+ samp->tv.tv_usec = ev.input_event_usec;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "RAW---------------------> %d %d %d %d.%d\n",
|
||||
samp->x, samp->y, samp->pressure, samp->tv.tv_sec,
|
||||
@@ -262,7 +263,8 @@
|
||||
samp->pressure = i->current_p = ev.value;
|
||||
break;
|
||||
}
|
||||
- samp->tv = ev.time;
|
||||
+ samp->tv.tv_sec = ev.input_event_sec;
|
||||
+ samp->tv.tv_usec = ev.input_event_usec;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "RAW---------------------------> %d %d %d\n",
|
||||
samp->x, samp->y, samp->pressure);
|
||||
@@ -278,7 +280,8 @@
|
||||
samp->x = 0;
|
||||
samp->y = 0;
|
||||
samp->pressure = 0;
|
||||
- samp->tv = ev.time;
|
||||
+ samp->tv.tv_sec = ev.input_event_sec;
|
||||
+ samp->tv.tv_usec = ev.input_event_usec;
|
||||
samp++;
|
||||
total++;
|
||||
}
|
||||
--- a/plugins/st1232-raw.c 2022-07-22 01:31:02.757483058 +0000
|
||||
+++ b/plugins/st1232-raw.c 2022-07-22 01:27:40.174757983 +0000
|
||||
@@ -162,7 +162,8 @@
|
||||
samp->x = i->current_x;
|
||||
samp->y = i->current_y;
|
||||
samp->pressure = i->current_p; /* is 0 on finger released */
|
||||
- samp->tv = ev.time;
|
||||
+ samp->tv.tv_sec = ev.input_event_sec;
|
||||
+ samp->tv.tv_usec = ev.input_event_usec;
|
||||
|
||||
i->current_p = 0; /* will be set again when getting xy cordinate */
|
||||
samp++;
|
@ -1,10 +0,0 @@
|
||||
--- a/src/ts_reconfig.c 2024-05-23 07:01:59.264165839 +0000
|
||||
+++ b/src/ts_reconfig.c 2024-05-23 07:01:54.034129359 +0000
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <dlfcn.h>
|
||||
+#include <string.h>
|
||||
|
||||
#include "tslib-private.h"
|
||||
|
@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="@PKG_ADDON_ID@"
|
||||
name="@ADDON_NAME@"
|
||||
version="@ADDON_VERSION@"
|
||||
provider-name="@PROVIDER_NAME@">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="3.0.0"/>
|
||||
@REQUIRES@
|
||||
</requires>
|
||||
<extension point="xbmc.service" library="service.py">
|
||||
<provides></provides>
|
||||
</extension>
|
||||
<extension point="xbmc.python.pluginsource" library="calibrate.py">
|
||||
<provides>executable</provides>
|
||||
</extension>
|
||||
<extension point="xbmc.addon.metadata">
|
||||
<summary>@PKG_SHORTDESC@</summary>
|
||||
<description>
|
||||
@PKG_LONGDESC@
|
||||
</description>
|
||||
<disclaimer>
|
||||
@PKG_DISCLAIMER@
|
||||
</disclaimer>
|
||||
<platform>all</platform>
|
||||
<news>
|
||||
@PKG_ADDON_NEWS@
|
||||
</news>
|
||||
<assets>
|
||||
<icon>resources/icon.png</icon>
|
||||
<fanart>resources/fanart.png</fanart>
|
||||
@PKG_ADDON_SCREENSHOT@
|
||||
</assets>
|
||||
</extension>
|
||||
</addon>
|
@ -1 +0,0 @@
|
||||
initial release
|
Before Width: | Height: | Size: 29 KiB |
@ -3,33 +3,24 @@
|
||||
|
||||
PKG_NAME="touchscreen"
|
||||
PKG_VERSION="1.0"
|
||||
PKG_REV="0"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
PKG_ADDON_PROJECTS="Generic RPi ARM"
|
||||
PKG_LICENSE="GPL"
|
||||
PKG_SITE=""
|
||||
PKG_URL=""
|
||||
PKG_DEPENDS_TARGET="toolchain tslib evtest"
|
||||
PKG_DEPENDS_TARGET="toolchain"
|
||||
PKG_SECTION="service"
|
||||
PKG_SHORTDESC="Touchscreen: support addon for Touchscreens"
|
||||
PKG_LONGDESC="Touchscreen: addon creates new virtual input device and \
|
||||
converts data from touchscreen to Kodi. Short tap sends button press event \
|
||||
and long tap sends only xy coordinates. Also includes calibration program."
|
||||
PKG_SHORTDESC="Add-on removed"
|
||||
PKG_LONGDESC="Add-on removed"
|
||||
PKG_TOOLCHAIN="manual"
|
||||
|
||||
PKG_ADDON_BROKEN="Touchscreen no longer required thus removed."
|
||||
|
||||
PKG_IS_ADDON="yes"
|
||||
PKG_ADDON_NAME="Touchscreen"
|
||||
PKG_ADDON_TYPE="xbmc.service"
|
||||
PKG_ADDON_TYPE="xbmc.broken"
|
||||
|
||||
addon() {
|
||||
mkdir -p ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
|
||||
|
||||
cp ${PKG_DIR}/addon.xml ${ADDON_BUILD}/${PKG_ADDON_ID}
|
||||
|
||||
# set only version (revision will be added by buildsystem)
|
||||
sed -e "s|@ADDON_VERSION@|${ADDON_VERSION}|g" \
|
||||
-i ${ADDON_BUILD}/${PKG_ADDON_ID}/addon.xml
|
||||
|
||||
cp $(get_install_dir tslib)/usr/bin/* ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
|
||||
cp $(get_install_dir evtest)/usr/bin/evtest ${ADDON_BUILD}/${PKG_ADDON_ID}/bin
|
||||
:
|
||||
}
|
||||
|
@ -1,65 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
oe_setup_addon service.touchscreen
|
||||
|
||||
if [ -d /usr/share/kodi/addons/service.touchscreen ]; then
|
||||
# addon included in image
|
||||
ADDON_DIR="/usr/share/kodi/addons/service.touchscreen"
|
||||
fi
|
||||
|
||||
. $ADDON_DIR/bin/ts_env.sh
|
||||
|
||||
echo "touchscreen device: $TSLIB_TSDEVICE"
|
||||
|
||||
if [ "$1" = "service" ]; then
|
||||
# recalibrate from service if required
|
||||
SETTINGS_XML="$ADDON_HOME/settings.xml"
|
||||
if [ -f "$SETTINGS_XML" ]; then
|
||||
mkdir -p /var/config
|
||||
|
||||
# check settings version
|
||||
XML_SETTINGS_VER="$(xmlstarlet sel -t -m settings -v @version $SETTINGS_XML)"
|
||||
if [ "$XML_SETTINGS_VER" = "2" ]; then
|
||||
xmlstarlet sel -t -m settings/setting -v @id -o "=\"" -v . -o "\"" -n "$SETTINGS_XML" > /var/config/ts_calibration_addon.conf
|
||||
else
|
||||
xmlstarlet sel -t -m settings -m setting -v @id -o "=\"" -v @value -o "\"" -n "$SETTINGS_XML" > /var/config/ts_calibration_addon.conf
|
||||
fi
|
||||
|
||||
. /var/config/ts_calibration_addon.conf
|
||||
|
||||
if [ "$TS_RECALIBRATE" = "true" ]; then
|
||||
sed -i 's|id="TS_RECALIBRATE"[ ]*value="true"|id="TS_RECALIBRATE" value="false"|g' "$SETTINGS_XML"
|
||||
touch $ADDON_HOME/recalibrate
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f $ADDON_HOME/recalibrate ]; then
|
||||
echo "recalibrating..."
|
||||
rm -f $ADDON_HOME/recalibrate
|
||||
ts_calibrate
|
||||
fi
|
||||
else
|
||||
echo "Stopping Kodi and touchscreen daemon..."
|
||||
systemctl stop kodi
|
||||
systemctl stop ts_uinput_touch
|
||||
|
||||
while pidof kodi.bin &>/dev/null; do
|
||||
sleep 0.5
|
||||
done
|
||||
|
||||
killall ts_uinput_touch &>/dev/null
|
||||
|
||||
ts_calibrate
|
||||
|
||||
# restart both if argument was set
|
||||
if [ "$1" = "run" ]; then
|
||||
echo "Starting touchscreen daemon and Kodi..."
|
||||
systemctl start ts_uinput_touch
|
||||
systemctl start kodi
|
||||
fi
|
||||
fi
|
@ -1,85 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
oe_setup_addon service.touchscreen
|
||||
|
||||
if [ -d /usr/share/kodi/addons/service.touchscreen ]; then
|
||||
# addon included in image
|
||||
ADDON_DIR=/usr/share/kodi/addons/service.touchscreen
|
||||
fi
|
||||
|
||||
if [ ! -f $ADDON_HOME/ts.conf-generic ]; then
|
||||
cp $ADDON_DIR/config/* $ADDON_HOME
|
||||
fi
|
||||
|
||||
if [ -f $ADDON_HOME/ts_env.sh ]; then
|
||||
# use user supplied script
|
||||
if [ ! -x $ADDON_HOME/ts_env.sh ]; then
|
||||
chmod +x $ADDON_HOME/ts_env.sh
|
||||
fi
|
||||
|
||||
dos2unix $ADDON_HOME/ts_env.sh
|
||||
dos2unix $ADDON_HOME/ts.conf
|
||||
|
||||
. $ADDON_HOME/ts_env.sh
|
||||
else
|
||||
# automatic start only on Udoo dual/quad for ldb screen
|
||||
LDB=""
|
||||
if grep -iq ":dev=ldb" /proc/cmdline; then
|
||||
LDB="yes"
|
||||
# maybe 7" LVDS display
|
||||
modprobe st1232 >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -n "$LDB" ]; then
|
||||
# find event# with command
|
||||
# ls -l /dev/input/by-id
|
||||
# or using evtest program
|
||||
|
||||
# st1232 module is always loaded so check for 3M first
|
||||
TS_DEVICE_1="3M 3M USB Touchscreen - EX II"
|
||||
TS_DEVICE_2="st1232-touchscreen"
|
||||
TS_DEVICE_CONF_1="ts.conf-udoo_15_6"
|
||||
TS_DEVICE_CONF_2="ts.conf-udoo_7"
|
||||
TS_DEVICE_CONF_GENERIC="ts.conf-generic"
|
||||
|
||||
#TS_DEVICE="$TS_DEVICE_1" # use specified one, should exist ts.conf for it
|
||||
TS_DEVICE="" # find one automatically
|
||||
#echo "device: $TS_DEVICE"
|
||||
|
||||
TS_DEVICE_CONF=""
|
||||
if [ -n "$TS_DEVICE" ]; then
|
||||
TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_DEVICE="$TS_DEVICE" '$0 ~ TS_DEVICE {print $1}')
|
||||
TS_DEVICE_CONF="$TS_DEVICE_CONF_GENERIC"
|
||||
else
|
||||
TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_DEVICE="$TS_DEVICE_1" '$0 ~ TS_DEVICE {print $1}')
|
||||
if [ -n "$TSLIB_TSDEVICE" ]; then
|
||||
TS_DEVICE_CONF="$TS_DEVICE_CONF_1"
|
||||
rmmod st1232 >/dev/null 2>&1 # it's not
|
||||
else
|
||||
TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_DEVICE="$TS_DEVICE_2" '$0 ~ TS_DEVICE {print $1}')
|
||||
if [ -n "$TSLIB_TSDEVICE" ]; then
|
||||
TS_DEVICE_CONF="$TS_DEVICE_CONF_2"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -f $ADDON_HOME/ts.conf -a -n "$TS_DEVICE_CONF" ]; then
|
||||
cp "$ADDON_HOME/$TS_DEVICE_CONF" $ADDON_HOME/ts.conf
|
||||
fi
|
||||
|
||||
export TSLIB_TSDEVICE="$TSLIB_TSDEVICE"
|
||||
export TSLIB_PLUGINDIR=$ADDON_DIR/lib
|
||||
export TSLIB_CONSOLEDEVICE=none
|
||||
export TSLIB_FBDEVICE=/dev/fb0
|
||||
export TSLIB_CALIBFILE=$ADDON_HOME/pointercal
|
||||
export TSLIB_CONFFILE=$ADDON_HOME/ts.conf
|
||||
|
||||
#export TSLIB_RES_X=800
|
||||
#export TSLIB_RES_Y=480
|
||||
fi
|
||||
fi
|
@ -1,41 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
oe_setup_addon service.touchscreen
|
||||
|
||||
if [ -d /usr/share/kodi/addons/service.touchscreen ]; then
|
||||
# addon included in image
|
||||
ADDON_DIR="/usr/share/kodi/addons/service.touchscreen"
|
||||
fi
|
||||
|
||||
. $ADDON_DIR/bin/ts_env.sh
|
||||
|
||||
params=$*
|
||||
|
||||
if [ "$1" = "service" ]; then
|
||||
# skip service parameter and daemonize
|
||||
params="-d"
|
||||
else
|
||||
# started from command line
|
||||
systemctl stop ts_uinput_touch >/dev/null 2>&1
|
||||
killall ts_uinput_touch >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
echo " touchscreen device: '$TSLIB_TSDEVICE'"
|
||||
|
||||
if [ -n "$TSLIB_RES_X" -a -n "$TSLIB_RES_Y" ]; then
|
||||
echo "touchscreen resolution: '${TSLIB_RES_X}x${TSLIB_RES_Y}'"
|
||||
params="-x $TSLIB_RES_X -y $TSLIB_RES_Y $params"
|
||||
fi
|
||||
|
||||
echo "params: .$params."
|
||||
if [ ! -x $ADDON_HOME/ts_uinput_touch ]; then
|
||||
ts_uinput_touch $params
|
||||
else
|
||||
echo "Using $ADDON_HOME/ts_uinput_touch"
|
||||
$ADDON_HOME/ts_uinput_touch $params
|
||||
fi
|
@ -1,142 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
import os
|
||||
import socket
|
||||
import sys
|
||||
from threading import Thread
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
TEXT_ALIGN_LEFT = 0
|
||||
TEXT_ALIGN_RIGHT = 1
|
||||
TEXT_ALIGN_CENTER_X = 2
|
||||
TEXT_ALIGN_CENTER_Y = 4
|
||||
TEXT_ALIGN_RIGHT_CENTER_Y = 5
|
||||
TEXT_ALIGN_LEFT_CENTER_X_CENTER_Y = 6
|
||||
ACTION_PREVIOUS_MENU = 10
|
||||
ACTION_BACKSPACE = 92
|
||||
|
||||
SOCK_PATH = "/tmp/ts_calibrate.socket"
|
||||
TSLIB_EDGE_OFFEST = 50
|
||||
CROSSHAIR_IMAGE_SIZE = 23
|
||||
CROSSHAIR_IMAGE_OFFSET = 11
|
||||
SKIN_WIDTH = 1280 # we are using 720p skin
|
||||
SKIN_HEIGHT = 720
|
||||
|
||||
class coordinates:
|
||||
var_x = 0
|
||||
var_y = 0
|
||||
|
||||
def server_thread(conn, self):
|
||||
while True:
|
||||
data = conn.recv(128)
|
||||
if not data:
|
||||
break
|
||||
|
||||
self.currentTarget = self.currentTarget + 1
|
||||
if self.currentTarget > 0:
|
||||
self.removeControl(self.targetImage)
|
||||
|
||||
if self.currentTarget == 5:
|
||||
xbmcgui.Dialog().ok("Calibration", "Calibration done.")
|
||||
break
|
||||
|
||||
self.info.setLabel("Touch '" + data + "' crosshair")
|
||||
self.targetImage = xbmcgui.ControlImage(
|
||||
self.touch_points[self.currentTarget].var_x - CROSSHAIR_IMAGE_OFFSET,
|
||||
self.touch_points[self.currentTarget].var_y - CROSSHAIR_IMAGE_OFFSET,
|
||||
CROSSHAIR_IMAGE_SIZE, CROSSHAIR_IMAGE_SIZE,
|
||||
self.crosshair_path, colorDiffuse='0x00000000')
|
||||
self.addControl(self.targetImage)
|
||||
|
||||
# out of loop, close connection
|
||||
conn.close()
|
||||
os.remove(SOCK_PATH)
|
||||
self.retval = 0
|
||||
self.close()
|
||||
|
||||
class ts_calibrate(xbmcgui.WindowDialog):
|
||||
def __init__(self):
|
||||
self.retval = 0
|
||||
self.media_path=os.path.join(addon.getAddonInfo('path'), 'resources','media') + '/'
|
||||
self.crosshair_path = self.media_path + 'crosshair.png'
|
||||
self.currentTarget = -1
|
||||
|
||||
self.edge_offset_x = TSLIB_EDGE_OFFEST * SKIN_WIDTH / self.getWidth()
|
||||
self.edge_offset_y = TSLIB_EDGE_OFFEST * SKIN_HEIGHT / self.getHeight()
|
||||
|
||||
self.touch_points = [coordinates() for i in range(5)]
|
||||
self.touch_points[0].var_x = self.edge_offset_x
|
||||
self.touch_points[0].var_y = self.edge_offset_y
|
||||
self.touch_points[1].var_x = SKIN_WIDTH - self.edge_offset_x
|
||||
self.touch_points[1].var_y = self.edge_offset_y
|
||||
self.touch_points[2].var_x = SKIN_WIDTH - self.edge_offset_x
|
||||
self.touch_points[2].var_y = SKIN_HEIGHT - self.edge_offset_y
|
||||
self.touch_points[3].var_x = self.edge_offset_x
|
||||
self.touch_points[3].var_y = SKIN_HEIGHT - self.edge_offset_y
|
||||
self.touch_points[4].var_x = SKIN_WIDTH / 2
|
||||
self.touch_points[4].var_y = SKIN_HEIGHT / 2
|
||||
|
||||
self.background = xbmcgui.ControlImage(0, 0, SKIN_WIDTH, SKIN_HEIGHT,
|
||||
self.media_path + 'background.jpg', colorDiffuse = '0xffffffff')
|
||||
self.addControl(self.background)
|
||||
|
||||
tmp_str = "Tslib/Kodi calibration utility\n\nTouch crosshair to calibrate"
|
||||
tmp_str += "\n\nresolution: " + str(self.getWidth()) + "x" + str(self.getHeight())
|
||||
tmp_str += "\nskin: " + str(SKIN_WIDTH) + "x" + str(SKIN_HEIGHT)
|
||||
|
||||
self.about = xbmcgui.ControlLabel(
|
||||
10, 80, SKIN_WIDTH, 400,
|
||||
"", textColor = '0xffffffff', font = 'font25', alignment = TEXT_ALIGN_CENTER_X)
|
||||
self.addControl(self.about)
|
||||
self.about.setLabel(tmp_str)
|
||||
|
||||
self.info = xbmcgui.ControlLabel(
|
||||
20, SKIN_HEIGHT/2 - 40,
|
||||
1000, 400,
|
||||
"", textColor = '0xffffffff', font = 'font30', alignment = TEXT_ALIGN_LEFT)
|
||||
self.addControl(self.info)
|
||||
self.info.setLabel("")
|
||||
|
||||
if os.path.exists(SOCK_PATH):
|
||||
os.remove(SOCK_PATH)
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sock.bind(SOCK_PATH)
|
||||
sock.listen(1)
|
||||
|
||||
# enter calibration mode
|
||||
os.system("killall -SIGUSR1 ts_uinput_touch")
|
||||
|
||||
print 'Waiting for calibration connection'
|
||||
conn, addr = sock.accept()
|
||||
print 'Calibration connection accepted'
|
||||
|
||||
self.t = Thread(target=server_thread, args=(conn, self,))
|
||||
self.t.start()
|
||||
|
||||
def onAction(self, action):
|
||||
if action == ACTION_PREVIOUS_MENU or action == ACTION_BACKSPACE:
|
||||
self.retval = 0
|
||||
self.close()
|
||||
|
||||
addon = xbmcaddon.Addon(id = 'service.touchscreen')
|
||||
finished = False
|
||||
|
||||
while finished == False:
|
||||
dialog = ts_calibrate()
|
||||
dialog.doModal()
|
||||
|
||||
if dialog.retval == 0:
|
||||
finished = True
|
||||
del dialog
|
||||
|
||||
del addon
|
||||
# exit calibration mode
|
||||
os.system("killall -SIGUSR2 ts_uinput_touch")
|
||||
|
||||
if os.path.exists(SOCK_PATH):
|
||||
os.remove(SOCK_PATH)
|
||||
|
@ -1,8 +0,0 @@
|
||||
module_raw input grab_events=1
|
||||
module pthres pmin=1
|
||||
module variance delta=30
|
||||
module dejitter delta=100
|
||||
|
||||
module linear
|
||||
# or use swap_xy parameter to swap axes
|
||||
#module linear swap_xy=1
|
@ -1,6 +0,0 @@
|
||||
# Udoo with 15.6" 1366x768 display with 3M USB Touchscreen - EX II
|
||||
module_raw input grab_events=1
|
||||
module pthres pmin=1
|
||||
module variance delta=30
|
||||
module dejitter delta=100
|
||||
module linear
|
@ -1,3 +0,0 @@
|
||||
# Udoo with 7" 800x480 display with ST1232 touch controler
|
||||
# only st1232 raw input module is used
|
||||
module_raw st1232 grab_events=1 invert_y=480
|
@ -1,6 +0,0 @@
|
||||
# len is hidraw data size
|
||||
module_raw waveshare len=22
|
||||
module pthres pmin=1
|
||||
module variance delta=30
|
||||
module dejitter delta=100
|
||||
module linear
|
@ -1,28 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
# find touchscreen device by name (substring) using evtest program
|
||||
|
||||
# $ evtest
|
||||
# No device specified, trying to scan all of /dev/input/event*
|
||||
# Available devices:
|
||||
# /dev/input/event0: Video Bus
|
||||
# /dev/input/event1: Goodix Capacitive TouchScreen
|
||||
# Select the device event number [0-1]:
|
||||
|
||||
TOUCHSCREEN_NAME="Goodix Capacitive TouchScreen"
|
||||
|
||||
TSLIB_TSDEVICE=$(echo 999 | evtest 2>&1 >/dev/null | awk -F':' -v TS_NAME="$TOUCHSCREEN_NAME" '$0 ~ TS_NAME {print $1; exit}')
|
||||
export TSLIB_TSDEVICE
|
||||
|
||||
export TSLIB_PLUGINDIR=$ADDON_DIR/lib
|
||||
export TSLIB_CONSOLEDEVICE=none
|
||||
export TSLIB_FBDEVICE=/dev/fb0
|
||||
export TSLIB_CALIBFILE=/storage/.kodi/userdata/addon_data/service.touchscreen/pointercal
|
||||
export TSLIB_CONFFILE=/storage/.kodi/userdata/addon_data/service.touchscreen/ts.conf
|
||||
|
||||
# sometimes needed
|
||||
#export TSLIB_RES_X=800
|
||||
#export TSLIB_RES_Y=480
|
@ -1,48 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
# change vid/pid for waveshare touchscreen device
|
||||
PRODUCT_VID=0EEF
|
||||
PRODUCT_PID=0005
|
||||
|
||||
# device set directly or find automaticaly at the end of this script
|
||||
export TSLIB_TSDEVICE=""
|
||||
#export TSLIB_TSDEVICE="/dev/hidrawN"
|
||||
|
||||
export TSLIB_PLUGINDIR=$ADDON_DIR/lib
|
||||
export TSLIB_CONSOLEDEVICE=none
|
||||
export TSLIB_FBDEVICE=/dev/fb0
|
||||
export TSLIB_CALIBFILE=/storage/.kodi/userdata/addon_data/service.touchscreen/pointercal
|
||||
export TSLIB_CONFFILE=/storage/.kodi/userdata/addon_data/service.touchscreen/ts.conf
|
||||
|
||||
export TSLIB_RES_X=800
|
||||
export TSLIB_RES_Y=480
|
||||
|
||||
|
||||
# find touchscreen device
|
||||
if [ "$TSLIB_TSDEVICE" = "" ]; then
|
||||
PRODUCT_VID_PID="0000${PRODUCT_VID}:0000${PRODUCT_PID}"
|
||||
echo "PRODUCT_VID_PID: $PRODUCT_VID_PID"
|
||||
|
||||
hidrawN=""
|
||||
for dev in /sys/class/hidraw/hidraw*/device/uevent; do
|
||||
echo
|
||||
echo "device: $dev"
|
||||
|
||||
HID_ID=$(cat $dev | grep HID_ID | grep "$PRODUCT_VID_PID")
|
||||
if [ -n "$HID_ID" ]; then
|
||||
hidrawN=$(echo $dev | awk -F "/" '{print $5}')
|
||||
hidrawN="/dev/$hidrawN"
|
||||
echo "OK HID_ID: $HID_ID"
|
||||
echo "OK hidrawN: $hidrawN"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "$hidrawN" ]; then
|
||||
echo "found hidrawN: $hidrawN"
|
||||
export TSLIB_TSDEVICE=$hidrawN
|
||||
fi
|
||||
fi
|
@ -1,33 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
||||
|
||||
import xbmc
|
||||
import xbmcgui
|
||||
import xbmcaddon
|
||||
|
||||
__scriptid__ = 'service.touchscreen'
|
||||
__addon__ = xbmcaddon.Addon(id=__scriptid__)
|
||||
_ = __addon__.getLocalizedString
|
||||
|
||||
# http://forum.kodi.tv/showthread.php?tid=230766
|
||||
def handle_wait(time_to_wait, title, text):
|
||||
dialog = xbmcgui.DialogProgress()
|
||||
ret = dialog.create(' ' + title)
|
||||
secs = 0
|
||||
percent = 0
|
||||
increment = int(100 / time_to_wait)
|
||||
|
||||
while secs < time_to_wait:
|
||||
secs += 1
|
||||
percent = increment*secs
|
||||
secs_left = time_to_wait - secs
|
||||
remaining_display = (_(2030).encode('utf-8')) % secs_left
|
||||
dialog.update(percent, text, "", remaining_display)
|
||||
xbmc.sleep(1000)
|
||||
|
||||
dialog.close()
|
||||
return False
|
||||
|
||||
# how long to lock the screen
|
||||
lock_secs = 30
|
||||
handle_wait(lock_secs, _(2010).encode('utf-8'), _(2020).encode('utf-8'))
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
<string id="1000">General</string>
|
||||
<string id="1010">Recalibrate after reboot</string>
|
||||
<string id="1020">Clean screen</string>
|
||||
|
||||
<string id="2010">Touchscreen</string>
|
||||
<string id="2020">Now you can safely clean the screen.</string>
|
||||
<string id="2030">Still %d seconds left.</string>
|
||||
</strings>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<strings>
|
||||
<string id="1000">Allgemein</string>
|
||||
<string id="1010">Nach einem Neustart neu kalibrieren</string>
|
||||
<string id="1020">Touchscreen reinigen</string>
|
||||
|
||||
<string id="2010">Touchscreen</string>
|
||||
<string id="2020">Sie können jetzt den Touchscreen sicher reinigen.</string>
|
||||
<string id="2030">Noch %d Sekunden übrig.</string>
|
||||
</strings>
|
Before Width: | Height: | Size: 53 KiB |
Before Width: | Height: | Size: 168 B |
Before Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 69 KiB |
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<settings>
|
||||
<category label="1000" >
|
||||
<setting type="sep" />
|
||||
<setting label="1010" id="TS_RECALIBRATE" type="bool" default="false" />
|
||||
<setting label="1020" id="clean_screen" type="action" option="close" action="RunScript($CWD/lock-screen.py)" />
|
||||
</category>
|
||||
</settings>
|
@ -1,2 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
# Copyright (C) 2016-present Team LibreELEC (https://libreelec.tv)
|
@ -1,14 +0,0 @@
|
||||
[Unit]
|
||||
Description=Touchscreen support daemon
|
||||
After=graphical.target
|
||||
Before=kodi.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
Environment=HOME=/storage
|
||||
ExecStartPre=-/bin/sh -c "exec /bin/sh /storage/.kodi/addons/service.touchscreen/bin/ts_calibrate.sh service"
|
||||
ExecStart=-/bin/sh -c "exec /bin/sh /storage/.kodi/addons/service.touchscreen/bin/ts_uinput_touch.sh service"
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=kodi.target
|