Build r953

Can't build because sys/select.h cannot be found

Scanning dependencies of target nfc
[  5%] Building C object libnfc/CMakeFiles/nfc.dir/nfc.c.obj
[ 10%] Building C object libnfc/CMakeFiles/nfc.dir/nfc-device.c.obj
H:\libnfc160\libnfc-read-only\libnfc\nfc-device.c: In function 'nfc_device_new':

H:\libnfc160\libnfc-read-only\libnfc\nfc-device.c:13:5: warning: implicit declar
ation of function 'err'
[ 15%] Building C object libnfc/CMakeFiles/nfc.dir/iso14443-subr.c.obj
[ 20%] Building C object libnfc/CMakeFiles/nfc.dir/mirror-subr.c.obj
[ 25%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/acr122.c.obj
[ 30%] Building C object libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj
H:\libnfc160\libnfc-read-only\libnfc\drivers\pn53x_usb.c:35:24: fatal error: sys
/select.h: No such file or directory
compilation terminated.
mingw32-make[2]: *** [libnfc/CMakeFiles/nfc.dir/drivers/pn53x_usb.c.obj] Error 1

mingw32-make[1]: *** [libnfc/CMakeFiles/nfc.dir/all] Error 2
mingw32-make: *** [all] Error 2

Dear readers,

I saw a request to have a c# function, and I recently also got a similar question in my emailbox, so I created a first example.
You can download it at

I'll expand the library over time, if people want it to be expanded.

No, it does not work as expected, you can't enable all optimisations in the compiler.

The library file created under windows (libnfc.dll.a) cannot be included in a C++ 2010 project with the setting set to release when the linker optimization is enabled.

I mean version 1.3.9 for example, in the deprecated download list

As indicated, it could be a VS2010 thing or a error by cmake.

-cmake 2.8.4
-mingw64-runtime (mingw64-runtime-tdm64-gcc45-r3427)

As an extra note, the older precompiled versions never had this problem.

Well, I might have explained it wrong because of the edits.

Under debug the libnfc.dll.a works fine, under release it gives the entrypoint errors...

Later i'm going to try and figure out which setting is causing this behaviour (vs c++ 2010)

When in release, you set References in Linker-->Optimization from Yes to No, it will also work in Release...

I have no clue why this is, might be an error with make under windows, that it will generate a not completly valid library file?


I compiled the libnfc 1.4.2 on Windows 7 (64 bit) using the manual provided, but there is no nfc.lib or any other library file created. How to generate the nfc.lib file?

I thought that the libnfc.dll.a was the library file, but when I rename it to libnfc.lib and use it in my project, it tries to find different entrypoints that don't exist in the libnfc.dll (for example, I use Gdiplus, and it will try and find GdipFree in libnfc.dll)

(exact error message)

Entry Point Not Found
The procedure entry point GdiplusShutdown could not be located in the dynamic link library libnfc.dll.

removing gdi+ to test, will result in the failing of sqlite

Only errors out in Release, works fine in debug


(4 replies, posted in Questions and Requests)


Thanks, that worked.

Now I get the same error as under windows.

Using sector 01 as an exploit sector
TX: 00  00  ff  04  fc  d4  06  63  02  c1  00 
RX: 00  00  ff  00  ff  00 
RX: 00  00  ff  03  fd  d5  07  80  a4  00 
TX: 00  00  ff  00  ff  00 
TX: 00  00  ff  05  fb  d4  08  63  02  00  bf  00 
RX: 00  00  ff  00  ff  00 
RX: 00  00  ff  02  fe  d5  09  22  00 
TX: 00  00  ff  00  ff  00 
TX: 00  00  ff  04  fc  d4  06  63  03  c0  00 
RX: 00  00  ff  00  ff  00 
RX: 00  00  ff  03  fd  d5  07  80  a4  00 
TX: 00  00  ff  00  ff  00 
TX: 00  00  ff  05  fb  d4  08  63  03  00  be  00 
RX: 00  00  ff  00  ff  00 
RX: 00  00  ff  02  fe  d5  09  22  00 
TX: 00  00  ff  00  ff  00 
TX: 00  00  ff  06  fa  d4  42  60  07  4a  0f  2a  00 
RX: 00  00  ff  00  ff  00 
RX: 00  00  ff  03  fd  d5  43  03  e5  00 
TX: 00  00  ff  00  ff  00 
Error while requesting plain tag-nonce

Is there any specification documentation of what is exactly send/received?
the 00 00 ff 00 ff 00 are clearly acknowledgements

I only have a different reader with a different chipset.

Is it that the device that I have doesn't support the commands ?

I have 2 questions about the snapper and libnfc, under windows, I can start it, but I can't send plain bytes to the device (for example mfoc, it errors out on nfc_initiator_transceive_bytes in the mf_enhanced_auth function.

this is the reason I wanted to try it in linux, to enable debug mode and see where it exactly goes wrong.
but in Linux it can't find the device (ubuntu 10.10).


nfc-list use libnfc 1.4.1 (r689)
nfc-list: DBG nfc.c:209
nfc-list:     1 device(s) found using PN531_USB driver
nfc-list: DBG acr122.c:164
nfc-list:     PCSC context not found
nfc-list: DBG arygon.c:116
nfc-list:     Serial auto-probing have been disabled at compile time. Skipping autoprobe.
nfc-list: DBG pn53x_usb.c:168
nfc-list:     Attempt to connect to PN531_USB device
nfc-list: DBG pn53x_usb.c:182
nfc-list:     Setting config failed
nfc-list: DBG nfc.c:142
nfc-list:     No device found using driver: PN531_USB
nfc-list: ERROR: Unable to connect to NFC device.

lsusb output

Bus 002 Device 008: ID 04cc:0531 ST-Ericsson

I tried to disable pcscd with
sudo /etc/init.d/pcscd stop

With windows the device works if you just read from it.
thanks in advance.

Worked like a charm!

(still makes me wonder why it first worked, then not...)

rconty wrote:

AFAIK, setting them up to relay doesn't affect permanently the device. BTW, relaying using ACR122 can become a headache: due to the way that libnfc, PCSC and hardware works, ACR122 have a really poor support around emulation, relaying, and passive polling.

Yeah, i saw that afterwards, I will not be using it anymore for relaying

rconty wrote:

Did you install the ACR122's drivers on Linux or did you use the standard CCID ?

I use the standard CCID, but this hasn't been a problem before. Not before I tried the nfc-relay program.

When using the windows command to get the firmware version (in the ACR122 ps/sc scripting program) with command
FF 00 48 00 00
I do get a result
41 43 52 31 32 32 55 32 30 37 (ACR122U207)

In LibNFC SCardControl returns SCARD_E_NOT_TRANSACTED which is that the data exchange wasn't successful

So I now have this problem … rd-on-top/

what is weird, since it first worked fine, before I tried nfc-relay.

pcsc_scan can connect to the ACR122 reader, with and without a card on top of it

I recently got a problem with libNFC version 1.4.0 (r833) on several linux systems.

This problem doesn't exist with the 1.3.9 version on windows

The problem:
-2 NFC ACR122 devices, worked perfectly before (readed cards, mfoc, and all different kind of things) are both not working anymore in 1.4.0 on linux after I tried to set them up as a relay device.
-nfc-list finds the devices, but can't connect to them (nfc-list: ERROR: Unable to connect to NFC device.)
-Same error message on several systems
-nfc_connect returns NULL so I can't do anything
-(don't know if this is the problem) pcPort is also NULL
-Persists on all systems, after reboots, after reinstallations

The weird thing is, that it just works fine under windows. (connecting, reading, nfc-list, mfoc)

Any suggestions on how to get it working again under linux systems?
Thanks in advance!

(Version 1.3.9 (r609) and Version 1.4.0 (r834) on linux also gives the same error)

Output with enable debug enabled:
nfc-list use libnfc 1.4.0 (r844)
nfc-list: DBG nfc.c:209
nfc-list:     1 device(s) found using ACR122 driver
nfc-list: DBG arygon.c:123
nfc-list:     Serial auto-probing have been disabled at compile time. Skipping autoprobe.
nfc-list: DBG acr122.c:215
nfc-list:     Attempt to connect to ACS ACR122U PICC Interface 00 00
No ACR122 firmware received, Error: 80100016
nfc-list: DBG nfc.c:142
nfc-list:     No device found using driver: ACR122
nfc-list: ERROR: Enable to connect to NFC device