Add support for standard USB Smartcard Readers (#765)

* add PCSC interface (pcsc.c and pcsc.h)
* new command 'sc select' to choose an USB Smartcard Reader
* updated CI/.travis.yml accordingly
* remove TCK CRC check in i2c.c It is done in PrintATR() anyway
* Fix TCK CRC check in PrintATR()
* Add PCSC reader support to 'sc info'
This commit is contained in:
pwpiwi 2019-01-28 21:54:34 +01:00 committed by GitHub
commit a9104f7e31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 382 additions and 93 deletions

View file

@ -20,7 +20,8 @@
#include "cmdmain.h"
#include "cmddata.h"
/* low-level hardware control */
static uint32_t hw_capabilities = 0;
static int CmdHelp(const char *Cmd);
@ -403,6 +404,10 @@ int CmdTune(const char *Cmd)
return CmdTuneSamples(Cmd);
}
bool PM3hasSmartcardSlot(void) {
return (hw_capabilities & HAS_SMARTCARD_SLOT);
}
int CmdVersion(const char *Cmd)
{
@ -411,10 +416,11 @@ int CmdVersion(const char *Cmd)
UsbCommand resp = {0, {0, 0, 0}};
SendCommand(&c);
if (WaitForResponseTimeout(CMD_ACK,&resp,1000)) {
if (WaitForResponseTimeout(CMD_ACK, &resp, 1000)) {
PrintAndLog("Prox/RFID mark3 RFID instrument");
PrintAndLog((char*)resp.d.asBytes);
lookupChipID(resp.arg[0], resp.arg[1]);
hw_capabilities = resp.arg[2];
}
return 0;
}