mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-01 05:06:38 +00:00
Merge r499-510 from trunk.
This commit is contained in:
@@ -41,25 +41,6 @@
|
||||
// Bus
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SERIAL_STRING "COM"
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#define delay_ms( X ) Sleep( X )
|
||||
#else
|
||||
// unistd.h is needed for usleep() fct.
|
||||
#include <unistd.h>
|
||||
#define delay_ms( X ) usleep( X * 1000 )
|
||||
|
||||
#ifdef __APPLE__
|
||||
// MacOS
|
||||
#define SERIAL_STRING "/dev/tty.SLAB_USBtoUART"
|
||||
#else
|
||||
// *BSD, Linux and others POSIX systems
|
||||
#define SERIAL_STRING "/dev/ttyUSB"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUFFER_LENGTH 256
|
||||
|
||||
/** @def DEV_ARYGON_PROTOCOL_ARYGON_ASCII
|
||||
|
||||
@@ -38,33 +38,6 @@
|
||||
// Bus
|
||||
#include "uart.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#define SERIAL_STRING "COM"
|
||||
#define snprintf _snprintf
|
||||
#define strdup _strdup
|
||||
#define delay_ms( X ) Sleep( X )
|
||||
#else
|
||||
// unistd.h is needed for usleep() fct.
|
||||
#include <unistd.h>
|
||||
#define delay_ms( X ) usleep( X * 1000 )
|
||||
|
||||
#ifdef __APPLE__
|
||||
// MacOS
|
||||
// TODO: find UART connection string for PN53X device on Mac OS X
|
||||
#define SERIAL_STRING ""
|
||||
#elif defined(__FreeBSD__)
|
||||
// XXX: Not tested
|
||||
#define SERIAL_STRING "/dev/cuau"
|
||||
#else
|
||||
// Linux and maybe some operating systems
|
||||
// FIXME: We'd rather have an #elif defined(__linux__) or something like
|
||||
// that and an #else that triggers an error at compile time instead
|
||||
// of "falling-back" on a value that is likely to not be suitable
|
||||
// for most operating systems.
|
||||
#define SERIAL_STRING "/dev/ttyUSB"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define BUFFER_LENGTH 256
|
||||
|
||||
#define SERIAL_DEFAULT_PORT_SPEED 115200
|
||||
|
||||
@@ -241,6 +241,7 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s
|
||||
byte_t abtTx[BUFFER_LENGTH] = { 0x00, 0x00, 0xff }; // Every packet must start with "00 00 ff"
|
||||
byte_t abtRx[BUFFER_LENGTH];
|
||||
usb_spec_t* pus = (usb_spec_t*)pnd->nds;
|
||||
uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
||||
|
||||
// Packet length = data length (len) + checksum (1) + end of stream marker (1)
|
||||
abtTx[3] = szTxLen;
|
||||
@@ -281,7 +282,6 @@ bool pn53x_usb_transceive(nfc_device_t* pnd, const byte_t* pbtTx, const size_t s
|
||||
PRINT_HEX("RX", abtRx,ret);
|
||||
#endif
|
||||
|
||||
uint8_t ack_frame[] = { 0x00, 0x00, 0xff, 0x00, 0xff, 0x00 };
|
||||
if ((ret != 6) || (memcmp (abtRx, ack_frame, 6))) {
|
||||
DBG ("%s", "===> No ACK!!!!!!");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user