Skip to content

Commit

Permalink
xinput_calibrator_pointercal.sh: specify output type since 'auto' doe…
Browse files Browse the repository at this point in the history
…sn't always pick 'xinput'

Also deal with pointercal files that contain '# replace with valid machine specific pointercal.xinput'

Signed-off-by: Koen Kooi <[email protected]>
  • Loading branch information
koenkooi committed Feb 28, 2012
1 parent 268bbc4 commit e73eb2c
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions scripts/xinput_calibrator_pointercal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,26 @@
#
# original script: Martin Jansa <[email protected]>, 2010-01-31
# updated by Tias Guns <[email protected]>, 2010-02-15
# updated by Koen Kooi <[email protected]>, 2012-02-28

PATH="/usr/bin:$PATH"

BINARY="xinput_calibrator"
CALFILE="/etc/pointercal.xinput"
LOGFILE="/var/log/xinput_calibrator.pointercal.log"

if [ -e $CALFILE ] ; then
echo "Using calibration data stored in $CALFILE"
. $CALFILE
else
CALDATA=`$BINARY -v | tee $LOGFILE | grep ' xinput set' | sed 's/^ //g; s/$/;/g'`
if [ ! -z "$CALDATA" ] ; then
echo $CALDATA > $CALFILE
echo "Calibration data stored in $CALFILE (log in $LOGFILE)"
if grep replace $CALFILE ; then
echo "Empty calibration file found, removing it"
rm $CALFILE
else
echo "Using calibration data stored in $CALFILE"
. $CALFILE && exit 0
fi
fi

CALDATA=`$BINARY --output-type xinput -v | tee $LOGFILE | grep ' xinput set' | sed 's/^ //g; s/$/;/g'`
if [ ! -z "$CALDATA" ] ; then
echo $CALDATA > $CALFILE
echo "Calibration data stored in $CALFILE (log in $LOGFILE)"
fi

0 comments on commit e73eb2c

Please sign in to comment.