Allow webplot to use multiple protocols

The underlying remote touch device classes support multiple touch
protocols now, but webplot didn't have a way to pass that information
through.  This CL adds a new command line parameter --protocol which
allows the user to specify a protocol if they'd like.

BUG=none
TEST=manually tested

Change-Id: I25c7aaca7d2a40f92ff13c005cdfc2e1297145cc
Signed-off-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/389551
Reviewed-by: Shyh-In Hwang <josephsih@chromium.org>
diff --git a/webplot/webplot.py b/webplot/webplot.py
index 52c1852..26fcd5c 100755
--- a/webplot/webplot.py
+++ b/webplot/webplot.py
@@ -571,6 +571,10 @@
                       help=('When this flag is set the script will try to '
                             'start a web browser automatically once webplot '
                             'is ready, instead of waiting for the user to.'))
+  parser.add_argument('--protocol',type=str, default='auto',
+                      choices=['auto', 'stylus', 'MTB', 'MTA'],
+                      help=('Which protocol does the device use? Choose from '
+                            'auto, MTB, MTA, or stylus'))
 
   # Arguments especial for centroiding visualizing tool.
   # Please set "--dut_type centroiding" for centroiding utility.
@@ -641,9 +645,10 @@
   # Instantiate a touch device.
   if args.dut_type == 'chromeos':
     addr = args.dut_addr if args.dut_addr else '127.0.0.1'
-    device = ChromeOSTouchDevice(addr, args.is_touchscreen, grab=args.grab)
+    device = ChromeOSTouchDevice(addr, args.is_touchscreen, grab=args.grab,
+                                 protocol=args.protocol)
   elif args.dut_type == 'android':
-    device = AndroidTouchDevice(args.dut_addr, True)
+    device = AndroidTouchDevice(args.dut_addr, True, protocol=args.protocol)
   elif is_centroiding:  # args.dut_type == 'centroiding'
     # Import centroiding library conditionally to avoid missing dependency.
     from centroiding import CentroidingDataReceiver, CentroidingDevice