mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
the waitforResponseTimeoutW fct will lock the client in situations like sniffing and if the device locks up there is no way to exit nice. This fix will look for life signs from the device. if lost, we will break. Allowing for the client to handle it better
This commit is contained in:
parent
4e540053e9
commit
9b8cf1e323
2 changed files with 11 additions and 2 deletions
|
@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file.
|
|||
This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log...
|
||||
|
||||
## [unreleased][unreleased]
|
||||
- Changed waiting for device loops. More stable experience (@iceman1001)
|
||||
- Changed client now handles CTRL-C and saves history if using READLINE (@iceman1001)
|
||||
- Changed `hf mf *` - printing of keys if MFC EV1 added extra explaination (@iceman1001)
|
||||
- Changed `hf mf ginfo - now supports decoding of user supplied configuration block (@iceman1001)
|
||||
|
|
|
@ -1038,21 +1038,29 @@ bool WaitForResponseTimeoutW(uint32_t cmd, PacketResponseNG *response, size_t ms
|
|||
// Wait until the command is received
|
||||
while (true) {
|
||||
|
||||
// if device gets disconnected or resets, break out of this loop
|
||||
if (IsCommunicationThreadDead()) {
|
||||
break;
|
||||
}
|
||||
|
||||
while (getReply(response)) {
|
||||
if (cmd == CMD_UNKNOWN || response->cmd == cmd) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (response->cmd == CMD_WTX && response->length == sizeof(uint16_t)) {
|
||||
uint16_t wtx = response->data.asDwords[0] & 0xFFFF;
|
||||
PrintAndLogEx(DEBUG, "Got Waiting Time eXtension request %i ms", wtx);
|
||||
if (ms_timeout != (size_t) - 1)
|
||||
if (ms_timeout != (size_t) - 1) {
|
||||
ms_timeout += wtx;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t tmp_clk = __atomic_load_n(&timeout_start_time, __ATOMIC_SEQ_CST);
|
||||
if ((ms_timeout != (size_t) - 1) && (msclock() - tmp_clk > ms_timeout))
|
||||
if ((ms_timeout != (size_t) - 1) && (msclock() - tmp_clk > ms_timeout)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (msclock() - tmp_clk > 3000 && show_warning) {
|
||||
// 3 seconds elapsed (but this doesn't mean the timeout was exceeded)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue