aboutsummaryrefslogtreecommitdiff
path: root/include/device_proto.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 15:54:00 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 15:54:00 +0200
commit06c0deb7935a9390a67bc02d6c323e64c785a026 (patch)
treec8343c0e1d504b2ae7d1ff5a727084f78a015f7e /include/device_proto.h
parentbe0d677aa2e7eb87a309dc3927c0917380892641 (diff)
parent3b5f40a19ca6c6fde55fcdab4ff0a9f91a46a051 (diff)
downloadlibnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.gz
libnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.bz2
Merge branch 'do_not_log_volatile_data'
Diffstat (limited to 'include/device_proto.h')
-rw-r--r--include/device_proto.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/device_proto.h b/include/device_proto.h
index 964c2d9..b557384 100644
--- a/include/device_proto.h
+++ b/include/device_proto.h
@@ -236,6 +236,7 @@ namespace nitrokey {
outp.payload = payload;
outp.update_CRC();
+ LOG("-------------------", Loglevel::DEBUG);
LOG("Outgoing HID packet:", Loglevel::DEBUG);
LOG(static_cast<std::string>(outp), Loglevel::DEBUG);
@@ -334,7 +335,7 @@ namespace nitrokey {
LOG(
"Device is not ready or received packet's last CRC is not equal to sent CRC packet, retrying...",
- Loglevel::DEBUG);
+ Loglevel::DEBUG_L2);
LOG("Invalid incoming HID packet:", Loglevel::DEBUG_L2);
LOG(static_cast<std::string>(resp), Loglevel::DEBUG_L2);
dev->m_counters.total_retries++;
@@ -351,6 +352,13 @@ namespace nitrokey {
clear_packet(outp);
+ if (!resp.isCRCcorrect())
+ LOGD(std::string("Accepting response from device with invalid CRC. ")
+ + "Command ID: " + std::to_string(resp.command_id) + " " +
+ commandid_to_string(static_cast<CommandID>(resp.command_id))
+ );
+
+
if (status <= 0) {
dev->m_counters.receiving_error++;
throw DeviceReceivingFailure( //FIXME replace with CriticalErrorException
@@ -361,7 +369,7 @@ namespace nitrokey {
LOG("Incoming HID packet:", Loglevel::DEBUG);
LOG(static_cast<std::string>(resp), Loglevel::DEBUG);
LOG(std::string("receiving_retry_counter count: ") + std::to_string(receiving_retry_counter),
- Loglevel::DEBUG);
+ Loglevel::DEBUG_L2);
if (resp.device_status == static_cast<uint8_t>(stick10::device_status::busy) &&
static_cast<stick20::device_status>(resp.storage_status.device_status)