Fix mifare_classic_transfer() with some readers.
This commit is contained in:
parent
d9ed7f2c24
commit
7c8c818a08
2 changed files with 18 additions and 2 deletions
|
|
@ -72,6 +72,8 @@
|
|||
#include <freefare.h>
|
||||
#include "freefare_internal.h"
|
||||
|
||||
#define MC_OK 0x0A
|
||||
|
||||
#define MC_AUTH_A 0x60
|
||||
#define MC_AUTH_B 0x61
|
||||
#define MC_READ 0x30
|
||||
|
|
@ -478,7 +480,16 @@ mifare_classic_transfer (MifareTag tag, const MifareClassicBlockNumber block)
|
|||
|
||||
CLASSIC_TRANSCEIVE (tag, cmd, res);
|
||||
|
||||
return (BUFFER_SIZE (res) == 0) ? 0 : res[0];
|
||||
/*
|
||||
* Depending on the device we are using, on success, the TRANSFER command
|
||||
* returns either no data (e.g. touchatag) or a 1 byte response, 0x0A,
|
||||
* meaning that the action was performed correctly (e.g. Snapper Feeder,
|
||||
* SCL 3711).
|
||||
*/
|
||||
if (!BUFFER_SIZE (res) || ((BUFFER_SIZE (res) == 1) && (res[0] = MC_OK)))
|
||||
return 0;
|
||||
else
|
||||
return res[0];
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue