aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-07-28 14:39:56 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-08-01 13:54:58 +0200
commit22023e34c50fd9b6f8958e80128ad4c89cba94de (patch)
treebee07f06701aee9a2fe73de7fa6b1b1fc5681300
parent794e6da41ba22dc7c7294da52a8d5f448820525d (diff)
downloadlibnitrokey-22023e34c50fd9b6f8958e80128ad4c89cba94de.tar.gz
libnitrokey-22023e34c50fd9b6f8958e80128ad4c89cba94de.tar.bz2
Correct debug message about wrong crc
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
-rw-r--r--include/device_proto.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/device_proto.h b/include/device_proto.h
index 82606a1..7e2c0d9 100644
--- a/include/device_proto.h
+++ b/include/device_proto.h
@@ -199,9 +199,10 @@ class Transaction : semantics::non_constructible {
status = dev.recv(&resp);
dev.set_last_command_status(resp.last_command_status); // FIXME should be handled on device.recv
- if (resp.device_status == 0) break;
- Log::instance()("Device status is not ready (CRC error?) retrying..",
- Loglevel::DEBUG); // FIXME translate device_status to log
+
+ if (resp.device_status == 0 && resp.last_command_crc == outp.crc) break;
+ Log::instance()("Device is not ready or received packet's last CRC is not equal to sent CRC packet, retrying...",
+ Loglevel::DEBUG);
Log::instance()("Invalid incoming HID packet:", Loglevel::DEBUG_L2);
Log::instance()((std::string)(resp), Loglevel::DEBUG_L2);
std::this_thread::sleep_for(dev.get_retry_timeout());