Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NFC Card Reader ACR 122 incompatible with Android 4.1 Jelly Beans?

I used the ACR 122 before and it worked flawlessly with an Android < 4.1 phone. I used it to exchange P2P SNEP messsages... But since the phone got 4.1, the reader starts beeping and flashing when you place the phone above it. Does anyone else have found this incompatibility? Any solutions?

like image 826
Sven Haiges Avatar asked Jul 27 '12 08:07

Sven Haiges


3 Answers

Since Android 4.1 Jelly Bean, NFC peer-to-peer communication is configured to use a higher bitrate (212 kbps), while earlier it was using 106 kbps (in Android devices that have Google Wallet installed it was always using 212 kbps).

I don't know whether the ACR122U can support the higher bitrate through javax.smartcardio. The NFC chip inside (NXP's PN532) can certainly do it. The low-level ISO18092/ECMA-340 protocol for 212 and 424 kbps is different from 106 kbps. With 106 kbps it uses the same modulation as ISO14443, while the higher bitrates use the same modulation as FeliCa (see page 7 and 8 of the standard). So I suspect this cannot be handled through javax.smartcardio.

like image 161
NFC guy Avatar answered Nov 11 '22 20:11

NFC guy


great to see someone else working on this. You can connect to the Reader via "Direct". credits go to Peter Kmet: javax.smartcardio transmit to NFC USB reader without card

This sample will just toggle the Lights

        TerminalFactory factory;
        List<CardTerminal> terminals;
        factory = TerminalFactory.getDefault();
        terminals = factory.terminals().list();
        terminal = terminals.get(0);

        byte[] response = null;
        byte[] command = new byte[] { (byte) 0xff, (byte) 0x00, (byte) 0x40, (byte) 0xd0, (byte) 0x04,
            (byte) 0x05, (byte) 0x05, (byte) 0x02, (byte) 0x01 };
        int controlCode = 0x310000 + 3500 * 4;
        Card card = null;
        card = terminal.connect("DIRECT");
        response = card.transmitControlCommand(controlCode, command);

Please update if you make any progress with Jelly Bean, I will checkout your code as well.

like image 27
user1818014 Avatar answered Nov 11 '22 19:11

user1818014


This can be helpful to make a connection to terminal without a card in range:

terminal.connect("DIRECT");
like image 3
user1818428 Avatar answered Nov 11 '22 20:11

user1818428