chromiumos/platform/xf86-input-cmt.git
16 months agoProperties: Switch to new Gestures properties API 35/59135/4 factory-4455.B factory-pit-4390.B factory-pit-4471.B firmware-falco_peppy-4389.B firmware-leon-4389.26.B firmware-pit-4482.B firmware-wolf-4389.24.B master release-R29-4319.B release-R30-4537.B stabilize-4443.B stabilize-4512.B
Andrew de los Reyes [Fri, 12 Apr 2013 15:45:04 +0000 (08:45 -0700)]
Properties: Switch to new Gestures properties API

Switch to the new API which supports array-based properties.

BUG=chromium:251407
TEST=Unittests pass. Tested that using xinput to change array values
works correctly, in that both xinput gives the correct values back and
gestures library sees the correct values. Regression tests show no
change in the first 4 significant digits of all scores.
CQ-DEPEND=CL:59133

Change-Id: I76f6a19762df7bb626f095cb78cf8bbae729e98a
Reviewed-on: https://gerrit.chromium.org/gerrit/59135
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Andrew de los Reyes <adlr@chromium.org>

17 months agoAdd support for the metrics gesture 29/55729/4 factory-4290.B factory-pit-4280.B factory-spring-4262.B stabilize-4255.B stabilize-4287.B
Tai-Hsu Lin [Mon, 20 May 2013 07:27:42 +0000 (15:27 +0800)]
Add support for the metrics gesture

This patch adds support for the metrics gesture (GestureMetrics) in
cmt. The metrics gesture is used to expose vital stats that we
would like to catch with the UMA system in Chrome. We currently catches
the ground noise pattern and send them with the metrics gesture.

BUG=chromium:237683
TEST=Based on https://gerrit.chromium.org/gerrit/55727/
On link:
$ DISPLAY=:0.0 xinput list-props 11 | grep "Metrics"

One should see:
        Metrics Noisy Ground Distance (403):    10.000000
        Metrics Noisy Ground Time (404):        0.100000

To watch for the metrics gesture, use command:
$ DISPLAY=:0.0 xinput test-xi2 11 | grep "9:"

With the default distance threshold (10.0), it should be impossible
to trigger the check. Try to quickly move finger on the touchpad and
make sure no line shows up. Now, change the threshold value to 0.1 with
the following line:

$ DISPLAY=:0.0 xinput set-float-prop 11 403 0.1

Quickly move finger back and forth on the touchpad again, one should
now see various lines coming up with the above watch command:

$ DISPLAY=:0.0 xinput test-xi2 11 | grep "9:"
                      Detail for Valuator 9:
                9: 0.00 (0.00)
                9: 0.00 (0.00)
                9: 0.00 (0.00)
                9: 0.00 (0.00)
                ...

CQ-DEPEND=I5e6c9bd5489f4e5aeb90e0d7d7f48cd3e068d08f

Change-Id: Ib30c43f55439a5bb45e0c983f8a8d5057e056048
Reviewed-on: https://gerrit.chromium.org/gerrit/55729
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Tai-Hsu Lin <sheckylin@chromium.org>
Tested-by: Tai-Hsu Lin <sheckylin@chromium.org>
20 months agoSend ordinal values. These are unaccelerated values for the 51/42951/3 factory-4128.B factory-spring-3842.B factory-spring-4131.B firmware-spring-3824.4.B firmware-spring-3824.55.B firmware-spring-3824.84.B firmware-spring-3824.B firmware-spring-3833.B release-R26-3701.B release-R27-3912.B release-R28-4100.B stabilize-3701.30.0 stabilize-3701.30.0b stabilize-3701.46.B stabilize-3701.81.B stabilize-3881.0.B stabilize-3912.79.B stabilize-4008.0.B stabilize-4035.0.B stabilize-4068.0.B stabilize-4100.38.B stabilize-bluetooth-smart stabilize-spring-4100.53.B toolchain-3701.42.B toolchainA toolchainB
David Moore [Fri, 8 Feb 2013 21:41:52 +0000 (13:41 -0800)]
Send ordinal values. These are unaccelerated values for the
various events that allow the client to choose which values
to use.

BUG=chromium-os:36802
TEST=On device

Change-Id: I7c3c0eba73dac16014bcea0fdd6bc43b5c69f5a5
Reviewed-on: https://gerrit.chromium.org/gerrit/42951
Tested-by: Dave Moore <davemoore@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Dave Moore <davemoore@chromium.org>

20 months agoCleaned up some code in gesture.c 02/39802/4
David Moore [Mon, 17 Dec 2012 22:37:51 +0000 (14:37 -0800)]
Cleaned up some code in gesture.c

Change-Id: Iebeab1b02462b7f4c0153e02736f13d83a389d8d
BUG=None
TEST=None
Reviewed-on: https://gerrit.chromium.org/gerrit/39802
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Queue: Dave Moore <davemoore@chromium.org>
Tested-by: Dave Moore <davemoore@chromium.org>
20 months agoSend FlingStart on SwipeLift 07/42807/2
David Moore [Wed, 6 Feb 2013 23:49:17 +0000 (15:49 -0800)]
Send FlingStart on SwipeLift

Change-Id: I80ae812b34d5533eb5751e0f5364b1639e0dbf1e
BUG=chromium:124830
TEST=None
Reviewed-on: https://gerrit.chromium.org/gerrit/42807
Tested-by: Dave Moore <davemoore@chromium.org>
Commit-Queue: Dave Moore <davemoore@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
21 months agoPass through device class info for touchscreen 35/41235/2 stabilize-3658.0.0
Yufeng Shen [Mon, 14 Jan 2013 21:31:27 +0000 (16:31 -0500)]
Pass through device class info for touchscreen

So this passes through the EvdevClassTouchscreen from libevdev to
gesture device class as GESTURES_DEVCLASS_TOUCHSCREEN.

BUG=chrome-os-partner:17222
TEST=plugin stantum touch device, make sure there is no error msg
     in /var/log/Xorg.0.log    like
[114197.687] (EE) ERROR:src/gestures.cc:314:Filters are not composed yet!

Change-Id: I349a37939db7890883f99f5f969afd38eaef9725
CQ-DEPEND=Idc4e2f7e
Reviewed-on: https://gerrit.chromium.org/gerrit/41235
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Yufeng Shen <miletus@chromium.org>
Tested-by: Yufeng Shen <miletus@chromium.org>
21 months agoAdd device class for multi-touch mice 21/41321/2
Che-Liang Chiou [Tue, 15 Jan 2013 22:54:49 +0000 (14:54 -0800)]
Add device class for multi-touch mice

BUG=chromium-os:36322
TEST=On Snow, Magic Mouse works (though its gestures are interpreted as
     a touchpad)

Change-Id: Id90f5c279fab65101f6124574e5aa8c450f0eafd
Reviewed-on: https://gerrit.chromium.org/gerrit/41321
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Queue: Che-Liang Chiou <clchiou@chromium.org>

22 months agoAvoid downcast to float for time values 10/39910/2 factory-3536.B
David Moore [Tue, 18 Dec 2012 23:23:45 +0000 (15:23 -0800)]
Avoid downcast to float for time values

Change-Id: Iebdbc3a3408679a99d81ee17b128d24cba583a36
BUG=None
TEST=None
Reviewed-on: https://gerrit.chromium.org/gerrit/39910
Commit-Queue: Dave Moore <davemoore@chromium.org>
Tested-by: Dave Moore <davemoore@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
22 months agoSupport swipe gesture 60/38860/2 release-R25-3428.B stabilize-3428.110.0 stabilize-3428.149 stabilize-3428.149.B stabilize-3428.193 stabilize2 toolchain-3428.65.B
David Moore [Wed, 28 Nov 2012 22:55:51 +0000 (14:55 -0800)]
Support swipe gesture

BUG=chromium-os:124830
TEST=None

Change-Id: Idac76c6dd6d1352c37dac44111efd1c806a03e5a
Reviewed-on: https://gerrit.chromium.org/gerrit/38860
Commit-Ready: Dave Moore <davemoore@chromium.org>
Tested-by: Dave Moore <davemoore@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
22 months agoPass device class to gesture interpreter 96/38696/3
Che-Liang Chiou [Tue, 27 Nov 2012 01:42:33 +0000 (17:42 -0800)]
Pass device class to gesture interpreter

