drop support for X
We aren't using X anywhere in the system anymore, so drop all the
scripts/logic that only works with it.
BUG=chromium:842060
TEST=precq passes
Change-Id: I63b591fa0daf190e43b3d749377bffdcad8789d3
Reviewed-on: https://chromium-review.googlesource.com/1055307
Commit-Ready: Mike Frysinger <[email protected]>
Tested-by: Mike Frysinger <[email protected]>
Reviewed-by: Chung-yih Wang <[email protected]>
diff --git a/99-inputcontrol.rules b/99-inputcontrol.rules
old mode 100755
new mode 100644
index 0b203d6..ddc2260
--- a/99-inputcontrol.rules
+++ b/99-inputcontrol.rules
@@ -1,6 +1,4 @@
# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-ACTION!="remove", SUBSYSTEM=="input", ENV{ID_INPUT_MOUSE}=="1", RUN+="/opt/google/input/device_added"
-ACTION!="remove", SUBSYSTEM=="input", ENV{ID_INPUT_TOUCHPAD}=="1", RUN+="/opt/google/input/device_added"
KERNEL=="event*", NAME="input/%k", MODE="660", GROUP="input"
diff --git a/Makefile b/Makefile
old mode 100755
new mode 100644
index cf10d16..1d096c9
--- a/Makefile
+++ b/Makefile
@@ -2,76 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-MOUSE_SCRIPTS=\
- common \
- mousecontrol
-
-MOUSE_SCRIPTS_DIR=/opt/google/mouse
-
-TP_SCRIPTS=\
- tpcontrol \
- tpcontrol_synclient \
- tpcontrol_xinput
-
-TP_SCRIPTS_DIR=/opt/google/touchpad
-
-TS_SCRIPTS=toggle_touch_event_logging
-
-TS_SCRIPTS_DIR=/opt/google/touchscreen
-
-SCRIPTS=\
- device_added
-
-X_SCRIPTS=\
- xinput.sh \
- inputcontrol \
- cmt_feedback \
- evdev_feedback \
- touch_noise_feedback \
- send_input_metrics
-
-SCRIPTS_DIR=/opt/google/input/
-
UDEV_RULE=99-inputcontrol.rules
MODPROBE_CONF=modprobe.d/inputcontrol.conf
-INIT_DIR=/etc/init
-
-UPSTART_CONF=\
- input-metrics.conf \
- mouse.conf
-
DESTDIR = .
-X_DEPS := $(MOUSE_SCRIPTS) $(TP_SCRIPTS) $(X_SCRIPTS) \
- $(UDEV_RULE) $(UPSTART_CONF)
-
-install_x: $(X_DEPS)
- mkdir -p $(DESTDIR)/$(MOUSE_SCRIPTS_DIR)
- cp -p $(MOUSE_SCRIPTS) $(DESTDIR)/$(MOUSE_SCRIPTS_DIR)
- chmod 0755 $(DESTDIR)/$(MOUSE_SCRIPTS_DIR)/*
- mkdir -p $(DESTDIR)/$(TP_SCRIPTS_DIR)
- cp -p $(TP_SCRIPTS) $(DESTDIR)/$(TP_SCRIPTS_DIR)
- chmod 0755 $(DESTDIR)/$(TP_SCRIPTS_DIR)/*
- mkdir -p $(DESTDIR)/$(TS_SCRIPTS_DIR)
- cp -p $(TS_SCRIPTS) $(DESTDIR)/$(TS_SCRIPTS_DIR)
- chmod 0755 $(DESTDIR)/$(TS_SCRIPTS_DIR)/*
- mkdir -p $(DESTDIR)/$(SCRIPTS_DIR)
- cp -p $(X_SCRIPTS) $(DESTDIR)/$(SCRIPTS_DIR)
- chmod 0755 $(DESTDIR)/$(SCRIPTS_DIR)/*
-
- install -d $(DESTDIR)$(INIT_DIR)
- install -m 0644 $(UPSTART_CONF) $(DESTDIR)$(INIT_DIR)
-
-ifneq ($(HAVE_XINPUT),0)
-install: install_x
-endif
-
install: $(SCRIPTS)
- mkdir -p $(DESTDIR)/$(SCRIPTS_DIR)
- cp -p $(SCRIPTS) $(DESTDIR)/$(SCRIPTS_DIR)
- chmod 0755 $(DESTDIR)/$(SCRIPTS_DIR)/*
install -D -m 0644 $(MODPROBE_CONF) \
$(DESTDIR)/etc/$(MODPROBE_CONF)
install -D -m 0644 $(UDEV_RULE) \
diff --git a/cmt_feedback b/cmt_feedback
deleted file mode 100755
index 8fa943f..0000000
--- a/cmt_feedback
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger -- "$0" "$@"
-
-# Tar up the logs and uuencode them, since feedback needs to text.
-base=/home/chronos/user/log
-if [ "$1" = "alt" ]; then
- base=/tmp/touchpad
- mkdir -p $base
-fi
-
-# Dump the logs
-/opt/google/input/inputcontrol --log --logdir="$base"
-
-tar cf - $(ls -1t $base/touchpad_activity_* | head -n 7 ) \
- $(ls -1t $base/cmt_input_events_* | head -n 7 ) 2>/dev/null | \
- uuencode -m touchpad_activity_log.tar
diff --git a/common b/common
deleted file mode 100755
index 9b51091..0000000
--- a/common
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# TODO(josephsih): need to have some way to derive this list
-# from system attributes automatically.
-DEVICES_WITHOUT_BUILT_IN_TOUCHPAD="stumpy"
-
-set_pref_vars() {
- local name=$1
- PREF_FILE=$(eval echo \$PREF_${name}_FILE)
- PREF_VALID=$(eval echo \$PREF_${name}_VALID)
- PREF_DEFAULT=$(eval echo \$PREF_${name}_DEFAULT)
-}
-
-load_pref() {
- local name="$1"
- set_pref_vars "$name"
- local file_size="$(stat -c %s $PREF_FILE)"
- if [ "$file_size" != "2" ]; then
- # invalid file size
- echo "$PREF_DEFAULT"
- return
- fi
- local value="$(cat "$PREF_FILE")"
- case $value in
- $PREF_VALID) echo "$value";;
- *) echo "$PREF_DEFAULT";;
- esac
-}
-
-store_pref() {
- local name="$1"
- local value="$2"
- set_pref_vars "$name"
- case $value in
- $PREF_VALID) ;;
- *) return;;
- esac
- echo $value > "$PREF_FILE"
-}
-
-list_input_device() {
- xinput --list --id-only
-}
-
-get_device_name() {
- if [ -z "$1" ]; then
- return 1
- fi
- xinput --list --name-only $1
-}
-
-canonical_ids() {
- # In case minus number is passed, truncate it to the last 4 hexdigits.
- # e.g., -16360 -> ffffffffffffc018 -> c018
- local id_strings id_str first
- read id_strings
- for id_str in $id_strings; do
- if [ -n "$first" ]; then
- printf ":"
- fi
- printf "%04x" "$id_str" | sed 's/.*\(.\{4\}\)$/\1/'
- first="not"
- done
-}
-
-vendor_product_for_xinput_id() {
- local xinput_id="$1"
-
- local vp="$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Product ID" | \
- cut -d : -f 2 | sed 's/,//' | canonical_ids)"
- if ! echo "${vp}" | grep -q ':'; then
- vp="$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Vendor ID" | \
- cut -d : -f 2 | canonical_ids)"
- vp="${vp}:$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Product ID" | \
- cut -d : -f 2 | canonical_ids)"
- fi
- echo "$vp"
-}
-
-is_multitouch_mouse() {
- # Whitelist of multitouch mice.
- case "$(vendor_product_for_xinput_id $1)" in
- "05ac:030d") true;; # Apple magicmouse (BT)
- "046d:4026") true;; # Logitech T400 (Unifying)
- "046d:4027") true;; # Logitech T620 (Unifying)
- "046d:b00d") true;; # Logitech Touch Mouse (BT)
- *) false;;
- esac
-}
-
-find_pad() {
- # Print the ID for any device that uses out touchpad driver,
- # including touch mice. We do this by looking for a magic
- # property.
- local device_id
- for device_id in $(list_input_device); do
- if $XINPUT list-props ${device_id} 2>/dev/null | \
- grep -q '^[[:blank:]]Integrated Touchpad (' ; then
- echo ${device_id}
- elif is_multitouch_mouse ${device_id}; then
- echo ${device_id}
- fi
- done
-}
-
-find_touchscreen() {
- # Use xinput to find if any touchscreen device is present. Then find its
- # device ID number.
- local device_id
- for device_id in $(list_input_device); do
- if get_device_name ${device_id} | grep -q '[tT]ouch[sS]creen'; then
- echo ${device_id}
- fi
- done
-}
-
-# Returns the xinput ID of the newly attached mouse. If X hasn't loaded a driver
-# for the new mouse, yet, this will not print anything. If found, it prints the
-# xinput ID. The env var DEVNAME must be set (as it is by udev).
-get_added_xinput_id() {
- # Must have $DEVNAME set
- if [ -z "$DEVNAME" ]; then
- return
- fi
- # Get the list of xinput IDs:
- local ids="$($XINPUT list | sed 's/.*id=\([0-9]*\).*/\1/g')"
- if [ -z "$ids" ]; then
- return
- fi
- for id in $ids; do
- local test_node=$($XINPUT list-props $id | grep "Device Node" | \
- cut -d '"' -f 2)
- if [ "$test_node" = "$DEVNAME" ]; then
- echo $id
- return
- fi
- done
-}
-
-wait_and_get_added_xinput_id() {
- tries=10
- while [ "$tries" -ne "0" ]; do
- tries=$((tries - 1))
- newid=$(get_added_xinput_id)
- if [ -n "$newid" ]; then
- break
- fi
- sleep 1
- done
- echo $newid
-}
diff --git a/device_added b/device_added
deleted file mode 100755
index 47070b9..0000000
--- a/device_added
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger -- "$0" "$@" "$DEVNAME"
-
-# inputcontrol can't configure devices without xinput yet
-test -x /usr/bin/xinput || exit 0
-
-/opt/google/input/inputcontrol --add="$DEVNAME" &
diff --git a/evdev_feedback b/evdev_feedback
deleted file mode 100755
index afe5cd6..0000000
--- a/evdev_feedback
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger -- "$0" "$@"
-
-base=/home/chronos/user/log
-if [ "$1" = "alt" ]; then
- base=/tmp/touchpad
- mkdir -p $base
-fi
-
-/opt/google/input/inputcontrol --log --logdir="$base"
-
-tar cf - $(ls -1t $base/evdev_input_events_* | head -n 7 ) 2>/dev/null | \
- uuencode -m touchscreen_activity_log.tar
diff --git a/input-metrics.conf b/input-metrics.conf
deleted file mode 100755
index d0638f1..0000000
--- a/input-metrics.conf
+++ /dev/null
@@ -1,11 +0,0 @@
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-
-description "Job to report input metrics"
-author "[email protected]"
-
-start on started metrics_daemon and stopped udev-trigger-early
-
-exec /opt/google/input/send_input_metrics
diff --git a/inputcontrol b/inputcontrol
deleted file mode 100755
index 0186340..0000000
--- a/inputcontrol
+++ /dev/null
@@ -1,325 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-logger -- "$0" "$@"
-
-. /usr/share/misc/shflags
-. $(dirname "$0")/xinput.sh
-
-# Sets mouse sensitivity preference
-apply_mouse_sensitivity() {
- device_set_prop "$1" "Pointer Sensitivity" "$2"
- device_set_prop "$1" "Scroll Sensitivity" "$2"
-}
-
-# Sets touchpad sensitivity preference
-apply_touchpad_sensitivity() {
- device_set_prop "$1" "Pointer Sensitivity" "$2"
- device_set_prop "$1" "Scroll Sensitivity" "$2"
-}
-
-apply_mouse_swap_lr() {
- local map="1 2 3"
- if [ "$2" -eq 1 ]; then
- map="3 2 1"
- fi
- log "$XINPUT get-button-map $1 | sed \"s/^[0-9]* [0-9]* [0-9]*/$map/\" | \
- xargs $XINPUT set-button-map $1"
- $XINPUT get-button-map "$1" | sed "s/^[0-9]* [0-9]* [0-9]*/$map/" | \
- xargs $XINPUT set-button-map "$1"
-}
-
-apply_tp_custom_point_accel() {
- the_id="$1"
- values="$(echo "$2" | sed 's/,/ /g')"
- $XINPUT set-prop "$the_id" "Pointer Accel Curve" \
- $values
-}
-
-apply_tp_custom_scroll_accel() {
- the_id="$1"
- values="$(echo "$2" | sed 's/,/ /g')"
- $XINPUT set-prop "$the_id" "Scroll Accel Curve" \
- $values
-}
-
-apply_mouse_custom_point_accel() {
- the_id="$1"
- values="$(echo "$2" | sed 's/,/ /g')"
- $XINPUT set-prop "$the_id" "Mouse Pointer Accel Curve" \
- $values
-}
-
-# Generate activity log files for all devices
-generate_logs() {
- local devices="$1"
- local now=$(date '+%Y%m%d-%H%M%S')
- local raw_file="/var/log/xorg/touchpad_activity_log.txt"
- local cmt_log_file="/var/log/xorg/cmt_input_events.dat"
- local evdev_log_file="/var/log/xorg/evdev_input_events.dat"
-
- local out_dir="$2"
- local out_prefix="touchpad_activity_"
- local cmt_out_prefix="cmt_input_events_"
- local evdev_out_prefix="evdev_input_events_"
-
- # Dump log files for each device
- for device in $devices ; do
- local name=$(device_get_canonical_name $device)
- local out_file="${out_dir}/${out_prefix}${now}.$device.$name"
- local cmt_out_file="${out_dir}/${cmt_out_prefix}${now}.$device.$name"
- local evdev_out_file="${out_dir}/${evdev_out_prefix}${now}.$device.$name"
-
- if ! device_is_touchscreen $device; then
- device_set_prop $device "Logging Notify" 1
- fi
- device_set_prop $device "Dump Debug Log" 1
-
- # Wait for writing to the files to complete. We do this by waiting for
- # two consecutive checks in which the file size of the logs doesn't
- # change.
- local raw_size="-1"
- local events_size="-1"
- local max_iterations=6
- while true; do
- if device_is_touchscreen $device; then
- local raw_size_new=0
- local events_size_new=$(stat -c %s $evdev_log_file)
- else
- local raw_size_new=$(stat -c %s $raw_file)
- local events_size_new=$(stat -c %s $cmt_log_file)
- fi
-
- if [ $raw_size -eq $raw_size_new -a \
- $events_size -eq $events_size_new ]; then
- break
- fi
- max_iterations=$((max_iterations - 1))
- if [ $max_iterations -lt 0 ]; then
- break
- fi
- sleep 0.5
- raw_size=$raw_size_new
- events_size=$events_size_new
- done
-
- if [ -d $out_dir ]; then
- if device_is_touchscreen $device ; then
- cp "$evdev_log_file" "$evdev_out_file"
- else
- gzip -c --stdout "$raw_file" > "$out_file"
- gzip -c --stdout "$cmt_log_file" > "$cmt_out_file"
- fi
- else
- echo "\"$out_dir\" is not a directory."
- fi
- done
-
- # Delete old log files
- if [ -d $out_dir ]; then
- del="$(ls -t ${out_dir}/${out_prefix}* | grep -v ${now})"
- del="${del} $(ls -t ${out_dir}/${cmt_out_prefix}* | grep -v ${now})"
- del="${del} $(ls -t ${out_dir}/${evdev_out_prefix}* | grep -v ${now})"
- for file in $del ; do
- rm -f "$file"
- done
- fi
-}
-
-# Mouse specific device setup
-setup_mouse() {
- local device="$1"
- device_set_prop $device "Device Accel Profile" -1
- device_set_prop $device "Device Accel Constant Deceleration" 1
- device_set_prop $device "Device Accel Velocity Scaling" 1
-}
-
-# Detup device preferences and properties
-setup_device() {
- local device=$1
- apply_all_preferences $device
-
- if device_is_mouse $device; then
- setup_mouse $device
- fi
-}
-
-# Helper method to add flags that set user preferences
-DEFINE_prop_preference() {
- local name="$2"
- local prop_name="$5"
- eval "apply_${name} () { device_set_prop \"\$1\" \"${prop_name}\" \"\$2\"; }"
- DEFINE_preference "$1" "$2" "$3" "$4"
-}
-
-DEFINE_preference() {
- local name=$2
-
- DEFINE_string ${name} '' "$3 set ${name} preference"
- eval "pref_${name}_type=\"$1\""
- eval "pref_${name}_validator=\"$3\""
- eval "pref_${name}_default=\"$4\""
- preferences="$preferences $name"
-}
-
-DEFINE_string 'type' 'all' 'type of devices to operate on' 't'
-DEFINE_string 'id' '' 'id to operate on' 'i'
-DEFINE_boolean 'verbose' false \
- 'show xinput commands executed by this script' 'v'
-DEFINE_boolean 'list' false 'list device xinput ids'
-DEFINE_boolean 'hwprops' false 'print hardware properties of device'
-DEFINE_boolean 'names' false 'list device ids and their names'
-DEFINE_boolean 'status' false 'show devices status'
-DEFINE_string 'add' '' 'to be called by udev when a new device is added'
-DEFINE_boolean 'refresh' false 're-apply preferences to all selected devices'
-
-DEFINE_boolean 'log' false 'generate activityt log files'
-DEFINE_string 'logdir' '/home/chronos/user/log' \
- 'use with --log. Choose target directory'
-
-DEFINE_prop_preference touchpad tapdrag "[01]" "0" "Tap Drag Enable"
-DEFINE_prop_preference touchpad tapclick "[01]" "1" "Tap Enable"
-DEFINE_prop_preference touchpad t5r2_three_finger_click "[01]" "0" \
- "T5R2 Three Finger Click Enable"
-DEFINE_prop_preference multitouch australian_scrolling "[01]" "1" \
- "Australian Scrolling"
-DEFINE_prop_preference nontouch_mouse mouse_australian_scrolling "[01]" "0" \
- "Australian Scrolling"
-DEFINE_preference touchpad touchpad_sensitivity "[12345]" "3"
-DEFINE_preference mouse mouse_sensitivity "[12345]" "3"
-DEFINE_preference mouse mouse_swap_lr "[01]" "0"
-DEFINE_prop_preference mouse mouse_old_accel "[01]" "0" \
- "Old Mouse Accel Curves"
-
-default_curve_string() {
- # Trick to print this string (up to % sign) 20 times
- printf "inf 0 1 0 %.0s" {1..20}
-}
-
-DEFINE_preference touchpad tp_custom_point_accel "*" \
- "$(default_curve_string)"
-DEFINE_preference multitouch tp_custom_scroll_accel "*" \
- "$(default_curve_string)"
-DEFINE_preference mouse mouse_custom_point_accel "*" \
- "$(default_curve_string)"
-
-DEFINE_prop_preference touchpad use_tp_custom_point_accel "[01]" "0" \
- "Use Custom Touchpad Pointer Accel Curve"
-DEFINE_prop_preference multitouch use_tp_custom_scroll_accel "[01]" "0" \
- "Use Custom Touchpad Scroll Accel Curve"
-DEFINE_prop_preference mouse use_mouse_custom_point_accel "[01]" "0" \
- "Use Custom Mouse Pointer Accel Curve"
-
-main() {
- if ! [ -z ${FLAGS_add} ] ; then
- local device=$(wait_and_get_added_device ${FLAGS_add})
- setup_device $device
- return
- fi
-
- # Determine list of devices to use for commands
- local devices=""
- if ! [ -z "${FLAGS_id}" ] ; then
- devices=${FLAGS_id}
- else
- case ${FLAGS_type} in
- mouse) devices=$(list_mice);;
- touchpad) devices=$(list_touchpads);;
- touchscreen) devices=$(list_touchscreens);;
- multitouch) devices=$(list_multitouch);;
- multitouchmouse) devices=$(list_multitouch_mice);;
- all) devices=$(list_devices);;
- *)
- echo "error: unknown device type ${FLAGS_type}" >&2
- flags_help
- ;;
- esac
- fi
-
- # Process preferences that have been set in arguments
- for pref in $preferences; do
- flag="$(eval echo \${FLAGS_$pref})"
- if ! [ -z "$flag" ]; then
- if validate_preference "$pref" "$flag"; then
- apply_preference "$pref" "$devices" "$flag"
- save_preference "$pref" "$flag"
- fi
- fi
- done
-
- # Refresh other properties of touchpads/mice.
- # We do this here because Chrome doesn't call --refresh.
- # We abuse chrome's calls to set sensitivity.
- if ! [ -z ${FLAGS_mouse_sensitivity} ] ; then
- devs="$(list_mice)"
- for dev in $devs; do
- setup_device $dev
- done
- fi
- if ! [ -z ${FLAGS_touchpad_sensitivity} ] ; then
- devs="$(list_touchpads)"
- for dev in $devs; do
- setup_device $dev
- done
- fi
-
- # Process commands
- if [ ${FLAGS_list} -eq ${FLAGS_TRUE} ] ; then
- if ! [ -z $devices ]; then
- echo $devices
- fi
- fi
- if [ ${FLAGS_hwprops} -eq ${FLAGS_TRUE} ] ; then
- for device in $devices; do
- local path=$(device_get_string_prop "$device" "Device Node")
- log "evemu-describe $path"
- evemu-describe $path
- if [ $? -ne 0 ]; then
- exit 1
- fi
- done
- fi
- if [ ${FLAGS_status} -eq ${FLAGS_TRUE} ] ; then
- for device in $devices; do
- device_status $device
- done
- fi
- if [ ${FLAGS_names} -eq ${FLAGS_TRUE} ] ; then
- for device in $devices; do
- echo "${device}: $(device_get_name $device)"
- done
- fi
- if [ ${FLAGS_log} -eq ${FLAGS_TRUE} ] ; then
- generate_logs "$devices" "${FLAGS_logdir}"
- fi
- if [ ${FLAGS_refresh} -eq ${FLAGS_TRUE} ] ; then
- for device in $devices; do
- setup_device $device
- done
- fi
-
- # Process "Property Name=Value" arguments
- for arg; do
- if echo $arg | grep -q =; then
- local name="${arg%%=*}"
- local value="${arg#*=}"
- for device in $devices; do
- device_set_prop "$device" "$name" "$value"
- done
- else
- flags_help
- fi
- done
-}
-
-if [ $# = 0 ] ; then
- flags_help
- exit 1
-fi
-
-# parse the command-line
-FLAGS "$@" || exit $?
-eval set -- "${FLAGS_ARGV}"
-main "$@"
diff --git a/mouse.conf b/mouse.conf
deleted file mode 100755
index df9fa7f..0000000
--- a/mouse.conf
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-start on started ui
-
-script
- set +e
- export DISPLAY=:0
- export XAUTHORITY=/home/chronos/.Xauthority
-
- tries=10
- while [ "$tries" -gt 0 ]; do
- tries=$((tries - 1))
- xinput list >/dev/null 2>&1
- RC="$?"
- if [ "$RC" -eq 0 ]; then
- /opt/google/input/inputcontrol --refresh
- exit 0
- fi
- sleep 1
- done
-end script
diff --git a/mousecontrol b/mousecontrol
deleted file mode 100755
index 24f73dc..0000000
--- a/mousecontrol
+++ /dev/null
@@ -1,309 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger "$0" "$@"
-
-XINPUT=/usr/bin/xinput
-
-PROG=`basename $0`
-COMMAND=$1
-
-SCREEN_DPI=125
-
-. $(dirname "$0")/common
-
-export DISPLAY=:0
-export XAUTHORITY=/home/chronos/.Xauthority
-
-# On disk preferences
-PREF_SENS_FILE=/home/chronos/user/mouse_sensitivity
-PREF_SENS_VALID="[12345]"
-PREF_SENS_DEFAULT=3
-PREF_SWAP_LR_FILE=/home/chronos/user/mouse_swap_lr_buttons
-PREF_SWAP_LR_VALID="[01]"
-PREF_SWAP_LR_DEFAULT=0
-
-# We are supposed to set an xinput setting as screen DPI * a multiplier that
-# describes how fast the mouse should be (user preference). This function
-# returns that product.
-# We use multipliers of: 1, 1.4, 1.8, 2, 2.2. The low three have a slope that
-# stops rising after speeds of 5 in/sec (hence 500 hundredths of an inch/sec
-# param). See xorg-server's dix/ptrveloc.c for more info on the acceleration
-# algorithm.
-thresh_and_dpi_times_sensitivity_multiplier() {
- local sens=$1 # 1..5
- case $sens in
- 1) echo 500 $SCREEN_DPI;;
- 2) echo 500 $(((SCREEN_DPI * 7) / 5));;
- 3) echo 500 $(((SCREEN_DPI * 9) / 5));;
- 4) echo 0 $((SCREEN_DPI * 2));;
- 5) echo 0 $(((SCREEN_DPI * 11) / 5));;
- esac
-}
-
-# Applies the given sensitivity preference (1..5) to all mice attached to the
-# system. If this is called when a new device is being connected, that new
-# device probably won't show up yet, so this won't apply to it.
-apply_sensitivity() {
- local sens="$1"
- local mice="$2"
- local thresh_and_acc="$(thresh_and_dpi_times_sensitivity_multiplier "$sens")"
- if [ -z "$thresh_and_acc" ]; then
- return
- fi
- for mouse in $mice ; do
- if is_multitouch_mouse ${mouse}; then
- $XINPUT set-prop ${mouse} "Pointer Sensitivity" "${sens}"
- else
- $XINPUT set-ptr-feedback $mouse $thresh_and_acc 1
- fi
- done
-}
-
-# Applies the preference for whether or not to swap the left and right mouse
-# buttons on all existing mice attached to the system. If this is called when a
-# new device is being connected, that new device probably won't show up yet, so
-# this won't apply to it.
-apply_swap_lr() {
- local value="$1"
- local mice="$2"
- local map="1 2 3"
- if [ "$value" -eq 1 ]; then
- map="3 2 1"
- fi
- for mouse in $mice ; do
- $XINPUT get-button-map $mouse | sed "s/^[0-9]* [0-9]* [0-9]*/$map/" | \
- xargs $XINPUT set-button-map $mouse
- done
-}
-
-# Remaps buttons for a device
-apply_button_remap() {
- local xinput_ids="$1"
-
- for xinput_id in $xinput_ids ; do
- local vp="$(vendor_product_for_xinput_id $xinput_id)"
- # 0304: USB Mighty Mouse, 030c: BT Mighty Mouse
- if [ "$vp" = "05ac:0304" -o "$vp" = "05ac:030c" ]; then
- $XINPUT get-button-map $xinput_id | awk \
- '{ for (i=1; i <= NF; i++) { \
- if (i == 8) { printf 0 } else { printf $(i) }; printf " " \
- } } END{ print "" }' | \
- xargs $XINPUT set-button-map $xinput_id
- fi
- done
-}
-
-apply_cpi_for_mouse() {
- local mouse="$1"
- if is_multitouch_mouse $1; then
- $XINPUT set-prop $mouse "Mouse CPI" $(get_cpi $mouse)
- $XINPUT set-prop $mouse "Device Accel Profile" -1
- $XINPUT set-prop $mouse "Device Accel Constant Deceleration" 1
- $XINPUT set-prop $mouse "Device Accel Velocity Scaling" 1
- else
- $XINPUT set-prop $mouse "Device Accel Constant Deceleration" \
- $(get_cpi $mouse)
- $XINPUT set-prop $mouse "Device Accel Velocity Scaling" 1
- fi
-}
-
-# Applies the correct CPI to the given mice
-apply_cpi() {
- local mice="$1"
- for mouse in $mice ; do
- apply_cpi_for_mouse $mouse
- done
-}
-
-# Prints out all xinput IDs for all existing attached mice. If this is called
-# when a new device is being connected, that new device probably won't show up
-# yet, so this won't apply to it.
-find_mice() {
- # Search for an xinput entry that contains the "slave pointer"
- # Then, find a field that matches "id=".
- # Lastly, return the part of the field after the '='.
- local slave_pointers="$($XINPUT list | \
- awk '/slave *pointer/ { for (i=1; i<NF; i++) \
- if ($i ~/id=/) print substr($i, 4) }')"
- # Next, return only those slave pointers that are using the Evdev driver
- for pointer in $slave_pointers ; do
- local match=$($XINPUT list-props $pointer | grep "Evdev" | wc -l)
- if [ "$match" != "0" ]; then
- echo -n " $pointer"
- elif is_multitouch_mouse ${pointer}; then
- echo -n " ${pointer}"
- fi
- done
-}
-
-# WARNING: This table is now deprecated. If you want to add new entries to it,
-# please instead add a new section in the 20-mouse.conf file in the xorg-conf
-# package.
-#
-# Returns the CPI (counts per inch) of the newly attached mouse. Since mice
-# generally don't report CPI, we use the following approach: By default, we
-# assume a CPI of 1000, as this is quite close to most mice on the market today
-# (2012 time frame). For mice that we know aren't near 1000, we have a database
-# of CPI values.
-get_cpi() {
- local xinput_id="$1"
-
- local vp="$(vendor_product_for_xinput_id $xinput_id)"
-
- # Database of mice that have CPI (DPI) significantly off from 1000.
- local cpi=1000; # Default CPI
- local trackpoint_cpi=400; # Approximate, since CPI doesn't exactly apply
- case $vp in
- "0002:000a") cpi=$trackpoint_cpi;; # PS/2 IBM Trackpoint
- "045e:0024") cpi=400;; # Microsoft Corp. Trackball Explorer*
- "045e:0040") cpi=416;; # Microsoft Corp. Wheel Mouse Optical
- "0461:4d22") cpi=474;; # Standard Dell
- "046d:1028") cpi=600;; # M570 trackball[u]
- "046d:400e") cpi=400;; # K400 touchpad[u]
- "046d:4024") cpi=400;; # K400r touchpad[u]
- "046d:c00f") cpi=385;; # Logitech MouseMan Traveler/Mobile
- "046d:c00"*) cpi=385;; # Old Logitech Mice (copying 0xc00f setting)
- "046d:c014") cpi=425;; # HP branded "Logitech Optical USB Mouse"
- "046d:c016") cpi=377;; # HP branded "Logitech, Inc. Optical Wheel Mouse"
- "046d:c018") cpi=530;; # "Logitech, Inc. Optical Wheel Mouse" model M-UAE96
- "046d:c03d") cpi=434;; # Logitech M-BT96a Pilot Optical Mouse
- "046d:c03e") cpi=464;; # Logitech Premium Optical Wheel Mouse (M-BT58)
- "046d:c077") cpi=580;; # HP branded "Logitech USB Optical Mouse"
- # According to http://www.linux-usb.org/usb.ids , these are 4 trackballs:
- "046d:c40"*) cpi=300;; # Logitech Trackballs*
- "046d:c508") cpi=300;; # Cordless Trackball
- "047d:1002") cpi=300;; # Kensington Turbo Mouse Pro (trackball)*
- "047d:1003") cpi=300;; # Kensington Orbit TrackBall (trackball)*
- "047d:1005") cpi=300;; # Kensington TurboBall (trackball)*
- "047d:1006") cpi=300;; # Kensington TurboRing (trackball)*
- "047d:1009") cpi=300;; # Kensington Orbit TrackBall for Mac (trackball)*
- "047d:1020") cpi=300;; # Kensington Expert Mouse (trackball)*
- "047d:2041") cpi=300;; # Kensington SlimBlade Trackball (trackball)*
- "04d9:2519") cpi=400;; # FAVI Wireless Keyboard (TouchPad)*
- "05ac:0304") cpi=400;; # Apple USB Optical Mouse (Mighty Mouse)
- "05ac:030c") cpi=400;; # Apple BT Optical Mouse (Mighty Mouse)
- "05ac:030d") cpi=1780;; # Apple magicmouse (BT)
- "05ac:"*) cpi=373;; # Apple mice (other)
- "06cb:0009") cpi=$trackpoint_cpi;; # USB IBM Trackpoint
- "0a5c:8502") cpi=400;; # FAVI Wireless Keyboard (TouchPad), Bluetooth*
- "0c45:7000") cpi=400;; # FAVI Entertainment Wireless Keyboard (TouchPad)*
- "1532:0016") cpi=1714;; # Razer USA, Ltd DeathAdder RZ01-0015
- "17ef:6009") cpi=$trackpoint_cpi;; # Lenovo ThinkPad Keyboard w/ TrackPoint
- "17ef:6014") cpi=400;; # Lenovo N5901 multimedia keyboard/trackball*
- "17ef:602b") cpi=400;; # Lenovo N5902 multimedia keyboard/OFN*
- "1997:0409") cpi=400;; # Riitek Rii Mote i6 (TouchPad)*
- "413c:3012") cpi=502;; # Dell Computer Corp. Optical Wheel Mouse
- esac
- # * Trackball/touchpad measurements are approximate
- # [u] This device uses the unifying receiver
- echo $cpi
-}
-
-# Kernel's Apple magicmouse driver by default will interpret mouse events, and
-# we would like to turn off this interpretation.
-fixup_apple_magicmouse_driver_parameters() {
- if [ "$(vendor_product_for_xinput_id $1)" != "05ac:030d" ]; then
- return
- fi
- echo 0 > /sys/module/hid_magicmouse/parameters/emulate_3button
- echo 0 > /sys/module/hid_magicmouse/parameters/emulate_scroll_wheel
-}
-
-# Add is a special command that's run possibly before xinput detects the mice.
-# It's run from udev. We handle this here, rather than below, since a newly
-# plugged device may not show up in xinput yet.
-if [ "$COMMAND" = "add" ]; then
- newid=$(wait_and_get_added_xinput_id)
- if [ -z "$newid" ]; then
- return
- fi
- apply_cpi_for_mouse $newid
-
- sens=$(load_pref SENS)
- apply_sensitivity $sens "$newid"
- swap_lr=$(load_pref SWAP_LR)
- apply_swap_lr $swap_lr "$newid"
- apply_button_remap "$newid"
-
- fixup_apple_magicmouse_driver_parameters "$newid"
-
- exit 0
-fi
-
-usage() {
- echo "Usage:" \
- "$PROG {listdev|add|status|sensitivity [1-5]|swap_left_right" \
- "[01]|set property value}"
-}
-
-MICE=$(find_mice)
-if [ -z "$MICE" ]; then
- exit 0
-fi
-VALID=0
-
-# If no args passed, print usage
-if [ $# = 0 ] ; then
- usage
- exit 1
-fi
-
-while true ; do
- COMMAND=$1
- VALID=0
-
- if [ $# = 0 ] ; then
- # If no commands remain, we're done
- exit 0
- elif [ "$COMMAND" = "listdev" ] ; then
- for mouse in $MICE ; do
- echo "${mouse}"
- done
- VALID=1
- shift
- elif [ "$COMMAND" = "status" ] ; then
- for mouse in $MICE ; do
- echo "Details for mouse ${mouse}:"
- $XINPUT list-props $mouse
- $XINPUT get-feedbacks $mouse
- done
- VALID=1
- shift
- elif [ "$COMMAND" = "sensitivity" -a -n "$2" ] ; then
- sens="$2"
- store_pref SENS "$sens"
- apply_sensitivity "$sens" "$MICE"
- VALID=1
- shift 2
- elif [ "$COMMAND" = "swap_left_right" -a -n "$2" ] ; then
- value="$2"
- store_pref SWAP_LR "$value"
- apply_swap_lr "$value" "$MICE"
- VALID=1
- shift 2
- elif [ "$COMMAND" = "refresh" ] ; then
- apply_cpi "$MICE"
- apply_button_remap "$MICE"
- apply_sensitivity $(load_pref SENS) "$MICE"
- apply_swap_lr $(load_pref SWAP_LR) "$MICE"
- VALID=1
- shift
- elif [ "$COMMAND" = "set" -a -n "$2" -a -n "$3" ] ; then
- prop=$2
- value=$3
- for mouse in $MICE ; do
- $XINPUT set-prop $mouse "$prop" "$value"
- done
- VALID=1
- shift 3
- fi
-
- if [ $VALID = 0 ] ; then
- usage
- exit 1
- fi
-done
diff --git a/send_input_metrics b/send_input_metrics
deleted file mode 100755
index 5cca20e..0000000
--- a/send_input_metrics
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger -- "$0" "$@"
-
-. /opt/google/input/xinput.sh
-
-# Determine whether this device has a built-in touchpad by checking
-# DEVICES_WITHOUT_BUILT_IN_TOUCHPAD.
-check_built_in_touchpad_by_list() {
- BOARD=`grep CHROMEOS_RELEASE_BOARD= /etc/lsb-release | awk -F = '{print $2}'`
- echo "$DEVICES_WITHOUT_BUILT_IN_TOUCHPAD" | grep -v "$BOARD"
-}
-
-# Look up if the touchpad default driver conf exists. Note that the touchpad
-# default driver conf exists only on a device with a built-in touchpad.
-touchpad_default_driver_conf_exists() {
- TOUCHPAD_DEFAULT_DRIVER=touchpad-cmt
- XORG_CONF=/etc/X11/xorg.conf.d
- ls "$XORG_CONF" | grep "$TOUCHPAD_DEFAULT_DRIVER"
-}
-
-is_touchpad_builtin() {
- # If the touchpad default driver conf exists, the device definitely has a
- # built-in touchpad.
- # In some rare cases, the touchpad default driver conf may not exist
- # for a short period due to some special reasons. In those cases, we should
- # make sure to update the DEVICES_WITHOUT_BUILT_IN_TOUCHPAD for devices
- # without built-in touchpads.
- touchpad_default_driver_conf_exists || check_built_in_touchpad_by_list
-}
-
-# Define the DEVICE state.
-# Note that the following device state is not supported yet:
-# TP_PRESENT_NO_TP_EXPECTED
-# NO_TP_PRESENT_TP_EXPECTED_RESUME
-# TP_PRESENT_TP_EXPECTED_RESUME
-NO_TP_PRESENT_NO_TP_EXPECTED=0
-TP_PRESENT_NO_TP_EXPECTED=1
-NO_TP_PRESENT_TP_EXPECTED_BOOT=2
-TP_PRESENT_TP_EXPECTED_BOOT=3
-NO_TP_PRESENT_TP_EXPECTED_RESUME=4
-TP_PRESENT_TP_EXPECTED_RESUME=5
-DEVICE_MIN=0
-DEVICE_MAX=5
-DEVICE_COUNT=$(($DEVICE_MAX - $DEVICE_MIN + 1))
-
-# Probe the touchpad status.
-is_touchpad_found() {
- if is_touchpad_builtin; then
- if [ -n "$DEVICE" ]; then
- DEVICE=$TP_PRESENT_TP_EXPECTED_BOOT
- else
- DEVICE=$NO_TP_PRESENT_TP_EXPECTED_BOOT
- fi
- else
- DEVICE=$NO_TP_PRESENT_NO_TP_EXPECTED
- fi
-}
-
-# Report the existence of touchpad device
-is_touchpad_found
-echo $DEVICE > /tmp/input_device_state
-metrics_client Touchpad.Device $DEVICE $DEVICE_MIN $DEVICE_MAX $DEVICE_COUNT
diff --git a/toggle_touch_event_logging b/toggle_touch_event_logging
deleted file mode 100755
index c453689..0000000
--- a/toggle_touch_event_logging
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-logger "$0" "$@"
-
-export DISPLAY=:0.0
-export XAUTHORITY=/home/chronos/.Xauthority
-
-. /opt/google/mouse/common
-
-for device_id in $(find_touchscreen); do
- # Only process device id that's integer
- if echo $device_id | egrep -q '^[0-9]+$'; then
- xinput set-prop $device_id --type=int --format=32 "Enable Debug Log" $1
- fi
-done
diff --git a/touch_noise_feedback b/touch_noise_feedback
deleted file mode 100755
index f2971df..0000000
--- a/touch_noise_feedback
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger -- "$0" "$@"
-
-TOUCH_NOISE_LOG="/var/log/xorg/touch_noise.log"
-if [ -f "$TOUCH_NOISE_LOG" ]; then
- gzip -c "$TOUCH_NOISE_LOG" | uuencode -m touch_noise_log.gz
-fi
diff --git a/tpcontrol b/tpcontrol
deleted file mode 100755
index f6a407f..0000000
--- a/tpcontrol
+++ /dev/null
@@ -1,114 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger "$0" "$@"
-
-VALID=1
-SYN_ENABLE="/home/chronos/.syntp_enable"
-PROG=`basename $0`
-COMMAND=$1
-VALUE=$2
-WANT_USAGE=0
-
-
-# Check if syntp is installed
-if [ -x /opt/Synaptics/bin/tpcontrol_syncontrol ]; then
- SYNTP_INSTALLED=1
-else
- SYNTP_INSTALLED=0
-fi
-
-# Global verbs usage message
-gusage() {
- # One usage message per global command; only output syntp usage if it is
- # supported in the current configuration
- if [ "x$SYNTP_INSTALLED" = "x1" ] ; then
- echo "Usage: $PROG {syntp [on|off]}"
- fi
-}
-
-
-# Global verbs here
-#
-# A global verb is one which is applied to all underlying tpcontrol utilities;
-# in the case of "mostly global" verbs, we have to do extra testing to drop
-# them out when they don't apply.
-#
-# Note: "status" is a special verb, since we want to add any global verb
-# status reports to the end of the underlying tpcontrol utilities status
-#
-
-#
-# syntp verb is only valid if $SYNTP_INSTALLED
-#
-if [ "$COMMAND" = "syntp" -a "x$SYNTP_INSTALLED" = "x1" ] ; then
- if [ "$VALUE" = "off" ] ; then
- /bin/rm -f "$SYN_ENABLE"
- exit 0
- elif [ "$VALUE" = "on" ] ; then
- /usr/bin/touch "$SYN_ENABLE"
- exit 0
- else
- # bad command; force usage via pseudo-command (unimplemented) "usage"
- WANT_USAGE=1
- fi
-fi
-
-
-# Fall through to handle other commands; we source the script so it can
-# tell us whether or not it's valid by picking up the 'VALID' environment
-# variable.
-
-# Select an underlying tpcontrol command to run
-if [ "x$SYNTP_INSTALLED" = "x1" -a \
- -n "$(find /dev -maxdepth 1 -type c -name 'serio_raw*' -print -quit)" ]; \
- then
- # Configure using tpcontrol_syncontrol if it exists, and there is a
- # /dev/serio_raw* char device for syntp to use. This lets the code work
- # after a switch but before a restart of the ui.
- CONTROL=/opt/Synaptics/bin/tpcontrol_syncontrol
-elif [ -x /usr/bin/xinput ] ; then
- # TODO(djkurtz): This is fragile, for now it works because xinput is only
- # installed in /usr/bin/ if cmt USE flag is set when building libcros.
- CONTROL=/opt/google/touchpad/tpcontrol_xinput
-else
- CONTROL=/opt/google/touchpad/tpcontrol_synclient
-fi
-
-# Run the underlying command
-#
-# NOTE: This is sourcing the script, not calling it in a subshell
-#
-# We only WANT_USAGE if we had a global command and it failed; we make
-# this explicit as a call, since the previous implementation was confusing
-if [ "x$WANT_USAGE" = "x1" ] ; then
- . $CONTROL usage
-else
- . $CONTROL
-fi
-
-# Append global verb status results; for commands which aren't applicable to
-# the current configuration, a test must be done to disable status for
-# particular global commands
-if [ "$COMMAND" = "status" ] ; then
- # the status only applies to the syntp command if it is enabled
- if [ "x$SYNTP_INSTALLED" = "x1" ] ; then
- if [ -f "$SYN_ENABLE" ]; then
- echo "syntp: on"
- else
- echo "syntp: off"
- fi
- fi
-fi
-
-# for invalid input, append our usage to that of the underlying command
-# which has had its usage message forced previously
-if [ "x$VALID" = "x0" ] ; then
- gusage
- exit 1
-fi
-
-exit 0
diff --git a/tpcontrol_synclient b/tpcontrol_synclient
deleted file mode 100755
index 41714d6..0000000
--- a/tpcontrol_synclient
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger "$0" "$@"
-
-SYNCLIENT=/usr/bin/synclient
-
-PROG=`basename $0`
-COMMAND=$1
-VALUE=$2
-
-echo_setting() {
- echo $1: `$SYNCLIENT $1`
-}
-
-usage() {
- echo "Usage: $PROG {status|taptoclick [on|off]|sensitivity [1-5]}"
-}
-
-VALID=0
-
-if [ "$COMMAND" = "status" ] ; then
- $SYNCLIENT -l
- VALID=1
-elif [ "$COMMAND" = "taptoclick" ] ; then
- if [ "$VALUE" = "on" ] ; then
- $SYNCLIENT "MaxTapTime=180"
- VALID=1
- elif [ "$VALUE" = "off" ] ; then
- $SYNCLIENT "MaxTapTime=0"
- VALID=1
- fi
-elif [ "$COMMAND" = "sensitivity" ] ; then
- case $VALUE in
- 1)
- $SYNCLIENT "MinSpeed=0.5"
- $SYNCLIENT "MaxSpeed=1.0"
- $SYNCLIENT "AccelFactor=0.015"
- $SYNCLIENT "VertScrollDelta=36"
- VALID=1
- ;;
- 2)
- $SYNCLIENT "MinSpeed=0.8"
- $SYNCLIENT "MaxSpeed=1.5"
- $SYNCLIENT "AccelFactor=0.03"
- $SYNCLIENT "VertScrollDelta=27"
- VALID=1
- ;;
- 3)
- $SYNCLIENT "MinSpeed=1"
- $SYNCLIENT "MaxSpeed=2"
- $SYNCLIENT "AccelFactor=0.045"
- $SYNCLIENT "VertScrollDelta=18"
- VALID=1
- ;;
- 4)
- $SYNCLIENT "MinSpeed=1.5"
- $SYNCLIENT "MaxSpeed=3"
- $SYNCLIENT "AccelFactor=0.06"
- $SYNCLIENT "VertScrollDelta=9"
- VALID=1
- ;;
- 5)
- $SYNCLIENT "MinSpeed=2"
- $SYNCLIENT "MaxSpeed=5"
- $SYNCLIENT "AccelFactor=0.075"
- $SYNCLIENT "VertScrollDelta=4"
- VALID=1
- ;;
- esac
-fi
-
-if [ $VALID = 0 ] ; then
- usage
-fi
diff --git a/tpcontrol_xinput b/tpcontrol_xinput
deleted file mode 100755
index f828dbc..0000000
--- a/tpcontrol_xinput
+++ /dev/null
@@ -1,270 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Log all calls, with arguments, to /var/log/messages
-logger "$0" "$@"
-
-XINPUT=/usr/bin/xinput
-
-export DISPLAY=:0
-export XAUTHORITY=/home/chronos/.Xauthority
-
-. /opt/google/mouse/common
-
-PROG=`basename $0`
-COMMAND=$1
-
-# On disk preferences
-PREF_SENS_FILE=/home/chronos/user/touchpad_sensitivity
-PREF_SENS_VALID="[12345]"
-PREF_SENS_DEFAULT=3
-PREF_TAP_FILE=/home/chronos/user/touchpad_tap_enable
-PREF_TAP_VALID="[01]"
-PREF_TAP_DEFAULT=0
-PREF_T5R2_3FCLICK_FILE=/home/chronos/user/touchpad_t5r2_3f_click_enable
-PREF_T5R2_3FCLICK_VALID="[01]"
-PREF_T5R2_3FCLICK_DEFAULT=0
-PREF_3FSWIPE_FILE=/home/chronos/user/touchpad_3f_swipe_enable
-PREF_3FSWIPE_VALID="[01]"
-PREF_3FSWIPE_DEFAULT=0
-PREF_TAPDRAG_FILE=/home/chronos/user/touchpad_tap_drag_enable
-PREF_TAPDRAG_VALID="[01]"
-PREF_TAPDRAG_DEFAULT=0
-
-# For tpcontrol firmware trials
-TP_FIRMWARE_TRIAL_SELECTION_FILE=/var/cache/touch_trial/selection
-TP_FIRMWARE_TRIAL_CHOICES_FILE=/opt/google/touchpad/firmware/choices
-
-print_firmware_selection() {
- selected=$(cat "${TP_FIRMWARE_TRIAL_SELECTION_FILE}")
- while read CHOICE; do
- if [ "${selected}" = "${CHOICE}" ]; then
- printf "[${CHOICE}] "
- else
- printf "${CHOICE} "
- fi
- done < "${TP_FIRMWARE_TRIAL_CHOICES_FILE}"
- printf "\n"
-}
-
-usage() {
- echo "Usage:"\
- "$PROG {status|log ['alt']|tap_dragging [on|off]|"\
- "taptoclick [on|off]|sensitivity [1-5]|"\
- "t5r2_three_finger_click [on|off]|"\
- "three_finger_swipe [on|off]|"\
- "set <property> <value>|add|listdev}"
-}
-
-# echos "0" (off) or "1" (on) on success, or nothing on failure.
-parse_bool() {
- local value="$1"
- case $value in
- "on"|"1")
- echo "1"
- ;;
- "off"|"0")
- echo "0"
- ;;
- esac
-}
-
-# Sets VALID to 1 (valid input) or 0 (invalid input)
-apply_on_off_prop() {
- local prop_name="$1"
- local value="$2"
- local pref_name="$3"
-
- local num_val=$(parse_bool "$value")
- if [ -n "$num_val" ]; then
- for DEVICE in $DEVICES ; do
- $XINPUT set-prop $DEVICE "$prop_name" "$num_val"
- done
- store_pref "$pref_name" "$num_val"
- VALID=1
- else
- VALID=0
- fi
-}
-
-# If no args passed, print usage
-if [ $# = 0 ] ; then
- usage
- exit 1
-fi
-
-DEVICES="$(find_pad)"
-while true; do
- COMMAND=$1
- VALID=0
-
- if [ $# = 0 ] ; then
- # If no commands remain, we're done
- exit 0
- elif [ "$COMMAND" = "status" ] ; then
- for DEVICE in $DEVICES ; do
- echo DEVICE: $DEVICE
- $XINPUT list-props $DEVICE
- done
- VALID=1
- shift
- elif [ "$COMMAND" = "log" -a \( $# = 1 -o $# = 2 \) ] ; then
- # This must be the last command on the line b/c it has variable args
- now=$(date '+%Y%m%d-%H%M%S')
- for DEVICE in $DEVICES ; do
- DEVNAME="$(get_device_name $DEVICE | sed 's/[^a-zA-Z0-9]/_/g')"
- raw_file=/var/log/xorg/touchpad_activity_log.txt
- cmt_log_file=/var/log/xorg/cmt_input_events.dat
- $XINPUT set-prop $DEVICE "Logging Notify" 1
- $XINPUT set-prop $DEVICE "Dump Debug Log" 1
-
- # Wait for writing to the files to complete. We do this by waiting for
- # two consecutive checks in which the file size of the logs doesn't
- # change.
- raw_size="-1"
- cmt_size="-1"
- max_iterations=6
- while true; do
- raw_size_new=$(stat -c %s $raw_file)
- cmt_size_new=$(stat -c %s $cmt_log_file)
- if [ $raw_size -eq $raw_size_new -a $cmt_size -eq $cmt_size_new ]; then
- break
- fi
- max_iterations=$((max_iterations - 1))
- if [ $max_iterations -lt 0 ]; then
- break
- fi
- sleep 0.5
- raw_size=$raw_size_new
- cmt_size=$cmt_size_new
- done
-
- out_dir=/home/chronos/user/log
- if [ "$2" = "alt" ]; then
- out_dir=/debugd/touchpad
- fi
- out_prefix=touchpad_activity_
- out_file="${out_dir}/${out_prefix}${now}.$DEVICE.$DEVNAME"
- cmt_out_prefix=cmt_input_events_
- cmt_out_file="${out_dir}/${cmt_out_prefix}${now}.$DEVICE"
- if [ ! -d $out_dir ]; then
- echo "User not logged in, so not moving log to user dir"
- else
- gzip -c --stdout "$raw_file" > "$out_file"
- gzip -c --stdout "$cmt_log_file" > "$cmt_out_file"
- # Delete old log files
- del="$(ls -t ${out_dir}/${out_prefix}* | grep -v ${now})"
- del="${del} $(ls -t ${out_dir}/${cmt_out_prefix}* | grep -v ${now})"
- for file in $del ; do
- rm -f "$file"
- done
- fi
- done
- VALID=1
- shift $#
- elif [ "$COMMAND" = "tap_dragging" -a -n "$2" ] ; then
- VALUE=$2
- apply_on_off_prop "Tap Drag Enable" "$VALUE" "TAPDRAG"
- shift 2
- elif [ "$COMMAND" = "taptoclick" -a -n "$2" ] ; then
- VALUE=$2
- apply_on_off_prop "Tap Enable" "$VALUE" "TAP"
- shift 2
- elif [ "$COMMAND" = "sensitivity" -a -n "$2" ] ; then
- VALUE=$2
- for DEVICE in $DEVICES ; do
- if ! is_multitouch_mouse ${DEVICE}; then
- $XINPUT set-prop $DEVICE "Pointer Sensitivity" "$VALUE"
- fi
- $XINPUT set-prop $DEVICE "Scroll Sensitivity" "$VALUE"
- done
- store_pref SENS "$VALUE"
- VALID=1
- shift 2
- elif [ "$COMMAND" = "three_finger_click" -a -n "$2" ] ; then
- # 3F click is no longer experimental -> ignore this command
- true
- shift 2
- elif [ "$COMMAND" = "t5r2_three_finger_click" -a -n "$2" ] ; then
- VALUE=$2
- apply_on_off_prop "T5R2 Three Finger Click Enable" "$VALUE" "T5R2_3FCLICK"
- shift 2
- elif [ "$COMMAND" = "three_finger_swipe" -a -n "$2" ] ; then
- VALUE=$2
- apply_on_off_prop "Three Finger Swipe Enable" "$VALUE" "3FSWIPE"
- shift 2
- elif [ "$COMMAND" = "set" -a -n "$2" -a -n "$3" ] ; then
- PROP=$2
- VALUE=$3
- for DEVICE in $DEVICES ; do
- $XINPUT set-prop $DEVICE "$PROP" "$VALUE"
- done
- VALID=1
- shift 3
- elif [ "$COMMAND" = "firmware" -a $# = 1 ]; then
- # firmware must be the last command on the line
- if [ -e "${TP_FIRMWARE_TRIAL_SELECTION_FILE}" ] &&
- [ -e "${TP_FIRMWARE_TRIAL_CHOICES_FILE}" ]; then
- # List firmwares available for trial
- print_firmware_selection
- else
- echo "Touchpad trial firmwares not supported."
- fi
- VALID=1
- shift
- elif [ "$COMMAND" = "firmware" -a $# = 2 ]; then
- # firmware must be the last command on the line
- VALUE=$2
- if [ -e "${TP_FIRMWARE_TRIAL_SELECTION_FILE}" ] &&
- [ -e "${TP_FIRMWARE_TRIAL_CHOICES_FILE}" ]; then
- FOUND=0
- while read CHOICE; do
- if [ "${VALUE}" = "${CHOICE}" ]; then
- FOUND=1
- break
- fi
- done < "${TP_FIRMWARE_TRIAL_CHOICES_FILE}"
- if [ ${FOUND} -eq 1 ]; then
- printf "${VALUE}" > "${TP_FIRMWARE_TRIAL_SELECTION_FILE}"
- echo "Selected ${VALUE} as touchpad trial firmware. Reboot to apply."
- else
- echo "Please select one of these :"
- print_firmware_selection
- fi
- else
- echo "Touchpad trial firmwares not supported."
- fi
- VALID=1
- shift 2
- elif [ "$COMMAND" = "add" ] ; then
- # New device. Set sensitivity/tap enable
- # Give some time for device to arrive, if necessary
- DEVICE=$(wait_and_get_added_xinput_id)
- if [ -z "$DEVICE" ]; then
- logger New touchpad device not found with xinput: $DEVNAME
- fi
- if ! is_multitouch_mouse ${DEVICE}; then
- $XINPUT set-prop $DEVICE "Pointer Sensitivity" "$(load_pref SENS)"
- fi
- $XINPUT set-prop $DEVICE "Scroll Sensitivity" "$(load_pref SENS)"
- $XINPUT set-prop $DEVICE "Tap Drag Enable" "$(load_pref TAPDRAG)"
- $XINPUT set-prop $DEVICE "Tap Enable" "$(load_pref TAP)"
- $XINPUT set-prop $DEVICE "T5R2 Three Finger Click Enable" \
- "$(load_pref T5R2_3FCLICK)"
- $XINPUT set-prop $DEVICE "Three Finger Swipe Enable" \
- "$(load_pref 3FSWIPE)"
- VALID=1
- shift
- elif [ "$COMMAND" = "listdev" ] ; then
- find_pad
- VALID=1
- shift
- fi
-
- if [ $VALID = 0 ] ; then
- usage
- exit 1
- fi
-done
diff --git a/xinput.sh b/xinput.sh
deleted file mode 100755
index cdee454..0000000
--- a/xinput.sh
+++ /dev/null
@@ -1,332 +0,0 @@
-#!/bin/sh
-# Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-XINPUT=/usr/bin/xinput
-
-export DISPLAY=:0
-export XAUTHORITY=/home/chronos/.Xauthority
-
-pref_folder="/home/chronos/user/cmt"
-if ! [ -d $pref_folder ]; then
- mkdir $pref_folder
-fi
-if [ "$(id -u)" -eq 0 ]; then
- chown chronos:chronos $pref_folder
-fi;
-# Functions for storing preferences
-# A preference requires the following global variables:
-# pref_${pref}_type: device type this preference is appllied on
-# pref_${pref}_validator: a batch match to validate the preference value
-# pref_${pref}_default: default value
-# apply_${pref}: function to apply the preference to a device
-# Also a list of all preference names is stored in the variable: preferences
-
-apply_preference() {
- local pref="$1"
- local type="$(eval echo \"\${pref_${pref}_type}\")"
- local value="$3"
- for device in $2; do
- if device_is_${type} $device; then
- log "Applying $pref=$value to device $device"
- apply_${pref} "$device" "$value"
- fi
- done
-}
-
-apply_all_preferences() {
- local devices="$1"
- for pref in $preferences; do
- local value="$(load_preference $pref)"
- for device in $devices; do
- apply_preference $pref $device "$value"
- done
- done
-}
-
-validate_preference() {
- local pref="$1"
- local value="$2"
- local validator="$(eval echo \"\${pref_${pref}_validator}\")"
- case $value in
- $validator) true ;;
- *)
- echo "invalid value '${value}' for preference ${pref}" >&2
- false
- ;;
- esac
-}
-
-transition_legacy_pref_file() {
- local pref=$1
- local new_file="$pref_folder/$pref"
-
- case $pref in
- "mouse_sensitivity") filename="mouse_sensitivity" ;;
- "touchpad_sensitivity") filename="touchpad_sensitivity" ;;
- "mouse_swap_lr") filename="mouse_swap_lr_buttons" ;;
- "tapclick") filename="touchpad_tap_enable" ;;
- "tapdrag") filename="touchpad_tap_drag_enable" ;;
- "t5r2_three_finger_click") filename="touchpad_t5r2_3f_click_enable" ;;
- *) return ;;
- esac
-
- legacy_file="/home/chronos/user/$filename"
- if [ -f $legacy_file ]; then
- log "mv $legacy_file $new_file"
- mv $legacy_file $new_file
- chown chronos:chronos $new_file
- fi
-}
-
-load_preference() {
- assert_eq $# 1
- local pref="$1"
- local default="$(eval echo \"\${pref_${pref}_default}\")"
- local file="$pref_folder/$pref"
-
- # The new inputcontrol script uses a different file path to store preferences
- # Make sure to copy the old setting over when the new file does not yet exist.
- if [ ! -f $file ]; then
- transition_legacy_pref_file $pref
- fi
-
- if [ ! -f $file ]; then
- echo $default
- return
- fi
-
- local file_size="$(stat -c %s $file)"
- if [ "$file_size" -gt "1000" ]; then
- # invalid file size
- echo $default
- return
- fi
-
- local value="$(cat ${file})"
- if validate_preference $pref "$value"; then
- echo $value
- else
- echo $default
- fi
-}
-
-save_preference() {
- assert_eq $# 2
- local pref="$1"
- local value="$2"
- local pref_file="$pref_folder/$pref"
-
- if validate_preference "$pref" "$value"; then
- log "echo $value > $pref_file"
- echo "$value" > $pref_file
- fi
-}
-
-# Functions to access information about a device
-
-device_get_name() {
- assert_eq $# 1
- xinput --list --name-only $1
-}
-
-device_get_canonical_name() {
- assert_eq $# 1
- device_get_name $device | sed 's/[^a-zA-Z0-9]/_/g'
-}
-
-device_set_prop() {
- assert_eq $# 3
- log "$XINPUT set-prop \"$1\" \"$2\" $3"
- $XINPUT set-prop "$1" "$2" $3
-}
-
-device_get_prop() {
- assert_eq $# 2
- $XINPUT list-props $1 | awk "/$2/ { print \$4 }"
-}
-
-device_get_bool_prop() {
- assert_eq $# 2
- prop=$(device_get_prop $1 "$2")
- [ "$prop" = "1" ]
-}
-
-device_get_string_prop() {
- assert_eq $# 2
- prop=$(device_get_prop $1 "$2")
- # get rid of " around value via eval
- eval echo $prop
-}
-
-device_is_mouse() {
- assert_eq $# 1
- device_get_bool_prop $1 "Device Mouse"
-}
-
-device_is_multitouch() {
- assert_eq $# 1
- device_get_bool_prop $1 "Device Touchpad"
-}
-
-device_is_touchpad() {
- assert_eq $# 1
- ! device_is_mouse $1 && device_is_multitouch $1
-}
-
-device_is_multitouch_mouse() {
- assert_eq $# 1
- device_is_mouse $1 && device_is_multitouch $1
-}
-
-device_is_nontouch_mouse() {
- assert_eq $# 1
- device_is_mouse $1 && ! device_is_multitouch $1
-}
-
-device_is_touchscreen() {
- assert_eq $# 1
- device_get_name $1 | grep -q '[tT]ouch[sS]creen'
-}
-
-device_is_valid() {
- assert_eq $# 1
- device_is_mouse $1 || device_is_multitouch $1 || device_is_touchscreen $1
-}
-
-device_status() {
- assert_eq $# 1
- if device_is_valid $1; then
- echo
- echo "ID $1:"
- $XINPUT list-props $1
- fi;
-}
-
-# Functions to list devices
-
-list_devices() {
- # optional first argument is filter method
- local filter=device_is_valid
- if ! [ -z $1 ]; then
- filter=$1
- fi
-
- # Search for an xinput entry that contains the "slave pointer"
- # Then, find a field that matches "id=".
- # Lastly, return the part of the field after the '='.
- local devices="$($XINPUT list | \
- awk '/.*slave.*/ { for (i=1; i<NF; i++) \
- if ($i ~/id=/) print substr($i, 4) }')"
-
- for device in $devices ; do
- if $filter $device; then
- echo -n " ${device}"
- fi
- done
-}
-
-list_mice() {
- list_devices device_is_mouse
-}
-
-list_touchpads() {
- list_devices device_is_touchpad
-}
-
-list_touchscreens() {
- list_devices device_is_touchscreen
-}
-
-list_multitouch() {
- list_devices device_is_multitouch
-}
-
-list_multitouch_mice() {
- list_devices device_is_multitouch_mouse
-}
-
-# Returns the xinput ID of the newly attached mouse. If X hasn't loaded a driver
-# for the new mouse, yet, this will not print anything. If found, it prints the
-# xinput ID.
-get_device_by_devname() {
- # Get the list of xinput IDs:
- local ids="$(list_devices)"
- if [ -z "$ids" ]; then
- return
- fi
- for id in $ids; do
- local test_node=$(device_get_prop $id "Device Node")
- if [ "$test_node" = "\"$1\"" ]; then
- echo $id
- return
- fi
- done
-}
-
-wait_and_get_added_device() {
- tries=10
- while [ "$tries" -ne "0" ]; do
- tries=$((tries - 1))
- newid=$(get_device_by_devname $1)
- if [ -n "$newid" ]; then
- echo $newid
- return
- fi
- sleep 1
- done
-}
-
-
-canonical_ids() {
- # In case minus number is passed, truncate it to the last 4 hexdigits.
- # e.g., -16360 -> ffffffffffffc018 -> c018
- local id_strings id_str first
- read id_strings
- for id_str in $id_strings; do
- if [ -n "$first" ]; then
- printf ":"
- fi
- printf "%04x" "$id_str" | sed 's/.*\(.\{4\}\)$/\1/'
- first="not"
- done
-}
-
-device_get_vendor_product() {
- local xinput_id="$1"
-
- local vp="$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Product ID" | \
- cut -d : -f 2 | sed 's/,//' | canonical_ids)"
- if ! echo "${vp}" | grep -q ':'; then
- vp="$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Vendor ID" | \
- cut -d : -f 2 | canonical_ids)"
- vp="${vp}:$(xinput list-props $xinput_id 2>/dev/null \
- | fgrep "Device Product ID" | \
- cut -d : -f 2 | canonical_ids)"
- fi
- echo "$vp"
-}
-
-
-# Helper for debugging in bash
-
-log() {
- if [ ${FLAGS_verbose} -eq ${FLAGS_TRUE} ] ; then
- echo "$@" >&2
- fi
-}
-
-assert_eq() {
- if [ "$1" -ne "$2" ]; then
- echo "${FUNCNAME[1]}: Assertion '$1' == '$2' failed" >&2
- exit -1
- fi
-}
-
-# FUNCNAME is only available in BASH. Disable assert_eq on all other shells.
-if [ -z "$BASH_VERSION" ]; then
- assert_eq() { true; }
-fi