removes the libusb-win32 workaround: libusb-win32 project released a new stable version which fixes the infinite timeout issue. (Thanks to Ergeerts Glenn)
This commit is contained in:
parent
752c247761
commit
fa7084fa77
2 changed files with 10 additions and 9 deletions
|
@ -7,12 +7,12 @@ Requirements
|
||||||
============
|
============
|
||||||
|
|
||||||
- MinGW-w64 compiler toolchain [1]
|
- MinGW-w64 compiler toolchain [1]
|
||||||
- LibUsb-Win32 1.2.4.6 (or greater) [2]
|
- LibUsb-Win32 1.2.5.0 (or greater) [2]
|
||||||
- CMake 2.8 [3]
|
- CMake 2.8 [3]
|
||||||
|
|
||||||
This was tested on Windows 7 64 bit, but should work on Windows Vista and
|
This was tested on Windows 7 64 bit, but should work on Windows Vista and
|
||||||
Windows XP and 32 bit as well.
|
Windows XP and 32 bit as well.
|
||||||
Only the ACS ACR122 reader is tested at the moment, so any feedback about other devices is very welcome.
|
Only the ACS ACR122 and the ASK Logo readers are tested at the moment, so any feedback about other devices is very welcome.
|
||||||
|
|
||||||
Community forum: http://www.libnfc.org/community/
|
Community forum: http://www.libnfc.org/community/
|
||||||
|
|
||||||
|
@ -53,5 +53,5 @@ References
|
||||||
[1] the easiest way is to use the TDM-GCC installer.
|
[1] the easiest way is to use the TDM-GCC installer.
|
||||||
Make sure to select MinGW-w64 in the installer, the regular MinGW does not contain headers for PCSC.
|
Make sure to select MinGW-w64 in the installer, the regular MinGW does not contain headers for PCSC.
|
||||||
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.5.1.exe/download
|
http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/tdm64-gcc-4.5.1.exe/download
|
||||||
[2] http://sourceforge.net/projects/libusb-win32/files/libusb-win32-snapshots/20110512/libusb-win32-snapshot-1.2.4.6.zip/download
|
[2] http://sourceforge.net/projects/libusb-win32/files/
|
||||||
[3] http://www.cmake.org
|
[3] http://www.cmake.org
|
||||||
|
|
|
@ -40,13 +40,12 @@ Thanks to d18c7db and Okko for example code
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
// Under POSIX system, we use libusb (>= 0.1.12)
|
// Under POSIX system, we use libusb (>= 0.1.12)
|
||||||
#include <usb.h>
|
#include <usb.h>
|
||||||
#define USB_INFINITE_TIMEOUT 0
|
#define USB_TIMEDOUT ETIMEDOUT
|
||||||
#define _usb_strerror( X ) strerror(-X)
|
#define _usb_strerror( X ) strerror(-X)
|
||||||
#else
|
#else
|
||||||
// Under Windows we use libusb-win32 (>= 1.2.4)
|
// Under Windows we use libusb-win32 (>= 1.2.5)
|
||||||
#include <lusb0_usb.h>
|
#include <lusb0_usb.h>
|
||||||
// libusb-win32's bug workaround: 0 as timeout does not means infite as expected
|
#define USB_TIMEDOUT 116
|
||||||
#define USB_INFINITE_TIMEOUT 100
|
|
||||||
#define _usb_strerror( X ) usb_strerror()
|
#define _usb_strerror( X ) usb_strerror()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,6 +60,8 @@ Thanks to d18c7db and Okko for example code
|
||||||
|
|
||||||
#define PN53X_USB_DRIVER_NAME "PN53x USB"
|
#define PN53X_USB_DRIVER_NAME "PN53x USB"
|
||||||
|
|
||||||
|
#define USB_INFINITE_TIMEOUT 0
|
||||||
|
|
||||||
#define DRIVER_DATA(pnd) ((struct pn53x_usb_data*)(pnd->driver_data))
|
#define DRIVER_DATA(pnd) ((struct pn53x_usb_data*)(pnd->driver_data))
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -105,7 +106,7 @@ pn53x_usb_bulk_read_ex (struct pn53x_usb_data *data, byte_t abtRx[], const size_
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
PRINT_HEX ("RX", abtRx, res);
|
PRINT_HEX ("RX", abtRx, res);
|
||||||
} else if (res < 0) {
|
} else if (res < 0) {
|
||||||
if (-res != ETIMEDOUT) {
|
if (-res != USB_TIMEDOUT) {
|
||||||
ERR ("Unable to read from USB (%s)", _usb_strerror (res));
|
ERR ("Unable to read from USB (%s)", _usb_strerror (res));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,7 +482,7 @@ pn53x_usb_receive (nfc_device_t * pnd, byte_t * pbtData, const size_t szDataLen)
|
||||||
read:
|
read:
|
||||||
res = pn53x_usb_bulk_read_ex (DRIVER_DATA (pnd), abtRxBuf, sizeof (abtRxBuf), delayed_reply ? 250 : USB_INFINITE_TIMEOUT);
|
res = pn53x_usb_bulk_read_ex (DRIVER_DATA (pnd), abtRxBuf, sizeof (abtRxBuf), delayed_reply ? 250 : USB_INFINITE_TIMEOUT);
|
||||||
|
|
||||||
if (delayed_reply && (res == -ETIMEDOUT)) {
|
if (delayed_reply && (res == -USB_TIMEDOUT)) {
|
||||||
if (DRIVER_DATA (pnd)->abort_flag) {
|
if (DRIVER_DATA (pnd)->abort_flag) {
|
||||||
DRIVER_DATA (pnd)->abort_flag = false;
|
DRIVER_DATA (pnd)->abort_flag = false;
|
||||||
pn53x_usb_ack (pnd);
|
pn53x_usb_ack (pnd);
|
||||||
|
|
Loading…
Reference in a new issue