The gesture interpreter needs device class to initialize itself.  While
we had once intended to set this information in xorg.conf and so gesture
interpreter may acquire it through properties, we decided that we would
let libevdev probe this and pass it on.  Thus, the gesture interpreter
initializer was added a new parameter for device class.

BUG=chromium-os:36634
TEST=On Snow, touchpad, Magic Trackpad, and generic mouse still work

Change-Id: I72d563e83a68264b02569edd2ca14d2ca6e9bc29
Reviewed-on: https://gerrit.chromium.org/gerrit/38696
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
23 months agoCall GestureInterpreter filter composition 69/37969/3
Che-Liang Chiou [Wed, 14 Nov 2012 01:02:52 +0000 (17:02 -0800)]
Call GestureInterpreter filter composition

GestureInterpreter postpones filter composition until device information
is available to it.  So xf86-input-cmt should call it when the
information is made ready for GestureInterpreter object.

BUG=chromium-os:36318
TEST=touchpad still works on snow

Change-Id: Ia774c63ba0ef2f4c0aeb0e2bdbad721438689f7e
Reviewed-on: https://gerrit.chromium.org/gerrit/37969
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
23 months agoPropagate EV_REL events up in input stack
Che-Liang Chiou [Thu, 25 Oct 2012 00:14:25 +0000 (17:14 -0700)]
Propagate EV_REL events up in input stack

As we want xf86-input-cmt to drive mice in addition to touchpads, EV_REL
events have to be propagated up.

BUG=chromium-os:29435
TEST=add debug output in gestures, and see it receives EV_REL events

Change-Id: I8a9eabc9635bf635a85572ffc01739cdbfdd041a
Reviewed-on: https://gerrit.chromium.org/gerrit/36516
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>

2 years agoPropagate orientation min/max up to next level of input stack
Che-Liang Chiou [Thu, 11 Oct 2012 18:46:10 +0000 (11:46 -0700)]
Propagate orientation min/max up to next level of input stack

This information is important to gestures library when scaling touch
major and minor input, which may adjustment their values according to
orientation of fingers.  So send it up.

BUG=chromium-os:29435
TEST=connect Apple Magic Trackpad, and observe gestures library has
     received orientation min/max [-31, 32]

Change-Id: I3a3b6dfcc7660aa2175fbb4d3e6213b8efdb3d5f
Reviewed-on: https://gerrit.chromium.org/gerrit/35295
Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
2 years agoDebug print Move Gesture using floats
Daniel Kurtz [Thu, 4 Oct 2012 07:37:50 +0000 (15:37 +0800)]
Debug print Move Gesture using floats

Now that we use double valuators for the motion vector, let's just debug
print using double values instead of casting to int.

BUG=none
TEST=Add -logverbose 10 to X invocation line in /sbin/xstart.sh
TEST=restart ui
TEST=tail -F /var/log/X.org.log | grep Move
TEST=move finger on touchpad and observe...
     Gesture Move: (0.000000, -1.000000)

Change-Id: Ia0f2fe18b65a27edbdb96283bbbe61fd8b05c6cf
Reviewed-on: https://gerrit.chromium.org/gerrit/34618
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoReschedule X OsTimer by returning next timeout value factory-2985.B factory-2993.B factory-3004.B
Daniel Kurtz [Tue, 25 Sep 2012 13:30:29 +0000 (21:30 +0800)]
Reschedule X OsTimer by returning next timeout value

The X OsTimer API allows a timer callback to immediately reschedule its
timer by returning a new (delta) timeout value.  This is slightly more
optimal than explicitly calling TimerSet() from within the TimerCallback.

When the GesturesTimer callback returns < 0 (i.e., -1.0), the OsTimer is
canceled by returning 0 from the OsTimer callback.  If the GesturesTimer
callback returns 0.0 or less than 0.001, this is rounded up to 1 ms.

We were not able to do this previously, since we were were relying on
explicit signal blocking in our timer callback.  Now that the X server
properly blocks signals when calling the callback, and while performing
global timer list operations in TimerSet(), we can make use of this more
efficient method.

BUG=chromium-os:34628
TEST=Verify tap-to-click still works for CMT

Change-Id: I6f943abc911a16a65b258e5a3f6e89dd13b808c7
Reviewed-on: https://gerrit.chromium.org/gerrit/33991
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoRemove SIGIO block from TimerCallback
Daniel Kurtz [Wed, 6 Jun 2012 09:07:52 +0000 (17:07 +0800)]
Remove SIGIO block from TimerCallback

A recent patch to the X server blocks signals during OsTimer calls,
and during the timer callback.  Thus, we no longer need to block them
explicitly.

See:
https://gerrit.chromium.org/gerrit/#change,24583

BUG=chromium-os:34628
TEST=Verify tap-to-click on a touchpad using CMT driver (ie a chromebook)

Change-Id: Ibe78f1b3c71243ce404d012ee2820181b05f9510
Reviewed-on: https://gerrit.chromium.org/gerrit/33990
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoDo not flush events between Event_Open and enabling input
Daniel Kurtz [Mon, 17 Sep 2012 07:41:09 +0000 (15:41 +0800)]
Do not flush events between Event_Open and enabling input

Flush in the DeviceOn handler is copied from old X Input drivers.
In those days, an input driver would read directly from hardware, and
communication with the device was stateless.

Nowadays, we use Evdev to get input_events from the kernel, and evdev is
stateful.

The following change to libevdev synchronizes kernel and X input
state during Event_Open():
  https://gerrit.chromium.org/gerrit/#/c/33408

Therefore, we must avoid flushing the input buffer after synchronizing,
since it may discard state updates which will cause the X input driver
to get out of sync with the kernel.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chrome-os-partner:13951
TEST=Manually confirmed no regression when using touchpad

Change-Id: I81fa1e943bcca5729288859451f749befb8b9fea
Reviewed-on: https://gerrit.chromium.org/gerrit/33415
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoremove CMT_AXIS_FLING_V* (integer) valuators factory-2914.B
Daniel Kurtz [Sat, 8 Sep 2012 02:58:11 +0000 (10:58 +0800)]
remove CMT_AXIS_FLING_V* (integer) valuators

X (and Chrome) have supported the newer CMT_AXIS_DBL_FLING_V* valuators
since the upgrade to 1.12 on all platforms.

It's time to remove the older integer valuators.
This saves a tiny amount of processing time for every fling gesture
processed by CMT, X and Chrome.

BUG=chromium-os:34227
TEST=verify a fling using xinput test-xi2:
  Only "Abs Dbl Fling X/Y Velocity" valuators registered and sent

Change-Id: I6425c3c000450307d8b36a3097f8b1ef9b50c129
Reviewed-on: https://gerrit.chromium.org/gerrit/32542
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoremove CMT_AXIS_START/END_TIME (integer) valuators
Daniel Kurtz [Fri, 7 Sep 2012 13:20:42 +0000 (21:20 +0800)]
remove CMT_AXIS_START/END_TIME (integer) valuators

X (and Chrome) have supported the newer CMT_AXIS_DBL_*_TIME valuators
since the upgrade to 1.12 on all platforms.

It's time to remove the older integer time stamp valuators.
This saves a tiny amount of processing time for every event in CMT, X and
Chrome.

BUG=chromium-os:34227
TEST=verify valuators using xinput test-xi2
TEST=only "Abs Dbl Start/End Timestamp" should be registered and sent

Change-Id: Icd3dd3a97bd8ad9c7458b93ec63f7db72c6d0873
Reviewed-on: https://gerrit.chromium.org/gerrit/32541
Reviewed-by: Dave Moore <davemoore@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agomark _log functions with printf attribute
Daniel Kurtz [Fri, 7 Sep 2012 14:23:39 +0000 (22:23 +0800)]
mark _log functions with printf attribute

This supresses a compiler warning, but is also good practice, since the
compiler can help enforce that our log messages are well defined.

BUG=chromium-os:34226
TEST=builds with 1 less [-Wmissing-format-attribute] warnings
TEST=log messages routed to /var/log/Xorg.0.log w/ -logverbose 10

Change-Id: I47bde1666918ba6fec2ba01a35b0830a1bbf08c9
Reviewed-on: https://gerrit.chromium.org/gerrit/32540
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoremove conflicting MAX_VALUATORS definition
Daniel Kurtz [Fri, 7 Sep 2012 13:16:42 +0000 (21:16 +0800)]
remove conflicting MAX_VALUATORS definition

MAX_VALUATORS is defined as 32 in an X server header (xorg/input.h),
so let's just use that definition, instead of our own.

