tools: blob: implement open blob

Implement the host-side tool's open blob command.

Change-Id: Iee432eae0539015e87969159a3d03761df9f8fb5
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/tools/updater.cpp b/tools/updater.cpp
index a7f9c96..5061e82 100644
--- a/tools/updater.cpp
+++ b/tools/updater.cpp
@@ -16,6 +16,8 @@
 
 #include "updater.hpp"
 
+#include "blob_errors.hpp"
+
 #include <algorithm>
 #include <memory>
 
@@ -50,5 +52,19 @@
         return -1; /* throw custom exception. */
     }
 
+    /* Yay, our data handler is supported. */
+    std::uint16_t session;
+    try
+    {
+        session = blob->openBlob(goalFirmware, handler->supportedType());
+    }
+    catch (const BlobException& b)
+    {
+        std::fprintf(stderr, "blob exception received: %s\n", b.what());
+        return -1;
+    }
+
+    std::fprintf(stderr, "using session: %d\n", session);
+
     return 0;
 }