make sure CloseProxmark sets pm3_present.

This commit is contained in:
iceman1001 2019-05-07 17:31:07 +02:00
commit cb991b4d2c
3 changed files with 11 additions and 10 deletions

View file

@ -515,19 +515,18 @@ static int CmdConnect(const char *Cmd) {
port = (char *)Cmd;
}
if ( port == NULL ) {
if ( port == NULL )
return usage_hw_connect();
}
PrintAndLogEx(INFO, "Disconnecting from current serial port");
CloseProxmark();
if ( session.pm3_present ) {
CloseProxmark();
}
session.pm3_present = OpenProxmark(port, false, 20, false, USART_BAUD_RATE);
if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) {
PrintAndLogEx(ERR, _RED_("ERROR:") "cannot communicate with the Proxmark\n");
CloseProxmark();
session.pm3_present = false;
}
return PM3_SUCCESS;
}