NFC: Only show MFP GetVersion info when available

This commit is contained in:
Willy-JL
2025-03-23 03:10:42 +00:00
parent d2f4d0c216
commit 2f521d5e00
2 changed files with 17 additions and 1 deletions

View File

@@ -15,7 +15,21 @@ void nfc_render_mf_plus_info(
} }
void nfc_render_mf_plus_data(const MfPlusData* data, FuriString* str) { void nfc_render_mf_plus_data(const MfPlusData* data, FuriString* str) {
nfc_render_mf_plus_version(&data->version, str); MfPlusVersion empty_version = {0};
if(memcmp(&data->version, &empty_version, sizeof(MfPlusVersion)) == 0) {
const char* device_name = mf_plus_get_device_name(data, NfcDeviceNameTypeFull);
if(data->type == MfPlusTypeUnknown || data->size == MfPlusSizeUnknown ||
data->security_level == MfPlusSecurityLevelUnknown) {
furi_string_cat_printf(str, "This %s", device_name);
furi_string_replace(str, " Unknown", "");
} else {
furi_string_cat(str, device_name);
}
furi_string_replace(str, "Mifare", "MIFARE");
furi_string_cat(str, " does not support the GetVersion command, extra info unavailable\n");
} else {
nfc_render_mf_plus_version(&data->version, str);
}
} }
void nfc_render_mf_plus_version(const MfPlusVersion* data, FuriString* str) { void nfc_render_mf_plus_version(const MfPlusVersion* data, FuriString* str) {

View File

@@ -242,6 +242,8 @@ MfPlusError mf_plus_version_parse(MfPlusVersion* data, const BitBuffer* buf) {
if(can_parse) { if(can_parse) {
bit_buffer_write_bytes(buf, data, sizeof(MfPlusVersion)); bit_buffer_write_bytes(buf, data, sizeof(MfPlusVersion));
} else {
memset(data, 0, sizeof(MfPlusVersion));
} }
return can_parse ? MfPlusErrorNone : MfPlusErrorProtocol; return can_parse ? MfPlusErrorNone : MfPlusErrorProtocol;