Fix build on Windows (using cmake and nmake).
This commit is contained in:
parent
3dccc218df
commit
3e8e1c8844
6 changed files with 32 additions and 11 deletions
|
|
@ -350,11 +350,11 @@ char* acr122_firmware(const nfc_device_spec_t nds)
|
|||
|
||||
bool acr122_led_red(const nfc_device_spec_t nds, bool bOn)
|
||||
{
|
||||
(void)bOn;
|
||||
byte_t abtLed[9] = { 0xFF,0x00,0x40,0x05,0x04,0x00,0x00,0x00,0x00 };
|
||||
acr122_spec_t* pas = (acr122_spec_t*)nds;
|
||||
byte_t abtBuf[2];
|
||||
size_t szBufLen = sizeof(abtBuf);
|
||||
(void)bOn;
|
||||
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
|
||||
{
|
||||
return (SCardControl(pas->hCard,IOCTL_CCID_ESCAPE_SCARD_CTL_CODE,abtLed,sizeof(abtLed),abtBuf,szBufLen,(void*)&szBufLen) == SCARD_S_SUCCESS);
|
||||
|
|
|
|||
|
|
@ -218,6 +218,9 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
|||
size_t szRxBufLen = BUFFER_LENGTH;
|
||||
size_t szPos;
|
||||
|
||||
const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 };
|
||||
const byte_t pn53x_nack_frame[] = { 0x00,0x00,0xff,0xff,0x00,0x00 };
|
||||
|
||||
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||
abtTxBuf[4] = szTxLen;
|
||||
// Packet length checksum
|
||||
|
|
@ -254,8 +257,6 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
|||
print_hex(abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 };
|
||||
const byte_t pn53x_nack_frame[] = { 0x00,0x00,0xff,0xff,0x00,0x00 };
|
||||
if(szRxBufLen >= sizeof(pn53x_ack_frame)) {
|
||||
|
||||
// Check if PN53x reply ACK
|
||||
|
|
|
|||
17
libnfc/nfc.c
17
libnfc/nfc.c
|
|
@ -590,14 +590,17 @@ nfc_initiator_poll_targets(const nfc_device_t* pnd,
|
|||
const byte_t btPollNr, const byte_t btPeriod,
|
||||
nfc_target_t* pntTargets, size_t* pszTargetFound)
|
||||
{
|
||||
size_t szTxInAutoPoll, n, szRxLen;
|
||||
byte_t abtRx[256];
|
||||
bool res;
|
||||
byte_t *pbtTxInAutoPoll;
|
||||
if(pnd->nc == NC_PN531) {
|
||||
// errno = ENOSUPP
|
||||
return false;
|
||||
}
|
||||
// byte_t abtInAutoPoll[] = { 0xd4, 0x60, 0x0f, 0x01, 0x00 };
|
||||
size_t szTxInAutoPoll = 4 + szTargetTypes;
|
||||
size_t n;
|
||||
byte_t *pbtTxInAutoPoll = malloc( szTxInAutoPoll );
|
||||
szTxInAutoPoll = 4 + szTargetTypes;
|
||||
pbtTxInAutoPoll = malloc( szTxInAutoPoll );
|
||||
pbtTxInAutoPoll[0] = 0xd4;
|
||||
pbtTxInAutoPoll[1] = 0x60;
|
||||
pbtTxInAutoPoll[2] = btPollNr;
|
||||
|
|
@ -606,9 +609,8 @@ nfc_initiator_poll_targets(const nfc_device_t* pnd,
|
|||
pbtTxInAutoPoll[4+n] = pnttTargetTypes[n];
|
||||
}
|
||||
|
||||
size_t szRxLen = 256;
|
||||
byte_t abtRx[256];
|
||||
bool res = pnd->pdc->transceive(pnd->nds, pbtTxInAutoPoll, szTxInAutoPoll, abtRx, &szRxLen);
|
||||
szRxLen = 256;
|
||||
res = pnd->pdc->transceive(pnd->nds, pbtTxInAutoPoll, szTxInAutoPoll, abtRx, &szRxLen);
|
||||
|
||||
if((szRxLen == 0)||(res == false)) {
|
||||
DBG("pnd->pdc->tranceive() failed: szRxLen=%d, res=%d", szRxLen, res);
|
||||
|
|
@ -616,12 +618,13 @@ nfc_initiator_poll_targets(const nfc_device_t* pnd,
|
|||
} else {
|
||||
*pszTargetFound = abtRx[0];
|
||||
if( *pszTargetFound ) {
|
||||
uint8_t ln;
|
||||
byte_t* pbt = abtRx + 1;
|
||||
/* 1st target */
|
||||
// Target type
|
||||
pntTargets[0].ntt = *(pbt++);
|
||||
// AutoPollTargetData length
|
||||
uint8_t ln = *(pbt++);
|
||||
ln = *(pbt++);
|
||||
pn53x_decode_target_data(pbt, ln, pnd->nc, pntTargets[0].ntt, &(pntTargets[0].nti));
|
||||
pbt += ln;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue