[hdctools] servod: add miniservo functionality.

Miniservo is a smaller debug / control board that connects to the
Google debug header.  It provides uart access + 4 gpios via the FT232R
chip from FTDI.  This CL enables servod to recognize and instantiate
necessary interfaces to a connected miniservo.  This CL obsoletes the
previous prototype c-based server src/miniservod.c by providing a
nicer interface via dut-control and/or the servo autotest classes

Depends on:
CL: http://gerrit.chromium.org/gerrit/#change,1675

BUG=chrome-os-partner:2784
TEST=manual,
- Launch server
  sudo servod -c miniservo.xml -v 0x18d1 -p 0x5000
- investigate gpios
  dut-control
- connect to uart
  cu -l /dev/pts/XX

Similarily make sure servod still works by repeating client steps
above but by launching server with
  sudo servod -c servo.xml -v 0x18d1 -p 0x5001

Change-Id: I16921d89ea847397843c497a66c93672569219d8
Reviewed-on: http://gerrit.chromium.org/gerrit/8866
Tested-by: Todd Broch <tbroch@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/servo/servo_server.py b/servo/servo_server.py
index 1c493aa..f98e2d2 100644
--- a/servo/servo_server.py
+++ b/servo/servo_server.py
@@ -57,7 +57,11 @@
         func = getattr(self, '_init_%s' % name)
       except AttributeError:
         raise ServodError("Unable to locate init for interface %s" % name)
-      self._interface_list.append(func(i + 1))
+      result = func(i + 1)
+      if isinstance(result, tuple):
+        self._interface_list.extend(result)
+      else:
+        self._interface_list.append(result)
 
   def _init_gpio(self, interface):
     """Initialize gpio driver interface and open for use.
@@ -109,6 +113,26 @@
     self._logger.info("%s" % fobj.get_pty())
     return fobj
 
+  def _init_gpiouart(self, interface):
+    """Initialize special gpio + uart interface and open for use
+
+    Note, the uart runs in a separate thread (pthreads).  Users wishing to
+    interact with it will query control for the pty's pathname and connect
+    with there favorite console program.  For example:
+      cu -l /dev/pts/22
+
+    Args:
+      interface: interface number of FTDI device to use
+
+    Returns:
+      Instance objects of interface
+    """
+    fgpio = self._init_gpio(interface)
+    fuart = ftdiuart.Fuart(self._vendor, self._product, interface, fgpio._fc)
+    fuart.run()
+    self._logger.info("uart pty: %s" % fuart.get_pty())
+    return fgpio, fuart
+
   def _get_param_drv(self, control_name, is_get=True):
     """Get access to driver for a given control.