as I wrote in the title, I'm trying to use card emulation using my Nexus S, Cyanogenmod 10.1.3 and the ACS Acr122 usb reader. I found this article http://nelenkov.blogspot.it/2012/10/emulating-pki-smart-card-with-cm91.html and the github with the source code https://github.com/nelenkov/virtual-pki-card. I followed the instructions and it happened a strange thing. While the smartphone is on the reader the connection starts and stops repeatedly thus the demo doesn't work and the client raises this exception:
Exception in thread "main" java.lang.RuntimeException: javax.smartcardio.CardException: connect() failed
at org.nick.sepkiclient.Main.main(Main.java:105)
Caused by: javax.smartcardio.CardException: connect() failed
at sun.security.smartcardio.TerminalImpl.connect(Unknown Source)
at org.nick.sepkiclient.Main.waitForCard(Main.java:166)
at org.nick.sepkiclient.Main.main(Main.java:48)
Caused by: sun.security.smartcardio.PCSCException: SCARD_E_READER_UNAVAILABLE
at sun.security.smartcardio.PCSC.SCardStatus(Native Method)
at sun.security.smartcardio.CardImpl.<init>(Unknown Source)
... 3 more
Do you have any idea on how to fix that? Thanks
Unfortunately, the ACR 122U NFC reader is not really useable as a smartcard reader. Eventhough it uses PC/SC (CCID) to connect the reader to a PC, most versions of the ACR 122U require you to use reader specific commands and tunnel them over PC/SC. See this question for further information on the tunneling procedure and on available commands.