trunks: ftdi: make sure all commands use FTDI interface when requested

The --ftdi command line option was not propagated to all
TrunksFactoryImpl instantiations, this patch fixes that.

The rest of the commands (other than startup) still don't work,
because TrunksFtdiSpi::Init() indiscriminately issues hardware reset
each time the object is constructed.

BUG=chromium:498861
TEST=new commands do not work yet, careful hardware reset handling is
     required.

Change-Id: I653139770b0f6fef36e09f5a929221dd848a690a
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/281073
Reviewed-by: Utkarsh Sanghi <usanghi@chromium.org>
Commit-Queue: Bill Richardson <wfrichar@chromium.org>
Trybot-Ready: Bill Richardson <wfrichar@chromium.org>
diff --git a/trunks_client.cc b/trunks_client.cc
index e4b1535..7252579 100644
--- a/trunks_client.cc
+++ b/trunks_client.cc
@@ -50,17 +50,17 @@
 }
 
 int Clear(bool use_ftdi) {
-  trunks::TrunksFactoryImpl factory;
+  trunks::TrunksFactoryImpl factory(use_ftdi);
   return factory.GetTpmUtility()->Clear();
 }
 
 int InitializeTpm(bool use_ftdi) {
-  trunks::TrunksFactoryImpl factory;
+  trunks::TrunksFactoryImpl factory(use_ftdi);
   return factory.GetTpmUtility()->InitializeTpm();
 }
 
 int AllocatePCR(bool use_ftdi) {
-  trunks::TrunksFactoryImpl factory;
+  trunks::TrunksFactoryImpl factory(use_ftdi);
   trunks::TPM_RC result;
   result = factory.GetTpmUtility()->AllocatePCR("");
   if (result != trunks::TPM_RC_SUCCESS) {
@@ -72,7 +72,7 @@
 }
 
 int TakeOwnership(const std::string& owner_password, bool use_ftdi) {
-  trunks::TrunksFactoryImpl factory;
+  trunks::TrunksFactoryImpl factory(use_ftdi);
   trunks::TPM_RC rc;
   rc = factory.GetTpmUtility()->TakeOwnership(owner_password,
                                               owner_password,
@@ -85,7 +85,7 @@
 }
 
 int DumpStatus(bool use_ftdi) {
-  trunks::TrunksFactoryImpl factory;
+  trunks::TrunksFactoryImpl factory(use_ftdi);
   scoped_ptr<trunks::TpmState> state = factory.GetTpmState();
   trunks::TPM_RC result = state->Initialize();
   if (result != trunks::TPM_RC_SUCCESS) {