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 15DEFINE_string device "touchpad" "the touch device (touchpad or touchscreen)" "d" 16DEFINE_string file "/tmp/interval_event.dat" "the event data filename" "f" 17 18FLAGS_HELP="USAGE: $PROG [flags]" 19 20FLAGS "$@" || exit 1 21eval set -- "${FLAGS_ARGV}" 22set -e 23 24 25# Derive the device node of the specified device. 26if [ $FLAGS_device = "touchscreen" ]; then 27 control_script="/opt/google/touchscreen/tscontrol status" 28else 29 FLAGS_device="touchpad" 30 control_script="/opt/google/touchpad/tpcontrol status" 31fi 32 33# device_node_info looks like: 34# Device Node (250): "/dev/input/event8" 35device_node_info=`$control_script | grep -i "Device Node"` 36device_node=`echo $device_node_info | sed -n "s/.*\"\(.*\)\"/\1/p"` 37echo "device_node for ${FLAGS_device}: $device_node" 38 39echo "Large intervals are preceded with *****." 40echo "Remember to press 'q' to terminate.\n" 41 42 43# Get the directory of the awk script. 44SYN_PROG="awk_process_syn" 45syn_dir=`dirname $0` 46 47cmd="DISPLAY=:0 mtplot $device_node | tee $FLAGS_file | $syn_dir/${SYN_PROG}" 48echo "Executing ... $cmd" 49eval $cmd 50