简体   繁体   English

频繁断开ACR122U NFC阅读器

[英]Frequent Disconnection ACR122U NFC Reader

When I put SIII (Android 4.3) on ACR122U NFC reader the LED keeps blinking green. 当我在ACR122U NFC阅读器上放置SIII(Android 4.3)时,LED保持绿色闪烁。 When I put Samsung S4 (Android 4.3) LED turns green till the time phone is on the reader. 当我放入Samsung S4(Android 4.3)时,LED变为绿色,直到手机在阅读器上打开。 In both the cases NFC is turned on and device is in unlocked state. 在这两种情况下,NFC均已打开且设备处于解锁状态。 This behaviour translates into frequent disconnections in SIII and a stable connection on S4. 此行为将导致SIII中频繁断开连接以及S4上的稳定连接。 Why two phones behave differently? 为什么两个手机的行为不同? I am aware of the fact that two phones have NFC chipsets from two different vendors namely NXP and Broadcom. 我知道以下事实:两部手机具有来自两个不同供应商(即NXP和Broadcom)的NFC芯片组。

My question is what is the source for such inconsistent behaviour among these devices? 我的问题是这些设备之间这种不一致行为的根源是什么?

Another question is why does phone give an ATR at all? 另一个问题是,为什么电话完全给定ATR?

The command sequence for software card emulation using an ACR122U/PN532 can be found in this answer . 此答案中可以找到使用ACR122U / PN532仿真软件卡的命令序列。

In addition to that, there are different versions of the ACR122U: 除此之外,还有其他版本的ACR122U:

  • Some always indicate the presence of a smartcard. 有些总是表明存在智能卡。 In that case it is possible to connect to the "simulated" card using 在这种情况下,可以使用以下命令连接到“模拟”卡

     // SCardConnect with SCARD_SHARE_SHARED, SCARD_PROTOCOL_ANY Card card = cardTerminal.connect("*"); CardChannel cardChannel = card.getBasicChannel(); 

    After that, PN532 commands can be sent using APDU wrapping: 之后,可以使用APDU包装发送PN532命令:

     > FF000000 Lc PN532-COMMAND < PN532-RESPONSE 9000 

    with the cardChannel.transmit method: 使用cardChannel.transmit方法:

     CommandAPDU commandAPDU = ... // SCardTransmit Response responseAPDU = cardChannel.transmit(commandAPDU); 
  • Other versions of the ACR122U do not always "simulate" the presence of a smartcard. 其他版本的ACR122U并不总是“模拟”智能卡的存在。 Instead they automatically poll for contactless cards and only indicate card-presence if an actual card is presented to the reader. 取而代之的是,它们会自动轮询非接触式卡,并且仅在向读卡器提供了实际的卡时才指示卡的存在。 In that case using cardTerminal.connect("*"); 在这种情况下,使用cardTerminal.connect("*"); would be only possible if there is an actual card present. 仅在有实际卡的情况下才有可能。 However, this is typically not the case in situations where the ACR122U is used in software card emulation mode. 但是,在软件卡仿真模式下使用ACR122U的情况通常不是这种情况。 In that case it is still possible to establish a connection to the reader using direct mode 在这种情况下,仍然可以使用直接模式建立与阅读器的连接

     // SCardConnect with SCARD_SHARE_DIRECT Card card = cardTerminal.connect("direct"); 

    After that, the same APDU-wrapped PN532 commands can be exchanged with the reader using escape commands (you might want to check the manual if the escape command is correct for your reader version): 之后,可以使用转义命令与阅读器交换相同的APDU包装的PN532命令(如果转义命令对于您的阅读器版本正确,您可能需要检查手册):

     final int IOCTL_SMARTCARD_ACR122_ESCAPE_COMMAND = 0x003136B0; //IOCTL(3500) for Windows //final int IOCTL_SMARTCARD_ACR122_ESCAPE_COMMAND = 0x42000DAC; //IOCTL(3500) for Linux byte[] commandAPDU = ... // SCardControl byte[] responseAPDU = card.transmitControlCommand(IOCTL_SMARTCARD_ACR122_ESCAPE_COMMAND, commandAPDU); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM