Skip to content

修复Felica读写以及CMD_SEND_HEX_DATA的回复 #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions Aime_Reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ typedef union {
struct {
uint8_t RW_status[2];
uint8_t numBlock;
uint8_t blockData[1][1][16];
uint8_t blockData[4][16];
};
uint8_t felica_payload[1];
};
Expand Down Expand Up @@ -385,13 +385,12 @@ void nfc_felica_through() {
break;
case FelicaReadWithoutEncryptData:
{
uint16_t serviceCodeList[1] = { (uint16_t)(req.serviceCodeList[1] << 8 | req.serviceCodeList[0]) };
uint16_t serviceCodeList = req.serviceCodeList[1] << 8 | req.serviceCodeList[0];
uint16_t blockList[4];
for (uint8_t i = 0; i < req.numBlock; i++) {
uint16_t blockList[1] = { (uint16_t)(req.blockList[i][0] << 8 | req.blockList[i][1]) };
if (nfc.felica_ReadWithoutEncryption(1, serviceCodeList, 1, blockList, res.blockData[i]) != 1) {
memset(res.blockData[i], 0, 16); // dummy data
}
blockList[i] = (uint16_t)(req.blockList[i][0] << 8 | req.blockList[i][1]);
}
nfc.felica_ReadWithoutEncryption(1, &serviceCodeList, req.numBlock, blockList, res.blockData);
res.RW_status[0] = 0;
res.RW_status[1] = 0;
res.numBlock = req.numBlock;
Expand All @@ -400,7 +399,10 @@ void nfc_felica_through() {
break;
case FelicaWriteWithoutEncryptData:
{
res_init(0x0C); // WriteWithoutEncryption,ignore
uint16_t serviceCodeList = req.serviceCodeList[1] << 8 | req.serviceCodeList[0];
uint16_t blockList = (uint16_t)(req.blockList[0][0] << 8 | req.blockList[0][1]);
nfc.felica_WriteWithoutEncryption(1, &serviceCodeList, 1, &blockList, &req.blockData);
res_init(0x0C);
res.RW_status[0] = 0;
res.RW_status[1] = 0;
}
Expand Down
4 changes: 4 additions & 0 deletions Arduino-Aime-Reader.ino
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ void loop() {
case CMD_CARD_HALT:
case CMD_EXT_TO_NORMAL_MODE:
case CMD_TO_UPDATER_MODE:
res_init();
break;

case CMD_SEND_HEX_DATA:
res_init();
res.status = STATUS_COMP_DUMMY_3RD;
break;

case STATUS_SUM_ERROR:
Expand Down