inputcontrol: many knobs for acceleration

We add new inputcontrol command line flags:

--mouse_old_accel

Since we're switching to new mouse pointer acceleration curves, we add
a new crosh option to revert to the old mouse pointer acceleration
curves, to help users that may be unhappy with the change.

--tp_custom_point_accel
--tp_custom_scroll_accel
--mouse_custom_point_accel
--use_tp_custom_point_accel
--use_tp_custom_scroll_accel
--use_mouse_custom_point_accel

For three types of acceleration (tp pointing, tp scrolling (applies to
touchpad and touch mice), and mouse pointing), we have two
options. One allows the specification of a custom acceleration curve,
while the other enables/disables this curve. Note that mouse wheel
acceleration is not tuneable with these flags.

To set a custom curve, one specifies 20 segments, each with the
following four values: x-cutoff, a, b, c. The acceleration code will
find the first segment such that the current speed is under the
x-cutoff (in mm/sec). It will then apply the formula: output_speed =
a(input_speed)^2 + b(input_speed) + c.

So, for example, to set a silly curve that makes the touchpad move
normally at low speed, but move backwards at high speed, you would
run:

inputcontrol --mouse_custom_point_accel=\
80,0,1,0,\
inf,0,-1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0,\
inf,0,1,0
inputcontrol --use_mouse_custom_point_accel=1

Note: inf == infinity

So when speed is < 80mm/sec, out = 0in^2 + 1in + 0 = in. When 80mm/sec
is exceeded, but speed is under infinity: out = 0in^2 + -1in + 0 = -in

To disable this: inputcontrol --use_mouse_custom_point_accel=0

BUG=chromium:359288
TEST=Will add regression test before checking in

Change-Id: I65ab99382c58e92b0f029d32c7e926d04e4738c4
Reviewed-on: https://chromium-review.googlesource.com/209915
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
1 file changed