Pressure Calibration to use new RemoteTouchDevices

The RemoteTouchDevice interface has changed slightly, so this
CL updates it to use the newest version.  Now there is only a single
"remote" module to import that includes everything.  Furthermore
the state machines are hidden inside the touch devices so you don't
have to mess with them anymore.  Overall it makes things a lot more
simple, and fixes some problem with reconnections that more complex
usages were having.

BUG=chromium:464829
TEST=I ran "mtbringup-xorg -r 192.168.0.3 --conf" on a Chromebook and
the test was able to detect my finger on the pad when collecting
pressure data

Change-Id: I624bef7c3ceb99d8436bdacce80d7d045783fc3b
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/260850
Reviewed-by: Dennis Kempin <denniskempin@chromium.org>
Trybot-Ready: Dennis Kempin <denniskempin@chromium.org>
diff --git a/Makefile b/Makefile
index f287cc2..dc088b3 100644
--- a/Makefile
+++ b/Makefile
@@ -41,8 +41,7 @@
 	done
 
 	# Copy symlinks
-	cp -d mt $(DESTDIR)/
-	cp -d remote.py $(DESTDIR)/
+	cp -d remote $(DESTDIR)/
 
 IN_PLACE_DEPS=../libevdev ../gestures mtreplay
 
diff --git a/mt b/mt
deleted file mode 120000
index 72e5f2a..0000000
--- a/mt
+++ /dev/null
@@ -1 +0,0 @@
-../touch_firmware_test/mt
\ No newline at end of file
diff --git a/mtlib/xorg_conf.py b/mtlib/xorg_conf.py
index 15c1a8e..3e6c8cb 100644
--- a/mtlib/xorg_conf.py
+++ b/mtlib/xorg_conf.py
@@ -6,7 +6,6 @@
 import re
 import sys
 import time
-from mt.state_machine import MtbStateMachine
 from mtlib.util import RequiredRegex, SafeExecute, Execute, Path
 from remote import ChromeOSTouchDevice
 
@@ -154,23 +153,14 @@
     print "Move probe %s in circles over the touchpad:" % probe_name
 
     pressures = []
-    state_machine = MtbStateMachine()
-    remote_touch.BeginEventStream()
+    remote_touch.FlushSnapshotBuffer()
     while len(pressures) < self.num_samples:
-      event = remote_touch.NextEvent()
-      if not event:
-        raise Exception("Lost connection to remote device.")
-      state_machine.add_event(event)
-      if not event.is_SYN_REPORT():
-        # we are only processing SYN reports.
-        continue
-      state = state_machine.get_current_snapshot()
+      state = remote_touch.NextSnapshot()
       if len(state.fingers) == 1:
         pressures.append(state.fingers[0].pressure)
       sys.stdout.write("\r%d/%d" % (len(pressures), self.num_samples))
       sys.stdout.flush()
     print
-    remote_touch.EndEventStream()
     return pressures
 
   def GenerateComment(self, average, expected):
diff --git a/remote b/remote
new file mode 120000
index 0000000..eb839b9
--- /dev/null
+++ b/remote
@@ -0,0 +1 @@
+../touch_firmware_test/remote/
\ No newline at end of file
diff --git a/remote.py b/remote.py
deleted file mode 120000
index fd20d4c..0000000
--- a/remote.py
+++ /dev/null
@@ -1 +0,0 @@
-../touch_firmware_test/remote.py
\ No newline at end of file