From 5d640e412305428dc3d290511aacd40487ebeea7 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Thu, 25 May 2017 13:10:36 +0200 Subject: Show warning message about invalid incoming packet's CRC Signed-off-by: Szczepan Zalega --- include/device_proto.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'include') 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(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(resp.command_id)) + " " + + "Reported and calculated: " + std::to_string(resp.crc) + "!=" + std::to_string(resp.calculate_CRC()), + Loglevel::WARNING + ); + // See: DeviceResponse return resp; } -- cgit v1.2.3