mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
[FL-3857] NFC Ultralight Original write support (#3718)
* mf ultralight: rename ultralight unknown to origin * nfc app: add write to origin support for origin ultralights * mf ultralight: add orig write support on lib level * targets: bump major API version
This commit is contained in:
parent
039faf02f1
commit
729db7fa98
7 changed files with 18 additions and 19 deletions
|
@ -192,7 +192,7 @@ static void nfc_scene_read_and_saved_menu_on_enter_mf_ultralight(NfcApp* instanc
|
|||
} else if(
|
||||
data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 ||
|
||||
data->type == MfUltralightTypeNTAG216 || data->type == MfUltralightTypeUL11 ||
|
||||
data->type == MfUltralightTypeUL21) {
|
||||
data->type == MfUltralightTypeUL21 || data->type == MfUltralightTypeOrigin) {
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Write",
|
||||
|
|
|
@ -49,7 +49,7 @@ static void nfc_generate_mf_ul_orig(NfcDevice* nfc_device) {
|
|||
MfUltralightData* mfu_data = mf_ultralight_alloc();
|
||||
nfc_generate_mf_ul_common(mfu_data);
|
||||
|
||||
mfu_data->type = MfUltralightTypeUnknown;
|
||||
mfu_data->type = MfUltralightTypeOrigin;
|
||||
mfu_data->pages_total = 16;
|
||||
mfu_data->pages_read = 16;
|
||||
memset(&mfu_data->page[4], 0xff, sizeof(MfUltralightPage));
|
||||
|
|
|
@ -26,7 +26,7 @@ typedef struct {
|
|||
static const uint32_t mf_ultralight_data_format_version = 2;
|
||||
|
||||
static const MfUltralightFeatures mf_ultralight_features[MfUltralightTypeNum] = {
|
||||
[MfUltralightTypeUnknown] =
|
||||
[MfUltralightTypeOrigin] =
|
||||
{
|
||||
.device_name = "Mifare Ultralight",
|
||||
.total_pages = 16,
|
||||
|
@ -215,7 +215,7 @@ static const char*
|
|||
mf_ultralight_get_device_name_by_type(MfUltralightType type, NfcDeviceNameType name_type) {
|
||||
if(name_type == NfcDeviceNameTypeShort &&
|
||||
(type == MfUltralightTypeUL11 || type == MfUltralightTypeUL21)) {
|
||||
type = MfUltralightTypeUnknown;
|
||||
type = MfUltralightTypeOrigin;
|
||||
}
|
||||
|
||||
return mf_ultralight_features[type].device_name;
|
||||
|
@ -512,7 +512,7 @@ Iso14443_3aData* mf_ultralight_get_base_data(const MfUltralightData* data) {
|
|||
MfUltralightType mf_ultralight_get_type_by_version(MfUltralightVersion* version) {
|
||||
furi_check(version);
|
||||
|
||||
MfUltralightType type = MfUltralightTypeUnknown;
|
||||
MfUltralightType type = MfUltralightTypeOrigin;
|
||||
|
||||
if(version->storage_size == 0x0B || version->storage_size == 0x00) {
|
||||
type = MfUltralightTypeUL11;
|
||||
|
@ -575,12 +575,14 @@ uint8_t mf_ultralight_get_write_end_page(MfUltralightType type) {
|
|||
furi_assert(
|
||||
type == MfUltralightTypeUL11 || type == MfUltralightTypeUL21 ||
|
||||
type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
|
||||
type == MfUltralightTypeNTAG216);
|
||||
type == MfUltralightTypeNTAG216 || type == MfUltralightTypeOrigin);
|
||||
|
||||
uint8_t end_page = mf_ultralight_get_config_page_num(type);
|
||||
if(type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
|
||||
type == MfUltralightTypeNTAG216) {
|
||||
end_page -= 1;
|
||||
} else if(type == MfUltralightTypeOrigin) {
|
||||
end_page = mf_ultralight_features[type].total_pages;
|
||||
}
|
||||
|
||||
return end_page;
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef enum {
|
|||
} MfUltralightError;
|
||||
|
||||
typedef enum {
|
||||
MfUltralightTypeUnknown,
|
||||
MfUltralightTypeOrigin,
|
||||
MfUltralightTypeNTAG203,
|
||||
MfUltralightTypeMfulC,
|
||||
MfUltralightTypeUL11,
|
||||
|
|
|
@ -281,12 +281,7 @@ static NfcCommand mf_ultralight_poller_handler_check_ntag_203(MfUltralightPoller
|
|||
} else {
|
||||
FURI_LOG_D(TAG, "Original Ultralight detected");
|
||||
iso14443_3a_poller_halt(instance->iso14443_3a_poller);
|
||||
instance->data->type = MfUltralightTypeUnknown;
|
||||
if(instance->mode == MfUltralightPollerModeWrite) {
|
||||
instance->mfu_event.type = MfUltralightPollerEventTypeCardMismatch;
|
||||
instance->callback(instance->general_event, instance->context);
|
||||
next_state = MfUltralightPollerStateWriteFail;
|
||||
}
|
||||
instance->data->type = MfUltralightTypeOrigin;
|
||||
}
|
||||
instance->state = next_state;
|
||||
|
||||
|
@ -575,10 +570,12 @@ static NfcCommand mf_ultralight_poller_handler_request_write_data(MfUltralightPo
|
|||
break;
|
||||
}
|
||||
|
||||
if(!instance->auth_context.auth_success) {
|
||||
FURI_LOG_D(TAG, "Unknown password");
|
||||
instance->mfu_event.type = MfUltralightPollerEventTypeCardLocked;
|
||||
break;
|
||||
if(mf_ultralight_support_feature(features, MfUltralightFeatureSupportPasswordAuth)) {
|
||||
if(!instance->auth_context.auth_success) {
|
||||
FURI_LOG_D(TAG, "Unknown password");
|
||||
instance->mfu_event.type = MfUltralightPollerEventTypeCardLocked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const MfUltralightPage staticlock_page = tag_data->page[2];
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,65.0,,
|
||||
Version,+,66.0,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
Header,+,applications/services/cli/cli.h,,
|
||||
|
|
|
|
@ -1,5 +1,5 @@
|
|||
entry,status,name,type,params
|
||||
Version,+,65.0,,
|
||||
Version,+,66.0,,
|
||||
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt.h,,
|
||||
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
|
||||
|
|
|
Loading…
Reference in a new issue