First attempt to support Sony S330 reader
Tested: - nfc-list - nfc-anticol - nfc-mfultralight - nfc-mfclassic Commands momentarily disabled: - SetParameters - InDeselect - InRelease
This commit is contained in:
parent
f4c3d9d4ed
commit
91c46050c0
4 changed files with 31 additions and 13 deletions
|
|
@ -119,7 +119,8 @@ typedef struct {
|
|||
typedef enum {
|
||||
PN531 = 0x01,
|
||||
PN532 = 0x02,
|
||||
PN533 = 0x04
|
||||
PN533 = 0x04,
|
||||
S330 = 0x08
|
||||
} pn53x_type;
|
||||
|
||||
#ifndef DEBUG
|
||||
|
|
@ -141,7 +142,7 @@ typedef enum {
|
|||
static const pn53x_command pn53x_commands[] = {
|
||||
// Miscellaneous
|
||||
PNCMD( Diagnose, PN531|PN532|PN533 ),
|
||||
PNCMD( GetFirmwareVersion, PN531|PN532|PN533 ),
|
||||
PNCMD( GetFirmwareVersion, PN531|PN532|PN533|S330 ),
|
||||
PNCMD( GetGeneralStatus, PN531|PN532|PN533 ),
|
||||
PNCMD( ReadRegister, PN531|PN532|PN533 ),
|
||||
PNCMD( WriteRegister, PN531|PN532|PN533 ),
|
||||
|
|
@ -204,12 +205,6 @@ typedef struct {
|
|||
} pn53x_register;
|
||||
#endif
|
||||
|
||||
/*
|
||||
#define PN531 0x01
|
||||
#define PN532 0x02
|
||||
#define PN533 0X04
|
||||
*/
|
||||
|
||||
#ifndef DEBUG
|
||||
# define PNREG_DBG( X ) do { \
|
||||
} while(0)
|
||||
|
|
|
|||
|
|
@ -593,8 +593,12 @@ pn53x_get_firmware_version (nfc_device_t * pnd, char abtFirmwareText[22])
|
|||
} else if (szFwLen == 4) {
|
||||
if (abtFw[0] == 0x32) { // PN532 version IC
|
||||
CHIP_DATA(pnd)->type = PN532;
|
||||
} else if (abtFw[0] == 0x33) { // PN532 version IC
|
||||
CHIP_DATA(pnd)->type = PN533;
|
||||
} else if (abtFw[0] == 0x33) { // PN533 version IC
|
||||
if (abtFw[1] == 0x01) { // Sony ROM code
|
||||
CHIP_DATA(pnd)->type = S330;
|
||||
} else {
|
||||
CHIP_DATA(pnd)->type = PN533;
|
||||
}
|
||||
} else {
|
||||
// Unknown version IC
|
||||
return false;
|
||||
|
|
@ -614,6 +618,7 @@ pn53x_get_firmware_version (nfc_device_t * pnd, char abtFirmwareText[22])
|
|||
pnd->btSupportByte = abtFw[3];
|
||||
break;
|
||||
case PN533:
|
||||
case S330:
|
||||
snprintf (abtFirmwareText, 22, "PN533 v%d.%d (0x%02x)", abtFw[1], abtFw[2], abtFw[3]);
|
||||
pnd->btSupportByte = abtFw[3];
|
||||
break;
|
||||
|
|
@ -1838,6 +1843,11 @@ pn53x_strerror (const nfc_device_t * pnd)
|
|||
bool
|
||||
pn53x_SetParameters (nfc_device_t * pnd, const uint8_t ui8Value)
|
||||
{
|
||||
if (CHIP_DATA (pnd)->type == S330) {
|
||||
// TODO add support for S330
|
||||
return true;
|
||||
}
|
||||
|
||||
byte_t abtCmd[] = { SetParameters, ui8Value };
|
||||
|
||||
if(!pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL)) {
|
||||
|
|
@ -1955,6 +1965,10 @@ pn53x_InListPassiveTarget (nfc_device_t * pnd,
|
|||
bool
|
||||
pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target)
|
||||
{
|
||||
if (CHIP_DATA(pnd)->type == S330) {
|
||||
// TODO Add support for S330
|
||||
return true;
|
||||
}
|
||||
byte_t abtCmd[] = { InDeselect, ui8Target };
|
||||
|
||||
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
||||
|
|
@ -1963,6 +1977,10 @@ pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target)
|
|||
bool
|
||||
pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target)
|
||||
{
|
||||
if (CHIP_DATA(pnd)->type == S330) {
|
||||
// TODO Add support for S330
|
||||
return true;
|
||||
}
|
||||
byte_t abtCmd[] = { InRelease, ui8Target };
|
||||
|
||||
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue