Nfc: add basic Mifare DESFire support (#1024)
* Fix TextBox word wrap behavior * Wrap width is 120 pixels, not 140. (140 is larger than the screen!) * Glyph width already includes spacing; don't add 1 additional px * When starting a new line, include wrapped glyph width in new line_width. * Call canvas_set_font before text_box_insert_endline so that glyph width is calculated using correct font. Previous approach worked somewhat well using default TextBoxFontText but this version is more robust, particularly when using TextBoxFontHex. * Add basic Mifare DESFire reading, file/app browser * Fix build with APP_ARCHIVE=0 * Add bool type to flipper_format * Add ability to save and load DESFire card data * Skip over NfcSceneDeviceInfo when viewing saved DESFire info * mf_df_clear: don't leak master key settings key versions * When opening a DESFire card from Archive, retain UID emulation behavior * rm unnecessary \r\n * show Popup instead of leaving view in bad state * Move NfcReaderRequestData out of union This makes it safe to emulate DESFire/EMV without clobbering card data. * Display saved DESFire cards via NfcSceneDeviceInfo * Display and save file metadata even when contents are missing This can happen when a file doesn't allow unauthenticated reads (see the call to mf_df_parse_read_data_response in nfc_worker.c). Co-authored-by: Kevin Wallace <git+flipperzero@kevin.wallace.seattle.wa.us> Co-authored-by: あく <alleteam@gmail.com> Co-authored-by: gornekich <n.gorbadey@gmail.com>
This commit is contained in:
396
applications/nfc/nfc_device.c
Executable file → Normal file
396
applications/nfc/nfc_device.c
Executable file → Normal file
@@ -16,6 +16,7 @@ NfcDevice* nfc_device_alloc() {
|
||||
|
||||
void nfc_device_free(NfcDevice* nfc_dev) {
|
||||
furi_assert(nfc_dev);
|
||||
nfc_device_clear(nfc_dev);
|
||||
furi_record_close("storage");
|
||||
furi_record_close("dialogs");
|
||||
free(nfc_dev);
|
||||
@@ -28,6 +29,8 @@ void nfc_device_prepare_format_string(NfcDevice* dev, string_t format_string) {
|
||||
string_set_str(format_string, "Bank card");
|
||||
} else if(dev->format == NfcDeviceSaveFormatMifareUl) {
|
||||
string_set_str(format_string, nfc_mf_ul_type(dev->dev_data.mf_ul_data.type, true));
|
||||
} else if(dev->format == NfcDeviceSaveFormatMifareDesfire) {
|
||||
string_set_str(format_string, "Mifare DESFire");
|
||||
} else {
|
||||
string_set_str(format_string, "Unknown");
|
||||
}
|
||||
@@ -53,6 +56,11 @@ bool nfc_device_parse_format_string(NfcDevice* dev, string_t format_string) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(string_start_with_str_p(format_string, "Mifare DESFire")) {
|
||||
dev->format = NfcDeviceSaveFormatMifareDesfire;
|
||||
dev->dev_data.nfc_data.protocol = NfcDeviceProtocolMifareDesfire;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -154,6 +162,383 @@ bool nfc_device_load_mifare_ul_data(FlipperFormat* file, NfcDevice* dev) {
|
||||
return parsed;
|
||||
}
|
||||
|
||||
static bool nfc_device_save_mifare_df_key_settings(
|
||||
FlipperFormat* file,
|
||||
MifareDesfireKeySettings* ks,
|
||||
const char* prefix) {
|
||||
bool saved = false;
|
||||
string_t key;
|
||||
string_init(key);
|
||||
|
||||
do {
|
||||
string_printf(key, "%s Change Key ID", prefix);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), &ks->change_key_id, 1)) break;
|
||||
string_printf(key, "%s Config Changeable", prefix);
|
||||
if(!flipper_format_write_bool(file, string_get_cstr(key), &ks->config_changeable, 1))
|
||||
break;
|
||||
string_printf(key, "%s Free Create Delete", prefix);
|
||||
if(!flipper_format_write_bool(file, string_get_cstr(key), &ks->free_create_delete, 1))
|
||||
break;
|
||||
string_printf(key, "%s Free Directory List", prefix);
|
||||
if(!flipper_format_write_bool(file, string_get_cstr(key), &ks->free_directory_list, 1))
|
||||
break;
|
||||
string_printf(key, "%s Key Changeable", prefix);
|
||||
if(!flipper_format_write_bool(file, string_get_cstr(key), &ks->master_key_changeable, 1))
|
||||
break;
|
||||
string_printf(key, "%s Max Keys", prefix);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), &ks->max_keys, 1)) break;
|
||||
for(MifareDesfireKeyVersion* kv = ks->key_version_head; kv; kv = kv->next) {
|
||||
string_printf(key, "%s Key %d Version", prefix, kv->id);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), &kv->version, 1)) break;
|
||||
}
|
||||
saved = true;
|
||||
} while(false);
|
||||
|
||||
string_clear(key);
|
||||
return saved;
|
||||
}
|
||||
|
||||
bool nfc_device_load_mifare_df_key_settings(
|
||||
FlipperFormat* file,
|
||||
MifareDesfireKeySettings* ks,
|
||||
const char* prefix) {
|
||||
bool parsed = false;
|
||||
string_t key;
|
||||
string_init(key);
|
||||
|
||||
do {
|
||||
string_printf(key, "%s Change Key ID", prefix);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), &ks->change_key_id, 1)) break;
|
||||
string_printf(key, "%s Config Changeable", prefix);
|
||||
if(!flipper_format_read_bool(file, string_get_cstr(key), &ks->config_changeable, 1)) break;
|
||||
string_printf(key, "%s Free Create Delete", prefix);
|
||||
if(!flipper_format_read_bool(file, string_get_cstr(key), &ks->free_create_delete, 1))
|
||||
break;
|
||||
string_printf(key, "%s Free Directory List", prefix);
|
||||
if(!flipper_format_read_bool(file, string_get_cstr(key), &ks->free_directory_list, 1))
|
||||
break;
|
||||
string_printf(key, "%s Key Changeable", prefix);
|
||||
if(!flipper_format_read_bool(file, string_get_cstr(key), &ks->master_key_changeable, 1))
|
||||
break;
|
||||
string_printf(key, "%s Max Keys", prefix);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), &ks->max_keys, 1)) break;
|
||||
MifareDesfireKeyVersion** kv_head = &ks->key_version_head;
|
||||
for(int key_id = 0; key_id < ks->max_keys; key_id++) {
|
||||
string_printf(key, "%s Key %d Version", prefix, key_id);
|
||||
uint8_t version;
|
||||
if(flipper_format_read_hex(file, string_get_cstr(key), &version, 1)) {
|
||||
MifareDesfireKeyVersion* kv = malloc(sizeof(MifareDesfireKeyVersion));
|
||||
memset(kv, 0, sizeof(MifareDesfireKeyVersion));
|
||||
kv->id = key_id;
|
||||
kv->version = version;
|
||||
*kv_head = kv;
|
||||
kv_head = &kv->next;
|
||||
}
|
||||
}
|
||||
parsed = true;
|
||||
} while(false);
|
||||
|
||||
string_clear(key);
|
||||
return parsed;
|
||||
}
|
||||
|
||||
static bool nfc_device_save_mifare_df_app(FlipperFormat* file, MifareDesfireApplication* app) {
|
||||
bool saved = false;
|
||||
string_t prefix, key;
|
||||
string_init_printf(prefix, "Application %02x%02x%02x", app->id[0], app->id[1], app->id[2]);
|
||||
string_init(key);
|
||||
uint8_t* tmp = NULL;
|
||||
|
||||
do {
|
||||
if(app->key_settings) {
|
||||
if(!nfc_device_save_mifare_df_key_settings(
|
||||
file, app->key_settings, string_get_cstr(prefix)))
|
||||
break;
|
||||
}
|
||||
uint32_t n_files = 0;
|
||||
for(MifareDesfireFile* f = app->file_head; f; f = f->next) {
|
||||
n_files++;
|
||||
}
|
||||
tmp = malloc(n_files);
|
||||
int i = 0;
|
||||
for(MifareDesfireFile* f = app->file_head; f; f = f->next) {
|
||||
tmp[i++] = f->id;
|
||||
}
|
||||
string_printf(key, "%s File IDs", string_get_cstr(prefix));
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), tmp, n_files)) break;
|
||||
bool saved_files = true;
|
||||
for(MifareDesfireFile* f = app->file_head; f; f = f->next) {
|
||||
saved_files = false;
|
||||
string_printf(key, "%s File %d Type", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), &f->type, 1)) break;
|
||||
string_printf(
|
||||
key, "%s File %d Communication Settings", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), &f->comm, 1)) break;
|
||||
string_printf(key, "%s File %d Access Rights", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_hex(
|
||||
file, string_get_cstr(key), (uint8_t*)&f->access_rights, 2))
|
||||
break;
|
||||
uint16_t size = 0;
|
||||
if(f->type == MifareDesfireFileTypeStandard ||
|
||||
f->type == MifareDesfireFileTypeBackup) {
|
||||
size = f->settings.data.size;
|
||||
string_printf(key, "%s File %d Size", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.data.size, 1))
|
||||
break;
|
||||
} else if(f->type == MifareDesfireFileTypeValue) {
|
||||
string_printf(key, "%s File %d Hi Limit", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.hi_limit, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Lo Limit", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.lo_limit, 1))
|
||||
break;
|
||||
string_printf(
|
||||
key, "%s File %d Limited Credit Value", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.limited_credit_value, 1))
|
||||
break;
|
||||
string_printf(
|
||||
key, "%s File %d Limited Credit Enabled", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_bool(
|
||||
file, string_get_cstr(key), &f->settings.value.limited_credit_enabled, 1))
|
||||
break;
|
||||
size = 4;
|
||||
} else if(
|
||||
f->type == MifareDesfireFileTypeLinearRecord ||
|
||||
f->type == MifareDesfireFileTypeCyclicRecord) {
|
||||
string_printf(key, "%s File %d Size", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.size, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Max", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.max, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Cur", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.cur, 1))
|
||||
break;
|
||||
size = f->settings.record.size * f->settings.record.cur;
|
||||
}
|
||||
if(f->contents) {
|
||||
string_printf(key, "%s File %d", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_write_hex(file, string_get_cstr(key), f->contents, size)) break;
|
||||
}
|
||||
saved_files = true;
|
||||
}
|
||||
if(!saved_files) {
|
||||
break;
|
||||
}
|
||||
saved = true;
|
||||
} while(false);
|
||||
|
||||
free(tmp);
|
||||
string_clear(prefix);
|
||||
string_clear(key);
|
||||
return saved;
|
||||
}
|
||||
|
||||
bool nfc_device_load_mifare_df_app(FlipperFormat* file, MifareDesfireApplication* app) {
|
||||
bool parsed = false;
|
||||
string_t prefix, key;
|
||||
string_init_printf(prefix, "Application %02x%02x%02x", app->id[0], app->id[1], app->id[2]);
|
||||
string_init(key);
|
||||
uint8_t* tmp = NULL;
|
||||
MifareDesfireFile* f = NULL;
|
||||
|
||||
do {
|
||||
app->key_settings = malloc(sizeof(MifareDesfireKeySettings));
|
||||
memset(app->key_settings, 0, sizeof(MifareDesfireKeySettings));
|
||||
if(!nfc_device_load_mifare_df_key_settings(
|
||||
file, app->key_settings, string_get_cstr(prefix))) {
|
||||
free(app->key_settings);
|
||||
app->key_settings = NULL;
|
||||
break;
|
||||
}
|
||||
string_printf(key, "%s File IDs", string_get_cstr(prefix));
|
||||
uint32_t n_files;
|
||||
if(!flipper_format_get_value_count(file, string_get_cstr(key), &n_files)) break;
|
||||
tmp = malloc(n_files);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), tmp, n_files)) break;
|
||||
MifareDesfireFile** file_head = &app->file_head;
|
||||
bool parsed_files = true;
|
||||
for(int i = 0; i < n_files; i++) {
|
||||
parsed_files = false;
|
||||
f = malloc(sizeof(MifareDesfireFile));
|
||||
memset(f, 0, sizeof(MifareDesfireFile));
|
||||
f->id = tmp[i];
|
||||
string_printf(key, "%s File %d Type", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), &f->type, 1)) break;
|
||||
string_printf(
|
||||
key, "%s File %d Communication Settings", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), &f->comm, 1)) break;
|
||||
string_printf(key, "%s File %d Access Rights", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), (uint8_t*)&f->access_rights, 2))
|
||||
break;
|
||||
if(f->type == MifareDesfireFileTypeStandard ||
|
||||
f->type == MifareDesfireFileTypeBackup) {
|
||||
string_printf(key, "%s File %d Size", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.data.size, 1))
|
||||
break;
|
||||
} else if(f->type == MifareDesfireFileTypeValue) {
|
||||
string_printf(key, "%s File %d Hi Limit", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.hi_limit, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Lo Limit", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.lo_limit, 1))
|
||||
break;
|
||||
string_printf(
|
||||
key, "%s File %d Limited Credit Value", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.value.limited_credit_value, 1))
|
||||
break;
|
||||
string_printf(
|
||||
key, "%s File %d Limited Credit Enabled", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_bool(
|
||||
file, string_get_cstr(key), &f->settings.value.limited_credit_enabled, 1))
|
||||
break;
|
||||
} else if(
|
||||
f->type == MifareDesfireFileTypeLinearRecord ||
|
||||
f->type == MifareDesfireFileTypeCyclicRecord) {
|
||||
string_printf(key, "%s File %d Size", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.size, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Max", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.max, 1))
|
||||
break;
|
||||
string_printf(key, "%s File %d Cur", string_get_cstr(prefix), f->id);
|
||||
if(!flipper_format_read_uint32(
|
||||
file, string_get_cstr(key), &f->settings.record.cur, 1))
|
||||
break;
|
||||
}
|
||||
string_printf(key, "%s File %d", string_get_cstr(prefix), f->id);
|
||||
if(flipper_format_key_exist(file, string_get_cstr(key))) {
|
||||
uint32_t size;
|
||||
if(!flipper_format_get_value_count(file, string_get_cstr(key), &size)) break;
|
||||
f->contents = malloc(size);
|
||||
if(!flipper_format_read_hex(file, string_get_cstr(key), f->contents, size)) break;
|
||||
}
|
||||
*file_head = f;
|
||||
file_head = &f->next;
|
||||
f = NULL;
|
||||
parsed_files = true;
|
||||
}
|
||||
if(!parsed_files) {
|
||||
break;
|
||||
}
|
||||
parsed = true;
|
||||
} while(false);
|
||||
|
||||
if(f) {
|
||||
free(f->contents);
|
||||
free(f);
|
||||
}
|
||||
free(tmp);
|
||||
string_clear(prefix);
|
||||
string_clear(key);
|
||||
return parsed;
|
||||
}
|
||||
|
||||
static bool nfc_device_save_mifare_df_data(FlipperFormat* file, NfcDevice* dev) {
|
||||
bool saved = false;
|
||||
MifareDesfireData* data = &dev->dev_data.mf_df_data;
|
||||
uint8_t* tmp = NULL;
|
||||
|
||||
do {
|
||||
if(!flipper_format_write_comment_cstr(file, "Mifare DESFire specific data")) break;
|
||||
if(!flipper_format_write_hex(
|
||||
file, "PICC Version", (uint8_t*)&data->version, sizeof(data->version)))
|
||||
break;
|
||||
if(data->free_memory) {
|
||||
if(!flipper_format_write_uint32(file, "PICC Free Memory", &data->free_memory->bytes, 1))
|
||||
break;
|
||||
}
|
||||
if(data->master_key_settings) {
|
||||
if(!nfc_device_save_mifare_df_key_settings(file, data->master_key_settings, "PICC"))
|
||||
break;
|
||||
}
|
||||
uint32_t n_apps = 0;
|
||||
for(MifareDesfireApplication* app = data->app_head; app; app = app->next) {
|
||||
n_apps++;
|
||||
}
|
||||
if(!flipper_format_write_uint32(file, "Application Count", &n_apps, 1)) break;
|
||||
tmp = malloc(n_apps * 3);
|
||||
int i = 0;
|
||||
for(MifareDesfireApplication* app = data->app_head; app; app = app->next) {
|
||||
memcpy(tmp + i, app->id, 3);
|
||||
i += 3;
|
||||
}
|
||||
if(!flipper_format_write_hex(file, "Application IDs", tmp, n_apps * 3)) break;
|
||||
for(MifareDesfireApplication* app = data->app_head; app; app = app->next) {
|
||||
if(!nfc_device_save_mifare_df_app(file, app)) break;
|
||||
}
|
||||
saved = true;
|
||||
} while(false);
|
||||
|
||||
free(tmp);
|
||||
return saved;
|
||||
}
|
||||
|
||||
bool nfc_device_load_mifare_df_data(FlipperFormat* file, NfcDevice* dev) {
|
||||
bool parsed = false;
|
||||
MifareDesfireData* data = &dev->dev_data.mf_df_data;
|
||||
memset(data, 0, sizeof(MifareDesfireData));
|
||||
uint8_t* tmp = NULL;
|
||||
|
||||
do {
|
||||
if(!flipper_format_read_hex(
|
||||
file, "PICC Version", (uint8_t*)&data->version, sizeof(data->version)))
|
||||
break;
|
||||
if(flipper_format_key_exist(file, "PICC Free Memory")) {
|
||||
data->free_memory = malloc(sizeof(MifareDesfireFreeMemory));
|
||||
memset(data->free_memory, 0, sizeof(MifareDesfireFreeMemory));
|
||||
if(!flipper_format_read_uint32(
|
||||
file, "PICC Free Memory", &data->free_memory->bytes, 1)) {
|
||||
free(data->free_memory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
data->master_key_settings = malloc(sizeof(MifareDesfireKeySettings));
|
||||
memset(data->master_key_settings, 0, sizeof(MifareDesfireKeySettings));
|
||||
if(!nfc_device_load_mifare_df_key_settings(file, data->master_key_settings, "PICC")) {
|
||||
free(data->master_key_settings);
|
||||
data->master_key_settings = NULL;
|
||||
break;
|
||||
}
|
||||
uint32_t n_apps;
|
||||
if(!flipper_format_read_uint32(file, "Application Count", &n_apps, 1)) break;
|
||||
tmp = malloc(n_apps * 3);
|
||||
if(!flipper_format_read_hex(file, "Application IDs", tmp, n_apps * 3)) break;
|
||||
bool parsed_apps = true;
|
||||
MifareDesfireApplication** app_head = &data->app_head;
|
||||
for(int i = 0; i < n_apps; i++) {
|
||||
MifareDesfireApplication* app = malloc(sizeof(MifareDesfireApplication));
|
||||
memset(app, 0, sizeof(MifareDesfireApplication));
|
||||
memcpy(app->id, &tmp[i * 3], 3);
|
||||
if(!nfc_device_load_mifare_df_app(file, app)) {
|
||||
free(app);
|
||||
parsed_apps = false;
|
||||
break;
|
||||
}
|
||||
*app_head = app;
|
||||
app_head = &app->next;
|
||||
}
|
||||
if(!parsed_apps) break;
|
||||
parsed = true;
|
||||
} while(false);
|
||||
|
||||
free(tmp);
|
||||
return parsed;
|
||||
}
|
||||
|
||||
static bool nfc_device_save_bank_card_data(FlipperFormat* file, NfcDevice* dev) {
|
||||
bool saved = false;
|
||||
NfcEmvData* data = &dev->dev_data.emv_data;
|
||||
@@ -263,6 +648,8 @@ static bool nfc_device_save_file(
|
||||
// Save more data if necessary
|
||||
if(dev->format == NfcDeviceSaveFormatMifareUl) {
|
||||
if(!nfc_device_save_mifare_ul_data(file, dev)) break;
|
||||
} else if(dev->format == NfcDeviceSaveFormatMifareDesfire) {
|
||||
if(!nfc_device_save_mifare_df_data(file, dev)) break;
|
||||
} else if(dev->format == NfcDeviceSaveFormatBankCard) {
|
||||
if(!nfc_device_save_bank_card_data(file, dev)) break;
|
||||
}
|
||||
@@ -327,6 +714,8 @@ static bool nfc_device_load_data(NfcDevice* dev, string_t path) {
|
||||
// Parse other data
|
||||
if(dev->format == NfcDeviceSaveFormatMifareUl) {
|
||||
if(!nfc_device_load_mifare_ul_data(file, dev)) break;
|
||||
} else if(dev->format == NfcDeviceSaveFormatMifareDesfire) {
|
||||
if(!nfc_device_load_mifare_df_data(file, dev)) break;
|
||||
} else if(dev->format == NfcDeviceSaveFormatBankCard) {
|
||||
if(!nfc_device_load_bank_card_data(file, dev)) break;
|
||||
}
|
||||
@@ -389,9 +778,16 @@ bool nfc_file_select(NfcDevice* dev) {
|
||||
return res;
|
||||
}
|
||||
|
||||
void nfc_device_data_clear(NfcDeviceData* dev_data) {
|
||||
if(dev_data->nfc_data.protocol == NfcDeviceProtocolMifareDesfire) {
|
||||
mf_df_clear(&dev_data->mf_df_data);
|
||||
}
|
||||
}
|
||||
|
||||
void nfc_device_clear(NfcDevice* dev) {
|
||||
furi_assert(dev);
|
||||
|
||||
nfc_device_data_clear(&dev->dev_data);
|
||||
memset(&dev->dev_data, 0, sizeof(dev->dev_data));
|
||||
dev->format = NfcDeviceSaveFormatUid;
|
||||
}
|
||||
|
Reference in New Issue
Block a user