In reality, we only use it once, when calling valuator_mask_new(), and
that function actually just ignores its parameter...

BUG=chromium-os:34225
TEST=builds w/ MAX_VALUATORS compiler warning
TEST=valuators still passed out of X server (w/ test-xi2)

Change-Id: Ib0a6a0669180917eb37f9617e9e2aa1a4adf1cff
Reviewed-on: https://gerrit.chromium.org/gerrit/32539
Reviewed-by: Chung-yih Wang <cywang@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agoDebug print Pinch gesture factory-2846.B factory-2848.B
Daniel Kurtz [Wed, 29 Aug 2012 09:26:00 +0000 (17:26 +0800)]
Debug print Pinch gesture

The gesture library can detect and generate Pinch gestures.
Currently these are not supported by upper layers, and hence aren't
routed through CMT.
However, let's at least catch and debug print them instead of logging a
generic "Unrecognized gesture type" error.

BUG=chromium-os:33996
TEST=tail -F /var/log/Xorg.0.log
TEST=perform some pinch gestures
  => no "Unrecognized gesture type" messages get logged.
TEST=enable X11 -logverbose 10 in /sbin/xstart.sh
  => "Gesture Pinch" shown in log.

Change-Id: I5d4fe6ded8be938c55076e64396044a0bbc64a5e
Reviewed-on: https://gerrit.chromium.org/gerrit/31695
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
2 years agogesture.c: Properly free valuator mask 47/27747/1 factory-2717.B factory-2723.14.B firmware-butterfly-2788.B firmware-link-2695.2.B firmware-link-2695.B firmware-parrot-2685.B firmware-snow-2695.90.B firmware-snow-2695.B firmware-stout-2817.B release-R22-2723.B
Daniel Kurtz [Wed, 18 Jul 2012 06:33:26 +0000 (14:33 +0800)]
gesture.c: Properly free valuator mask

valuator_mask_free() takes a pointer to a pointer to a valuator mask,
because it sets its value to NULL after free'ing.

BUG=chromium-os:32657
TEST=tail -f /var/log/Xort.0.log
TEST=stop ui
TEST=No "Segmentation Fault" in /var/log/Xorg.0.log
TEST=Instead: "Server terminated successfully (0). Closing log file."

Change-Id: Ib01c0d0aafc5f92130d2005d6477315babb02f45

2 years agogesture: Fixed crash during uninit 87/27687/2
Dennis Kempin [Tue, 17 Jul 2012 19:37:16 +0000 (12:37 -0700)]
gesture: Fixed crash during uninit

before freeing any gestures related resources, the gesture interpreter
has to be destroyed which will cancel any timers.
Otherwise the timer callback might access free'd resources.

BUG=chromium-os:32657
TEST=Run any xorg related autotests

Change-Id: I6de60c88517d393bc17d9ad4f1376c1c2c6f0d44

2 years agogesture.c: Allocate valuator mask per gesture object, not per invocation. 36/27336/1
Andrew de los Reyes [Thu, 12 Jul 2012 23:34:41 +0000 (16:34 -0700)]
gesture.c: Allocate valuator mask per gesture object, not per invocation.

This led to hard X freezes b/c valuator_mask_new calls malloc() behind
the scenes.

BUG=chromium-os:32535
TEST=tested on device

Change-Id: I5bedd3bc7cc55f6ade62ca8eb0e4746ad8d72ab0

2 years agogesture.c: Free member variable fingers. 35/27335/1
Andrew de los Reyes [Thu, 12 Jul 2012 23:38:57 +0000 (16:38 -0700)]
gesture.c: Free member variable fingers.

Looks like it was an oversight in
https://gerrit.chromium.org/gerrit/#change,19051.

BUG=None
TEST=tested on device

Change-Id: I4cb30602d6798388630a9f5860d54cd7fe0fd7f6

2 years agoRefactoring: removed libevdev files and link to libevdev library 15/25015/5
Dennis Kempin [Mon, 11 Jun 2012 18:11:55 +0000 (11:11 -0700)]
Refactoring: removed libevdev files and link to libevdev library

the libevdev files have been moved to a new library in platform/libevdev.
This CL removed the libevdev files from CMT and links to the libevdev library
instead.

BUG=chromium-os:31022
TEST=gmerge libevdev; gmerge xf86-input-cmt; restart ui;

Change-Id: I08b0b21c9cd4051c5d3b6a50079213d6f79df525

2 years agolibevdev: fix EvdevProbeMTSlot() 13/25513/2 factory-2460.B factory-2475.B
Daniel Kurtz [Mon, 18 Jun 2012 04:34:42 +0000 (12:34 +0800)]
libevdev: fix EvdevProbeMTSlot()

MTSlotInfoPtr is already a pointer, get the size of what it points to,
and pass its value, not its address, to the ioctl.

BUG=chromium-os:31878
TEST=boot chromebook;  inspect /var/log/Xorg.0.log
    => No (EE) error messages related to EVIOCGMTSLOTS

Change-Id: I6e56456e2f47af79b94932498d1abb1b42cf8584

2 years agolibevdev_event: make some error messages less verbose 72/25372/1
Daniel Kurtz [Fri, 15 Jun 2012 05:58:51 +0000 (13:58 +0800)]
libevdev_event: make some error messages less verbose

A recent refactor is filling /var/log/Xorg.0.log with debug messages on
every input sample, and labeling them as errors.  Reduce these messages
to LOG_DEBUG.
Note: "SYN_DROPPED" and "SYN_UNKNOWN" are anomalous conditions that we do
want to report as a WARNING.

Also reduce a few other recoverable error conditions to WARNING.

BUG=chromium-os:31880
TEST=tail -F /var/log/Xorg.0.log, no more Event_Print() message

Change-Id: I080542f3211c786c92bc495cc9c72576147fe6a6

2 years agoFix: only log error message when error occurred. 48/25048/2
Daniel Kurtz [Fri, 15 Jun 2012 06:00:55 +0000 (14:00 +0800)]
Fix: only log error message when error occurred.

Fixed a mistake during refactoring.
ReadInput() should only print error messages on error, not on success.

BUG=chromium-os:31714
TEST=gmerge xf86-input-cmt; restart ui; see that log contains no more error
messages

Change-Id: Ic5a0a0c8d64695c90b01608ab68e95988f50ffcb

2 years agogesture: added log method for gestures library 20/24920/1
Dennis Kempin [Thu, 7 Jun 2012 17:58:36 +0000 (10:58 -0700)]
gesture: added log method for gestures library

this is the corresponding CL to https://gerrit.chromium.org/gerrit/#change,24919
it adds the log method that is required by the gestures library.
No change in functionality. But it allows the log method to be replaced
for regression testing.

BUG=chromium-os:31022
TEST=touch regression suite

Change-Id: I2ab3ccd50ffd33d6587bc3df948a4e23c9109db7

2 years agorefactoring: Renamed EvDevice to Evdev 32/24732/3
Dennis Kempin [Thu, 7 Jun 2012 17:58:36 +0000 (10:58 -0700)]
refactoring: Renamed EvDevice to Evdev

This CL renames the EvDevice structure to Evdev, as well as
EvDeviceInfo to EvdevInfo.

BUG=chromium-os:31022
TEST=touch regression suite

Change-Id: Ice386c7483473841089aec186ceabf66247a5967

2 years agorefactoring: moved last ioctl calls from libevdev_event to libevdev. 28/24228/7
Dennis Kempin [Thu, 31 May 2012 20:52:42 +0000 (13:52 -0700)]
refactoring: moved last ioctl calls from libevdev_event to libevdev.

Now all device(fd) accessing methods are gathered in libevdev.c and can
be easily mocked for regression testing.
Note: CMT was using the X.org input driver guidelines. New changes in the code
are written with the google style guidelines, so there is a style mismatch
in some cases.
This code will be moved to a separate library in upcoming CLs that will
completely follow the google guidelines.

BUG=chromium-os:31022
TEST=touch regression suite
Change-Id: I529cc3140d028be8e230b33e94eb7d61279fcc20

2 years agorefactoring: moved device info ioctl's to libevdev 76/24476/6
Dennis Kempin [Tue, 5 Jun 2012 03:18:40 +0000 (20:18 -0700)]
refactoring: moved device info ioctl's to libevdev

During initialization in libevdev_event.c the kernel is queried
for device information using ioctl's. This code has been moved to
libevdev. This allows nitrous to reuse the ioctl code and the
regression test suite to easily mock the ioctl code with fake data.

The remaining ioctl's will be moved to libevdev in the following
CLs.

BUG=chromium-os:31022
TEST=touch regression suite

Change-Id: I3cb2adf81e8b3888822df44112d5cd3e1220ff40

2 years agorefactoring: moved device info from EvDevice to EvDeviceInfo 75/24475/6
Dennis Kempin [Tue, 5 Jun 2012 02:54:12 +0000 (19:54 -0700)]
refactoring: moved device info from EvDevice to EvDeviceInfo

all references to device info fields of EvDevice have been updated to access
EvDevice.info instead.

BUG=chromium-os:31022
TEST=touch regression suite

Change-Id: Ibafbc2ecf0fb2866a636026c959710d43829eb16

2 years agoRefactored device reading code from cmt.c to libevdev 11/23911/8
Dennis Kempin [Tue, 29 May 2012 18:34:36 +0000 (11:34 -0700)]
Refactored device reading code from cmt.c to libevdev

Opening/Reading/Closing the kernel device is now handled by
functions defined in libevdev.c.
The functionality has not changed.

BUG=chromium-os:31022
TEST=touch regression suite

Change-Id: I0e0b63f945168f4c250e298009bf3d3f5f9e685d

2 years agoRefactoring: Separated x handling code from kernel handling code. 73/23573/10
Dennis Kempin [Thu, 17 May 2012 23:40:49 +0000 (16:40 -0700)]
Refactoring: Separated x handling code from kernel handling code.

the event.c/h and mt.c/h files are dealing with the kernels input_event data
structures. Their functionality has been made independent of the rest of the
code to be able to move them to a new library called libevdev.
The following refactorings have been performed:

Extracted kernel related information from CmtDeviceRec to EvDevice structure.
Changed all Event/MT methods to depend only on EvDevice.
Replaced logging with an abstract method (which is implemented using X in CMT)
Logging no longer requires an x device.
Some datatypes defined by X have been redefined to get rid of the xorg header.
Event_Syn_Report uses a callback method to get back to CMT for further
processing

BUG=chromium-os:31022
TEST=touch regression suite passed

Change-Id: I25b737ccd8574f609a3690d5f88f6f6ad8ef9c3b

2 years agoRefactoring: Renamed files that are going to be moved into libevdev 21/24421/2
Dennis Kempin [Mon, 4 Jun 2012 21:43:58 +0000 (14:43 -0700)]
Refactoring: Renamed files that are going to be moved into libevdev

event/mt are going to be extracted to libevdev. This CL renames the files
accordingly.

BUG=chromium-os:31022
TEST=compiles. (no code changes, only file renames)

Change-Id: Iadcd98c015102e60acbbfb09d715692cedded0a4

2 years agofix how kernel BTN_* maps to GESTURE_BUTTON_* 59/22459/1 factory-2305.B factory-2338.B factory-2368.B factory-2394.B firmware-link-2348.B
Daniel Kurtz [Fri, 11 May 2012 11:28:29 +0000 (19:28 +0800)]
fix how kernel BTN_* maps to GESTURE_BUTTON_*

Recently a regression occurred where the kernel representation of physical
buttons was being incorrectly mapped to GESTURE_BUTTON_* values.

BUG=chromium-os:30812
TEST=capture touchpad log of a physical button press
     inspect resulting log in tpview
     notice "buttonsDown": 1 (GESTURES_BUTTON_LEFT) for all clicks in
       all hardwareState structs.

Change-Id: I3014d6dd9f5bc3ba142bb704ea81f91bde792fc3

2 years agoCleanup some compiler warnings 58/22458/1
Daniel Kurtz [Fri, 11 May 2012 09:58:29 +0000 (17:58 +0800)]
Cleanup some compiler warnings

gesture.c: In function 'Gesture_Gesture_Ready':
gesture.c:244:18: warning: unused variable 'cmt' [-Wunused-variable]
event.c: In function 'Event_Sync_State':
event.c:514:13: warning: unused variable 'j' [-Wunused-variable]
event.c:490:19: warning: unused variable 'evstate' [-Wunused-variable]

BUG=chromium-os:30811
TEST=builds without these warnings

Change-Id: Ic733e7067f01d61e9899c6accf15c19dcbd6b3f3

2 years agoUse valuator_mask to allow the passing of doubles, 25/19925/13 factory-2268.16.B
Dave Moore [Tue, 10 Apr 2012 21:30:53 +0000 (14:30 -0700)]
Use valuator_mask to allow the passing of doubles,

Send both old and new valuators to maintain compatibility.

This patch does a bit of cleanup as well:
- Add macros for each axis.
- Clean up axes initialization.
- Use valuator_mask for all events, to allow discontiguous axes.
- Use X's value for time valuators instead of storing the previous

BUG=chromium-os:30609
TEST=None
Change-Id: Ia414c0b78d67daa2e88efe8752629aa70837eb5a

2 years agoRefactor cmt especially for event_sync 98/22198/2
Chung-yih Wang [Wed, 9 May 2012 02:58:36 +0000 (10:58 +0800)]
Refactor cmt especially for event_sync

BUG=chromium-os:28997
TEST=on device; no impact to users

Change-Id: I41e627187a298e0681e4f6f48da92e952f4ec7a6

2 years agoOnly sync MT axes actually supported by device 97/22197/2
Chung-yih Wang [Wed, 9 May 2012 02:38:01 +0000 (10:38 +0800)]
Only sync MT axes actually supported by device

Plus some style fixes.

BUG=chromium-os:28997
TEST=on device; should not have any impact

Change-Id: I8ff5eb67cf97ad92fc2456698075701925db8f62

2 years agoMerge "Print an error when an unknown gesture is received"
Gerrit [Wed, 9 May 2012 03:56:58 +0000 (20:56 -0700)]
Merge "Print an error when an unknown gesture is received"

2 years agoMerge "Remove unused variable props"
Gerrit [Wed, 9 May 2012 03:56:57 +0000 (20:56 -0700)]
Merge "Remove unused variable props"

2 years agoInitialize sync times for cmt with wall clock 95/22195/1
Chung-yih Wang [Wed, 9 May 2012 02:13:01 +0000 (10:13 +0800)]
Initialize sync times for cmt with wall clock

BUG=chromium-os:28997
TEST=on device; should make no impact to users

Change-Id: I083f83c8e19ed8dc80511d6ab39edebe777a0360

2 years agoPrint an error when an unknown gesture is received 96/22096/2
Daniel Kurtz [Tue, 8 May 2012 08:44:35 +0000 (16:44 +0800)]
Print an error when an unknown gesture is received

A pinch gesture was added recently to gestures.h, but is not yet supported
by xf86-input-cmt.

Fixes compiler warning:
gesture.c: In function 'Gesture_Gesture_Ready':
gesture.c:207:5: warning: enumeration value 'kGestureTypeZoom' not handled in switch [-Wswitch]
gesture.c:196:22: warning: unused variable 'props' [-Wunused-variable]

BUG=chromium-os:30677
TEST=builds without above error

Change-Id: I07f88b8449d6f9e49a47865917a128cbacd4681c

2 years agoRemove unused variable props 95/22095/2
Daniel Kurtz [Tue, 8 May 2012 08:42:26 +0000 (16:42 +0800)]
Remove unused variable props

Cleanup after:
f4c937424a11caf4f0963b7fadd0692a0a5eb823
"Remove support for scrolling by buttons"

Fixes compiler warning:
gesture.c: In function 'Gesture_Gesture_Ready':
gesture.c:196:22: warning: unused variable 'props' [-Wunused-variable]

BUG=chromium-os:30677
TEST=builds without the above warning

Change-Id: I88004149de966ab6204a362f49f9ac1614730f6f

2 years agoSynchronize cmt state with kernel evdev driver 82/19982/8
Chung-yih Wang [Thu, 5 Apr 2012 11:09:06 +0000 (19:09 +0800)]
Synchronize cmt state with kernel evdev driver

A SYN_DROPPED event indicates the the kernel's internal event buffer
overflowed, and some events will not be delivered to userspace.
This can directly lead to 'ghost finger' (userspace thinking a finger
exists after it is no longer touching a pad), for example, if a
TRACKING_ID=-1 event is dropped for a given mt slot.

BUG=chromium-os:28997
TEST=run the following test on device and see if it is completed successfully.
  autotest platform_TrackpadSynDrop/control

