mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-01 04:29:59 -07:00
NFC: T4T interact with DESFire without state reset
This commit is contained in:
@@ -75,9 +75,7 @@ static NfcCommand type_4_tag_poller_handler_detect_platform(Type4TagPoller* inst
|
||||
}
|
||||
instance->state = Type4TagPollerStateSelectApplication;
|
||||
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
return NfcCommandContinue;
|
||||
}
|
||||
|
||||
static NfcCommand type_4_tag_poller_handler_select_app(Type4TagPoller* instance) {
|
||||
@@ -90,9 +88,6 @@ static NfcCommand type_4_tag_poller_handler_select_app(Type4TagPoller* instance)
|
||||
if(instance->mode == Type4TagPollerModeWrite &&
|
||||
instance->error == Type4TagErrorCardUnformatted) {
|
||||
instance->state = Type4TagPollerStateCreateApplication;
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
} else {
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
}
|
||||
@@ -113,9 +108,6 @@ static NfcCommand type_4_tag_poller_handler_read_cc(Type4TagPoller* instance) {
|
||||
if(instance->mode == Type4TagPollerModeWrite &&
|
||||
instance->error == Type4TagErrorCardUnformatted) {
|
||||
instance->state = Type4TagPollerStateCreateCapabilityContainer;
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
} else {
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
}
|
||||
@@ -141,10 +133,7 @@ static NfcCommand type_4_tag_poller_handler_create_app(Type4TagPoller* instance)
|
||||
instance->error = type_4_tag_poller_create_app(instance);
|
||||
if(instance->error == Type4TagErrorNone) {
|
||||
FURI_LOG_D(TAG, "Create application success");
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
instance->state = Type4TagPollerStateSelectApplication;
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to create application");
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
@@ -157,10 +146,7 @@ static NfcCommand type_4_tag_poller_handler_create_cc(Type4TagPoller* instance)
|
||||
instance->error = type_4_tag_poller_create_cc(instance);
|
||||
if(instance->error == Type4TagErrorNone) {
|
||||
FURI_LOG_D(TAG, "Create CC success");
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
instance->state = Type4TagPollerStateSelectApplication;
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
instance->state = Type4TagPollerStateReadCapabilityContainer;
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to create CC");
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
@@ -173,10 +159,7 @@ static NfcCommand type_4_tag_poller_handler_create_ndef(Type4TagPoller* instance
|
||||
instance->error = type_4_tag_poller_create_ndef(instance);
|
||||
if(instance->error == Type4TagErrorNone) {
|
||||
FURI_LOG_D(TAG, "Create NDEF success");
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
instance->state = Type4TagPollerStateSelectApplication;
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
instance->state = Type4TagPollerStateWriteNdefMessage;
|
||||
} else {
|
||||
FURI_LOG_E(TAG, "Failed to create NDEF");
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
@@ -195,9 +178,6 @@ static NfcCommand type_4_tag_poller_handler_write_ndef(Type4TagPoller* instance)
|
||||
if(instance->mode == Type4TagPollerModeWrite &&
|
||||
instance->error == Type4TagErrorCardUnformatted) {
|
||||
instance->state = Type4TagPollerStateCreateNdefMessage;
|
||||
// Reset card state so platform-specific commands do not interfere
|
||||
iso14443_4a_poller_halt(instance->iso14443_4a_poller);
|
||||
return NfcCommandReset;
|
||||
} else {
|
||||
instance->state = Type4TagPollerStateFailed;
|
||||
}
|
||||
|
||||
@@ -201,6 +201,7 @@ Type4TagError type_4_tag_poller_detect_platform(Type4TagPoller* instance) {
|
||||
do {
|
||||
FURI_LOG_D(TAG, "Detect DESFire");
|
||||
MfDesfirePoller* mf_des = mf_desfire_poller.alloc(instance->iso14443_4a_poller);
|
||||
mf_desfire_poller_set_command_mode(mf_des, MfDesfirePollerCommandModeIsoWrapped);
|
||||
if(mf_desfire_poller.detect(event, mf_des)) {
|
||||
platform = Type4TagPlatformMfDesfire;
|
||||
nfc_device_set_data(device, NfcProtocolMfDesfire, mf_desfire_poller.get_data(mf_des));
|
||||
@@ -308,6 +309,7 @@ Type4TagError type_4_tag_poller_create_app(Type4TagPoller* instance) {
|
||||
|
||||
if(instance->data->platform == Type4TagPlatformMfDesfire) {
|
||||
MfDesfirePoller* mf_des = mf_desfire_poller.alloc(instance->iso14443_4a_poller);
|
||||
mf_desfire_poller_set_command_mode(mf_des, MfDesfirePollerCommandModeIsoWrapped);
|
||||
MfDesfireError mf_des_error;
|
||||
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user