diff options
| author | Szczepan Zalega <szczepan@nitrokey.com> | 2017-02-04 16:14:55 +0100 | 
|---|---|---|
| committer | Szczepan Zalega <szczepan@nitrokey.com> | 2017-03-11 15:41:42 +0100 | 
| commit | 832ae0720e7ce2a9666baaf9b86c1c9b9c150697 (patch) | |
| tree | afd003717996bb007bc8cbf49b1dce71d15065a1 | |
| parent | 3fcbb90176fb02816cc47ad7172b7b89bf6cb67d (diff) | |
| download | libnitrokey-832ae0720e7ce2a9666baaf9b86c1c9b9c150697.tar.gz libnitrokey-832ae0720e7ce2a9666baaf9b86c1c9b9c150697.tar.bz2  | |
Allow device to reply 10 times with busy status in a try
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
| -rw-r--r-- | include/device_proto.h | 14 | 
1 files changed, 11 insertions, 3 deletions
diff --git a/include/device_proto.h b/include/device_proto.h index e3a217d..ea740b3 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -298,9 +298,17 @@ namespace nitrokey {                      break;                    }                    if (resp.device_status == static_cast<uint8_t>(stick10::device_status::busy)) { -                    receiving_retry_counter++; -                    Log::instance()("Status busy, not decresing receiving_retry_counter counter: " + -                                    std::to_string(receiving_retry_counter), Loglevel::DEBUG_L2); +                    static int busy_counter = 0; +                    if (busy_counter++<10) { +                      receiving_retry_counter++; +                      dev->m_counters.busy++; +                      Log::instance()("Status busy, not decreasing receiving_retry_counter counter: " + +                                      std::to_string(receiving_retry_counter), Loglevel::DEBUG_L2); +                    } else { +                      busy_counter = 0; +                      Log::instance()("Status busy, decreasing receiving_retry_counter counter: " + +                                      std::to_string(receiving_retry_counter), Loglevel::DEBUG); +                    }                    }                    if (resp.device_status == static_cast<uint8_t>(stick10::device_status::busy) &&                        static_cast<stick20::device_status>(resp.storage_status.device_status)  | 
