remove c files moved from servo -> src subdir previously

BUG=none
TEST=manual
sudo emerge -1 hdctools
check that it builds and installs

Change-Id: I1eab69efa1d2fb46dfcf6cb278e70aa05cc6e22b

Review URL: https://chromereviews.googleplex.com/2701015
diff --git a/servo/fgpio_test.c b/servo/fgpio_test.c
deleted file mode 100644
index 8d84e0b..0000000
--- a/servo/fgpio_test.c
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include <ftdi.h>
-#include "ftdi_common.h"
-#include "ftdigpio.h"
-
-void usage(char *progname) {
-  printf("\n\n%s [switch args]\n", progname);
-  printf("\nOnce started input value and direction when prompted.\n");
-  printf("<cr> to exit\n");
-  exit(-1);
-}
-
-int main(int argc, char **argv) {
-  int rv = 0;
-
-  struct ftdi_context fc;
-  struct fgpio_context fgc;
-
-  int args_consumed = 0;
-  struct ftdi_common_args fargs = {
-    .interface = INTERFACE_D,
-    .vendor_id = 0x0403,
-    .product_id = 0x6011,
-    .serialname = NULL,
-    // default is inputs
-    .direction = 0,
-    .value = 0,
-  };
-
-  if ((args_consumed = fcom_args(&fargs, argc, argv)) < 0) {
-    usage(argv[0]);
-  }
-  if (ftdi_init(&fc) < 0) {
-    ERROR_FTDI("Initializing ftdi context", &fc);
-    return 1;
-  }
-  if (fgpio_init(&fgc, &fc)) {
-    prn_fatal("fgpio_init\n");
-  }
-  if (fgpio_open(&fgc, &fargs)) {
-    prn_fatal("fgpio_open\n");
-  }
-
-  struct gpio_s gpio;
-  uint8_t rd_val;
-  // just default to allowable maximum
-  gpio.mask = fgc.gpio.mask;
-  
-  if (fargs.direction) {
-    gpio.direction = fargs.direction;
-    gpio.value = fargs.value;
-    if ((rv = fgpio_wr_rd(&fgc, &gpio, &rd_val, GPIO))) {
-      prn_error("fgpio_wr_rd (%d)\n", rv);
-    } else {
-      prn_info("Initialized gpio dir = 0x%02x, val = 0x%02x\n",
-               gpio.direction, gpio.value);
-    }
-  }
-  while (1) {
-    char in_str[128];
-    printf("DIR:");
-    if ((fgets(in_str, sizeof(in_str) - 1, stdin) == NULL) ||
-        (in_str[0] == '\n')) {
-      break;
-    }
-    gpio.direction = strtoul(in_str, NULL, 0);
-
-    printf("VAL:");
-
-    if ((fgets(in_str, sizeof(in_str) - 1, stdin) == NULL) ||
-        (in_str[0] == '\n')) {
-      break;
-    }
-    gpio.value = strtoul(in_str, NULL, 0);
-
-    if ((rv = fgpio_wr_rd(&fgc, &gpio, &rd_val, GPIO))) {
-      prn_error("fgpio_wr_rd (%d)\n", rv);
-      break;
-    }
-    printf("RD:0x%02x\n", rd_val);
-  }
-  fgpio_close(&fgc);
-  return rv;
-}
diff --git a/servo/fi2c_test.c b/servo/fi2c_test.c
deleted file mode 100644
index 0163cc9..0000000
--- a/servo/fi2c_test.c
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include <ftdi.h>
-#include "ftdi_common.h"
-#include "ftdii2c.h"
-
-#define MAX_BUF_SIZE 128
-
-void usage(char *progname) {
-  printf("%s [switch args] <slv> [<reg0> [ <reg1> ] ] rd <cnt>\n", progname);
-  puts("\tor");
-  printf("%s [switch args] <slv> wr <b0> [<b1> ... <bn>]\n", progname);
-  puts("\nWhere:");
-  puts("        <slv>      : slave device ( 1 byte )");
-  puts("        <regX>     : index register into slave.  Can be 1 || 2 bytes");
-  puts("        rd|wr      : read or write");
-  puts("        <cnt>      : bytes to read");
-  puts("        <b1>..<bn> : bytes to write");
-  exit(-1);
-}
-
-void prn_output(uint8_t *buf, int cnt) {
-  int i;
-
-  for (i = 0; i < cnt; i++) {
-    if (i && (i % 16) == 0) { printf("\n"); }
-    if (cnt > 4) {
-      printf("0x%02x ", buf[i]);
-    } else if (i == 0) {
-      printf("0x%02x", buf[i]);
-    } else {
-      printf("%02x", buf[i]);
-    }
-  }
-  printf("\n");
-}
-
-int parse_i2c_args(uint8_t *wbuf, int *wcnt, int *rcnt, uint8_t *slv, 
-                   int argc, char **argv) {
-  int i;
-  int cnt = 0;
-  unsigned long int slv_ul;
-
-  if (argc < 4) {
-    prn_error("More arguments please\n\n");
-    usage(argv[0]);
-  }
-  slv_ul = strtoul(argv[1], NULL, 0);
-  // 7-bit i2c has 112 valid slaves from 0x8 -> 0x77 only
-  if ((slv_ul < 0x8) || (slv_ul > 0x77)) {
-    prn_error("Invalid slave address 0x%lx\n", slv_ul);
-    return -1;
-  }
-  *slv = (uint8_t)slv_ul;
-
-  /* argc[2] == rd|wr :: raw read|write */
-  /* argc[3:4] == rd :: registered read */
-  if (!strcmp(argv[2], "rd")) {
-    *rcnt = strtoul(argv[3], NULL, 0);
-  } else if (!strcmp(argv[3], "rd")) {
-    wbuf[cnt++] = strtoul(argv[2], NULL, 0);
-    *rcnt = strtoul(argv[4], NULL, 0);
-  } else if (!strcmp(argv[4], "rd")) {
-    wbuf[cnt++] = strtoul(argv[2], NULL, 0);
-    wbuf[cnt++] = strtoul(argv[3], NULL, 0);
-    *rcnt = strtoul(argv[5], NULL, 0);
-  } else if (!strcmp(argv[2], "wr")) {
-    if ((argc - 3) > MAX_BUF_SIZE) {
-      goto INPUT_ERROR;
-    }
-    for (i = 3; i < argc; i++) {
-      wbuf[cnt++] = strtoul(argv[i], NULL, 0);
-    }
-  } else {
-    goto INPUT_ERROR;
-  }
-  if ((*rcnt > MAX_BUF_SIZE) || (cnt > MAX_BUF_SIZE)) {
-    goto INPUT_ERROR;
-  }
-  *wcnt = cnt;
-  return FCOM_ERR_NONE;
- INPUT_ERROR:
-  prn_error("Unrecognized input.  See %s -h\n", argv[0]);
-  return FCOM_ERR;
-}
-
-int main (int argc, char **argv) {
-
-  uint8_t wbuf[MAX_BUF_SIZE];
-  uint8_t rbuf[MAX_BUF_SIZE];
-  uint8_t slv;
-
-  int wcnt = 0;
-  int rcnt = 0;
-  int rv = 0;
-
-  struct ftdi_context fc;
-  struct fi2c_context fic;
-  struct ftdi_common_args fargs;
-  memset(&fargs, 0, sizeof(fargs));
-  // defaults for servo 
-  fargs.vendor_id = 0x0403;
-  fargs.product_id = 0x6011;
-  fargs.interface = INTERFACE_B;
-  fargs.serialname = NULL;
-  fargs.speed = 100000;
-
-  int args_consumed;
-  if ((args_consumed = fcom_args(&fargs, argc, argv)) < 0) {
-    usage(argv[0]);
-  }
-  parse_i2c_args(wbuf, &wcnt, &rcnt, &slv, (argc - args_consumed), 
-                 &argv[args_consumed]);
-  
-  if (!rcnt && !wcnt) {
-    prn_error("No writes or reads to perform\n");
-    return -1;
-  }
-  
-  if ((rv = ftdi_init(&fc)) < 0) {
-    ERROR_FTDI("Initializing ftdi context", &fc);
-    return rv;
-  }
-  fi2c_init(&fic, &fc);
-  
-  if ((rv = fi2c_open(&fic, &fargs)))
-    return rv;
-  
-  if ((rv = fi2c_setclock(&fic, fargs.speed)))
-    return rv;
-  fic.slv = slv;
-  
-  if ((rv = fi2c_wr_rd(&fic, wbuf, wcnt, rbuf, rcnt))) {
-    prn_error("Problem reading/writing i2c\n");
-    return rv;
-  }
-  if (rcnt) 
-    prn_output(rbuf, rcnt);
-
-  rv = fi2c_close(&fic);
-  return rv;
-}
diff --git a/servo/ftdi_common.c b/servo/ftdi_common.c
deleted file mode 100644
index 1588508..0000000
--- a/servo/ftdi_common.c
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <stdio.h>
-#include <string.h>
-#include "ftdi_common.h"
-
-// return number of interfaces, -1 for error
-int fcom_num_interfaces(struct ftdi_context *fc) {
-  if (fc->usb_dev == NULL) {
-    // no ftdi_usb_open so haven't contacted device yet ... fail
-    return -1;
-  }
-  switch (fc->type) {
-    case(TYPE_AM):
-    case(TYPE_R):
-    case(TYPE_BM):
-      return 1;
-      break;
-    case(TYPE_2232C):
-    case(TYPE_2232H):
-      return 2;
-      break;
-    case(TYPE_4232H):
-      return 4;
-      break;
-  }
-  return -1;
-}
-
-int fcom_cfg(struct ftdi_context *fc, int interface, 
-                   enum ftdi_mpsse_mode mode, int direction) {
-
-  if (fcom_num_interfaces(fc) > 1) {
-    prn_dbg("setting interface to %d\n", interface);
-    if (ftdi_set_interface(fc, interface)) {
-      ERROR_FTDI("setting interface", fc);
-      return FCOM_ERR_SET_INTERFACE;
-    }
-  }
-  CHECK_FTDI(ftdi_set_latency_timer(fc, FCOM_USB_LATENCY_TIMER),
-             "Set latency timer", fc);
-  CHECK_FTDI(ftdi_set_bitmode(fc, 0, BITMODE_RESET),
-  "Resetting", fc);
-  CHECK_FTDI(ftdi_set_bitmode(fc, direction, mode), 
-             "setting mode", fc);
-  CHECK_FTDI(ftdi_usb_purge_buffers(fc), "Purge buffers", fc);
-  return FCOM_ERR_NONE;
-}
-
-#define USG_DEFAULT(...)                                \
-  printf("                             DEFAULT=");      \
-  printf(__VA_ARGS__)
-
-static void usage(struct ftdi_common_args *fargs) {
-  puts("Common ftdi args ::");
-  puts("       -v <num>            : vendor id of device to connect to");
-  USG_DEFAULT("0x%02x\n", fargs->vendor_id);
-  puts("       -p <num>            : product id of device to connect to");
-  USG_DEFAULT("0x%02x\n", fargs->product_id);
-  puts("       -d <num>            : device id if >1 ftdi with same vid:pid");
-  USG_DEFAULT("%d\n", fargs->dev_id);
-  puts("       -i <interface>      : interface id for FTDI port");
-  USG_DEFAULT("%d\n", fargs->interface);
-  puts("       -s <num>             : speed ( buadrate ) in hertz");
-  USG_DEFAULT("%d\n", fargs->speed);
-  puts("       -g <dir>:<val>      : initial gpio configuration");
-  puts("       -h                  : this message");
-  puts("\nWhere:");
-  puts("       <interface> : a|b|c|d|1|2|3|4.  Note '0' means 'Any' which is device dependent");
-  puts("       <hz>        : number in hertz");
-  puts("       <dir>       : mask for gpio direction.  1=output, 0=input");
-  puts("       <val>       : mask for gpio value.  1=high, 0=low");
-  puts("\n");
-
-}
-
-int fcom_args(struct ftdi_common_args *fargs, int argc, char **argv) {
-  int c;
-  char *ptr;
-  int args_consumed = 0;
-
-  // TODO(tbroch) add uart bits,sbits,parity arg parsing
-  while ((c = getopt(argc, argv, "v:p:i:s:g:h")) != -1) {
-    switch (c) {
-      case 'v':
-        fargs->vendor_id = strtoul(optarg, NULL, 0);
-        args_consumed += 2;
-        break;
-      case 'p':
-        fargs->product_id = strtoul(optarg, NULL, 0);
-        args_consumed += 2;
-        break;
-      case 'i':
-        switch(optarg[0]) {
-          case '0':
-            fargs->interface = INTERFACE_ANY;
-            break;
-          case '1':
-          case 'a':
-          case 'A':
-              fargs->interface = INTERFACE_A;
-              break;
-          case '2':
-          case 'b':
-          case 'B':
-              fargs->interface = INTERFACE_B;
-              break;
-          case '3':
-          case 'c':
-          case 'C':
-              fargs->interface = INTERFACE_C;
-              break;
-          case '4':
-          case 'd':
-          case 'D':
-              fargs->interface = INTERFACE_D;
-              break;
-          default:
-            prn_fatal("Unknown interface value %c.  Should be [a|b|c|d]\n", c);
-            break;
-        }
-        args_consumed += 2;
-        break;
-      case 's':
-        fargs->speed = strtoul(optarg, NULL, 0);
-        args_consumed += 2;
-        break;
-      case 'g':
-        fargs->direction = strtoul(optarg, &ptr, 0);
-        if (ptr[0] != ':') {
-          prn_fatal("Poorly formatted direction in -g <dir>:<val> string\n");
-          break;
-        }
-        ptr++;
-        fargs->value = strtoul(ptr, &ptr, 0);
-        if (ptr[0] != '\0') {
-          prn_fatal("Poorly formatted value in -g <dir>:<val> string\n");
-          break;
-        }
-        
-        args_consumed += 2;
-        break;
-      case 'h':
-        usage(fargs);
-        return -1;
-      default:
-        // remaining args parsed by caller
-        break;
-    }
-  }
-  return args_consumed;
-}
-
-int fcom_lookup_serial(struct ftdi_context *fc, char *name) {
-  // TODO(tbroch) implement lookup of serial from eeprom
-  prn_fatal("not implemented\n");
-}
-
-int fcom_is_mpsse(struct ftdi_context *fc, 
-                        struct ftdi_common_args *fargs) {
-  switch(fc->type) {
-    case(TYPE_2232C):
-      return (fargs->interface <= 1);
-      break;
-    case(TYPE_2232H):
-    case(TYPE_4232H):
-      return (fargs->interface <= 2);
-      break;
-    case(TYPE_AM):
-    case(TYPE_R):
-    case(TYPE_BM):
-    default:
-      return 0;
-      break;
-  }
-}
-
-struct ftdi_itype *fcom_lookup_interface(struct ftdi_itype *interfaces, 
-                                         unsigned int cnt, 
-                                         unsigned int interface_num,
-                                         enum ftdi_interface_type itype) {
-  if (interface_num > cnt) {
-    return NULL;
-  }
-  if ((itype != ANY) && (interfaces[interface_num-1].type != itype)) {
-    return NULL;
-  }
-  return &interfaces[interface_num-1];
-}
-
diff --git a/servo/ftdi_common.h b/servo/ftdi_common.h
deleted file mode 100644
index 6da03e5..0000000
--- a/servo/ftdi_common.h
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef __FTDI_UTILS_H__
-#define __FTDI_UTILS_H__
-
-#include <ftdi.h>
-#include <sys/time.h>
-#include <stdint.h>
-#include <time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FCOM_USB_LATENCY_TIMER 16   // in msecs
-
-#define FCOM_OK 0
-
-#define FCOM_ERR_NONE 0
-#define FCOM_ERR 1
-#define FCOM_ERR_SET_INTERFACE 1
-
-#define FTDI_ERR_USB_UNAVAIL -666
-
-#define FTDI_CLK_MAX_X5 30000000    // max clock (hz) for FTDI high speed dev
-#define FTDI_CLK_MAX_X1  6000000    // max clock (hz) for FTDI dev
-#define FTDI_CLK_MIN         100    // min clock (hz) for FTDI dev
-
-// global clock setup commands
-#define FTDI_CMD_X5_OFF      0x8a   // disable clock div 5 for 60mhz master clk
-#define FTDI_CMD_3PHASE      0x8c   // 3 phase clocking needed for i2c
-#define FTDI_CMD_NO_ADAP_CLK 0x97   // turn off adaptive clocking
-#define FTDI_CMD_3PH_CLK     0x8d   // enable 3 phase clocking
-
-// MPSSE clocking control commands
-// M(F|R)E == MSB Falling|Rising Edge 
-// L(F|R)E == LSB Falling|Rising Edge
-#define FTDI_CMD_MRE_CLK_BYTE_OUT 0x10
-#define FTDI_CMD_MFE_CLK_BYTE_OUT 0x11
-#define FTDI_CMD_MRE_CLK_BIT_OUT  0x12
-#define FTDI_CMD_MFE_CLK_BIT_OUT  0x13
-#define FTDI_CMD_MRE_CLK_BYTE_IN  0x20
-#define FTDI_CMD_MFE_CLK_BYTE_IN  0x24
-#define FTDI_CMD_LRE_CLK_BIT_IN   0x2a
-#define FTDI_CMD_LFE_CLK_BIT_IN   0x2e
-
-#define IS_FTDI_OPEN(context) (context->usb_dev != NULL)
-
-#define ERROR_FTDI(msg, context)                                \
-  prn_error("%s: %s\n", msg, ftdi_get_error_string(context))
-
-#define CHECK_FTDI(fx, msg, context) \
-  do {                               \
-    if (fx < 0) {                    \
-      ERROR_FTDI(msg, context);      \
-    }                                \
-  } while (0)
-    
-struct gpio_s {
-  uint8_t value;
-  uint8_t direction;
-  uint8_t mask;
-};
-
-struct ftdi_common_args {
-  unsigned int vendor_id;
-  unsigned int product_id;
-  unsigned int dev_id;
-  enum ftdi_interface interface;
-  char *serialname;
-  unsigned int speed;
-  enum ftdi_bits_type bits;
-  enum ftdi_parity_type parity;
-  enum ftdi_stopbits_type sbits;
-  uint8_t value;
-  uint8_t direction;
-};
-
-enum ftdi_interface_type {
-  ANY,
-  GPIO,
-  I2C,
-  JTAG,
-  SPI,
-  UART
-};
-
-struct ftdi_itype {
-  enum ftdi_interface_type type;
-  void *context;
-};
-
-#ifdef WITH_TIME
-// TODO(tbroch) switch to clock_gettime
-
-/*
-struct timezone {
-  int tz_minuteswest;     // minutes west of Greenwich 
-  int tz_dsttime;         // type of DST correction 
-};
-*/
-
-struct timeval tv;
-struct timezone tz;
-struct tm *tm;
-
-#define _prn_time()                                                 \
-  gettimeofday(&tv, &tz);                                           \
-  tm=localtime(&tv.tv_sec);                                         \
-  fprintf(stderr, "(%02d:%02d:%02d.%u)", tm->tm_hour, tm->tm_min,   \
-          tm->tm_sec, (unsigned int)tv.tv_usec)
-#else
-#define _prn_time()
-#endif
-
-#define _prn_common(type, ...)                               \
-  fprintf(stderr, "%s %s:%u :: ", type, __FILE__, __LINE__); \
-  fprintf(stderr, __VA_ARGS__)
-
-#define prn_fatal(...)             \
-  _prn_common("-F-", __VA_ARGS__); \
-  exit(-1);
-#define prn_error(...)                          \
-  _prn_common("-E-", __VA_ARGS__)
-#define prn_warn(...)                           \
-  _prn_common("-W-", __VA_ARGS__)
-#define prn_info(...)                          \
-  _prn_time();                                 \
-  _prn_common("-I-", __VA_ARGS__)
-
-#define prn_perror(...)                                 \
-  prn_error("%s (%d): ", strerror(errno), errno);       \
-  fprintf(stderr, __VA_ARGS__)
-
-#ifdef DEBUG
-#define prn_dbg(...)                            \
-  _prn_time();                                  \
-  _prn_common("-D-", __VA_ARGS__)
-#else
-#define prn_dbg(...)
-#endif
-
-#define _prn_ftdi_common(type, rv, context, ...)                         \
-  fprintf(stderr, "%s:", type);                                          \
-  fprintf(stderr, __VA_ARGS__);                                          \
-  fprintf(stderr, " : %d (%s)\n", rv, ftdi_get_error_string(context))
-
-#define prn_ftdi_error(rv, context, ...)               \
-  _prn_ftdi_common("ERROR", rv, context, __VA_ARGS__)
-#define prn_ftdi_warn(rv, context, ...)                \
-  _prn_ftdi_common("WARN", rv, context, __VA_ARGS__)
-
-int fcom_cfg(struct ftdi_context *, int, enum ftdi_mpsse_mode, int);
-int fcom_args(struct ftdi_common_args *, int, char **);
-int fcom_lookup_serial(struct ftdi_context *, char *);
-int fcom_num_interfaces(struct ftdi_context *);
-int fcom_is_mpsse(struct ftdi_context *, struct ftdi_common_args *);
-struct ftdi_itype *fcom_lookup_interface(struct ftdi_itype *, unsigned int,
-                                         unsigned int,
-                                         enum ftdi_interface_type itype);
-
-#ifdef __cplusplus
-}
-#endif
-#endif // __FTDI_UTILS_H__
diff --git a/servo/ftdigpio.c b/servo/ftdigpio.c
deleted file mode 100644
index 07e8158..0000000
--- a/servo/ftdigpio.c
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include <assert.h>
-
-#include "ftdi_common.h"
-#include "ftdigpio.h"
-
-int fgpio_init(struct fgpio_context *fgc, struct ftdi_context *fc) {
-  assert(fgc);
-  memset(fgc, 0, sizeof(*fgc));
-
-  fgc->fc = fc;
-  fgc->gpio.direction = 0;
-  fgc->gpio.value = 0;
-  fgc->gpio.mask = 0xff;
-
-  if (fgc->fc->type == TYPE_R) {
-    // only a nibble worth of gpios
-    fgc->gpio.mask = 0x0f;
-  }
-  return FGPIO_ERR_NONE;
-}
-
-int fgpio_open(struct fgpio_context *fgc, struct ftdi_common_args *fargs) {
-  int rv = 0;
-  ftdi_set_interface(fgc->fc, fargs->interface);
-  if (!IS_FTDI_OPEN(fgc->fc)) {
-    rv = ftdi_usb_open(fgc->fc, fargs->vendor_id, fargs->product_id);
-    // TODO(tbroch) investigate rmmod for ftdi_sio and retrying open when the
-    // return value is -5 (unable to claim device)
-    if (rv < 0) {
-      ERROR_FTDI("Opening usb connection", fgc->fc);
-      return rv;
-    }
-  }
-  assert(fgc->fc);
-  if (fgc->fc->type != TYPE_R) {
-    rv = fcom_cfg(fgc->fc, fargs->interface, BITMODE_BITBANG, 0);
-  }
-  return rv;
-}
-
-int fgpio_wr_rd(struct fgpio_context *fgc, struct gpio_s *new_gpio, 
-                uint8_t *rd_val, enum ftdi_interface_type itype) {
-  uint8_t buf[3];
-  int dir_chg = 0;
-  int val_chg = 0;
-  struct ftdi_context *fc = fgc->fc;
-  struct gpio_s *gpio = &fgc->gpio;
-
-  if (new_gpio != NULL) {
-    if ((gpio->mask | new_gpio->mask) != gpio->mask) {
-      prn_dbg("GPIO mask mismatch 0x%02x != 0x%02x for this interface\n",
-              gpio->mask, new_gpio->mask);
-      return FGPIO_ERR_MASK;
-    }
-    // direction register is changing
-    if (new_gpio->mask & (gpio->direction ^ new_gpio->direction)) {
-      dir_chg = 1;
-      gpio->direction = (new_gpio->mask & new_gpio->direction) | 
-                        (~new_gpio->mask & gpio->direction);
-      prn_dbg("Changing direction register to 0x%02x\n", gpio->direction);
-    }
-    // value is changing
-    if (new_gpio->mask & (gpio->value ^ new_gpio->value)) {
-      val_chg = 1;
-      gpio->value = (new_gpio->mask & new_gpio->value) | 
-                    (~new_gpio->mask & gpio->value);
-      prn_dbg("Changing value register to 0x%02x\n", gpio->value);
-    }
-
-    if ((fgc->fc->type == TYPE_R) && (val_chg || dir_chg)) {
-      buf[0] = ((0xf & gpio->direction)<<4) | (0xf & gpio->value);
-      prn_dbg("cbus write of 0x%02x\n", buf[0]);
-      CHECK_FTDI(ftdi_set_bitmode(fc, buf[0], BITMODE_CBUS),
-                 "write cbus gpio", fc);
-    } else {
-      // traditional 8-bit interfaces
-      if (itype == UART) {
-        // TODO(tbroch) implement this but requires libusb plumbing in all
-        // likelihood.  For now error
-        return FGPIO_ERR_NOIMP;
-      }
-      if ((itype == GPIO) && dir_chg) {
-        CHECK_FTDI(ftdi_set_bitmode(fc, gpio->direction, BITMODE_BITBANG), 
-                   "re-cfg gpio direction", fc);
-        prn_dbg("Wrote direction to 0x%02x\n", gpio->direction);
-      }
-      // dir change takes effect on ftdi_write_data done below
-      if (val_chg || dir_chg) {
-        int wr_bytes = 0;
-        int bytes_to_wr = 0;
-
-        if (itype != GPIO) {
-          // all non-gpio interfaces (spi,jtag,i2c) rely on MPSSE mode
-          // TODO(tbroch) PRI=2, add support for chips w/ hi/low support
-          buf[bytes_to_wr++] = SET_BITS_LOW;
-          buf[bytes_to_wr++] = gpio->value;
-          buf[bytes_to_wr++] = gpio->direction;
-        } else {
-          buf[bytes_to_wr++] = gpio->value;
-        }
-        wr_bytes = ftdi_write_data(fc, buf, bytes_to_wr);
-        if (wr_bytes != bytes_to_wr) {
-          ERROR_FTDI("writing gpio data", fc);
-          return FGPIO_ERR_WR;
-        }
-        prn_dbg("Wrote value to 0x%02x\n", gpio->value);
-      }
-    }
-  }
-  if (rd_val != NULL) {
-    CHECK_FTDI(ftdi_read_pins(fc, rd_val), "reading gpios", fc);
-    if (fgc->fc->type == TYPE_R) {
-      *rd_val &= 0xf;
-    }
-    prn_dbg("Read value to 0x%02x\n", *rd_val);
-  }
-  return FGPIO_ERR_NONE;
-}
-
-int fgpio_close(struct fgpio_context *fgc) {
-  int rv = FGPIO_ERR_NONE;
-  CHECK_FTDI(ftdi_disable_bitbang(fgc->fc), "disable bitbang", fgc->fc);
-  CHECK_FTDI(ftdi_usb_close(fgc->fc), "usb close", fgc->fc);
-  ftdi_deinit(fgc->fc);
-  return rv;
-}
-
diff --git a/servo/ftdigpio.h b/servo/ftdigpio.h
deleted file mode 100644
index c565f48..0000000
--- a/servo/ftdigpio.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef __FTDIGPIO_H__
-#define __FTDIGPIO_H__
-
-#include <ftdi.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FGPIO_ERR_NONE   0
-#define FGPIO_ERR_WR     1
-#define FGPIO_ERR_RD     2
-#define FGPIO_ERR_MASK   3
-#define FGPIO_ERR_NOIMP  4
-  
-#define ERROR_FGPIO(ecode, ...)                 \
-  fprintf(stderr, "-E- (%d) ", ecode);          \
-  fprintf(stderr, __VA_ARGS__)                 
-  
-#ifndef DEBUG
-#define DEBUG_FGPIO(...)
-#else
-#define DEBUG_FGPIO(...)                                        \
-  fprintf(stderr, "DEBUG: %s:%u ", __FILE__, __LINE__);		\
-  fprintf(stderr, __VA_ARGS__)
-#endif
-  
-#define CHECK_FGPIO(fgpioc, fx, ...) do {           \
-    DEBUG_FGPIO(__VA_ARGS__);                       \
-    if ((fgpioc->error = fx) < 0) {                 \
-      ERROR_FGPIO(fgpioc->error,__VA_ARGS__);       \
-    }                                               \
-  } while (0)
-
-enum fgpio_type {
-  TYPE_STANDARD,
-  TYPE_CBUS
-};
-
-struct fgpio_context { 
-  // v--- DO NOT REORDER ---v
-  struct ftdi_context *fc;
-  struct gpio_s gpio;
-  // ^--- DO NOT REORDER ---^
-  int error;
-};
-
-int fgpio_init(struct fgpio_context *, struct ftdi_context *);
-int fgpio_open(struct fgpio_context *, struct ftdi_common_args *);
-int fgpio_wr_rd(struct fgpio_context *, struct gpio_s *, uint8_t *,
-                enum ftdi_interface_type);
-int fgpio_close(struct fgpio_context *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__FTDIGPIO_H__
diff --git a/servo/ftdii2c.c b/servo/ftdii2c.c
deleted file mode 100644
index 7357c14..0000000
--- a/servo/ftdii2c.c
+++ /dev/null
@@ -1,315 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <assert.h>
-#include <ftdi.h>
-#include <stdio.h>
-
-#include "ftdi_common.h"
-#include "ftdii2c.h"
-
-static int fi2c_start_bit_cmds(struct fi2c_context *fic) {
-  int i;
-
-  // for now don't allow starts in middle of a command buffer
-  assert(fic->bufcnt == 0);
-
-  // TODO(tbroch) factor in whether its high speed dev or not
-  // guarantee minimum setup time between SDA -> SCL transistions
-  for (i = 0; i < 4; i++) {
-    // SCL & SDA high
-    FI2C_CFG_IO(fic, 0, 0);
-  }
-  
-  for (i = 0; i < 4; i++) {
-    // SCL high, SDA low
-    FI2C_CFG_IO(fic, 0, (SDA_POS));
-   }
-  
-  // SCL & SDA low
-  FI2C_CFG_IO(fic, 0, (SCL_POS | SDA_POS));
-  
-  return FI2C_ERR_NONE;
-}
-
-static int fi2c_stop_bit_cmds(struct fi2c_context *fic) {
-  int i;
-
-  // guarantee minimum setup time between SDA -> SCL transistions
-  for (i = 0; i < 4; i++) {
-    // SCL high, SDA low
-    FI2C_CFG_IO(fic, 0, (SDA_POS));
-  }
-  
-  for (i = 0; i < 4; i++) {
-    // SCL & SDA high
-    FI2C_CFG_IO(fic, 0, 0);
-  }
-
-  // SCL & SDA release
-  FI2C_CFG_IO(fic, 0, 0);
-
-  return FI2C_ERR_NONE;
-}
-
-static int fi2c_write_cmds(struct fi2c_context *fic) {
-  int bytes_wrote = 0;
-  int bufcnt = fic->bufcnt;
-
-  fic->bufcnt = 0;
-  bytes_wrote = ftdi_write_data(fic->fc, fic->buf, bufcnt);
-
-  if (bytes_wrote < 0) {
-    ERROR_FTDI("fi2c_write_cmds", fic->fc);
-    return FI2C_ERR_FTDI;
-  } else if (bytes_wrote != bufcnt) {
-    return FI2C_ERR_WRITE;
-  }
-  return FI2C_ERR_NONE;
-}
-
-// TODO(tbroch) can we use the WAIT_ON_x cmds to postpone checking and increase
-//              the payload to/from ftdi queues.  At the very least use 
-//              WAIT_ON to h/w check the ack for speeds sake
-static int fi2c_send_byte_and_check(struct fi2c_context *fic, uint8_t data) {
-  int bytes_read;
-  uint8_t rdbuf[1];
-
-  // clk the single byte out
-  FI2C_WBUF(fic, FTDI_CMD_MFE_CLK_BIT_OUT);
-  FI2C_WBUF(fic, 0x07);
-  FI2C_WBUF(fic, data);
-
-  // SCL low, SDA release for Ack
-  FI2C_CFG_IO(fic, 0, SCL_POS);
-  
-  // read of the ack (cmd,num of bits)
-  FI2C_WBUF(fic, FTDI_CMD_LRE_CLK_BIT_IN);
-  FI2C_WBUF(fic, 0x00);
-
-  // force rx buffer back to host so you can see ack/noack
-  FI2C_WBUF(fic, SEND_IMMEDIATE);
-
-  CHECK_FI2C(fic, fi2c_write_cmds(fic), "write cmds for ack check\n");
-  prn_dbg("bufcnt after write = %d\n", fic->bufcnt);
-
-  // TODO(tbroch) this is s/w ACK should be doable via h/w WAIT_ON_x
-  bytes_read = ftdi_read_data(fic->fc, rdbuf, 1);
-  if (bytes_read < 0) {
-    ERROR_FTDI("read of ack", fic->fc);
-    return FI2C_ERR_FTDI;
-  }
-  if (bytes_read != 1) {
-    prn_error("bytes read %d != 1\n", bytes_read);
-    return FI2C_ERR_READ;
-  } else {
-    if ((rdbuf[0] & 0x80) != 0x0) {
-      prn_error("ack read 0x%02x != 0x0\n", (rdbuf[0] & 0x80));
-      return FI2C_ERR_ACK;
-    }
-    prn_dbg("saw the ack 0x%02x\n", rdbuf[0]);
-  }
-
-  // TODO(tbroch) : shouldn't need to pull SDA high here but get strange results
-  // otherwise.  Needs investigation
-  // SCL low, SDA high
-  FI2C_CFG_IO(fic, SDA_POS, (SCL_POS | SDA_POS));
-  return FI2C_ERR_NONE;
-}
-
-static int fi2c_send_slave(struct fi2c_context *fic, int read) {
-  return fi2c_send_byte_and_check(fic, (fic->slv<<1) | (read ? 0x1 : 0x0));
-}
-
-static int fi2c_wr(struct fi2c_context *fic, uint8_t *wbuf, int wcnt) {
-  int i;
-
-  for (i = 0; i < wcnt; i++) {
-    CHECK_FI2C(fic, fi2c_send_byte_and_check(fic, wbuf[i]), 
-               "wr byte look for ack\n");
-    if (fic->error)
-      return fic->error;
-  }
-  return FI2C_ERR_NONE;
-}
-
-static int fi2c_rd(struct fi2c_context *fic, uint8_t *rbuf, int rcnt) {
-  int i;
-
-  for (i = 0; i < rcnt; i++) {
-    // SCL low
-    FI2C_CFG_IO(fic, 0, SCL_POS);
-    
-    FI2C_WBUF(fic, FTDI_CMD_MRE_CLK_BYTE_IN);
-    FI2C_WBUF(fic, 0x00);
-    FI2C_WBUF(fic, 0x00);
-    
-    if (i == rcnt - 1) {
-      // last byte ... send NACK
-      FI2C_CFG_IO(fic, 0, (SCL_POS));
-      FI2C_WBUF(fic, FTDI_CMD_MFE_CLK_BIT_OUT);
-      FI2C_WBUF(fic, 0x0);
-      FI2C_WBUF(fic, 0xff);
-    } else {
-      // send ACK
-      FI2C_CFG_IO(fic, 0, (SCL_POS | SDA_POS ));
-      FI2C_WBUF(fic, FTDI_CMD_MFE_CLK_BIT_OUT);
-      FI2C_WBUF(fic, 0x0);
-      FI2C_WBUF(fic, 0x0);
-    }
-  }
-  FI2C_WBUF(fic, SEND_IMMEDIATE);
-  CHECK_FI2C(fic, fi2c_write_cmds(fic), "FTDI cmd write for read\n");
-  if (fic->error) 
-    return fic->error;
-
-  int bytes_read;
-  if ((bytes_read = ftdi_read_data(fic->fc, rbuf, rcnt)) != rcnt) {
-    if (bytes_read < 0) {
-      ERROR_FTDI("FTDI read bytes", fic->fc);
-    } else {
-      prn_error("ftdi bytes_read %d != %d expected\n", bytes_read, rcnt);
-    }
-    return FI2C_ERR_READ;
-  }
-  return FI2C_ERR_NONE;
-}
-
-int fi2c_init(struct fi2c_context *fic, struct ftdi_context *fc) {
-  assert(fic);
-  memset(fic, 0, sizeof(*fic));
-
-  fic->fc = fc;
-  fic->fc->usb_read_timeout = 10000;
-  if ((fic->buf = malloc(FI2C_BUF_SIZE)) != NULL) {
-    fic->bufsize = FI2C_BUF_SIZE;
-  }
-  fic->bufcnt = 0;
-
-  // init all inputs
-  fic->gpio.direction = 0;
-  fic->gpio.value = 0;
-  fic->gpio.mask = ~(SCL_POS | SDA_POS | SDB_POS);
-  fic->error = FI2C_ERR_NONE;
-
-  return FI2C_ERR_NONE;
-}
-
-int fi2c_open(struct fi2c_context *fic, struct ftdi_common_args *fargs) {
-
-  ftdi_set_interface(fic->fc, fargs->interface);
-  if (!IS_FTDI_OPEN(fic->fc)) {
-    int rv = ftdi_usb_open(fic->fc, fargs->vendor_id, fargs->product_id);
-    if (rv < 0 && rv != -5) {
-      ERROR_FTDI("Opening usb connection", fic->fc);
-      return rv;
-    }
-  }
-  if (!fcom_is_mpsse(fic->fc, fargs)) {
-    prn_error("ftdi device / interface doesn't support MPSSE\n");
-    return FI2C_ERR_FTDI;
-  }
-  return fcom_cfg(fic->fc, fargs->interface, BITMODE_MPSSE, 0);
-}
-
-int fi2c_setclock(struct fi2c_context *fic, uint32_t clk) {
-  uint8_t  buf[3] = { 0, 0, 0 };
-
-
-
-  buf[0] = FTDI_CMD_3PHASE;
-  CHECK_FTDI(ftdi_write_data(fic->fc, buf, 1), "Set 3-phase clocking",
-             fic->fc);
-  if (clk > FTDI_CLK_MAX_X5 || clk < FTDI_CLK_MIN) {
-    return FI2C_ERR_CLK;
-  }
-  if (clk > FTDI_CLK_MAX_X5) {
-    buf[0] = FTDI_CMD_X5_OFF;
-    CHECK_FTDI(ftdi_write_data(fic->fc, buf, 1), "Set master clock 60mhz",
-               fic->fc);
-  }
-  // 1.5 due to 3-phase requirement
-  int div = DIV_VALUE((clk*1.5));
-  if (!div) {
-    prn_error("Unable to determine clock divisor\n");
-    return FI2C_ERR_CLK;
-  }
-  buf[0] = TCK_DIVISOR;
-  buf[1] = (div >> 0) & 0xFF;
-  buf[2] = (div >> 8) & 0xFF;
-  CHECK_FTDI(ftdi_write_data(fic->fc, buf, 3), "Set clk div", fic->fc);
-  return FI2C_ERR_NONE;
-}
-
-int fi2c_reset(struct fi2c_context *fic) {
-  CHECK_FI2C(fic, fi2c_start_bit_cmds(fic), "Start sent as reset\n");
-  CHECK_FI2C(fic, fi2c_write_cmds(fic), "FTDI write cmds\n");
-  fic->error = FI2C_ERR_NONE;
-  return fic->error;
-}
-
-int fi2c_wr_rd(struct fi2c_context *fic, uint8_t *wbuf, int wcnt,
-                     uint8_t *rbuf, int rcnt) {
-  int err;
-  static int retry_count;
-
- retry:
-  if (wcnt && wbuf) {
-#ifdef DEBUG
-    printf("begin write of: ");
-    int i;
-    for (i = 0; i < wcnt; i++) {
-      printf("0x%02x ", wbuf[i]);
-    } 
-    printf("\n");
-#endif
-    CHECK_FI2C(fic, fi2c_start_bit_cmds(fic), "(WR) Start bit\n");
-    err = fi2c_send_slave(fic, 0);
-    if (err == FI2C_ERR_READ) {
-          retry_count++;
-          goto retry;
-    }
-    if (!fic->error && !err) {
-      err = fi2c_wr(fic, wbuf, wcnt);
-      if (err == FI2C_ERR_READ) {
-          retry_count++;
-          goto retry;
-    }
-      CHECK_FI2C(fic, fi2c_stop_bit_cmds(fic), "(WR) Stop bit\n");
-      CHECK_FI2C(fic, fi2c_write_cmds(fic), "(WR) FTDI write cmds\n");
-    }
-  }
-  if (rcnt && rbuf && !fic->error) {
-    prn_dbg("begin read\n");
-    CHECK_FI2C(fic, fi2c_start_bit_cmds(fic), "(RD) Start bit\n");
-    err = fi2c_send_slave(fic, 1);
-      if (err == FI2C_ERR_READ) {
-          retry_count++;
-          goto retry;
-    }
-    CHECK_FI2C(fic, fi2c_rd(fic, rbuf, rcnt), "(RD) Payload\n");
-#ifdef DEBUG
-    printf("end read: ");
-    int i;
-    for (i = 0; i < rcnt; i++) {
-      printf("0x%02x ", rbuf[i]);
-    } 
-    printf("\n");
-#endif
-  }
-  // TODO(tbroch) debug why this is necessary.  W/o I get sporadic
-  // ftdi_usb_read_data failures.  Might be able to remedy by looking at 
-  // error codes from ftdi_read/write ( -666 ) or errno -16 (EBUSY)
-  // NOTE, removing exposes bug on linux w/ bad results
-  CHECK_FTDI(ftdi_usb_purge_tx_buffer(fic->fc), "Purge tx buf", fic->fc);
-  prn_dbg("done.  Error = %d, Retry count = %d\n", fic->error, retry_count);
-  return fic->error;
-}
-
-int fi2c_close(struct fi2c_context *fic) {
-  CHECK_FTDI(ftdi_usb_close(fic->fc), "fic close", fic->fc);
-  ftdi_deinit(fic->fc);
-  return FI2C_ERR_NONE;
-}
-
diff --git a/servo/ftdii2c.h b/servo/ftdii2c.h
deleted file mode 100644
index 543e4fd..0000000
--- a/servo/ftdii2c.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef __FI2C_H__
-#define __FI2C_H__
-
-#include <ftdi.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdio.h>
-#include "ftdi_common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-  
-// bit positions various signals in interface
-#define SCL_POS 0x01
-#define SDA_POS 0x02
-// note, 0x04 has to be tied to SDA for I/O capabilities
-#define SDB_POS 0x04
-
-#define GP0_POS 0x08
-#define GP1_POS 0x10
-#define GP2_POS 0x20
-#define GP3_POS 0x40
-#define GP4_POS 0x80
-
-#define FI2C_BUF_SIZE (1<<8)
-#define FI2C_CHUNKSIZE (1<<12)
-
-#define FI2C_ERR_NONE   0
-#define FI2C_ERR_FTDI   1
-#define FI2C_ERR_ACK    2
-#define FI2C_ERR_CLK    3
-#define FI2C_ERR_READ   4
-#define FI2C_ERR_WRITE  5
-
-  
-#define ERROR_FI2C(ecode, ...)                  \
-  fprintf(stderr, "-E- (%d) ", ecode);          \
-  fprintf(stderr, __VA_ARGS__)                 
-  
-#ifndef DEBUG
-#define DEBUG_FI2C(...)
-#else
-#define DEBUG_FI2C(...)	prn_dbg( __VA_ARGS__)
-#endif
-  
-#define CHECK_FI2C(fic, fx, ...) do {           \
-    DEBUG_FI2C(__VA_ARGS__);			\
-    if ((fic->error = fx) < 0) {                \
-      ERROR_FI2C(fic->error,__VA_ARGS__);       \
-    }                                           \
-  } while (0)
-  
-  
-#define FI2C_WBUF(fic, val) \
-  fic->buf[fic->bufcnt++] = val
-
-// buf = { cmd, val, dir }
-#define FI2C_CFG_IO(fic, val, dir) do {                                \
-    FI2C_WBUF(fic, SET_BITS_LOW);                                      \
-    FI2C_WBUF(fic, ((val) | fic->gpio.value));                         \
-    FI2C_WBUF(fic, ((dir) | fic->gpio.direction));                     \
-  } while (0)
-  
-struct fi2c_context { 
-  // v--- DO NOT REORDER ---v
-  struct ftdi_context *fc;
-  struct gpio_s gpio;
-  // ^--- DO NOT REORDER ---^
-  unsigned int clk;
-  int error;
-  uint8_t slv;
-  uint8_t *buf;
-  int bufcnt;
-  int bufsize;
-};
-
-int fi2c_init(struct fi2c_context *fic, struct ftdi_context *fc);
-int fi2c_open(struct fi2c_context *fic, struct ftdi_common_args *fargs);
-int fi2c_setclock(struct fi2c_context *fic, uint32_t clkhz);
-int fi2c_reset(struct fi2c_context *fic);
-int fi2c_wr_rd(struct fi2c_context *fic, uint8_t *wbuf, int wcnt,
-               uint8_t *rbuf, int rcnt);
-int fi2c_close(struct fi2c_context *fic);
-
-#ifdef __cplusplus
-}
-#endif
-#endif //__FI2C_H__
diff --git a/servo/ftdiuart.c b/servo/ftdiuart.c
deleted file mode 100644
index 0c8863e..0000000
--- a/servo/ftdiuart.c
+++ /dev/null
@@ -1,172 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <assert.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <ftdi.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <termios.h>
-#include <unistd.h>
-#include <usb.h>
-
-#include "ftdi_common.h"
-#include "ftdiuart.h"
-
-// TODO(tbroch) Where are these protos and under what conditions do they 
-//              exist across lin/mac/win
-int grantpt(int fd);
-int unlockpt(int fd);
-int ptsname_r(int fd, char *buf, size_t buflen);
-int posix_openpt(int flags);
-
-#ifdef DARWIN
-int ptsname_r(int fd, char *buf, size_t buflen) {
-  char *name = ptsname(fd);
-  if (name == NULL) {
-    errno = EINVAL;
-    return -1;
-  }
-  if (strlen(name) + 1 > buflen) {
-    errno = ERANGE;
-    return -1;
-  }
-  strncpy(buf, name, buflen);
-  return 0;
-}
-#endif
-
-int fuart_init(struct fuart_context *fuartc, struct ftdi_context *fc) {
-  assert(fuartc);
-  memset(fuartc, 0, sizeof(*fuartc));
-
-  fuartc->fc = fc;
-  // init all inputs
-  fuartc->gpio.direction = 0;
-  fuartc->gpio.value = 0;
-  // TODO(tbroch) NO OOB signal support (CTS,RTS,DCR,DTR)
-  fuartc->gpio.mask = ~(TX_POS | RX_POS);
-
-  fuartc->error = FUART_ERR_NONE;
-  return FUART_ERR_NONE;
-}
-
-int fuart_open(struct fuart_context *fuartc, 
-                     struct ftdi_common_args *fargs) {
-  int rv;
-
-  struct ftdi_context *fc = fuartc->fc;
-  assert(fc);
-
-  ftdi_set_interface(fc, fargs->interface);
-  if (!IS_FTDI_OPEN(fc)) {
-    rv = ftdi_usb_open(fc, fargs->vendor_id, fargs->product_id);
-    if (rv < 0) {
-      ERROR_FTDI("Opening usb connection", fc);
-      return FUART_ERR_FTDI;
-    }
-  }
-  if (fcom_num_interfaces(fc) > 1) {
-    if ((rv = ftdi_set_interface(fc, fargs->interface))) {
-      ERROR_FTDI("setting interface", fc);
-      return FUART_ERR_FTDI;
-    }
-  }
-  CHECK_FTDI(ftdi_set_bitmode(fc, TX_POS, BITMODE_RESET),
-             "uart mode", fc);
-
-  // TODO(tbroch) Do some checking of reasonable cfg/buadrate
-  CHECK_FTDI(ftdi_set_line_property(fc, fargs->bits, fargs->sbits,
-                                    fargs->parity), "line props", fc);
-  CHECK_FTDI(ftdi_set_baudrate(fc, fargs->speed), "baudrate", fc);
-
-  if (fc->type == TYPE_R) {
-    int gpio_cfg = fargs->direction<<4 | fargs->value;
-    CHECK_FTDI(ftdi_set_bitmode(fc, gpio_cfg, BITMODE_CBUS),
-               "uart mode", fc);
-  }
-
-  int fd;
-  if ((fd = posix_openpt(O_RDWR | O_NOCTTY)) == -1) {
-    perror("opening pty master");
-    return FUART_ERR_OPEN;
-  }
-  if (grantpt(fd) == -1) {
-    perror("grantpt");
-    return FUART_ERR_OPEN;
-  }
-  if (unlockpt(fd) == -1) {
-    perror("unlockpt");
-    return FUART_ERR_OPEN;
-  }
-  if (fcntl(fd, F_SETFL, O_NONBLOCK) == -1) {
-    perror("fcntl setfl -> nonblock");
-    return FUART_ERR_OPEN;
-  }
-  if (ptsname_r(fd, fuartc->name, PATH_MAX) != 0) {
-    perror("getting name of pty");
-    return FUART_ERR_OPEN;
-  }
-  prn_dbg("pty name = %s\n", fuartc->name);
-  if (!isatty(fd)) {
-    prn_error("Not a TTY device.\n"); 
-    return FUART_ERR_OPEN;
-  }
-  struct termios tty_cfg;
-  cfmakeraw(&tty_cfg);
-  tcsetattr(fd, TCSANOW, &tty_cfg);
-
-  fuartc->fd = fd;
-  return FUART_ERR_NONE;
-}
-
-int fuart_wr_rd(struct fuart_context *fuartc, int nsecs) {
-  
-  int rv;
-  int bytes;
-  struct ftdi_context *fc = fuartc->fc;
-  if ((bytes = read(fuartc->fd, fuartc->buf, sizeof(fuartc->buf))) > 0) {
-#ifdef DEBUG
-    fuartc->buf[bytes] = '\0';
-    printf("about to write %d bytes to ftdi %s\n", bytes, fuartc->buf);
-#endif
-    rv = ftdi_write_data(fc, fuartc->buf, bytes);
-    if (rv != bytes) {
-      ERROR_FTDI("writing to uart", fc);
-      return FUART_ERR_WR;
-    }
-  }
-  usleep(nsecs);
-  // TODO(tbroch) is there a lower cost way to interrogate ftdi for data.  How
-  // does the event/error_char factor into things?
-  bytes = ftdi_read_data(fc, fuartc->buf, sizeof(fuartc->buf));
-  if (bytes > 0) {
-    int bytes_remaining = bytes;
-    while ((bytes = write(fuartc->fd, fuartc->buf, bytes_remaining)) > 0) {
-      bytes_remaining -= bytes;
-    }
-    if (bytes == -1) {
-      perror("writing ftdi data to pty");
-    }
-
-  } else if (bytes < 0) {
-    perror("failed ftdi_read_data");
-    ERROR_FTDI("reading ftdi data", fuartc->fc);
-    return FUART_ERR_RD;
-  }
-  // TODO(tbroch) How do we guarantee no data loss for tx/rx
-  return FUART_ERR_NONE;
-}
-
-int fuart_close(struct fuart_context *fuartc) {
-  int rv = FUART_ERR_NONE;
-  close(fuartc->fd);
-  CHECK_FTDI(ftdi_usb_close(fuartc->fc), "fuart close", fuartc->fc);
-  ftdi_deinit(fuartc->fc);
-  return rv;
-}
-
diff --git a/servo/ftdiuart.h b/servo/ftdiuart.h
deleted file mode 100644
index 1591870..0000000
--- a/servo/ftdiuart.h
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef __FTDIUART_H__
-#define __FTDIUART_H__
-
-#include <ftdi.h>
-#include <unistd.h>
-#include <string.h>
-#include <stdint.h>
-#include <stdio.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define FUART_BUF_SIZE 128
-  
-// bit positions various signals in interface
-#define TX_POS  0x01
-#define RX_POS  0x02
-#define GPX_POS 0xfc
-
-#define FUART_ERR_NONE   0
-#define FUART_ERR_FTDI  -1 
-#define FUART_ERR_OPEN  -2
-#define FUART_ERR_WR    -3
-#define FUART_ERR_RD    -4
-  
-#define ERROR_FUART(ecode, ...)                 \
-  fprintf(stderr, "-E- (%d) ", ecode);          \
-  fprintf(stderr, __VA_ARGS__)                 
-  
-#ifndef DEBUG
-#define DEBUG_FUART(...)
-#else
-#define DEBUG_FUART(...)                                        \
-  fprintf(stderr, "DEBUG: %s:%u ", __FILE__, __LINE__);		\
-  fprintf(stderr, __VA_ARGS__)
-#endif
-  
-#define CHECK_FUART(fuartc, fx, ...) do {           \
-    DEBUG_FUART(__VA_ARGS__);                       \
-    if ((fuartc->error = fx) < 0) {                 \
-      ERROR_FUART(fuartc->error,__VA_ARGS__);       \
-    }                                               \
-  } while (0)
-
-struct fuart_cfg {
-  int baudrate;
-  enum ftdi_bits_type bits;
-  enum ftdi_stopbits_type sbits;
-  enum ftdi_parity_type parity;
-};
-
-struct fuart_context { 
-  // v--- DO NOT REORDER ---v
-  struct ftdi_context *fc;
-  struct gpio_s gpio;
-  // ^--- DO NOT REORDER ---^
-  char name[PATH_MAX];
-  int fd;
-  uint8_t buf[FUART_BUF_SIZE];
-  int error;
-};
-
-int fuart_init(struct fuart_context *, struct ftdi_context *);
-int fuart_open(struct fuart_context *, struct ftdi_common_args *);
-int fuart_wr_rd(struct fuart_context *, int);
-int fuart_close(struct fuart_context *);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif //__FTDIUART_H__
diff --git a/servo/fuart_test.c b/servo/fuart_test.c
deleted file mode 100644
index a3cb57a..0000000
--- a/servo/fuart_test.c
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <inttypes.h>
-#include <assert.h>
-
-#include <ftdi.h>
-#include "ftdi_common.h"
-#include "ftdiuart.h"
-
-void usage(char *progname) {
-  printf("\n\n%s [switch args]\n", progname);
-  exit(-1);
-}
-
-int main(int argc, char **argv) {
-  int rv = 0;
-
-  struct ftdi_context fc;
-  struct fuart_context fuartc;
-
-  int args_consumed = 0;
-  struct ftdi_common_args fargs = {
-    // default for servo
-    .interface = INTERFACE_C,
-    .vendor_id = 0x0403,
-    .product_id = 0x6011,
-    .serialname = NULL,
-    // most used defaults
-    .speed = 115200,
-    .bits = BITS_8,
-    .parity = NONE,
-    .sbits = STOP_BIT_1,
-  };
-
-  if ((args_consumed = fcom_args(&fargs, argc, argv)) < 0) {
-    usage(argv[0]);
-  }
-  if (ftdi_init(&fc) < 0) {
-    ERROR_FTDI("Initializing ftdi context", &fc);
-    return 1;
-  }
-  if (fuart_init(&fuartc, &fc)) {
-    prn_fatal("fuart_init\n");
-  }
-  if (fuart_open(&fuartc, &fargs)) {
-    prn_fatal("fuart_open\n");
-  }
-  prn_info("ftdi uart connected to %s\n", fuartc.name);
-  while (1) {
-    if ((rv = fuart_wr_rd(&fuartc, 10000))) {
-      prn_error("fuart_wr_rd (%d)\n", rv);
-      break;
-    }
-  }
-  fuart_close(&fuartc);
-  return rv;
-}
diff --git a/servo/miniservod.c b/servo/miniservod.c
deleted file mode 100644
index 883eb4f..0000000
--- a/servo/miniservod.c
+++ /dev/null
@@ -1,263 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#define _BSD_SOURCE
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <ftdi.h>
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-#include "ftdi_common.h"
-#include "ftdigpio.h"
-#include "ftdiuart.h"
-
-#define MAX_BUF 512
-#define CLIENT_FIELDS 2
-
-void usage(char *progname) {
-  printf("%s [common ftdi args]\n\n", progname);
-  exit(-1);
-}
-
-// parse_buffer - parse buffer from client
-//
-// fmt is <direction>,<value>
-// ex)    0xff,0xff  -- sets all to output '1'
-int parse_buffer(char *buf, struct gpio_s *gpio) {
-  char *eptr = NULL;
-  
-  gpio->direction = strtoul(buf, &eptr, 0);
-  if (eptr[0] != ',') {
-    prn_error("Malformed direction argument\n");
-    return 1;
-  }
-  eptr++;
-  char *bptr = eptr;
-  gpio->value = strtoul(bptr, &eptr, 0);
-  if (((eptr[0] != '\r') && (eptr[0] != '\n')) ||
-      (bptr == eptr)) {
-    prn_error("Malformed value argument %c\n", eptr[0]);
-    return 1;
-  }
-  prn_dbg("Done parsing buffer m:0x%02x d:0x%02x v:0x%02x\n",
-          gpio->mask, gpio->direction, gpio->value);
-  return 0;
-}
-// process_client - interact w/ client connection
-//
-// response to client looks like:
-// I:<read value>
-// A:
-//
-// or in case of error
-// E:<msg>
-//
-// where:
-//    read value == value read for that bank of 8 gpios
-//    msg == detailed message of error condition
-int process_client(struct fgpio_context *fgc, int client) {
-
-  char buf[MAX_BUF];
-  int blen, bcnt;
-  struct gpio_s new_gpio;
-  uint8_t rd_val;
-
-  memset(buf, 0, MAX_BUF);
-  if ((blen = read(client,buf,MAX_BUF-1)) <= 0) {
-    if (blen == 0) {
-      prn_info("client connection (fd=%d) hung up\n", client);
-      return 1;
-    } else {
-      perror("reading from client");
-      exit(1);
-    }
-  }
-
-  prn_dbg("client (fd=%d) cmd: %s",client, buf);
-
-  new_gpio.mask = fgc->gpio.mask;
-  if (parse_buffer(buf, &new_gpio)) {
-    snprintf(buf, MAX_BUF,
-             "E:parsing client request.  Should be <dir>,<val>.\n");
-    goto CLIENT_RSP;
-  }
-  if (fgpio_wr_rd(fgc, &new_gpio, &rd_val, GPIO)) {
-    snprintf(buf, MAX_BUF, "E:writing/reading gpio\n");
-    goto CLIENT_RSP;
-  }
-  snprintf(buf, MAX_BUF, "I:0x%02x\nA:\n", rd_val);
-
-CLIENT_RSP:
-  blen = strlen(buf);
-  bcnt = write(client, buf, blen);
-  if (bcnt != blen)
-    perror("writing to client");
-  return 0;
-}
-
-int init_socket(int port) {
-  struct sockaddr_in server_addr;
-
-  prn_dbg("Initializing server\n");
-  int sock = socket(AF_INET, SOCK_STREAM, 0);
-  if (sock < 0)
-    perror("opening socket");
-
-  memset(&server_addr, 0, sizeof(server_addr));
-
-  server_addr.sin_family = AF_INET;
-  server_addr.sin_addr.s_addr = INADDR_ANY;
-  server_addr.sin_port = htons(port);
-
-  int tr = 1;
-  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &tr, sizeof(int)) == -1) {
-    perror("setting sockopt");
-    exit(-1);
-  }
-  if (bind(sock, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) {
-    perror("binding socket");
-    exit(-1);
-  }
-
-  return sock;
-}
-
-int init_server(int port) {
-  int sock = init_socket(port);
-
-  assert(listen(sock, 5) == 0);
-  prn_dbg("Server initialized\n");
-  return sock;
-}
-
-void *run_uart(void *ptr) {
-  struct fuart_context *fcc = (struct fuart_context *)ptr;
-
-  while (1) {
-    prn_dbg("uart checked\n");
-    if (fuart_wr_rd(fcc, 1000)) {
-      prn_error("fuart_wr_rd");
-      break;
-    }
-  }
-  // should never reach
-  return NULL;
-}
-
-void run_server(struct fgpio_context *fgc, int server_fd) {
-  struct sockaddr_in client_addr;
-  fd_set read_fds, master_fds;
-  unsigned int client_len = sizeof(client_addr);
-
-  FD_ZERO(&read_fds);
-  FD_ZERO(&master_fds);
-  int max_fd = server_fd;
-  FD_SET(server_fd, &master_fds);
-
-  prn_dbg("Running server fd=%d\n", server_fd);
-  while (1) {
-    read_fds = master_fds;
-
-    if(select(max_fd+1, &read_fds, NULL, NULL, NULL) == -1) {
-      perror("Select test failed");
-      exit(1);
-    }
-    prn_dbg("select ok\n");
-
-    int i;
-    for (i = 0; i <= max_fd; i++) {
-      if (FD_ISSET(i, &read_fds)) {
-	if (i == server_fd) {
-	  // add new clients
-	  int new_client = accept(server_fd, (struct sockaddr *)&client_addr,
-                                  &client_len);
-	  if (new_client < 0) {
-	    perror("accepting connection");
-            exit(1);
-	  } else {
-	    prn_info("Client connected %s fd:%d\n",
-                     inet_ntoa(client_addr.sin_addr), new_client);
-	    FD_SET(new_client, &master_fds);
-	    if (new_client > max_fd) {
-	      max_fd = new_client;
-	      prn_dbg("max_fd increased to %d\n", max_fd);
-	    }
-	  }
-	} else {
-	  // process connected clients
-	  if (process_client(fgc, i)) {
-	    close(i);
-	    FD_CLR(i, &master_fds);
-	  }
-	}
-      }
-    }
-  }
-}
-
-int main(int argc, char **argv) {
-  int sock;
-
-  struct ftdi_context fc;
-  struct fgpio_context fgc;
-  struct fuart_context fcc;
-
-  struct ftdi_common_args fargs = {
-    .interface = 0,
-    .vendor_id = 0x18d1,
-    .product_id = 0x5000,
-    .speed = 115200,
-    .bits = BITS_8,
-    .parity = NONE,
-    .sbits = STOP_BIT_1
-  };
- 
-  int args_consumed;
-  if ((args_consumed = fcom_args(&fargs, argc, argv)) < 0) {
-    usage(argv[0]);
-  }
-
-  if (ftdi_init(&fc) < 0) {
-    ERROR_FTDI("Initializing ftdi context", &fc);
-    return 1;
-  }
-
-  if (fgpio_init(&fgc, &fc)) {
-    prn_error("fgpio_init\n");
-    return FCOM_ERR;
-  }
-  if (fgpio_open(&fgc, &fargs)) {
-    prn_error("fgpio_open\n");
-    return FCOM_ERR;
-  }
-  if (fuart_init(&fcc, &fc)) {
-    prn_error("fuart_init\n");
-    return FCOM_ERR;
-  }
-  if (fuart_open(&fcc, &fargs)) {
-    prn_error("fuart_open\n");
-    return FCOM_ERR;
-  }
-  printf("ftdi uart connected to pty at %s\n", fcc.name);
-
-  // TODO(tbroch) this should be configurable
-  sock = init_server(9999);
-
-  pthread_t fcc_thread;
-  if (pthread_create(&fcc_thread, NULL, run_uart, (void *)&fcc)) {
-    perror("threading fuart");
-    return errno;
-  } 
-  run_server(&fgc, sock);
-  return 0;
-}
diff --git a/servo/servod.c b/servo/servod.c
deleted file mode 100644
index 1efa7eb..0000000
--- a/servo/servod.c
+++ /dev/null
@@ -1,449 +0,0 @@
-// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-#include <arpa/inet.h>
-#include <assert.h>
-#include <errno.h>
-#include <ftdi.h>
-#include <inttypes.h>
-#include <netinet/in.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <unistd.h>
-
-#include "ftdi_common.h"
-#include "ftdigpio.h"
-#include "ftdiuart.h"
-#include "ftdii2c.h"
-
-#define MAX_BUF 512
-#define GPIO_FIELDS 3
-
-void usage(char *progname) {
-  printf("%s [common ftdi args]\n\n", progname);
-  exit(-1);
-}
-
-// parse_ul_element - parse element return non-zero for error else properly
-// converted value returned in value and buf set to character beyond delimeter
-char *parse_ul_element(unsigned long *value, char *buf, char delim) {
-  char *eptr;
-  *value = strtoul(buf, &eptr, 0);
-  if (!delim) { 
-    return eptr;
-  } else if (eptr[0] != delim) {
-    return NULL;
-  }
-  return eptr + 1;
-}
-
-// parse_buffer_gpio - parse gpio command from client
-// <interface>,<direction>,<value>[,<mask>]
-// ex)    1,0xff,0xff  -- set all gpios to output '1' on interface 1
-int parse_buffer_gpio(char *buf, struct gpio_s *gpio, 
-                      unsigned int *interface) {
-
-  char *bptr = buf;
-  unsigned long tmp_ul;
-
-  if (((bptr = parse_ul_element(&tmp_ul, bptr, ',')) == NULL) || 
-      (!tmp_ul || (tmp_ul > 4))) {
-    prn_error("Malformed interface argument\n");
-    return 1;
-  }
-  *interface = (unsigned int)tmp_ul;
-
-  if (((bptr = parse_ul_element(&tmp_ul, bptr, ',')) == NULL) || 
-      (tmp_ul > 0xff)) {
-    prn_error("Malformed direction argument\n");
-    return 1;
-  }
-  gpio->direction = (uint8_t)tmp_ul;
-  if (((bptr = parse_ul_element(&tmp_ul, bptr, 0)) == NULL) || 
-      (tmp_ul > 0xff)) {
-    prn_error("Malformed value argument\n");
-    return 1;
-  }
-  gpio->value = (uint8_t)tmp_ul;
-  if (bptr[0] == ',') {
-    bptr++;
-    // there's a mask
-    if (((bptr = parse_ul_element(&tmp_ul, bptr, 0)) == NULL) || 
-        (tmp_ul > 0xff)) {
-      prn_error("Malformed mask argument\n");
-      return 1;
-    }
-    gpio->mask = (uint8_t)tmp_ul;
-  } else {
-    gpio->mask = 0xff;
-  }
-  prn_dbg("Done parsing gpio buffer i:%d d:0x%02x v:0x%02x m:0x%02x\n",
-          *interface, gpio->direction, gpio->value, gpio->mask);
-  return 0;
-}
-// parse_buffer_i2c - parse i2c command from client
-// ex)    0x40,1,0x0,2 -- for i2c slave 0x40 write 1byte 0, read 2bytes
-int parse_buffer_i2c(char *buf, int *argc, uint8_t *argv) {
-  int argcnt = 0;
-  char *field;
-  field = strtok(buf, ",");
-  while (field) {
-    argv[argcnt++] = strtoul(field,  NULL, 0);
-    field = strtok(NULL, ",");
-  }
-  // do some checking
-  if ((argcnt > 2) && (argcnt < argv[1] + 2)) {
-    prn_error("looks like i2c write w/o enough data\n");
-    return -1;
-  } else if (argcnt < 2) {
-    prn_error("Must have at least 2 arguments to i2c cmd=%s\n", buf);
-    return -1;
-  }
-  *argc = argcnt;
-  return 0;
-}
-
-// process_client - interact w/ client connection
-//
-// response to client looks like:
-// I:<read value>
-// A:
-//
-// or in case of error
-// E:<msg>
-//
-// where:
-//    read value == value read for that bank of 8 gpios
-//    msg == detailed message of error condition
-int process_client(struct ftdi_itype *interfaces, int int_cnt, int client) {
-
-  char buf[MAX_BUF];
-  char *rsp = buf;
-  int blen, bcnt, err;
-  struct gpio_s new_gpio;
-  uint8_t rd_val;
-
-  struct ftdi_itype *interface;
-
-  memset(rsp, 0, MAX_BUF);
-  if ((blen = read(client,buf,MAX_BUF-1)) <= 0) {
-    if (blen == 0) {
-      prn_info("client connection (fd=%d) hung up\n", client);
-      return 1;
-    } else {
-      perror("reading from client ... guess he disappeared");
-      return 1;
-    }
-  }
-
-  prn_dbg("client cmd: %s",buf);
-  if ((buf[0] == 'g') && (buf[1] == ',')) {
-    unsigned int interface_num;
-    if (parse_buffer_gpio(&buf[2], &new_gpio, &interface_num)) {
-      snprintf(buf, MAX_BUF,
-               "E:parsing client request.  Should be\n\t%s\n",
-               "<interface>,<dir>,<val>[,<mask>]");
-      goto CLIENT_RSP;
-    }
-
-    interface = fcom_lookup_interface(interfaces, int_cnt, interface_num, ANY);
-    if (interface == NULL) {
-      snprintf(rsp, MAX_BUF, "E:No gpio at interface %d\n", interface_num);
-      goto CLIENT_RSP;
-    }
-
-    struct fgpio_context *fgc = NULL;
-    fgc = (struct fgpio_context *)interface->context;
-    assert(fgc);
-    if ((err = fgpio_wr_rd(fgc, &new_gpio, &rd_val, interface->type))) {
-      if (err == FGPIO_ERR_MASK) {
-        snprintf(rsp, MAX_BUF, "E:Illegal gpio mask.  Bits avail are 0x%02x\n",
-                 fgc->gpio.mask);
-      } else {
-        snprintf(rsp, MAX_BUF, "E:writing/reading gpio\n");
-      }
-      goto CLIENT_RSP;
-    }
-    snprintf(rsp, MAX_BUF, "I:0x%02x\nA:\n", rd_val);
-  } else if ((buf[0] == 'i') && (buf[1] == ',')) {
-    int argcnt = 0;
-
-    uint8_t args[128];
-    uint8_t rbuf[128];
-    if (parse_buffer_i2c(&buf[2], &argcnt, args)) {
-      snprintf(rsp, MAX_BUF, "E:parsing client request.  Should be\n\t%s\n",
-               "<slv>,[<bytes to Wr>,<Wr0>,<Wr1>,<WrN>],[<bytes to Rd>]");
-      goto CLIENT_RSP;
-    }
-
-    interface = fcom_lookup_interface(interfaces, int_cnt, 2, I2C);
-    if (interface == NULL) {
-      snprintf(rsp, MAX_BUF, "E:No i2c at interface 2\n");
-      goto CLIENT_RSP;
-    }
-    struct fi2c_context *fic = NULL;
-    fic = (struct fi2c_context *)interface->context;
-    assert(fic);
-
-    // defaults if read-only
-    uint8_t *wbuf = NULL;
-    int wcnt = 0;
-    int rcnt = args[argcnt-1];
-    fic->slv = args[0];
-    if (argcnt > 2) {
-      wbuf = &args[2];
-      wcnt = args[1];
-      if (argcnt != wcnt + 3) {
-        // its just a write
-        rcnt = 0;
-      }
-    }
-    if (fi2c_wr_rd(fic, wbuf, wcnt, rbuf, rcnt)) {
-      snprintf(rsp, MAX_BUF, "E:writing/reading i2c\n");
-      goto CLIENT_RSP;
-    }
-    int bytes_remaining = MAX_BUF;
-    if (rcnt) {
-      snprintf(rsp, bytes_remaining, "I:0x");
-      rsp = rsp + 4;
-      bytes_remaining-=4;
-      int i;
-      for (i = 0; i < rcnt; i++) {
-        if (i && !(i % 4)) {
-          snprintf(rsp, bytes_remaining, "\nI:0x");
-          rsp+=5;
-          bytes_remaining-=5;
-        }
-        snprintf(rsp, bytes_remaining, "%02x", rbuf[i]);
-        rsp+=2;
-        bytes_remaining-=2;
-        if (bytes_remaining < 5) {
-          snprintf(buf, MAX_BUF, "E: i2c request too large.  See developer\n");
-          goto CLIENT_RSP;
-        }
-      }
-    }
-    snprintf(rsp, bytes_remaining, "\nA:\n");
-  } else {
-      snprintf(rsp, MAX_BUF,
-               "E:parsing client request.  Should be\n\t%s\n\t%s\n",
-               "g,<interface>,<dir>,<val>",
-               "i,<slv>,<bytes to write(4max)>,<write word>,<bytes to read>");
-  }
-
-CLIENT_RSP:
-  blen = strlen(buf);
-  bcnt = write(client, buf, blen);
-  if (bcnt != blen)
-    perror("writing to client");
-  return 0;
-}
-
-int init_socket(int port) {
-  struct sockaddr_in server_addr;
-
-  prn_dbg("Initializing server\n");
-  int sock = socket(AF_INET, SOCK_STREAM, 0);
-  if (sock < 0)
-    perror("opening socket");
-
-  memset(&server_addr, 0, sizeof(server_addr));
-
-  server_addr.sin_family = AF_INET;
-  server_addr.sin_addr.s_addr = INADDR_ANY;
-  server_addr.sin_port = htons(port);
-
-  int tr = 1;
-  if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &tr, sizeof(int)) == -1) {
-    perror("setting sockopt");
-    exit(-1);
-  }
-  if (bind(sock, (struct sockaddr *) &server_addr, sizeof(server_addr)) < 0) {
-    perror("binding socket");
-    exit(-1);
-  }
-
-  return sock;
-}
-
-int init_server(int port) {
-  int sock = init_socket(port);
-
-  assert(listen(sock, 5) == 0);
-  prn_dbg("Server initialized\n");
-  return sock;
-}
-
-void *run_uart(void *ptr) {
-  struct fuart_context *fcc = (struct fuart_context *)ptr;
-
-  while (1) {
-    if (fuart_wr_rd(fcc, 10000)) {
-      prn_error("fuart_wr_rd");
-      break;
-    }
-  }
-  // should never reach
-  return NULL;
-}
-
-void run_server(struct ftdi_itype *interfaces, int int_cnt, int server_fd) {
-  struct sockaddr_in client_addr;
-  fd_set read_fds, master_fds;
-  unsigned int client_len = sizeof(client_addr);
-
-  FD_ZERO(&read_fds);
-  FD_ZERO(&master_fds);
-  int max_fd = server_fd;
-  FD_SET(server_fd, &master_fds);
-
-  prn_dbg("Running server fd=%d\n", server_fd);
-  while (1) {
-    read_fds = master_fds;
-
-    if(select(max_fd+1, &read_fds, NULL, NULL, NULL) == -1) {
-      perror("Select test failed");
-      exit(1);
-    }
-    prn_dbg("select ok\n");
-
-    int i;
-    for (i = 0; i <= max_fd; i++) {
-      if (FD_ISSET(i, &read_fds)) {
-	if (i == server_fd) {
-	  // add new clients
-	  int new_client = accept(server_fd, (struct sockaddr *)&client_addr,
-                                  &client_len);
-	  if (new_client < 0) {
-	    perror("accepting connection");
-            exit(1);
-	  } else {
-	    prn_info("Client connected %s fd:%d\n",
-                     inet_ntoa(client_addr.sin_addr), new_client);
-	    FD_SET(new_client, &master_fds);
-	    if (new_client > max_fd) {
-	      max_fd = new_client;
-	      prn_dbg("max_fd increased to %d\n", max_fd);
-	    }
-	  }
-	} else {
-	  // process connected clients
-	  if (process_client(interfaces, int_cnt, i)) {
-	    close(i);
-	    FD_CLR(i, &master_fds);
-	  }
-	}
-      }
-    }
-  }
-}
-
-#define NUM_GPIOS 2
-#define NUM_INTERFACES 4
-
-int main(int argc, char **argv) {
-  int sock;
-
-  struct ftdi_common_args fargs = {
-    .interface = 0,
-    //.vendor_id = 0x18d1,
-    //.product_id = 0x5001,
-    .vendor_id = 0x0403,
-    .product_id = 0x6011,
-    .speed = 115200,
-    .bits = BITS_8,
-    .parity = NONE,
-    .sbits = STOP_BIT_1
-  };
- 
-  int args_consumed;
-  if ((args_consumed = fcom_args(&fargs, argc, argv)) < 0) {
-    usage(argv[0]);
-  }
-
-  int i;
-  struct ftdi_context fc[NUM_INTERFACES];
-  struct fgpio_context fgs[NUM_GPIOS];
-
-  for (i = 0; i < NUM_INTERFACES; i++) {
-    if (ftdi_init(&fc[i]) < 0) {
-      ERROR_FTDI("Initializing ftdi context", &fc[i]);
-      return 1;
-    }
-  }
-
-  struct ftdi_itype interfaces[NUM_INTERFACES];
-
-  for (i = 0; i < NUM_GPIOS; i++) {
-    if (fgpio_init(&fgs[i], &fc[i])) {
-      prn_error("fgpio_init\n");
-      return FCOM_ERR;
-    }
-  }
-
-  // should be JTAG/SPI ... but GPIOs for now or use flashrom/openocd separately
-  fargs.interface = 1;
-  if (fgpio_open(&fgs[0], &fargs)) {
-    prn_error("fgpio_open\n");
-    return FCOM_ERR;
-  }
-  interfaces[fargs.interface - 1].context = (void *)&fgs[0];
-  interfaces[fargs.interface - 1].type = GPIO;
-
-  // i2c master
-  struct fi2c_context fic;
-  fargs.interface = 2;
-  if (fi2c_init(&fic, &fc[3])) {
-    prn_error("fi2c_init\n");
-    return FCOM_ERR;
-  }
-  if (fi2c_open(&fic, &fargs)) {
-    prn_error("fi2c_open\n");
-    return FCOM_ERR;
-  }
-  // 100khz
-  if (fi2c_setclock(&fic, 100000)) {
-    prn_error("fi2c_setclock\n");
-    return FCOM_ERR;
-  }
-  interfaces[fargs.interface - 1].context = (void *)&fic;
-  interfaces[fargs.interface - 1].type = I2C;
-
-  // DUT console uart
-  fargs.interface = 3;
-  struct fuart_context fcc;
-  if (fuart_init(&fcc, &fc[2])) {
-    prn_error("fuart_init\n");
-    return FCOM_ERR;
-  }
-  if (fuart_open(&fcc, &fargs)) {
-    prn_error("fuart_open\n");
-    return FCOM_ERR;
-  }
-  printf("ftdi uart connected to pty at %s\n", fcc.name);
-  pthread_t fcc_thread;
-  if (pthread_create(&fcc_thread, NULL, run_uart, (void *)&fcc)) {
-    perror("threading fuart");
-    return errno;
-  } 
-  interfaces[fargs.interface - 1].context = (void *)&fcc;
-  interfaces[fargs.interface - 1].type = UART;
-
-  // legit gpios
-  fargs.interface = 4;
-  if (fgpio_open(&fgs[1], &fargs)) {
-    prn_error("fgpio_open\n");
-    return FCOM_ERR;
-  }
-  interfaces[fargs.interface - 1].context = (void *)&fgs[1];
-  interfaces[fargs.interface - 1].type = GPIO;
-
-  sock = init_server(9999);
-  prn_info("%s running accepting connections at port %d\n", argv[0], 9999);
-  run_server(interfaces, NUM_INTERFACES, sock);
-  return 0;
-}