bmc: firmware updatePending: stat(session)

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: Idb3a51af0fa94f21fc797cab518a4f7976e306c8
diff --git a/firmware_handler.cpp b/firmware_handler.cpp
index 77e0e50..15dbee8 100644
--- a/firmware_handler.cpp
+++ b/firmware_handler.cpp
@@ -200,26 +200,21 @@
 
     meta->metadata.clear();
 
-    /* TODO: Implement this for the verification blob, which is what we expect.
-     * Calling stat() on the verify blob without an active session should not
-     * provide insight.
-     */
     if (item->second->activePath == verifyBlobId)
     {
         VerifyCheckResponses value;
 
-        if (state == UpdateState::verificationPending)
+        switch (state)
         {
-            value = VerifyCheckResponses::other;
-        }
-        else if (state == UpdateState::verificationCompleted)
-        {
-            value = lastVerificationResponse;
-        }
-        else
-        {
-            value = verification->checkVerificationState();
-            lastVerificationResponse = value;
+            case UpdateState::verificationPending:
+                value = VerifyCheckResponses::other;
+                break;
+            case UpdateState::verificationCompleted:
+                value = lastVerificationResponse;
+                break;
+            default:
+                value = verification->checkVerificationState();
+                lastVerificationResponse = value;
         }
 
         meta->metadata.push_back(static_cast<std::uint8_t>(value));
@@ -243,6 +238,21 @@
             }
         }
     }
+    else if (item->second->activePath == updateBlobId)
+    {
+        UpdateStatus value;
+
+        switch (state)
+        {
+            case UpdateState::updatePending:
+                value = UpdateStatus::unknown;
+                break;
+            default:
+                break;
+        }
+
+        meta->metadata.push_back(static_cast<std::uint8_t>(value));
+    }
 
     /* The blobState here relates to an active sesion, so we should return the
      * flags used to open this session.
@@ -625,8 +635,9 @@
                     /* TODO: Verification failed, what now? */
                     state = UpdateState::notYetStarted;
                 }
+                break;
             default:
-                [[fallthrough]];
+                break;
         }
         /* Must be verificationPending... not yet started, they may re-open and
          * trigger verification.