Call Event_Sync_State in Event_Open not Event_Init

Evdev is a 100% stateful protocol, meaning individual input_event's are
"deltas" between a shared input_event state shared by kernel driver and
userspace client.
Whenever the userspace client opens the kernel device, it must completely
resynchronize its state with the kernel (at least for those AXIS that are
stateful, such as KEYs and ABSs).

Previously, we were only doing this synchronization, but only once,
during driver PreInit().
However, the X input driver actually closes the device file during PreInit
and reopens it in the DeviceOn handler.  So, there is a small window
during which the kernel & X input driver state could get out of sync.
To make matters worse, during VT-Switch (e.g., during Suspend/Resume),
the X server issues DEVICE_OFF/_ON events, which also causes the X input
driver to close and then reopen the device file.  This means, on resume X
input driver state will not have been updated for any events during the
time when the device file was closed.

The solution is simple, always re-sync when opening the file for the
purpose of listening for input events.

BUG=chrome-os-partner:13951
TEST=On device using a touchpad supported by xf86-input-cmt:
 1) Place one finger on TP (finger A), move around to confirm pointer motion
 2) Place second finger on TP (finger B), move both to confirm 2-finger scroll
 3) Remove finger A so that on finger B is on pad, move around to confirm pointer motion
 4) Enter VT-2 (Ctrl-Alt-F2, F2 aka "->")
 5) While in VT-2, remove finger from touchpad
 6) Switch back to VT-1 (Ctrl-Alt-F1, F1 aka "<-")
 7) Try moving cursor, cursor responsive and smooth
 => w/out fix: no motion or choppy motion due to Ghost finger)

Change-Id: Ibd53b7767651a4387f624ac2a8cded6997909b70
Reviewed-on: https://gerrit.chromium.org/gerrit/33408
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>
diff --git a/src/libevdev_event.c b/src/libevdev_event.c
index 5029012..8b10cd6 100644
--- a/src/libevdev_event.c
+++ b/src/libevdev_event.c
@@ -284,9 +284,6 @@
             }
         }
     }
-
-    /* Synchronize all MT slots with kernel evdev driver */
-    Event_Sync_State(device);
     return Success;
 }
 
@@ -301,11 +298,11 @@
 {
     /* Select monotonic input event timestamps, if supported by kernel */
     device->info.is_monotonic = (EvdevEnableMonotonic(device) == Success);
-    /* Reset the sync time variables */
-    Event_Get_Time(&device->before_sync_time, device->info.is_monotonic);
-    Event_Get_Time(&device->after_sync_time, device->info.is_monotonic);
     LOG_DEBUG(device, "Using %s input event time stamps\n",
               device->info.is_monotonic ? "monotonic" : "realtime");
+
+    /* Synchronize all MT slots with kernel evdev driver */
+    Event_Sync_State(device);
 }
 
 static void