mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-24 13:52:38 +03:00
[FL-3706], [FL-3674] NFC NTAG and ISO14443-3b reading fix (#3285)
* mf ultralight poller: reset field after reading tearing flags * iso14443-3b poller: change cid comparison in ATTRIB cmd Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
90cb1c4f2e
commit
155e4e9fa4
@ -117,12 +117,13 @@ Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso144
|
||||
bit_buffer_reset(instance->rx_buffer);
|
||||
|
||||
// Send ATTRIB
|
||||
uint8_t cid = 0;
|
||||
bit_buffer_append_byte(instance->tx_buffer, 0x1d);
|
||||
bit_buffer_append_bytes(instance->tx_buffer, data->uid, ISO14443_3B_UID_SIZE);
|
||||
bit_buffer_append_byte(instance->tx_buffer, 0x00);
|
||||
bit_buffer_append_byte(instance->tx_buffer, ISO14443_3B_ATTRIB_FRAME_SIZE_256);
|
||||
bit_buffer_append_byte(instance->tx_buffer, 0x01);
|
||||
bit_buffer_append_byte(instance->tx_buffer, 0x00);
|
||||
bit_buffer_append_byte(instance->tx_buffer, cid);
|
||||
|
||||
ret = iso14443_3b_poller_frame_exchange(
|
||||
instance, instance->tx_buffer, instance->rx_buffer, iso14443_3b_get_fwt_fc_max(data));
|
||||
@ -138,11 +139,10 @@ Iso14443_3bError iso14443_3b_poller_activate(Iso14443_3bPoller* instance, Iso144
|
||||
bit_buffer_get_size_bytes(instance->rx_buffer));
|
||||
}
|
||||
|
||||
if(bit_buffer_get_byte(instance->rx_buffer, 0) != 0) {
|
||||
FURI_LOG_D(
|
||||
TAG,
|
||||
"Incorrect CID in ATTRIB response: %02X",
|
||||
bit_buffer_get_byte(instance->rx_buffer, 0));
|
||||
uint8_t cid_received = bit_buffer_get_byte(instance->rx_buffer, 0);
|
||||
// 15 bit is RFU
|
||||
if((cid_received & 0x7f) != cid) {
|
||||
FURI_LOG_D(TAG, "Incorrect CID in ATTRIB response: %02X", cid_received);
|
||||
instance->state = Iso14443_3bPollerStateActivationFailed;
|
||||
ret = Iso14443_3bErrorCommunication;
|
||||
break;
|
||||
|
@ -371,11 +371,14 @@ static NfcCommand mf_ultralight_poller_handler_read_counters(MfUltralightPoller*
|
||||
}
|
||||
|
||||
static NfcCommand mf_ultralight_poller_handler_read_tearing_flags(MfUltralightPoller* instance) {
|
||||
NfcCommand command = NfcCommandContinue;
|
||||
|
||||
if(mf_ultralight_support_feature(
|
||||
instance->feature_set,
|
||||
MfUltralightFeatureSupportCheckTearingFlag | MfUltralightFeatureSupportSingleCounter)) {
|
||||
if(instance->tearing_flag_read == instance->tearing_flag_total) {
|
||||
instance->state = MfUltralightPollerStateTryDefaultPass;
|
||||
command = NfcCommandReset;
|
||||
} else {
|
||||
bool single_counter = mf_ultralight_support_feature(
|
||||
instance->feature_set, MfUltralightFeatureSupportSingleCounter);
|
||||
@ -391,6 +394,7 @@ static NfcCommand mf_ultralight_poller_handler_read_tearing_flags(MfUltralightPo
|
||||
} else if(instance->error != MfUltralightErrorNone) {
|
||||
FURI_LOG_D(TAG, "Reading tearing flag %d failed", instance->tearing_flag_read);
|
||||
instance->state = MfUltralightPollerStateTryDefaultPass;
|
||||
command = NfcCommandReset;
|
||||
} else {
|
||||
instance->tearing_flag_read++;
|
||||
}
|
||||
@ -398,9 +402,10 @@ static NfcCommand mf_ultralight_poller_handler_read_tearing_flags(MfUltralightPo
|
||||
} else {
|
||||
FURI_LOG_D(TAG, "Skip reading tearing flags");
|
||||
instance->state = MfUltralightPollerStateTryDefaultPass;
|
||||
command = NfcCommandReset;
|
||||
}
|
||||
|
||||
return NfcCommandContinue;
|
||||
return command;
|
||||
}
|
||||
|
||||
static NfcCommand mf_ultralight_poller_handler_auth(MfUltralightPoller* instance) {
|
||||
|
Loading…
Reference in New Issue
Block a user