mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-03 14:21:47 +00:00
Merge the libnfc-less-bitutils-more-ponies branch into trunk.
This commit is contained in:
@@ -35,7 +35,6 @@
|
||||
|
||||
#include "acr122.h"
|
||||
#include "../drivers.h"
|
||||
#include "../bitutils.h"
|
||||
|
||||
// Bus
|
||||
#include <winscard.h>
|
||||
@@ -279,8 +278,7 @@ bool acr122_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||
memcpy(abtTxBuf+5,pbtTx,szTxLen);
|
||||
szRxBufLen = sizeof(abtRxBuf);
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex(abtTxBuf,szTxLen+5);
|
||||
PRINT_HEX("TX", abtTxBuf,szTxLen+5);
|
||||
#endif
|
||||
|
||||
if (pas->ioCard.dwProtocol == SCARD_PROTOCOL_UNDEFINED)
|
||||
@@ -305,8 +303,7 @@ bool acr122_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRxBuf,szRxBufLen);
|
||||
PRINT_HEX("RX", abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
// When the answer should be ignored, just return a succesful result
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include "../drivers.h"
|
||||
#include "../bitutils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -243,8 +242,7 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||
abtTxBuf[szTxLen+7] = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex(abtTxBuf,szTxLen+8);
|
||||
PRINT_HEX("TX", abtTxBuf,szTxLen+8);
|
||||
#endif
|
||||
if (!uart_send((serial_port)nds,abtTxBuf,szTxLen+8)) {
|
||||
ERR("%s", "Unable to transmit data. (TX)");
|
||||
@@ -257,8 +255,7 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRxBuf,szRxBufLen);
|
||||
PRINT_HEX("RX", abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
if(szRxBufLen >= sizeof(pn53x_ack_frame)) {
|
||||
@@ -287,10 +284,9 @@ bool arygon_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, const s
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
PRINT_HEX("RX", abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
// When the answer should be ignored, just return a successful result
|
||||
if(pbtRx == NULL || pszRxLen == NULL) return true;
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#endif // HAVE_CONFIG_H
|
||||
|
||||
#include "../drivers.h"
|
||||
#include "../bitutils.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
@@ -223,8 +222,7 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con
|
||||
abtTxBuf[szTxLen+6] = 0;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex(abtTxBuf,szTxLen+7);
|
||||
PRINT_HEX("TX", abtTxBuf,szTxLen+7);
|
||||
#endif
|
||||
if (!uart_send((serial_port)nds,abtTxBuf,szTxLen+7)) {
|
||||
ERR("%s", "Unable to transmit data. (TX)");
|
||||
@@ -237,8 +235,7 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRxBuf,szRxBufLen);
|
||||
PRINT_HEX("RX", abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
const byte_t pn53x_ack_frame[] = { 0x00,0x00,0xff,0x00,0xff,0x00 };
|
||||
@@ -269,10 +266,9 @@ bool pn532_uart_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, con
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
PRINT_HEX("RX", abtRxBuf,szRxBufLen);
|
||||
#endif
|
||||
|
||||
// When the answer should be ignored, just return a successful result
|
||||
if(pbtRx == NULL || pszRxLen == NULL) return true;
|
||||
@@ -311,8 +307,7 @@ pn532_uart_check_communication(const nfc_device_spec_t nds)
|
||||
const byte_t pncmd_communication_test[] = { 0x00,0x00,0xff,0x09,0xf7,0xd4,0x00,0x00,'l','i','b','n','f','c',0xbe,0x00 };
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex(pncmd_communication_test,sizeof(pncmd_communication_test));
|
||||
PRINT_HEX("TX", pncmd_communication_test,sizeof(pncmd_communication_test));
|
||||
#endif
|
||||
uart_send((serial_port)nds, pncmd_communication_test, sizeof(pncmd_communication_test));
|
||||
|
||||
@@ -320,8 +315,7 @@ pn532_uart_check_communication(const nfc_device_spec_t nds)
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRx,szRxLen);
|
||||
PRINT_HEX("RX", abtRx,szRxLen);
|
||||
#endif
|
||||
|
||||
const byte_t attempted_result[] = { 0x00,0x00,0xff,0x00,0xff,0x00,0x00,0x00,0xff,0x09,0xf7,0xD5,0x01,0x00,'l','i','b','n','f','c',0xbc,0x00};
|
||||
|
||||
@@ -38,7 +38,6 @@ Thanks to d18c7db and Okko for example code
|
||||
#include <string.h>
|
||||
|
||||
#include "../drivers.h"
|
||||
#include "../bitutils.h"
|
||||
|
||||
#include <nfc/nfc-messages.h>
|
||||
|
||||
@@ -267,10 +266,9 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
|
||||
abtTx[szTxLen+6] = 0;
|
||||
|
||||
DBG("%s","pn53x_usb_transceive");
|
||||
#ifdef DEBUG
|
||||
printf(" TX: ");
|
||||
print_hex(abtTx,szTxLen+7);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
PRINT_HEX("TX", abtTx,szTxLen+7);
|
||||
#endif
|
||||
|
||||
ret = usb_bulk_write(pus->pudh, pus->uiEndPointOut, (char*)abtTx, szTxLen+7, USB_TIMEOUT);
|
||||
if( ret < 0 )
|
||||
@@ -286,10 +284,9 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
PRINT_HEX("RX", abtRx,ret);
|
||||
#endif
|
||||
|
||||
if( ret == 6 )
|
||||
{
|
||||
@@ -300,10 +297,9 @@ bool pn53x_usb_transceive(const nfc_device_spec_t nds, const byte_t* pbtTx, cons
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
printf(" RX: ");
|
||||
print_hex(abtRx,ret);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
PRINT_HEX("RX", abtRx,ret);
|
||||
#endif
|
||||
}
|
||||
|
||||
// When the answer should be ignored, just return a succesful result
|
||||
|
||||
Reference in New Issue
Block a user