Skip to content
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

Modify code to support PC/SC reader #126

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Init data with SW1SW2 before use
Init data with SW1SW2 before use
  • Loading branch information
FeitianSmartcardReader committed May 28, 2020
commit cf35084295fe2f31d3e93dc751c104bc40bb9d7e
5 changes: 3 additions & 2 deletions libfreefare/mifare_classic.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,13 +356,14 @@ mifare_classic_read(FreefareTag tag, const MifareClassicBlockNumber block, Mifar

BUFFER_INIT(cmd, 2);
//For PC/SC reader, need give SW1SW2
BUFFER_ALIAS(res, data, sizeof(MifareClassicBlock)+2);
BUFFER_INIT(res, sizeof(MifareClassicBlock) + 2);

BUFFER_APPEND(cmd, MC_READ);
BUFFER_APPEND(cmd, block);

CLASSIC_TRANSCEIVE(tag, cmd, res);

memcpy(data, (MifareClassicBlock* )res, sizeof(MifareClassicBlock));

return 0;
}

Expand Down