Andrew de los Reyes | 392288b | 2012-01-21 00:04:51 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 3 | # Use of this source code is governed by a BSD-style license that can be |
| 4 | # found in the LICENSE file. |
| 5 | |
Daniel Kurtz | aa13e90 | 2012-03-14 18:15:52 | [diff] [blame] | 6 | # Log all calls, with arguments, to /var/log/messages |
| 7 | logger "$0" "$@" |
| 8 | |
Andrew de los Reyes | 392288b | 2012-01-21 00:04:51 | [diff] [blame] | 9 | SYNCLIENT=/usr/bin/synclient |
| 10 | |
| 11 | PROG=`basename $0` |
| 12 | COMMAND=$1 |
| 13 | VALUE=$2 |
| 14 | |
| 15 | echo_setting() { |
| 16 | echo $1: `$SYNCLIENT $1` |
| 17 | } |
| 18 | |
| 19 | usage() { |
| 20 | echo "Usage: $PROG {status|taptoclick [on|off]|sensitivity [1-5]}" |
| 21 | } |
| 22 | |
| 23 | VALID=0 |
| 24 | |
| 25 | if [ "$COMMAND" = "status" ] ; then |
| 26 | $SYNCLIENT -l |
| 27 | VALID=1 |
| 28 | elif [ "$COMMAND" = "taptoclick" ] ; then |
| 29 | if [ "$VALUE" = "on" ] ; then |
| 30 | $SYNCLIENT "MaxTapTime=180" |
| 31 | VALID=1 |
| 32 | elif [ "$VALUE" = "off" ] ; then |
| 33 | $SYNCLIENT "MaxTapTime=0" |
| 34 | VALID=1 |
| 35 | fi |
| 36 | elif [ "$COMMAND" = "sensitivity" ] ; then |
| 37 | case $VALUE in |
| 38 | 1) |
| 39 | $SYNCLIENT "MinSpeed=0.5" |
| 40 | $SYNCLIENT "MaxSpeed=1.0" |
| 41 | $SYNCLIENT "AccelFactor=0.015" |
| 42 | $SYNCLIENT "VertScrollDelta=36" |
| 43 | VALID=1 |
| 44 | ;; |
| 45 | 2) |
| 46 | $SYNCLIENT "MinSpeed=0.8" |
| 47 | $SYNCLIENT "MaxSpeed=1.5" |
| 48 | $SYNCLIENT "AccelFactor=0.03" |
| 49 | $SYNCLIENT "VertScrollDelta=27" |
| 50 | VALID=1 |
| 51 | ;; |
| 52 | 3) |
| 53 | $SYNCLIENT "MinSpeed=1" |
| 54 | $SYNCLIENT "MaxSpeed=2" |
| 55 | $SYNCLIENT "AccelFactor=0.045" |
| 56 | $SYNCLIENT "VertScrollDelta=18" |
| 57 | VALID=1 |
| 58 | ;; |
| 59 | 4) |
| 60 | $SYNCLIENT "MinSpeed=1.5" |
| 61 | $SYNCLIENT "MaxSpeed=3" |
| 62 | $SYNCLIENT "AccelFactor=0.06" |
| 63 | $SYNCLIENT "VertScrollDelta=9" |
| 64 | VALID=1 |
| 65 | ;; |
| 66 | 5) |
| 67 | $SYNCLIENT "MinSpeed=2" |
| 68 | $SYNCLIENT "MaxSpeed=5" |
| 69 | $SYNCLIENT "AccelFactor=0.075" |
| 70 | $SYNCLIENT "VertScrollDelta=4" |
| 71 | VALID=1 |
| 72 | ;; |
| 73 | esac |
| 74 | fi |
| 75 | |
| 76 | if [ $VALID = 0 ] ; then |
| 77 | usage |
| 78 | fi |