Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
felica的读写在某些需要验证MAC_A的服务器上是很重要的操作。根据索尼官方的Felica-LiteS使用手册以及15396抓包数据,游戏只会向0x8080区块写入数值。0x8080为felica liteS的random challenge区块,验证MAC_A的流程即是先将16个随机字符写入8080区块,之后读取MAC_A区块即可。而MAC_A区块计算的值不仅是根据random challenge,还会将同一读取命令中前面读取的其他非MAC_A区块的数值也纳入计算中,又根据抓包数据以及实践分析,在发出读取命令时,必须在同一条命令中读取全部四个区块(即0x8082,0x8086,0x8090,0x8091)才能获取到服务器期望的正确MAC_A。关于使用PN532库读取felica四个区块会报错的问题,请见我提出的issus:Seeed-Studio/PN532#147 以及 Seeed-Studio/PN532#148
修改后的PN532库请见https://github.com/QHPaeek/PN532
经过测试,在需要MAC_A验证的服务器上可以正确刷入felica卡。
另外,经过对比15396抓包数据,发现:
15396的回复:
out:e0 30 00 05 61 2b 3a 31 30 30 30 30 30 30 30 30 43 39 34 34 43 30 30 30 43 39 34 36 39 30 30 30 43 39 34 36 39 30 30 30 43 39 34 36 39 30 30 45 39 be
in: e0 06 00 05 61 20 00 8c //CMD_SEND_HEX_DATA
arduino读卡器的回复:
out : e0 30 00 05 61 2b 3a 31 30 30 30 30 30 30 30 30 43 39 34 34 43 30 30 30 43 39 34 36 39 30 30 30 43 39 34 36 39 30 30 30 43 39 34 36 39 30 30 45 39 be
in : e0 06 00 05 61 00 00 6c //CMD_SEND_HEX_DATA
此错误似乎不影响读卡器的正常使用,但是会导致游戏反复向读卡器发送命令,可能会造成未知影响。修复后一切正常。