Change-Id: Ice0ea3574b88635a86134e274e921978cd5d5142

2 years agoRequire XInput version 12 and above. 92/19992/2
Dave Moore [Wed, 11 Apr 2012 16:47:21 +0000 (09:47 -0700)]
Require XInput version 12 and above.

BUG=None
TEST=None

Change-Id: I27bc78e9c08b1b28bbf55840f251e699810f8ebf

2 years agoRemove support for scrolling by buttons. 93/19993/2
Dave Moore [Wed, 11 Apr 2012 16:53:16 +0000 (09:53 -0700)]
Remove support for scrolling by buttons.

BUG=None
TEST=None

Change-Id: I05313d6a77c48f92601229336fcf1c5da6794b99

2 years agoDebug Print Device INPUT_PROP_* 18/20818/1
Daniel Kurtz [Mon, 23 Apr 2012 07:24:38 +0000 (15:24 +0800)]
Debug Print Device INPUT_PROP_*

BUG=chromium-os:27072
TEST=In /sbin/xstart.sh:
  Add "-logverbose 10" to X invocation line.
  restart ui
  Note "Has Property: " lines for CMT devices in /var/log/Xorg.0.log

Change-Id: I3cd9d198260d80ef3ae66ae4fdaded8b45c8111f

2 years agoxf86-input-cmt: Pass three-finger swipe as button 8/9. 56/19356/3
Daniel Erat [Wed, 14 Mar 2012 01:58:43 +0000 (18:58 -0700)]
xf86-input-cmt: Pass three-finger swipe as button 8/9.

BUG=chromium-os:27349
TEST=manual

Change-Id: I57ed4550ffa42d9ebe69fd1bc424c2507f11b259

2 years agoUse KEY bit array for touch_cnt. 45/20445/2
Chung-yih Wang [Wed, 18 Apr 2012 09:29:14 +0000 (17:29 +0800)]
Use KEY bit array for touch_cnt.

Refactor the touch_cnt process by using a key bit array. It is a best
way to reflect the current touch_cnt. Also, we need this change for
SYN_DROPPED processing to get the key state of evdev driver.

BUG=chromium-os:28997
TEST=on device; a simple test if 1f, 2f and 3f gestures work correctly.

Change-Id: I2c8db08204d10dbc8cd9aad946929c2c4edf9144

2 years agoInitialize the timer class after the device is opened. 83/19983/1
Dave Moore [Wed, 11 Apr 2012 15:40:45 +0000 (08:40 -0700)]
Initialize the timer class after the device is opened.

This allows us to correctly set the timer mode to monotonic when
supported.

BUG=chromium-os:29293
TEST=None

Change-Id: I2586ed6a04b43c9ed5136173f3e22e561892a596

2 years agologging code for ghost finger 75/19975/2
Andrew de los Reyes [Mon, 2 Apr 2012 18:18:47 +0000 (11:18 -0700)]
logging code for ghost finger

BUG=chrome-os-partner:8695
TEST=test if we could use the following command to dump input events into
/var/log/cmt_input_events.dat.

  xinput list | awk '/[pP]ad|cyapa/ { for (i=1; i<NF; i++) \
      if ($i ~/id=/) print substr($i, 4) }' |  \
      xargs -I {} xinput set-prop {} "Dump Debug Log" 1

Change-Id: Ib2bc355b878d627bf0da4bda03f2864fbdebdd5a

2 years agoAdd ERR message for SYN_DROPPED 52/19352/1
Daniel Kurtz [Fri, 30 Mar 2012 11:54:55 +0000 (19:54 +0800)]
Add ERR message for SYN_DROPPED

SYN_DROPPED events were added to evdev recently:
 - Used to indicate buffer overrun in the evdev client's event queue.
   Client should ignore all events up to and including next SYN_REPORT
   event and query the device (using EVIOCG* ioctls) to obtain its
   current state.

This indicates that CMT fell behind and wasn't able to clear the kernel
evdev queue fast enough.

This patch just adds a log message.
Another patch should read and discard whatever events are still in the
queue.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chromium-os:28718
TEST=See chromium-os:28718 for repro steps
Change-Id: Ifb9421ec4687bdd4262a46442f4d601b1104bc84

2 years agozero-initialize hardware states and finger states 51/19051/3 release-R19-2046.B
Daniel Kurtz [Tue, 27 Mar 2012 03:50:31 +0000 (11:50 +0800)]
zero-initialize hardware states and finger states

This makes these structs more forward compatible with future additions
to either.

As a side-affect, allocate finger states from the heap just once, at
Gestures init time.  A single per-Gestures fingers array can be used
since it is only used in the ReadInput signal handler, which is itself
guaranteed not to be interrupted by another ReadInput signal.

BUG=chromium-os:28349
TEST=builds clean;
     test motion, scroll, tap manually on device

Change-Id: I6d99b43a245b24e77e23b4c6757886f75d0d82ba

2 years agoFree cmt on error during initialization. 48/19148/1
Daniel Kurtz [Tue, 27 Mar 2012 02:05:37 +0000 (10:05 +0800)]
Free cmt on error during initialization.

Plugs a memory leak in an error path.

BUG=none
TEST=builds clean

Change-Id: Id111fbdcd0e6b55634d9654e1eb31324b164fd91

2 years agoCreate ERR() convenience macro and convert existing error messages 50/19050/1
Daniel Kurtz [Mon, 26 Mar 2012 04:38:10 +0000 (12:38 +0800)]
Create ERR() convenience macro and convert existing error messages

BUG=none
TEST=builds clean

Change-Id: I5563976f5c71a49aa847602b04740ae7b9e90a90

2 years agoMerge "Add support for fling gestures"
Gerrit [Tue, 20 Mar 2012 03:42:03 +0000 (20:42 -0700)]
Merge "Add support for fling gestures"

2 years agoAdd support for fling gestures 10/18310/2
Dave Moore [Fri, 16 Mar 2012 02:55:34 +0000 (19:55 -0700)]
Add support for fling gestures

BUG=28039
TEST=None (xf86-input-cmt has no tests)

Change-Id: Iac61b36679f7c26522dabdf28b514066cf5423ec

2 years agoFill pressure information for both slots on Cr48 28/18228/1 factory-1987.B
Chung-yih Wang [Thu, 15 Mar 2012 14:53:10 +0000 (22:53 +0800)]
Fill pressure information for both slots on Cr48

On Cr48, the pressure event may not be informed right after a new slot
is reported, instead, the previous value of the new slot will be
reported. However, we have to use the same pressure value as the other slot
(i.e., the current pressure value) for the semi_mt device.

Therefore, the pressure value will be filled into both slots for every
ABS_PRESSURE event even if the slot is unused.

BUG=chromium-os:27520
TEST=test it on Cr48 with CMT.

Change-Id: I2d8a2da20b15c7e6e33bf796c34573fcc377b132

2 years agoReport the correct touch_cnt to gestures library 85/17485/3
Chung-yih Wang [Wed, 7 Mar 2012 15:49:34 +0000 (23:49 +0800)]
Report the correct touch_cnt to gestures library

During a double-tap action, the synaptics touchpad kernel driver on Cr48
somtime reports the wrong order of the BTN_TOUCH and BTN_TOOL_FINGER
when both fingers lift the contact. For example, the wrong button event
reports may show:

BTN_TOUCH=0
BTN_TOOL_FINGER=1
BTN_TOOL_FINGER=0

As we did not reset the touch_cnt when we see BTN_TOOL_FINGER down to
zero, this causes the incorrect touch_cnt reported to the gesture
library and results in the single tap(left click) delivered from immediate
interpreter instead.

Since the kernel will only every report one of the BTN_TOOL_* events
as 1 during a single SYN_REPORT, it turns out that we can completely
ignore BTN_TOUCH, and just set touch_cnt to the BTN_TOOL_* that is 1.
Only if they are all 0, do we set touch_cnt = 0.

BUG=chromium-os:27368
TEST=device ; test the double-tap with CMT driver on Cr48 to see if
right-click event will be seen.

Change-Id: I51137ae451e76d8f4fa4c9307145ad34e08181ce

2 years agoFix supports_t5r2 flag on Cr48. 91/17391/1
Chung-yih Wang [Tue, 6 Mar 2012 06:50:58 +0000 (14:50 +0800)]
Fix supports_t5r2 flag on Cr48.

As we will pass the supports_t5r2 flag into gestures library for
Tap-to-click manipulation, we will need to reflect the real property of
the hardware to make TTC working correctly on Cr48.

BUG=chromium-os:27368
TEST=device ; after the change 17390 merged, we could test it on Cr48 to see
if TTC is working.

Change-Id: I09647f9f58ea0284022d0c5679ef29babeae0212

2 years agoThe scroll Valuators are accumulating because we're passing a "FALSE" 00/16800/2
Dave Moore [Sun, 26 Feb 2012 13:14:34 +0000 (05:14 -0800)]
The scroll Valuators are accumulating because we're passing a "FALSE"
for the is_absolute parameter to xf86PostMotionEvent(). This is somewhat
counter intuitive. Hopefully it will get better when we move to the
newer version of XI.

BUG=chromium-os:26887
TEST=manual
TBR=djkurtz@chromium.org

Change-Id: I5e37e9d19a1eb11a5a7350525b55e424a6829ef5

2 years agoMerge "Fix xf86-input-cmt build for ABIs >= 12 in preparation for X.org update."
Gerrit [Fri, 24 Feb 2012 23:15:56 +0000 (15:15 -0800)]
Merge "Fix xf86-input-cmt build for ABIs >= 12 in preparation for X.org update."

2 years agoFix xf86-input-cmt build for ABIs >= 12 in preparation for X.org update. 72/15872/4
Stuart Abercrombie [Fri, 24 Feb 2012 21:01:50 +0000 (13:01 -0800)]
Fix xf86-input-cmt build for ABIs >= 12 in preparation for X.org update.

BUG=chromium-os:25404
TEST=x86/AMD64/Arm build.  x86 runs correctly.

Change-Id: I8961cf4dd1d9d493f7a199479eaf35ff0a96b3a5

2 years agoImproved event debugging messages 50/16250/2
Daniel Kurtz [Wed, 22 Feb 2012 04:15:35 +0000 (12:15 +0800)]
Improved event debugging messages

Use string descriptions for event types and codes.

BUG=none
TEST=In /sbin/xstart.sh, add "-logverbose 10" to X invocation.
  $ restart ui
  $ less /var/log/Xorg.0.log

Change-Id: I587ffd24a95c750a2ad12b94814eb8f48e594f9e

2 years agoStore last timestamp as cmt data, not static 72/14372/4
Daniel Kurtz [Wed, 22 Feb 2012 04:08:23 +0000 (12:08 +0800)]
Store last timestamp as cmt data, not static

This patch cleans up the timestamp valuator implementation.
In particular, it stores the 'last timestamp', used for relative to
absolute timestamp conversion, as member variables of the cmt struct
instead of static variables.  In this way, a single driver can support
multiple instances.

Also, the Button valuators are explicitly posted as absolute events,
whereas the motion and scroll motion events are posted as relative
events.  It is unclear whether this has any observable affect or not.

Hopefully, the treatment of these valuators will become more rational
once ABI 12 is introduced with the forthcoming upgrade to xorg-server
1.12.

BUG=chromium-os:25181
TEST=builds clean; xinput test-xi2 shows timestamps for motion and
     button events with CMT.

Change-Id: I2e2a42a6f89c00b0ee5d5d414846956fdc44fe88

2 years agoUse monotonic timestamps for input events if available in kernel 40/16040/4
Daniel Kurtz [Fri, 17 Feb 2012 03:56:57 +0000 (11:56 +0800)]
Use monotonic timestamps for input events if available in kernel

This also requires that the timer provider use the same monotonic clock
for scheduling timer callbacks.  This is done using
clock_gettime(CLOCK_MONOTONIC, x).

Most of the complication of this patch involves routing the 'is_monontic'
indicator from the kernel to the timer callback.  To do this, the
previously unused GestureInterpreterSetTimerProvider(,, data) data field
is used to store a reference to the cmt device.

BUG=chromium-os:26493
TEST=on kernel with monotonic timestamp patch applied;
   add "-logverbose 10" to X invocation in /sbin/startx.sh
   from shell, tail -F /var/log/Xorg.0.log &
   move fingers on touchpad.
   Note that device events are timestamped with a monotonic clock
   (Timestamps will be close to, but not exactly equal to, X log times)

Change-Id: I23311b80293f84c0754c96b9c774587e60d3f38c

2 years agoFix the pressure readings of semi_mt devices for gesture recognition. 76/13976/5 release-R18-1660.B
Chung-yih Wang [Wed, 11 Jan 2012 10:31:12 +0000 (18:31 +0800)]
Fix the pressure readings of semi_mt devices for gesture recognition.

The current cmt driver did not support semi-mt device well such as
Synaptics touchpad on Cr-48. The major issues are from the pressure
readings are not passed into the gesture library and its sensitivity.
For semi-MT, drivers do not report a 'per-contact' pressure
(ABS_MT_PRESSURE), but instead report a single pressure that is assumed
to be constant for all fingers (ABS_PRESSURE). This is unfortunate, but
the best that can be done given the limitations of semi-mt. We
need to retrieve the readings from ABS_PRESSURE events instead of
ABS_MT_PRESSURE for SEMI_MT devices.

BUG=chromium-os:24951
TEST=test the cmt on Cr48, and this change should not see anything
different from users.

Change-Id: I62578553ac4d1a735fef5ca9947c84b3eb5aebb0

2 years agoSend start and end times to clients 95/13995/5
Dave Moore [Fri, 6 Jan 2012 17:23:24 +0000 (09:23 -0800)]
Send start and end times to clients
Units are milliseconds.

BUG=none
TEST=examine cmt events for new valuators

Change-Id: Id0506f39689bd712c14c71e8616e6688005305c6

2 years agoScroll by less when using buttons 49/13849/1
Dave Moore [Sat, 7 Jan 2012 00:22:54 +0000 (16:22 -0800)]
Scroll by less when using buttons
Now that Chrome supports using axes we have increase the amount we
scroll by in gestures. This change will cause us to scroll by fewer
increments when using buttons.

BUG=chromium-os:24829
TEST=tested on device

Change-Id: Idbcf8ceaf8c3f1502e97d2f0e946affc078f9019

Use constant for kPixelsPerBtn

Change-Id: I146b534e697cb93cfb092c52e8a5abb35daf0356

2 years agoInclude xorg-server.h before any other X header files 02/13702/1
Daniel Kurtz [Thu, 5 Jan 2012 08:07:20 +0000 (16:07 +0800)]
Include xorg-server.h before any other X header files

xorg-server.h contains various defines that are used by other X header
files.

In particular, on 64-bit machines it defines _XSERVER64, which is used
to determine whether the "Atom" type is "unsigned long" or "CARD32".
This has a drastic affect on the layout of various internal structs shared
between the driver and the x server.

BUG=chromium-os:22902
TEST=build with:
 USE="cmt" INPUT_DEVICES="cmt evdev" build_packages --board=amd64-generic
 * cmt loads properly, detects trackpad, correctly initializes based on
   kernel driver properties, as reported in /var/log/Xorg.0.log
 * Verify pointer motion, click, tap, scroll, etc. all perform as expected

Change-Id: I7c1df73c09f7fc33b849a7988756019817519cf6

2 years agoFix 64-bit issue in TestBit() 41/13641/1
Daniel Kurtz [Wed, 4 Jan 2012 11:07:38 +0000 (19:07 +0800)]
Fix 64-bit issue in TestBit()

Type "Bool" is exported by the xorg-server as "int".
So, if the result of &'ing two 64-bit numbers only has non-zero bits in
the upper 32, the result is incorrectly reported as False.

BUG=chromium-os:22902
TEST=Use:
         --board=amd64-generic
         zgb w/ synaptics Touchpad
     Note that MT axes are detected properly.

Change-Id: I284a661cecbecb6907d1cbde9ea7aef395f75d21

2 years agoRefactor error handling in PreInit() 79/13579/1
Daniel Kurtz [Tue, 3 Jan 2012 11:06:36 +0000 (19:06 +0800)]
Refactor error handling in PreInit()

Don't call Event/Gesture_Free() functions if the corresponding *_Init()
failed.

To make this work properly, fix Event_Init() to free slots if they were
allocated in the error path.

BUG=chromium-os:22902
TEST=64-bit CMT
     No sig11

Change-Id: I649256e0ea68ba1abdc607f316c379484644e282

2 years agoInitialize entire button map 34/13134/1
Daniel Kurtz [Mon, 19 Dec 2011 06:55:34 +0000 (14:55 +0800)]
Initialize entire button map

For some reason, the 'button' map appears to be 1-indexed, with a total
length of CMT_NUM_BUTTONS + 1.

Without this fix, Scrolling right generates some randomly large button
number, which gets mapped to button '0', which is LEFT click.

BUG=chromium-os:24381
TEST=Using CMT, browse to a page with many links.
  scroll up/down/left/right using CMT
  No page loads while scrolling

Change-Id: I8f54a51fbb49937d0d96c80982c2c77b092e1074

2 years agoAdd properties to control how scroll events are sent to clients 55/7255/4
Daniel Kurtz [Mon, 5 Sep 2011 11:09:31 +0000 (19:09 +0800)]
Add properties to control how scroll events are sent to clients

Two new boolean properties:
  Scroll Buttons - if true, then Scroll events are sent using legacy
    X button events (left=4, right=5, up=6, down=7)
  Scroll Axes - if true, Scroll events are sent using REL axes WHEEL (2)
    and HWHEEL (3).

Note, all four combinations of these bits are supported.  It is possible
to configure either type of scroll events, or both, or even neither.
By default, the driver is configured for legacy usage - only the scroll
button events are sent.

Note:  Although the axes' valuators support double values, the actual
amount to scroll is still converted to an integer before sending to the
client.  This is because the Gestures library is still handling rounding
itself.

TODO: Emit fractional scroll values once Gestures can handle it.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
BUG=chromium-os:23925
TEST=On device with xf86-input-cmt as touchpad driver:
  (1) Confirm default values:
  xinput list-props <dev>
    Scroll Buttons (263):  1
    Scroll Axes (264):  0
  xinput test-xi2 <dev>
    => Scroll should emit ButtonPress/Release events for Master & Slave
       Pointers:
  EVENT type 4 (ButtonPress)
    device: 8 (8)
    detail: 5
    ...
  EVENT type 4 (ButtonPress)
    device: 2 (8)
    detail: 5
    ...
  EVENT type 5 (ButtonRelease)
    device: 8 (8)
    detail: 5
    ...
  EVENT type 5 (ButtonRelease)
    device: 2 (8)
    detail: 5
    ...

 (2) Confirm Scroll Axes behavior:
     xinput set-prop <dev> "Scroll Buttons" 0
     xinput set-prop <dev> "Scroll Axes" 1
     xinput test-xi2 <dev>
     2-finger vertical scroll posts events like this:
EVENT type 17 (RawMotion)
    device: 2
    detail: 0
    valuators:
          2: 0.00 (0.00)
          3: 27.00 (27.00)

EVENT type 6 (Motion)
    device: 7 (7)
    detail: 0
    flags:
    root: 903.00/736.00
    event: 903.00/736.00
    buttons:
    modifiers: locked 0 latched 0 base 0 effective: 0
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        2: 0.00
        3: 27.00
    windows: root 0x48 event 0xa00001 child 0x0

Horizontal like this:
EVENT type 17 (RawMotion)
    device: 2
    detail: 0
    valuators:
          2: 35.00 (35.00)
          3: 0.00 (0.00)

EVENT type 6 (Motion)
    device: 7 (7)
    detail: 0
    flags:
    root: 903.00/736.00
    event: 903.00/736.00
    buttons:
    modifiers: locked 0 latched 0 base 0 effective: 0
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        2: 35.00
        3: 0.00
    windows: root 0x48 event 0xa00001 child 0x0
EVENT type 6 (Motion)
    device: 2 (7)
    detail: 0
    flags:
    root: 903.00/736.00
    event: 903.00/736.00
    buttons:
    modifiers: locked 0 latched 0 base 0 effective: 0
    group: locked 0 latched 0 base 0 effective: 0
    valuators:
        2: 35.00
        3: 0.00
    windows: root 0x48 event 0xa00001 child 0x0

Change-Id: Ic072bec8590fd7c190dda6cb38ef685f41dc72a6

2 years agoCleanup CMT_NUM_BUTTONS 15/12615/1
Daniel Kurtz [Thu, 8 Dec 2011 11:48:12 +0000 (19:48 +0800)]
Cleanup CMT_NUM_BUTTONS

The button map configuration code was copied from xf86-input-synaptics,
which appears to have been slightly incorrect.

The map need only be as large as the number of buttons, and does a trivial
1:1 mapping between button label index and button function.

BUG=none
TEST=builds clean
 xinput list <dev>
  Button labels: Button Left Button Middle Button Right
                 Button Wheel Up Button Wheel Down
                 Button Horiz Wheel Left Button Horiz Wheel Right

Change-Id: I2151ae9061ce78bd8a98906eb8852b925d6f0324

2 years agoReturn BadMatch for unknown types in PropChange 14/12614/1
Daniel Kurtz [Thu, 8 Dec 2011 11:01:52 +0000 (19:01 +0800)]
Return BadMatch for unknown types in PropChange

This fixes a compiler warning.

BUG=none
TEST=compiles without warnings

Change-Id: Ie2cebc568753c16aa687e902632f215a04e3957c

3 years agoAdd GesturesPropRegisterHandler 15/8415/1 factory-1235.B factory-1284.B factory-1412.B firmware-kiev-2.112.B firmware-uboot_v2-1299.B release-R16-1193.B release-R17-1412.B
Daniel Kurtz [Wed, 28 Sep 2011 14:47:05 +0000 (22:47 +0800)]
Add GesturesPropRegisterHandler

Add a function to GesturesPropProvider to allow registering:
 a "get" handler, called immediately before a GesturesProp is read
 a "set" handler, called immediately after a GesturesProp is updated

BUG=chromium-os:20768
TEST=compiles; unittests pass

Change-Id: I992c11a31fd0942cdfa75980c17bc55d5a0a9525

3 years agoAdd support for new synaptics image sensor kernel driver. 84/5884/2 factory-1020.B factory-980.B release-1011.B test-982.B
Daniel Kurtz [Fri, 12 Aug 2011 16:17:15 +0000 (00:17 +0800)]
Add support for new synaptics image sensor kernel driver.

Report the number of fingers on pad using "touch_cnt", and the number of
valid MT-B slots using finger_cnt.

The new synaptics image sensor kernel driver reports up to 2 slots
(max_finger_cnt), however, it also reports up to 5 fingers on the pad
using the BTN_TOOL_*TAP EV_KEY events (max_touch_cnt).

For this kind of driver, where the max_touch_cnt > max_finger_cnt, we
signal this from cmt to gestures by setting the T5R2 flag.

The gestures library can use this flag to handle cases where
touch_cnt > finger_cnt.

When this flag is not set, the library should always expect
finger_cnt <= touch_cnt.  (The < case is due to the fact that the kernel
does not yet support an EV_KEY for signalling 5 fingers on the pad:
adding BTN_TOOL_QUINTTAP is actually part of the synaptics mt-b driver
patchset).

BUG=chromium-os:19094
TEST=builds clean;
     Test 1f & 2f tap, click motion & scroll with:
        synaptics image sensor (MT-B) kernel driver
        cypress MT-B kernel driver
        elantech MT-B kernel driver

Change-Id: I0ad4991ae698840bcd166b9ebef77054f45082da

3 years agoEvent Debug Print with Event Names when possible 85/5885/2
Daniel Kurtz [Fri, 12 Aug 2011 17:25:35 +0000 (01:25 +0800)]
Event Debug Print with Event Names when possible

ABS[0] and KEY[0x110] are accurate, but not as descriptive as ABS_X and
BTN_LEFT.

BUG=none
TEST=compiles clean; Set X -logverbose 10;
     move finger on touchpad, and inspect /var/log/Xorg.0.log
     Input Event Debug messages should use ABS_* and BTN_* strings

Change-Id: I2039627d7485f80aa71924495b39dc53db03d7ba

3 years agoReplace __FILE__ with __FUNCTION__ 88/4988/4
Daniel Kurtz [Fri, 29 Jul 2011 06:51:07 +0000 (14:51 +0800)]
Replace __FILE__ with __FUNCTION__

Logging with __FILE__: is useful, but the absolute pathnames
from __FILE__ are too long.
Using __FUNCTION__ achieves much of the same purpose: identifying a
location in source code, and is more succinct.

BUG=none
TEST=Add "-logverbose 10" to X invocation in /sbin/xstart.sh
     Observe cmt logs in /var/log/Xorg.0.log

Change-Id: I5886a8d91b0536b6562db08ce96af7c9151a577f

