Skip to content

Commit

Permalink
return missing part
Browse files Browse the repository at this point in the history
  • Loading branch information
xMasterX committed Apr 5, 2024
1 parent f746977 commit 3348951
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions base_pack/nfc_magic/magic/protocols/gen4/gen4_poller.c
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,45 @@ static NfcCommand gen4_poller_write_mf_ultralight(Gen4Poller* instance) {
break;
}

// Password
MfUltralightConfigPages* config_pages = NULL;
mf_ultralight_get_config_page(mfu_data, &config_pages);

block[0] = config_pages->password.data[0];
block[1] = config_pages->password.data[1];
block[2] = config_pages->password.data[2];
block[3] = config_pages->password.data[3];
error = gen4_poller_write_block(instance, instance->password, 0xE5, block);
if(error != Gen4PollerErrorNone) {
FURI_LOG_E(TAG, "Failed to write Password to sector E5");
instance->state = Gen4PollerStateFail;
break;
}
error = gen4_poller_write_block(instance, instance->password, 0xF0, block);
if(error != Gen4PollerErrorNone) {
FURI_LOG_E(TAG, "Failed to write Password to sector F0");
instance->state = Gen4PollerStateFail;
break;
}

// PACK
block[0] = config_pages->pack.data[0];
block[1] = config_pages->pack.data[1];
block[2] = 0x00;
block[3] = 0x00;
error = gen4_poller_write_block(instance, instance->password, 0xE6, block);
if(error != Gen4PollerErrorNone) {
FURI_LOG_E(TAG, "Failed to write PACK to sector E6");
instance->state = Gen4PollerStateFail;
break;
}
error = gen4_poller_write_block(instance, instance->password, 0xF1, block);
if(error != Gen4PollerErrorNone) {
FURI_LOG_E(TAG, "Failed to write PACK to sector F1");
instance->state = Gen4PollerStateFail;
break;
}

instance->state = Gen4PollerStateSuccess;
}
} while(false);
Expand Down

0 comments on commit 3348951

Please sign in to comment.