diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-25 13:10:36 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-05-25 13:10:36 +0200 |
commit | 5d640e412305428dc3d290511aacd40487ebeea7 (patch) | |
tree | 2ff48e47459bfd62e5cdf625243283c04b5f68e0 /include | |
parent | 06c0deb7935a9390a67bc02d6c323e64c785a026 (diff) | |
download | libnitrokey-5d640e412305428dc3d290511aacd40487ebeea7.tar.gz libnitrokey-5d640e412305428dc3d290511aacd40487ebeea7.tar.bz2 |
Show warning message about invalid incoming packet's CRC
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/device_proto.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/include/device_proto.h b/include/device_proto.h index b557384..c126acd 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -352,12 +352,6 @@ 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++; @@ -398,6 +392,14 @@ namespace nitrokey { dev->m_counters.successful_storage_commands++; } + if (!resp.isCRCcorrect()) + LOG(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)) + " " + + "Reported and calculated: " + std::to_string(resp.crc) + "!=" + std::to_string(resp.calculate_CRC()), + Loglevel::WARNING + ); + // See: DeviceResponse return resp; } |