Skip to content

Commit

Permalink
Merge pull request #825 from mishamyte/fix-read-pwd-protected-ul
Browse files Browse the repository at this point in the history
Read Ultralight block by block
  • Loading branch information
xMasterX authored Oct 16, 2024
2 parents 5434405 + d3f192a commit d72fad4
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lib/nfc/protocols/mf_ultralight/mf_ultralight_poller.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,16 +505,14 @@ static NfcCommand mf_ultralight_poller_handler_read_pages(MfUltralightPoller* in
instance->error = mf_ultralight_poller_read_page(instance, start_page, &data);
}

const uint8_t read_cnt = instance->data->type == MfUltralightTypeMfulC ? 1 : 4;
if(instance->error == MfUltralightErrorNone) {
for(size_t i = 0; i < read_cnt; i++) {
if(start_page + i < instance->pages_total) {
FURI_LOG_D(TAG, "Read page %d success", start_page + i);
instance->data->page[start_page + i] = data.page[i];
instance->pages_read++;
instance->data->pages_read = instance->pages_read;
}
}
if (start_page < instance->pages_total) {
FURI_LOG_D(TAG, "Read page %d success", start_page);
instance->data->page[start_page] = data.page[start_page];
instance->pages_read++;
instance->data->pages_read = instance->pages_read;
}

if(instance->pages_read == instance->pages_total) {
instance->state = MfUltralightPollerStateReadCounters;
}
Expand Down

0 comments on commit d72fad4

Please sign in to comment.