Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NFC: Goofy ISO15693 block sizes? #274

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ void nfc_render_iso15693_3_extra(const Iso15693_3Data* data, FuriString* str) {
}

if(data->system_info.flags & ISO15693_3_SYSINFO_FLAG_AFI) {
furi_string_cat_printf(
str, "AFI: %s locked\n", data->settings.lock_bits.dsfid ? "" : "not");
furi_string_cat_printf(str, "AFI: %s locked\n", data->settings.lock_bits.afi ? "" : "not");
}
}
9 changes: 6 additions & 3 deletions lib/nfc/protocols/iso15693_3/iso15693_3_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,12 @@ Iso15693_3Error
}

if(data->flags & ISO15693_3_SYSINFO_FLAG_MEMORY) {
// Add 1 to get actual values
data->block_count = *extra++ + 1;
data->block_size = (*extra++ & 0x1F) + 1;
data->block_count = *extra++;
data->block_size = (*extra++ & 0x1F);
// Some tags report values -1 than actual values for some reason
// Some others don't, so let's just assume people use even numbers
if(data->block_count % 2) data->block_count++;
if(data->block_size % 2) data->block_size++;
}

if(data->flags & ISO15693_3_SYSINFO_FLAG_IC_REF) {
Expand Down
4 changes: 2 additions & 2 deletions lib/nfc/protocols/iso15693_3/iso15693_3_listener_i.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ static Iso15693_3Error iso15693_3_listener_get_system_info_handler(
}
if(system_flags & ISO15693_3_SYSINFO_FLAG_MEMORY) {
const uint8_t memory_info[2] = {
instance->data->system_info.block_count - 1,
instance->data->system_info.block_size - 1,
instance->data->system_info.block_count,
instance->data->system_info.block_size,
};
bit_buffer_append_bytes(instance->tx_buffer, memory_info, COUNT_OF(memory_info));
}
Expand Down
Loading