diff options
5 files changed, 125 insertions, 0 deletions
diff --git a/meta/recipes-graphics/xinput-calibrator/pointercal-xinput/pointercal.xinput b/meta/recipes-graphics/xinput-calibrator/pointercal-xinput/pointercal.xinput new file mode 100644 index 0000000000..9633fc5f32 --- /dev/null +++ b/meta/recipes-graphics/xinput-calibrator/pointercal-xinput/pointercal.xinput | |||
@@ -0,0 +1 @@ | |||
# replace with valid machine specific pointercal.xinput | |||
diff --git a/meta/recipes-graphics/xinput-calibrator/pointercal-xinput_0.0.bb b/meta/recipes-graphics/xinput-calibrator/pointercal-xinput_0.0.bb new file mode 100644 index 0000000000..2e9dc03ead --- /dev/null +++ b/meta/recipes-graphics/xinput-calibrator/pointercal-xinput_0.0.bb | |||
@@ -0,0 +1,20 @@ | |||
1 | DESCRIPTION = "Touchscreen calibration data from xinput-calibrator" | ||
2 | LICENSE = "MIT" | ||
3 | LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" | ||
4 | |||
5 | PR = "r4" | ||
6 | |||
7 | SRC_URI = "file://pointercal.xinput" | ||
8 | S = "${WORKDIR}" | ||
9 | |||
10 | do_install() { | ||
11 | # Only install file if it has a contents | ||
12 | if [ -s ${S}/pointercal.xinput ] &&\ | ||
13 | [ ! -n "$(head -n1 ${S}/pointercal.xinput|grep "replace.*pointercal\.xinput")" ]; then | ||
14 | install -d ${D}${sysconfdir}/ | ||
15 | install -m 0644 ${S}/pointercal.xinput ${D}${sysconfdir}/ | ||
16 | fi | ||
17 | } | ||
18 | |||
19 | PACKAGE_ARCH = "${MACHINE_ARCH}" | ||
20 | CONFFILES_${PN} = "${sysconfdir}/pointercal.xinput" | ||
diff --git a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/30xinput_calibrate.sh b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/30xinput_calibrate.sh new file mode 100644 index 0000000000..5290726784 --- /dev/null +++ b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/30xinput_calibrate.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | . /etc/formfactor/config | ||
4 | |||
5 | if [ "$HAVE_TOUCHSCREEN" = "1" ]; then | ||
6 | /usr/bin/xinput_calibrator_once.sh | ||
7 | fi | ||
diff --git a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch new file mode 100644 index 0000000000..86982924a8 --- /dev/null +++ b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | Upstream-Status: Pending | ||
2 | |||
3 | From 14734a93bd3fc323325459e24b04795422e395e6 Mon Sep 17 00:00:00 2001 | ||
4 | From: Laurentiu Palcu <laurentiu.palcu@intel.com> | ||
5 | Date: Mon, 1 Jul 2013 15:38:02 +0300 | ||
6 | Subject: [PATCH] Allow xinput_calibrator_pointercal.sh to be run as normal | ||
7 | user | ||
8 | |||
9 | Allow normal user to create their own pointercal.xinput files that | ||
10 | override the system pointercal file in /etc. | ||
11 | |||
12 | Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> | ||
13 | --- | ||
14 | scripts/xinput_calibrator_pointercal.sh | 33 +++++++++++++++++++++---------- | ||
15 | 1 file changed, 23 insertions(+), 10 deletions(-) | ||
16 | |||
17 | diff --git a/scripts/xinput_calibrator_pointercal.sh b/scripts/xinput_calibrator_pointercal.sh | ||
18 | index fccb197..0ada7da 100755 | ||
19 | --- a/scripts/xinput_calibrator_pointercal.sh | ||
20 | +++ b/scripts/xinput_calibrator_pointercal.sh | ||
21 | @@ -11,19 +11,32 @@ | ||
22 | PATH="/usr/bin:$PATH" | ||
23 | |||
24 | BINARY="xinput_calibrator" | ||
25 | -CALFILE="/etc/pointercal.xinput" | ||
26 | -LOGFILE="/var/log/xinput_calibrator.pointercal.log" | ||
27 | +SYS_CALFILE="/etc/pointercal.xinput" | ||
28 | +USER_CALFILE="$HOME/.pointercal/pointercal.xinput" | ||
29 | |||
30 | -if [ -e $CALFILE ] ; then | ||
31 | - if grep replace $CALFILE ; then | ||
32 | - echo "Empty calibration file found, removing it" | ||
33 | - rm $CALFILE | ||
34 | - else | ||
35 | - echo "Using calibration data stored in $CALFILE" | ||
36 | - . $CALFILE && exit 0 | ||
37 | - fi | ||
38 | +if [ "$USER" = "root" ]; then | ||
39 | + LOGFILE="/var/log/xinput_calibrator.pointercal.log" | ||
40 | + CALFILES="$SYS_CALFILE" | ||
41 | +else | ||
42 | + LOGFILE="$HOME/.pointercal/xinput_calibrator.pointercal.log" | ||
43 | + CALFILES="$USER_CALFILE $SYS_CALFILE" | ||
44 | + mkdir -p "$HOME/.pointercal" | ||
45 | fi | ||
46 | |||
47 | +for CALFILE in $CALFILES; do | ||
48 | + if [ -e $CALFILE ]; then | ||
49 | + if grep replace $CALFILE ; then | ||
50 | + echo "Empty calibration file found, removing it" | ||
51 | + rm $CALFILE 2>/dev/null || true | ||
52 | + else | ||
53 | + echo "Using calibration data stored in $CALFILE" | ||
54 | + . $CALFILE && exit 0 | ||
55 | + fi | ||
56 | + fi | ||
57 | +done | ||
58 | + | ||
59 | +[ "$USER" != "root" ] && CALFILE=$USER_CALFILE | ||
60 | + | ||
61 | CALDATA=`$BINARY --output-type xinput -v | tee $LOGFILE | grep ' xinput set' | sed 's/^ //g; s/$/;/g'` | ||
62 | if [ ! -z "$CALDATA" ] ; then | ||
63 | echo $CALDATA > $CALFILE | ||
64 | -- | ||
65 | 1.7.9.5 | ||
66 | |||
diff --git a/meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb new file mode 100644 index 0000000000..d0f07c9ad8 --- /dev/null +++ b/meta/recipes-graphics/xinput-calibrator/xinput-calibrator_git.bb | |||
@@ -0,0 +1,31 @@ | |||
1 | DESCRIPTION = "A generic touchscreen calibration program for X.Org" | ||
2 | HOMEPAGE = "http://www.freedesktop.org/wiki/Software/xinput_calibrator" | ||
3 | LICENSE = "MIT-X" | ||
4 | LIC_FILES_CHKSUM = "file://src/calibrator.cpp;endline=22;md5=1bcba08f67cdb56f34021557898e4b5a" | ||
5 | DEPENDS = "virtual/libx11 libxi" | ||
6 | |||
7 | PV = "0.7.5+git${SRCPV}" | ||
8 | PR = "r6" | ||
9 | |||
10 | inherit autotools | ||
11 | |||
12 | SRCREV = "c01c5af807cb4b0157b882ab07a893df9a810111" | ||
13 | SRC_URI = "git://github.com/tias/xinput_calibrator.git;protocol=git \ | ||
14 | file://30xinput_calibrate.sh \ | ||
15 | file://Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch" | ||
16 | |||
17 | S = "${WORKDIR}/git" | ||
18 | |||
19 | # force native X11 ui as we don't have gtk+ in DEPENDS | ||
20 | EXTRA_OECONF += "--with-gui=x11" | ||
21 | |||
22 | do_install_append() { | ||
23 | install -d ${D}${bindir} | ||
24 | install -m 0755 scripts/xinput_calibrator_pointercal.sh ${D}${bindir}/xinput_calibrator_once.sh | ||
25 | |||
26 | install -d ${D}${sysconfdir}/X11/Xsession.d/ | ||
27 | install -m 0755 ${WORKDIR}/30xinput_calibrate.sh ${D}${sysconfdir}/X11/Xsession.d/ | ||
28 | } | ||
29 | |||
30 | RDEPENDS_${PN} = "xinput" | ||
31 | RRECOMMENDS_${PN} = "pointercal-xinput" | ||