3 years agoCheck for NULL prop in Prop_Free() 83/5883/1
Daniel Kurtz [Fri, 12 Aug 2011 15:50:51 +0000 (23:50 +0800)]
Check for NULL prop in Prop_Free()

If an uninitialized GesturesProp* is passed to Prop_Free(), exit
immediately.

BUG=chromium-os:19093
TEST=builds clean;
     restart ui
     check /var/log/Xorg.0.log

Change-Id: I51b8c4bc542daa368fd4cc59f8ec904871e60b4f

3 years agoinitial unittests for xf86-input-cmt 90/5290/5 firmware-881-u-boot-v1 firmware-u-boot-v1
Andrew de los Reyes [Thu, 4 Aug 2011 01:25:42 +0000 (18:25 -0700)]
initial unittests for xf86-input-cmt

BUG=chromium-os:18835
TEST=built w/, w/o tests

Change-Id: Idce60c5e509e2600d27d31de83d714d969c4bdd5

3 years agoImplement gestures lib GesturesProp interface 18/5218/6 0.15.877.B
Daniel Kurtz [Mon, 8 Aug 2011 16:09:41 +0000 (00:09 +0800)]
Implement gestures lib GesturesProp interface

Gestures lib can create XI properties of type Int, Short, Bool, Real or
String.  Each property must have a unique name, which is converted to an
Atom which is managed by the server.

When creating a property, a pointer to a variable of the appropriate type
should be provided.  If NULL is provided, the property is ReadOnly.
Otherwise, when the server updates a property, the passed-in variable
is automatically updated as well.

Unlike traditional XI properties, each Gesture property can contain
exactly one value.  Its value may be initialized by an identically named
(and typed) Option value in an xorg.conf snippet file.  If no such entry
is found, then the default value is as passed in to the property creation
function.

BUG=chromium-os:17991
TEST=compile w/ no errors;
     props with correct names accessible w/ xinput
     props initialized with .conf snippet values if present

Change-Id: I7389fd671529ff23bcc3185a91d2fe804a3e104d

3 years agoRemove unused legacy property interface 70/5470/1
Daniel Kurtz [Mon, 8 Aug 2011 15:48:51 +0000 (23:48 +0800)]
Remove unused legacy property interface

Plumbing for gestures properties tap_to_click, move_speed and
scroll_speed_v and scroll_speed_h was never implemented, so remove them.

This functionality will be reimplemented within the gestures library,
when needed, using the GesturesProp infrastructure.

BUG=chromium-os:17991
TEST=builds clean; unittests

Change-Id: I25f31f157b2e4b07a5f025e66a9817ddfa154f74

3 years agoRevert "Revert "Support Gestures timers with X timers."" 33/5333/1
Andrew de los Reyes [Thu, 4 Aug 2011 22:04:11 +0000 (15:04 -0700)]
Revert "Revert "Support Gestures timers with X timers.""

This reverts commit d59446a9e196502be38c018ec10eaf2245ad5834.

BUG=None
TEST=built locally; discussed with sheriffs

Change-Id: Ica7c0d3d280f99af1edc50dae52333c1b79c553e

3 years agoRevert "Support Gestures timers with X timers." 06/5306/1
Ryan Harrison [Thu, 4 Aug 2011 17:44:45 +0000 (10:44 -0700)]
Revert "Support Gestures timers with X timers."

This reverts commit 81cc4cd876b72744204aecc918712678cb0b4ecf

TBR=adlr

3 years agoSupport Gestures timers with X timers. 27/5127/5
Andrew de los Reyes [Mon, 1 Aug 2011 20:51:37 +0000 (13:51 -0700)]
Support Gestures timers with X timers.

This CL adds necessary methods to support the Gestures timers API and
uses X timers to make it work.

BUG=chromium-os:18505
TEST=tested on device

Change-Id: I9e4eca9dc56ab223f0cf1a83b884c253637e8c47

3 years agoAdd Gesture_Device_*() 17/5217/1
Daniel Kurtz [Wed, 3 Aug 2011 15:36:42 +0000 (23:36 +0800)]
Add Gesture_Device_*()

Do gestures-layer initialization in the Device_Init event.
Have the gestures layer store a pointer to the DeviceIntPtr which is
then passed to gestures lib on the Device_On event.

BUG=none
TEST=compiles, check gestures still generates events.

Change-Id: Ic7bef712a878b6c419bfc9c466ed74d5bd499076

3 years agoAdd X_WARNING when writing read-only property 16/5216/1
Daniel Kurtz [Wed, 3 Aug 2011 10:41:42 +0000 (18:41 +0800)]
Add X_WARNING when writing read-only property

Also, assign correct Atom to prop_product_id.

BUG=chromium-os:18467
TEST=xinput set-prop 7 "Device Node" --type=atom "My Node"
     Observe (WW) message in /var/log/Xorg.0.log

Change-Id: I031d49685ca978cedad15c4ac78a18c6a1f51cb9
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
3 years agoStore slot_count instead of slot_max 87/4987/1
Daniel Kurtz [Fri, 29 Jul 2011 06:19:13 +0000 (14:19 +0800)]
Store slot_count instead of slot_max

Whereever it matters, slot_max can be derived from slot_min and slot_count.
However, if the kernel driver doesn't support MT-B (ie, it does not
advertise ABS_MT_SLOT valuator during absinfo device probe), then
by default slot_min = slot_max = 0, which implied slot_count = 1, which is
wrong.

Instead, store an explicit slot_count, which is implicitly initialized to 0

BUG=chromium-os:18403
TEST=(1) Configure cmt on a device with cypress MT-A fw
     (2) Boot, and wiggle finger on pad; should see no X crash.
     (3) Configure cmt on a device with non-MT synaptics
     (4) Boot, and wiggle finger on pad; should see no X crash.

Change-Id: Ib637ffb137a6300004027afe8d4df31d00fe4d51

3 years agoX server is fixed to allow non-X_NONE messages in sig handlers. 40/4740/2
Daniel Kurtz [Tue, 26 Jul 2011 08:28:05 +0000 (16:28 +0800)]
X server is fixed to allow non-X_NONE messages in sig handlers.

So, report read errors as X_ERROR.

BUG=chromium-os:18131
TEST=builds

Change-Id: Idcba01895e33f23a8d76ec17d408bf428a680425

3 years agoUse xf86IDrvMsgVerb()/xf86IDrvMsg() 39/4739/2
Daniel Kurtz [Tue, 26 Jul 2011 09:01:36 +0000 (17:01 +0800)]
Use xf86IDrvMsgVerb()/xf86IDrvMsg()

xf86IDrvMsgVerb()/xf86IDrvMsg() have been backported to 1.9.3.
Use the functions instead of local macros.

BUG=chromium-os:18131
TEST=builds, cmt log messages appear in /var/log/Xorg.0.log
     With "-logverbose 10" added to /sbin/xstart.sh:
     cmt DBG() messages also appear in /var/log/Xorg.0.log

Change-Id: I64c805d30dbc4fcedd69197f09dc3e2620017486

3 years agoAdd DBG messages for each gesture. 38/4738/2 0.14.811.B
Daniel Kurtz [Tue, 26 Jul 2011 17:38:26 +0000 (01:38 +0800)]
Add DBG messages for each gesture.

BUG=none
TEST=enable DBG, for each gesture, there should be a logged message
     disable DBG, no gesture log messages

Change-Id: I2fb6fcfbff029fd81050c0c6de4636b35e4dd589

3 years agoUse new DBG() macros 37/4737/2
Daniel Kurtz [Tue, 26 Jul 2011 09:14:40 +0000 (17:14 +0800)]
Use new DBG() macros

These new macro set the verbosity for DBG() messages such that the
messages are ignored by default.

BUG=chromium-os:18131
TEST=builds
     no change to /sbin/xstart.sh:  messages are not in /var/log/Xorg.0.log
     add -logverbose 10 to /sbin/xstart.sh:
       all DBG() messages in /var/log/Xorg.0.log

Change-Id: I89a0bc1e13f10f1fb7bf6d2537f8d5d9cfc2d9ee

3 years agoAdd new DBG() macros 36/4736/2
Daniel Kurtz [Tue, 26 Jul 2011 17:16:30 +0000 (01:16 +0800)]
Add new DBG() macros

BUG=chromium-os:18131
TEST=builds, driver messages still get sent to /var/log/Xorg.0.log

Change-Id: Id49e978c7ffc939ef49ea61ea5847a7d3febea93