Home | History | Annotate | Download | only in tools
      1 #!/bin/sh
      2 
      3 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 # This script invokes awk_process_syn to compute and print the
      8 # intervals between SYN_REPORT packets generated by the specified
      9 # touch device.
     10 
     11 # Usage: tools/print_syn.sh
     12 #        press 'q' to terminate
     13 
     14 . /usr/share/misc/shflags
     15 DEFINE_string device "touchpad" "the touch device (touchpad or touchscreen)" "d"
     16 DEFINE_string file "/tmp/interval_event.dat" "the event data filename" "f"
     17 
     18 FLAGS_HELP="USAGE: $PROG [flags]"
     19 
     20 FLAGS "$@" || exit 1
     21 eval set -- "${FLAGS_ARGV}"
     22 set -e
     23 
     24 
     25 # Derive the device node of the specified device.
     26 if [ $FLAGS_device = "touchscreen" ]; then
     27   control_script="/opt/google/touchscreen/tscontrol status"
     28 else
     29   FLAGS_device="touchpad"
     30   control_script="/opt/google/touchpad/tpcontrol status"
     31 fi
     32 
     33 # device_node_info looks like:
     34 #     Device Node (250):      "/dev/input/event8"
     35 device_node_info=`$control_script |  grep -i "Device Node"`
     36 device_node=`echo $device_node_info | sed -n "s/.*\"\(.*\)\"/\1/p"`
     37 echo "device_node for ${FLAGS_device}: $device_node"
     38 
     39 echo "Large intervals are preceded with *****."
     40 echo "Remember to press 'q' to terminate.\n"
     41 
     42 
     43 # Get the directory of the awk script.
     44 SYN_PROG="awk_process_syn"
     45 syn_dir=`dirname $0`
     46 
     47 cmd="DISPLAY=:0 mtplot $device_node | tee $FLAGS_file | $syn_dir/${SYN_PROG}"
     48 echo "Executing ... $cmd"
     49 eval $cmd
     50