summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch')
-rw-r--r--meta/recipes-graphics/xinput-calibrator/xinput-calibrator/Allow-xinput_calibrator_pointercal.sh-to-be-run-as-n.patch66
1 files changed, 66 insertions, 0 deletions
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 @@
1Upstream-Status: Pending
2
3From 14734a93bd3fc323325459e24b04795422e395e6 Mon Sep 17 00:00:00 2001
4From: Laurentiu Palcu <laurentiu.palcu@intel.com>
5Date: Mon, 1 Jul 2013 15:38:02 +0300
6Subject: [PATCH] Allow xinput_calibrator_pointercal.sh to be run as normal
7 user
8
9Allow normal user to create their own pointercal.xinput files that
10override the system pointercal file in /etc.
11
12Signed-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
17diff --git a/scripts/xinput_calibrator_pointercal.sh b/scripts/xinput_calibrator_pointercal.sh
18index 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--
651.7.9.5
66