Open uocnb opened 9 years ago
Well, I found a solution, just install missing package and it work well:
pcscd
a pc/sc daemon service to handle nfc reader events to work with libpcsclite
- a ps/sc library for Linux / Mac OSXpcsc-tools
provide some tools written in perl to debug, monitor events, send raw commands.As Java is searching libpcsclite.so.1 in wrong directory (e.g: /lib or /usr/lib), so it is needed to append the path of library to help smartcardio find it. The demo run well with some exceptions as following command:
java -Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1 -cp .:nfctools-examples.jar org.nfctools.examples.scancard.ScanWholeCardDemo
Sample output from my sample card is:
$ java -Dsun.security.smartcardio.library=/lib/x86_64-linux-gnu/libpcsclite.so.1 -cp .:nfctools-examples.jar org.nfctools.examples.scancard.ScanWholeCardDemo
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar
May 07, 2015 12:42:14 AM org.nfctools.scio.TerminalHandler getAvailableTerminal
INFO: Checking terminal: ACS ACR122U 00 00
Waiting for tags, press ENTER to exit
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF82000006D3F7D3F7D3F7
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF860000050100006000
DEBUG: org.nfctools.spi.acs.AcsTag - response: 6300
INFO : org.nfctools.mf.tools.MfClassicCardScanner - Cannot read sector: 0 with key D3F7D3F7D3F7
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF82000006FFFFFFFFFFFF
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF860000050100006000
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FFB0000010
DEBUG: org.nfctools.spi.acs.AcsTag - response: 6300
ERROR: org.nfctools.mf.tools.MfClassicCardScanner - Reading block failed. Sector: 0, Block: 0 Key: A, Response: SW1: 99 SW2: 0
org.nfctools.mf.MfException: Reading block failed. Sector: 0, Block: 0 Key: A, Response: SW1: 99 SW2: 0
at org.nfctools.spi.acs.AcrMfClassicReaderWriter.readBlock(AcrMfClassicReaderWriter.java:64)
at org.nfctools.mf.tools.MfClassicCardScanner.doWithReaderWriter(MfClassicCardScanner.java:40)
at org.nfctools.mf.tools.AbstractCardTool.handleTag(AbstractCardTool.java:64)
at org.nfctools.NfcAdapter.onTag(NfcAdapter.java:81)
at org.nfctools.spi.acs.InitiatorTerminalTagScanner.handleCard(InitiatorTerminalTagScanner.java:89)
at org.nfctools.spi.acs.InitiatorTerminalTagScanner.run(InitiatorTerminalTagScanner.java:55)
at java.lang.Thread.run(Thread.java:745)
DEBUG: org.nfctools.spi.acs.InitiatorTerminalTagScanner - Waiting while card present
DEBUG: org.nfctools.spi.acs.InitiatorTerminalTagScanner - Waiting while card present
...
...
...
DEBUG: org.nfctools.spi.acs.InitiatorTerminalTagScanner - Wait for card absent
DEBUG: org.nfctools.spi.acs.InitiatorTerminalTagScanner - Disconnected
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF82000006D3F7D3F7D3F7
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF860000050100006000
DEBUG: org.nfctools.spi.acs.AcsTag - response: 6300
INFO : org.nfctools.mf.tools.MfClassicCardScanner - Cannot read sector: 0 with key D3F7D3F7D3F7
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF82000006FFFFFFFFFFFF
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FF860000050100006000
DEBUG: org.nfctools.spi.acs.AcsTag - response: 9000
DEBUG: org.nfctools.spi.acs.AcsTag - command: FFB0000010
DEBUG: org.nfctools.spi.acs.AcsTag - response: 6300
ERROR: org.nfctools.mf.tools.MfClassicCardScanner - Reading block failed. Sector: 0, Block: 0 Key: A, Response: SW1: 99 SW2: 0
org.nfctools.mf.MfException: Reading block failed. Sector: 0, Block: 0 Key: A, Response: SW1: 99 SW2: 0
at org.nfctools.spi.acs.AcrMfClassicReaderWriter.readBlock(AcrMfClassicReaderWriter.java:64)
at org.nfctools.mf.tools.MfClassicCardScanner.doWithReaderWriter(MfClassicCardScanner.java:40)
at org.nfctools.mf.tools.AbstractCardTool.handleTag(AbstractCardTool.java:64)
at org.nfctools.NfcAdapter.onTag(NfcAdapter.java:81)
at org.nfctools.spi.acs.InitiatorTerminalTagScanner.handleCard(InitiatorTerminalTagScanner.java:89)
at org.nfctools.spi.acs.InitiatorTerminalTagScanner.run(InitiatorTerminalTagScanner.java:55)
at java.lang.Thread.run(Thread.java:745)
DEBUG: org.nfctools.spi.acs.InitiatorTerminalTagScanner - Waiting while card present
I have a ACR122U-A9 NFC reader with MIFARE card. Demos work well in Windows, but failed to start in Linux (Ubuntu 15.04 x86_64)
I can execute some command with libnfc. I installed libnfc (from source), a library package provided by ACS.
All demos are failed, the error show as below:
Is nfctools library support libnfc? Do you have any solution to make it work on linux (or may be cross-platform: linux, windows, osx)?
P/S: thanks for great java library for NFC.