More attempt to support Sony RC-S360 reader
Adapt InDeselect & InRelease to RC-S360 nfc-list now supports discovery of several typeA tags properly Current status of RC-S360 support is: - nfc-list => ok except for B' & 3B - nfc-anticol => fails to send raw frames before select - nfc-mfultralight => ok - nfc-mfclassic => ok - pn53x-tamashell => ok - pn53x-diagnose => ok - nfc-dep-initiator => ok - nfc-dep-target => fails in InitAsTarget - nfc-emulate-* => fails in InitAsTarget Commands momentarily disabled for RC-S360: - select_passive_target for B'& 3B
This commit is contained in:
parent
80a5ad1fd6
commit
082edbf598
1 changed files with 37 additions and 10 deletions
|
@ -145,16 +145,13 @@ pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, b
|
||||||
}
|
}
|
||||||
|
|
||||||
*pszRx = (size_t) res;
|
*pszRx = (size_t) res;
|
||||||
|
|
||||||
switch (pbtTx[0]) {
|
switch (pbtTx[0]) {
|
||||||
case PowerDown:
|
case PowerDown:
|
||||||
case InDataExchange:
|
case InDataExchange:
|
||||||
case InCommunicateThru:
|
case InCommunicateThru:
|
||||||
case InDeselect:
|
|
||||||
case InJumpForPSL:
|
case InJumpForPSL:
|
||||||
case InPSL:
|
case InPSL:
|
||||||
case InATR:
|
case InATR:
|
||||||
case InRelease:
|
|
||||||
case InSelect:
|
case InSelect:
|
||||||
case InJumpForDEP:
|
case InJumpForDEP:
|
||||||
case TgGetData:
|
case TgGetData:
|
||||||
|
@ -165,6 +162,16 @@ pn53x_transceive (nfc_device_t * pnd, const byte_t * pbtTx, const size_t szTx, b
|
||||||
case TgSetMetaData:
|
case TgSetMetaData:
|
||||||
pnd->iLastError = pbtRx[0] & 0x3f;
|
pnd->iLastError = pbtRx[0] & 0x3f;
|
||||||
break;
|
break;
|
||||||
|
case InDeselect:
|
||||||
|
case InRelease:
|
||||||
|
if (CHIP_DATA(pnd)->type == RCS360) {
|
||||||
|
// Error code is in pbtRx[1] but we ignore error code anyway
|
||||||
|
// because other PN53x chips always return 0 on those commands
|
||||||
|
pnd->iLastError = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
pnd->iLastError = pbtRx[0] & 0x3f;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
pnd->iLastError = 0;
|
pnd->iLastError = 0;
|
||||||
}
|
}
|
||||||
|
@ -766,7 +773,7 @@ pn53x_configure (nfc_device_t * pnd, const nfc_device_option_t ndo, const bool b
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// When we reach this, the configuration is completed and succesful
|
// When we reach this, the configuration is completed and successful
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1965,11 +1972,21 @@ bool
|
||||||
pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target)
|
pn53x_InDeselect (nfc_device_t * pnd, const uint8_t ui8Target)
|
||||||
{
|
{
|
||||||
if (CHIP_DATA(pnd)->type == RCS360) {
|
if (CHIP_DATA(pnd)->type == RCS360) {
|
||||||
// TODO Add support for RC-S360
|
// We should do act here *only* if a target was previsouly selected
|
||||||
|
byte_t abtStatus[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||||
|
size_t szStatus = sizeof(abtStatus);
|
||||||
|
byte_t abtCmdGetStatus[] = { GetGeneralStatus };
|
||||||
|
if (!pn53x_transceive (pnd, abtCmdGetStatus, sizeof (abtCmdGetStatus), abtStatus, &szStatus)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((szStatus < 3) || (abtStatus[2] == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// No much choice what to deselect actually...
|
||||||
|
byte_t abtCmdRcs360[] = { InDeselect, 0x01, 0x01 };
|
||||||
|
return (pn53x_transceive (pnd, abtCmdRcs360, sizeof (abtCmdRcs360), NULL, NULL));
|
||||||
|
}
|
||||||
byte_t abtCmd[] = { InDeselect, ui8Target };
|
byte_t abtCmd[] = { InDeselect, ui8Target };
|
||||||
|
|
||||||
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1977,11 +1994,21 @@ bool
|
||||||
pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target)
|
pn53x_InRelease (nfc_device_t * pnd, const uint8_t ui8Target)
|
||||||
{
|
{
|
||||||
if (CHIP_DATA(pnd)->type == RCS360) {
|
if (CHIP_DATA(pnd)->type == RCS360) {
|
||||||
// TODO Add support for RC-S360
|
// We should do act here *only* if a target was previsouly selected
|
||||||
|
byte_t abtStatus[PN53x_EXTENDED_FRAME__DATA_MAX_LEN];
|
||||||
|
size_t szStatus = sizeof(abtStatus);
|
||||||
|
byte_t abtCmdGetStatus[] = { GetGeneralStatus };
|
||||||
|
if (!pn53x_transceive (pnd, abtCmdGetStatus, sizeof (abtCmdGetStatus), abtStatus, &szStatus)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((szStatus < 3) || (abtStatus[2] == 0)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
// No much choice what to release actually...
|
||||||
|
byte_t abtCmdRcs360[] = { InRelease, 0x01, 0x01 };
|
||||||
|
return (pn53x_transceive (pnd, abtCmdRcs360, sizeof (abtCmdRcs360), NULL, NULL));
|
||||||
|
}
|
||||||
byte_t abtCmd[] = { InRelease, ui8Target };
|
byte_t abtCmd[] = { InRelease, ui8Target };
|
||||||
|
|
||||||
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
return (pn53x_transceive (pnd, abtCmd, sizeof (abtCmd), NULL, NULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue