From e235664cdac283d2dd08059f09cc0ac141146fe8 Mon Sep 17 00:00:00 2001
From: Szczepan Zalega <szczepan@nitrokey.com>
Date: Fri, 14 Oct 2016 13:49:24 +0200
Subject: Show NK Storage status on response packet dissection (regardless of
 connected device)

Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
---
 include/dissect.h | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

(limited to 'include')

diff --git a/include/dissect.h b/include/dissect.h
index c83e648..56c1403 100644
--- a/include/dissect.h
+++ b/include/dissect.h
@@ -67,7 +67,7 @@ class ResponseDissector : semantics::non_constructible {
 
     out << "Device status:\t" << pod.device_status + 0 << " "
         << status[pod.device_status] << std::endl;
-    out << "Command ID:\t" << commandid_to_string((CommandID)(pod.command_id))
+    out << "Command ID:\t" << commandid_to_string((CommandID)(pod.command_id)) << " hex: " << std::hex << (int)pod.command_id
         << std::endl;
     out << "Last command CRC:\t"
             << std::hex << std::setw(2) << std::setfill('0')
@@ -77,6 +77,14 @@ class ResponseDissector : semantics::non_constructible {
     out << "CRC:\t"
             << std::hex << std::setw(2) << std::setfill('0')
             << pod.crc << std::endl;
+      out << "Storage stick status:" << std::endl;
+#define d(x) out << " "#x": \t"<< std::hex << std::setw(2) \
+    << std::setfill('0')<< static_cast<int>(x) << std::endl;
+    d(pod.StorageStatus.CommandCounter_u8);
+    d(pod.StorageStatus.LastCommand_u8);
+    d(pod.StorageStatus.Status_u8);
+    d(pod.StorageStatus.ProgressBarValue_u8);
+#undef d
 
     out << "Payload:" << std::endl;
     out << pod.payload.dissect();
-- 
cgit v1.2.3