Topic: LibNFC 1.5.0 not working under windows.

When i compile with mingw32-make i get the following out put:

C:\Users\ZZZZZ\Desktop\LIBNFC\build>mingw32-make
Scanning dependencies of target nfc
[  4%] Building C object libnfc/CMakeFiles/nfc.dir/nfc.c.obj
[  8%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-device.c.obj
[ 13%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-emulation.c.obj
[ 17%] Building C object libnfc/CMakeFiles/nfc.dir/iso14443-subr.c.obj
[ 21%] Building C object libnfc/CMakeFiles/nfc.dir/mirror-subr.c.obj
[ 26%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c: In function 'pn53x_usb_
receive':
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:489:5: warning: unknown
conversion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:489:5: warning: unknown
conversion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:489:5: warning: too many
 arguments for format
[ 30%] Building C object libnfc/CMakeFiles/nfc.dir/buses/uart.c.obj
[ 34%] Building C object libnfc/CMakeFiles/nfc.dir/chips/pn53x.c.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\chips\pn53x.c: In function 'pn53x_build_fram
e':
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\chips\pn53x.c:431:5: warning: unknown conver
sion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\chips\pn53x.c:431:5: warning: too many argum
ents for format
Linking C shared library libnfc.dll
Creating library file: libnfc.dll.a
[ 34%] Built target nfc
Scanning dependencies of target nfc-utils
[ 39%] Building C object examples/CMakeFiles/nfc-utils.dir/nfc-utils.c.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-utils.c: In function 'print_nfc_iso144
43a_info':
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-utils.c:273:13: warning: unknown conve
rsion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-utils.c:273:13: warning: too many argu
ments for format
Linking C static library libnfc-utils.a
[ 39%] Built target nfc-utils
Scanning dependencies of target nfc-anticol
[ 43%] Building C object examples/CMakeFiles/nfc-anticol.dir/nfc-anticol.c.obj
Linking C executable nfc-anticol.exe
[ 43%] Built target nfc-anticol
Scanning dependencies of target nfc-dep-initiator
[ 47%] Building C object examples/CMakeFiles/nfc-dep-initiator.dir/nfc-dep-initi
ator.c.obj
Linking C executable nfc-dep-initiator.exe
[ 47%] Built target nfc-dep-initiator
Scanning dependencies of target nfc-dep-target
[ 52%] Building C object examples/CMakeFiles/nfc-dep-target.dir/nfc-dep-target.c
.obj
Linking C executable nfc-dep-target.exe
[ 52%] Built target nfc-dep-target
Scanning dependencies of target nfc-emulate-forum-tag4
[ 56%] Building C object examples/CMakeFiles/nfc-emulate-forum-tag4.dir/nfc-emul
ate-forum-tag4.c.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-emulate-forum-tag4.c: In function 'nde
f_message_save':
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-emulate-forum-tag4.c:268:5: warning: f
ormat '%lu' expects type 'long unsigned int', but argument 3 has type 'size_t'
Linking C executable nfc-emulate-forum-tag4.exe
[ 56%] Built target nfc-emulate-forum-tag4
Scanning dependencies of target nfc-emulate-tag
[ 60%] Building C object examples/CMakeFiles/nfc-emulate-tag.dir/nfc-emulate-tag
.c.obj
Linking C executable nfc-emulate-tag.exe
[ 60%] Built target nfc-emulate-tag
Scanning dependencies of target nfc-emulate-uid
[ 65%] Building C object examples/CMakeFiles/nfc-emulate-uid.dir/nfc-emulate-uid
.c.obj
Linking C executable nfc-emulate-uid.exe
[ 65%] Built target nfc-emulate-uid
Scanning dependencies of target nfc-list
[ 69%] Building C object examples/CMakeFiles/nfc-list.dir/nfc-list.c.obj
Linking C executable nfc-list.exe
[ 69%] Built target nfc-list
Scanning dependencies of target nfc-mfclassic
[ 73%] Building C object examples/CMakeFiles/nfc-mfclassic.dir/nfc-mfclassic.c.o
bj
[ 78%] Building C object examples/CMakeFiles/nfc-mfclassic.dir/mifare.c.obj
Linking C executable nfc-mfclassic.exe
[ 78%] Built target nfc-mfclassic
Scanning dependencies of target nfc-mfultralight
[ 82%] Building C object examples/CMakeFiles/nfc-mfultralight.dir/nfc-mfultralig
ht.c.obj
[ 86%] Building C object examples/CMakeFiles/nfc-mfultralight.dir/mifare.c.obj
Linking C executable nfc-mfultralight.exe
[ 86%] Built target nfc-mfultralight
Scanning dependencies of target nfc-poll
[ 91%] Building C object examples/CMakeFiles/nfc-poll.dir/nfc-poll.c.obj
Linking C executable nfc-poll.exe
[ 91%] Built target nfc-poll
Scanning dependencies of target nfc-relay
[ 95%] Building C object examples/CMakeFiles/nfc-relay.dir/nfc-relay.c.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay.c: In function 'main':
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay.c:121:5: warning: unknown conver
sion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay.c:121:5: warning: too many argum
ents for format
Linking C executable nfc-relay.exe
[ 95%] Built target nfc-relay
Scanning dependencies of target nfc-relay-picc
[100%] Building C object examples/CMakeFiles/nfc-relay-picc.dir/nfc-relay-picc.c
.obj
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c: In function 'print_hex_f
d4':
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c:112:3: warning: unknown c
onversion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c:112:3: warning: too many
arguments for format
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c: In function 'main':
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c:224:7: warning: unknown c
onversion type character 'z' in format
C:\Users\ZZZZZ\Desktop\LIBNFC\examples\nfc-relay-picc.c:224:7: warning: too many
arguments for format
Linking C executable nfc-relay-picc.exe
[100%] Built target nfc-relay-picc

C:\Users\ZZZZZ\Desktop\LIBNFC\build>cd C:\Users\ZZZZZ\Desktop\LIBNFC\build\example
s

C:\Users\ZZZZZ\Desktop\LIBNFC\build\examples>nfc-anticol.exe
DBG C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:260
    Checking device 04e6:5591
 TX: 00  00  ff  00  ff  00
DBG C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\chips\pn53x.c:129
    GetFirmwareVersion
 TX: 00  00  ff  02  fe  d4  02  2a  00
DBG C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:375
    usb_bulk_write failed with error -116
DBG C:\Users\ZZZZZ\Desktop\LIBNFC\libnfc\nfc.c:145
    No device found using driver: PN53x USB
Error connecting NFC reader

C:\Users\ZZZZZ\Desktop\LIBNFC\build\examples>

What can be causing these errors in compiling?

Thanks. Oh and does the LibUSB-lib    mean the .dll or the .lib file?

And ive noticed that its only the PNxxx driver that is the problem

Last edited by spookyman166 (2011-04-29 22:42:00)

Re: LibNFC 1.5.0 not working under windows.

Hi,

Based on your log there is no compiler error but a runtime problem.
What reader are you using?

it looks similar like the problem i'm having with the ASK Logo and libusb.

Re: LibNFC 1.5.0 not working under windows.

Im using the SCL3711, and a mifare classic 1k. sorry for late reply

Re: LibNFC 1.5.0 not working under windows.

it would be good if you could test the following. This was needed for getting an ASK Logo working on windows, and i think this might solve your issue as well..

  • apply the following patch against libnfc

  • download the following libusb-win32 release: http://sourceforge.net/projects/libusb- … p/download

  • extract the libusb-win32-bin-debug-1.2.4.0.zip file

  • run bin/inf-wizard

  • choose your device from the list, click next

  • choose a location for the inf file

  • install the driver

  • check with bin\x86\testlibusb-win.exe if your device is recognized

  • run nfc-list (compiled with the patched code) and post the output

Index: pn53x_usb.c
===================================================================
--- pn53x_usb.c    (revision 1086)
+++ pn53x_usb.c    (working copy)
@@ -36,7 +36,13 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <usb.h>
+
+#ifndef _WIN32
+  #include <usb.h>
+#else
+  #include <lusb0_usb.h>
+#endif
+
 #include <string.h>
 
 #include <nfc/nfc.h>
@@ -47,8 +53,13 @@
 #include "drivers/pn53x_usb.h"
 
 #define PN53X_USB_DRIVER_NAME "PN53x USB"
-#define USB_TIMEOUT   0
 
+#ifndef _WIN32
+  #define USB_TIMEOUT   0
+#else
+  #define USB_TIMEOUT   10
+#endif
+
 #define DRIVER_DATA(pnd) ((struct pn53x_usb_data*)(pnd->driver_data))
 
 typedef enum {
@@ -169,6 +180,7 @@
 bool
 pn53x_usb_probe (nfc_device_desc_t pnddDevices[], size_t szDevices, size_t * pszDeviceFound)
 {
+  usb_set_debug(3);
   usb_init ();
 
   int res;
@@ -183,11 +195,15 @@
 
   uint32_t uiBusIndex = 0;
   struct usb_bus *bus;
+  DBG("libusb found busses: %i, devices: %i", usb_find_busses(), usb_find_devices());
   for (bus = usb_get_busses (); bus; bus = bus->next) {
     struct usb_device *dev;
+    if(!bus->devices)
+      DBG("%s", "USB devices = NULL");
+      
     for (dev = bus->devices; dev; dev = dev->next, uiBusIndex++) {
       for (size_t n = 0; n < sizeof (pn53x_usb_supported_devices) / sizeof (struct pn53x_usb_supported_device); n++) {
-        // DBG("Checking device %04x:%04x (%04x:%04x)",dev->descriptor.idVendor,dev->descriptor.idProduct,candidates[i].idVendor,candidates[i].idProduct);
+        DBG("Checking device %04x:%04x (%04x:%04x)",dev->descriptor.idVendor,dev->descriptor.idProduct);
         if ((pn53x_usb_supported_devices[n].vendor_id == dev->descriptor.idVendor) &&
             (pn53x_usb_supported_devices[n].product_id == dev->descriptor.idProduct)) {
           // Make sure there are 2 endpoints available
@@ -249,6 +265,7 @@
 nfc_device_t *
 pn53x_usb_connect (const nfc_device_desc_t *pndd)
 {
+  usb_set_debug(3);
   nfc_device_t *pnd = NULL;
   struct pn53x_usb_data data = {
     .pudh = NULL,
@@ -407,7 +424,7 @@
     // packet.
     int res = pn53x_usb_bulk_write (DRIVER_DATA (pnd), (byte_t *)nack_frame, sizeof(nack_frame));
     if (res < 0) {
-      DBG ("usb_bulk_write failed with error %d", res);
+      DBG ("usb_bulk_write failed with error %d (%s)", res, usb_strerror());
       pnd->iLastError = DEIO;
       // try to interrupt current device state
       pn53x_usb_ack(pnd); 

disclaimer: this is mostly from memory, i still need to retry it on a clean pc to validate

Re: LibNFC 1.5.0 not working under windows.

Ill give it a shot when i can. Right now i have exams and such. No time for anything thanks for the advice Glenn.

Can you please PM me if you know anything about the Mifare SmartMX card? Like how to authencate keys and such? or what steps occur to get to the point where the communication is encrypted:

eg.   Reader: Send something
        Card:    reply with something
        Reader: send keys
        card: accepted
        Reader: [enc text]
         ............................


Thanks again glenn

Re: LibNFC 1.5.0 not working under windows.

Hi Glenn,

I cant patch my code libnfc. This is becuase it is saying that patch cant be applied cos a line doesnt match.

Re: LibNFC 1.5.0 not working under windows.

how do you execute the patch? I just retried it on a clean checkout of current trunk (r1096) and it still applies with problemes here..

If you can't get the patching to work you can change it manually in pn53x_usb.c:

replace

#include <usb.h>

with

#ifndef _WIN32
  #include <usb.h>
#else
  #include <lusb0_usb.h>
#endif

and replace

#define USB_TIMEOUT   0

with

#ifndef _WIN32
  #define USB_TIMEOUT   0
#else
  #define USB_TIMEOUT   10
#endif

The other changes are extra debugging output, not needed to get it working.
It would be very good if you (or someone else) could test this before i submit a patch ..

regards,
Glenn

Re: LibNFC 1.5.0 not working under windows.

hey glenn

i patched it manually. To apply the patch i copied the whole code in the box into a text file, changed extensive to .patch and right-clicked apply via tortoiseSVN, and it didnt work.

anyway here is my compile out put:

Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\windows\system32>cd C:\Users\xxxxxxx\Desktop\LIBNFC\build

C:\Users\xxxxxxx\Desktop\LIBNFC\build>mingw32-make
Linking C shared library libnfc.dll
Creating library file: libnfc.dll.a
[ 34%] Built target nfc
Scanning dependencies of target nfc-utils
[ 39%] Building C object examples/CMakeFiles/nfc-utils.dir/nfc-utils.c.obj
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-utils.c: In function 'print_nfc_iso144
43a_info':
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-utils.c:273:13: warning: unknown conve
rsion type character 'z' in format
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-utils.c:273:13: warning: too many argu
ments for format
Linking C static library libnfc-utils.a
[ 39%] Built target nfc-utils
Scanning dependencies of target nfc-anticol
[ 43%] Building C object examples/CMakeFiles/nfc-anticol.dir/nfc-anticol.c.obj
Linking C executable nfc-anticol.exe
[ 43%] Built target nfc-anticol
Scanning dependencies of target nfc-dep-initiator
[ 47%] Building C object examples/CMakeFiles/nfc-dep-initiator.dir/nfc-dep-initi
ator.c.obj
Linking C executable nfc-dep-initiator.exe
[ 47%] Built target nfc-dep-initiator
Scanning dependencies of target nfc-dep-target
[ 52%] Building C object examples/CMakeFiles/nfc-dep-target.dir/nfc-dep-target.c
.obj
Linking C executable nfc-dep-target.exe
[ 52%] Built target nfc-dep-target
Scanning dependencies of target nfc-emulate-forum-tag4
[ 56%] Building C object examples/CMakeFiles/nfc-emulate-forum-tag4.dir/nfc-emul
ate-forum-tag4.c.obj
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-emulate-forum-tag4.c: In function 'nde
f_message_save':
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-emulate-forum-tag4.c:267:5: warning: f
ormat '%lu' expects type 'long unsigned int', but argument 3 has type 'size_t'
Linking C executable nfc-emulate-forum-tag4.exe
[ 56%] Built target nfc-emulate-forum-tag4
Scanning dependencies of target nfc-emulate-tag
[ 60%] Building C object examples/CMakeFiles/nfc-emulate-tag.dir/nfc-emulate-tag
.c.obj
Linking C executable nfc-emulate-tag.exe
[ 60%] Built target nfc-emulate-tag
Scanning dependencies of target nfc-emulate-uid
[ 65%] Building C object examples/CMakeFiles/nfc-emulate-uid.dir/nfc-emulate-uid
.c.obj
Linking C executable nfc-emulate-uid.exe
[ 65%] Built target nfc-emulate-uid
Scanning dependencies of target nfc-list
[ 69%] Building C object examples/CMakeFiles/nfc-list.dir/nfc-list.c.obj
Linking C executable nfc-list.exe
[ 69%] Built target nfc-list
Scanning dependencies of target nfc-mfclassic
[ 73%] Building C object examples/CMakeFiles/nfc-mfclassic.dir/nfc-mfclassic.c.o
bj
[ 78%] Building C object examples/CMakeFiles/nfc-mfclassic.dir/mifare.c.obj
Linking C executable nfc-mfclassic.exe
[ 78%] Built target nfc-mfclassic
Scanning dependencies of target nfc-mfultralight
[ 82%] Building C object examples/CMakeFiles/nfc-mfultralight.dir/nfc-mfultralig
ht.c.obj
[ 86%] Building C object examples/CMakeFiles/nfc-mfultralight.dir/mifare.c.obj
Linking C executable nfc-mfultralight.exe
[ 86%] Built target nfc-mfultralight
Scanning dependencies of target nfc-poll
[ 91%] Building C object examples/CMakeFiles/nfc-poll.dir/nfc-poll.c.obj
Linking C executable nfc-poll.exe
[ 91%] Built target nfc-poll
Scanning dependencies of target nfc-relay
[ 95%] Building C object examples/CMakeFiles/nfc-relay.dir/nfc-relay.c.obj
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay.c: In function 'main':
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay.c:121:5: warning: unknown conver
sion type character 'z' in format
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay.c:121:5: warning: too many argum
ents for format
Linking C executable nfc-relay.exe
[ 95%] Built target nfc-relay
Scanning dependencies of target nfc-relay-picc
[100%] Building C object examples/CMakeFiles/nfc-relay-picc.dir/nfc-relay-picc.c
.obj
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c: In function 'print_hex_f
d4':
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c:112:3: warning: unknown c
onversion type character 'z' in format
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c:112:3: warning: too many
arguments for format
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c: In function 'main':
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c:224:7: warning: unknown c
onversion type character 'z' in format
C:\Users\xxxxxxx\Desktop\LIBNFC\examples\nfc-relay-picc.c:224:7: warning: too many
arguments for format
Linking C executable nfc-relay-picc.exe
[100%] Built target nfc-relay-picc

C:\Users\xxxxxxx\Desktop\LIBNFC\build>

and now i get this when i run nfc-list.exe

 

C:\Users\xxxxx\Desktop\LIBNFC\build\examples>nfc-list.exe
nfc-list.exe uses libnfc 1.5.0
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\nfc.c:187
    1 device(s) found using PN53x USB driver
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:277
    Checking device 04e6:5591
 TX: 00  00  ff  00  ff  00
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\chips\pn53x.c:113
    Diagnose
 TX: 00  00  ff  09  f7  d4  00  00  6c  69  62  6e  66  63  be  00
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:394
    usb_bulk_write failed with error -116
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\chips\pn53x.c:113
    GetFirmwareVersion
 TX: 00  00  ff  02  fe  d4  02  2a  00
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\drivers\pn53x_usb.c:394
    usb_bulk_write failed with error -116
DBG C:\Users\xxxxx\Desktop\LIBNFC\libnfc\nfc.c:108
    No device found using driver: PN53x USB
ERROR C:\Users\xxxxx\Desktop\LIBNFC\examples\nfc-list.c:123
    Unable to connect to NFC device.

C:\Users\xxxxx\Desktop\LIBNFC\build\examples>

Better than before, at least it is now detecting the reader.

Re: LibNFC 1.5.0 not working under windows.

Can you verify that the driver is correctly installed? You can do this using the testlibusb-win.exe program which comes with libusb. When your device is attached and the driver is installed you should see something like this:

DLL version:    1.2.4.6
Driver version:    -1.-1.-1.-1

bus/device  idVendor/idProduct
bus-0/\\.\libusb0-0001--0x1fd3-0x0608     1FD3/0608
- Manufacturer : ASK
- Product      : LoGO
bLength:             18
bDescriptorType:     01h
bcdUSB:              0200h
bDeviceClass:        00h
bDeviceSubClass:     00h
bDeviceProtocol:     00h
bMaxPacketSize0:     08h
idVendor:            1FD3h
idProduct:           0608h
bcdDevice:           0207h
iManufacturer:       1
iProduct:            2
iSerialNumber:       0
bNumConfigurations:  1
  wTotalLength:         32
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         80h
  MaxPower:             150
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      2
    bInterfaceClass:    255
    bInterfaceSubClass: 255
    bInterfaceProtocol: 255
    iInterface:         0
      bEndpointAddress: 04h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        4
      bRefresh:         0
      bSynchAddress:    0
      bEndpointAddress: 84h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        4
      bRefresh:         0
      bSynchAddress:    0

 

Re: LibNFC 1.5.0 not working under windows.

This is what i get:

DLL version:    1.2.4.6
Driver version:    1.2.4.6

bus/device  idVendor/idProduct
bus-0/\\.\libusb0-0001--0x04e6-0x5591     04E6/5591
- Manufacturer : SCM Micro
- Product      : SCL3711-NFC&RW
bLength:             18
bDescriptorType:     01h
bcdUSB:              0200h
bDeviceClass:        00h
bDeviceSubClass:     00h
bDeviceProtocol:     00h
bMaxPacketSize0:     08h
idVendor:            04E6h
idProduct:           5591h
bcdDevice:           0207h
iManufacturer:       1
iProduct:            2
iSerialNumber:       0
bNumConfigurations:  1
  wTotalLength:         32
  bNumInterfaces:       1
  bConfigurationValue:  1
  iConfiguration:       0
  bmAttributes:         80h
  MaxPower:             50
    bInterfaceNumber:   0
    bAlternateSetting:  0
    bNumEndpoints:      2
    bInterfaceClass:    255
    bInterfaceSubClass: 255
    bInterfaceProtocol: 255
    iInterface:         0
      bEndpointAddress: 04h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        4
      bRefresh:         0
      bSynchAddress:    0
      bEndpointAddress: 84h
      bmAttributes:     02h
      wMaxPacketSize:   64
      bInterval:        4
      bRefresh:         0
      bSynchAddress:    0

is there anything wrong glenn

Re: LibNFC 1.5.0 not working under windows.

ok, it seems the driver is successfully installed.
Are you able to test your device using linux? i wonder if it works alright there.
If it does there must be some incompatibility between libusb en libusb-win32

Re: LibNFC 1.5.0 not working under windows.

Works pretty fine in debian under a vmware machine.

Re: LibNFC 1.5.0 not working under windows.

so it seems like there is a problem with your device and libusb-win32 compatibility.
I had something similar with the ASK Logo, and in the end it turned out to be an inconsistency between libusb for linux and libusb-win32. I was hoping you were facing the same problem, but it seems like a different one.
I don't think i can help you further with my limited usb knowledge and not having the specific device.
I suggest you start a thread on the libusb-win32 mailing list. They are very helpfull..

this is the thread about the ASK reader problem: http://sourceforge.net/mailarchive/foru … in32-devel

Re: LibNFC 1.5.0 not working under windows.

Glenn's patch have been applied in r1104.

At the moment, no more manual patch is needed to work under Windows (be sure you have a up-to-date- libusb-win32 version).

Romuald Conty

Re: LibNFC 1.5.0 not working under windows.

Ok got it working here is how:

1. Update to latest revision.
2. Point to all current libnfc include dirs and libfiles
3. go into ...\libnfc\drivers and change the following line:

#ifndef _WIN32
  // Under POSIX system, we use libusb (>= 0.1.12)
  #include <usb.h>
  #define USB_INFINITE_TIMEOUT   0
  #define _usb_strerror( X ) strerror(-X)
#else
  // Under Windows we use libusb-win32 (>= 1.2.4)
  #include <lusb0_usb.h>
  // libusb-win32's bug workaround: 0 as timeout does not means infite as expected
  #define USB_INFINITE_TIMEOUT   100
  #define _usb_strerror( X ) usb_strerror()
#endif 

in PN53x_USB.c

to:

#ifndef _WIN32
  // Under POSIX system, we use libusb (>= 0.1.12)
  #include <usb.h>
  #define USB_INFINITE_TIMEOUT  5000
  #define _usb_strerror( X ) strerror(-X)
#else
  // Under Windows we use libusb-win32 (>= 1.2.4)
  #include <lusb0_usb.h>
  // libusb-win32's bug workaround: 0 as timeout does not means infite as expected
  #define USB_INFINITE_TIMEOUT   1000
  #define _usb_strerror( X ) usb_strerror()
#endif

Then compile and run

BAM.... WORKING!!!

Now all i need to do is find how to hack Mifare SmartMX that is emulating a mifare 4k card....

Thanks glenn and Rconty and xiaofan!!

Last edited by spookyman166 (2011-06-11 20:01:00)

Re: LibNFC 1.5.0 not working under windows.

Glad that you make it working.

On the other hand, 100ms timeout may still be too short in some cases. I think you may want to change that to 5000 or higher. The original timeout for Linux is actually infinite.

Re: LibNFC 1.5.0 not working under windows.

Is the lastest revision always cause troubles ?

Romuald Conty