mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-24 08:59:43 +08:00
reconnect fast
This commit is contained in:
parent
ec5876ba35
commit
1c70163605
1 changed files with 12 additions and 8 deletions
|
@ -52,6 +52,17 @@ static void showBanner(void) {
|
|||
fflush(stdout);
|
||||
}
|
||||
|
||||
int check_comm(void) {
|
||||
// If communications thread goes down. Device disconnected then this should hook up PM3 again.
|
||||
if ( IsCommunicationThreadDead() ) {
|
||||
session.pm3_present = ReConnectProxmark();
|
||||
if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) {
|
||||
session.pm3_present = false;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Main thread of PM3 Client
|
||||
void
|
||||
#ifdef __has_attribute
|
||||
|
@ -97,14 +108,6 @@ main_loop(char *script_cmds_file, char *script_cmd) {
|
|||
while (1) {
|
||||
bool printprompt = false;
|
||||
|
||||
// If communications thread goes down. Device disconnected then this should hook up PM3 again.
|
||||
if ( IsCommunicationThreadDead() ) {
|
||||
session.pm3_present = ReConnectProxmark();
|
||||
if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) {
|
||||
session.pm3_present = false;
|
||||
}
|
||||
}
|
||||
|
||||
// If there is a script file
|
||||
if (sf) {
|
||||
|
||||
|
@ -155,6 +158,7 @@ main_loop(char *script_cmds_file, char *script_cmd) {
|
|||
printprompt = true;
|
||||
|
||||
} else {
|
||||
rl_event_hook = check_comm;
|
||||
cmd = readline(PROXPROMPT);
|
||||
fflush(NULL);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue