Add a get_board() method to servod.

The new method is meant to support clients that need to determine
their behavior based on the kind of DUT board the Servo is
controlling.  The method returns the board (if any) that was passed
via the --board option.

BUG=chromium-os:35804
TEST=integration testing with a corresponding autotest client

Change-Id: Ic7f0d6467c5ab7faf030e0ec26a938509bd6ae03
Reviewed-on: https://gerrit.chromium.org/gerrit/45621
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Richard Barnette <jrbarnette@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Tom Wai-Hong Tam <waihong@chromium.org>
Commit-Queue: Richard Barnette <jrbarnette@chromium.org>
diff --git a/servo/servo_server.py b/servo/servo_server.py
index 7c9f064..fec57d5 100644
--- a/servo/servo_server.py
+++ b/servo/servo_server.py
@@ -32,7 +32,8 @@
   _USB_DETECTION_DELAY = 10
   _HTTP_PREFIX = "http://"
 
-  def __init__(self, config, vendor, product, serialname=None, interfaces=None):
+  def __init__(self, config, vendor, product, serialname=None,
+               interfaces=None, board=""):
     """Servod constructor.
 
     Args:
@@ -58,6 +59,7 @@
     # Dict of Dict to map control name, function name to to tuple (params, drv)
     # Ex) _drv_dict[name]['get'] = (params, drv)
     self._drv_dict = {}
+    self._board = board
 
     # Note, interface i is (i - 1) in list
     if not interfaces:
@@ -582,6 +584,10 @@
     self._logger.debug("echo(%s)" % (echo))
     return "ECH0ING: %s" % (echo)
 
+  def get_board(self):
+    """Return the board specified at startup, if any."""
+    return self._board
+
 
 def test():
   """Integration testing.
diff --git a/servo/servod.py b/servo/servod.py
index 209af4f..dafaa94 100755
--- a/servo/servod.py
+++ b/servo/servod.py
@@ -67,7 +67,7 @@
                     help="device serialname stored in eeprom")
   parser.add_option("-c", "--config", default=None, type=str, action="append",
                     help="system config files (XML) to read")
-  parser.add_option("-b", "--board", default=None, type=str, action="store",
+  parser.add_option("-b", "--board", default="", type=str, action="store",
                     help="include config file (XML) for given board")
   parser.add_option("--noautoconfig", action="store_true", default=False,
                     help="Disable automatic determination of config files")
@@ -264,7 +264,8 @@
   servod = servo_server.Servod(scfg, vendor=servo_device.idVendor,
                                product=servo_device.idProduct,
                                serialname=usb_get_iserial(servo_device),
-                               interfaces=options.interfaces.split())
+                               interfaces=options.interfaces.split(),
+                               board=options.board)
   servod.hwinit(verbose=True)
   server.register_introspection_functions()
   server.register_multicall_functions()