Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FL-3811] Write to ultralight cards is now possible #3684

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ static void nfc_scene_read_and_saved_menu_on_enter_mf_ultralight(NfcApp* instanc
instance);
} else if(
data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 ||
data->type == MfUltralightTypeNTAG216) {
data->type == MfUltralightTypeNTAG216 || data->type == MfUltralightTypeUL11 ||
data->type == MfUltralightTypeUL21) {
submenu_add_item(
submenu,
"Write",
Expand Down
16 changes: 16 additions & 0 deletions lib/nfc/protocols/mf_ultralight/mf_ultralight.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,22 @@ uint16_t mf_ultralight_get_config_page_num(MfUltralightType type) {
return mf_ultralight_features[type].config_page;
}

uint8_t mf_ultralight_get_write_end_page(MfUltralightType type) {
furi_check(type < MfUltralightTypeNum);
furi_assert(
type == MfUltralightTypeUL11 || type == MfUltralightTypeUL21 ||
type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
type == MfUltralightTypeNTAG216);

uint8_t end_page = mf_ultralight_get_config_page_num(type);
if(type == MfUltralightTypeNTAG213 || type == MfUltralightTypeNTAG215 ||
type == MfUltralightTypeNTAG216) {
end_page -= 1;
}

return end_page;
}

uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) {
furi_check(type < MfUltralightTypeNum);

Expand Down
2 changes: 2 additions & 0 deletions lib/nfc/protocols/mf_ultralight/mf_ultralight.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ uint32_t mf_ultralight_get_feature_support_set(MfUltralightType type);

uint16_t mf_ultralight_get_config_page_num(MfUltralightType type);

uint8_t mf_ultralight_get_write_end_page(MfUltralightType type);

uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type);

bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page_num);
Expand Down
2 changes: 1 addition & 1 deletion lib/nfc/protocols/mf_ultralight/mf_ultralight_poller.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ static NfcCommand mf_ultralight_poller_handler_write_pages(MfUltralightPoller* i

do {
const MfUltralightData* write_data = instance->mfu_event.data->write_data;
uint8_t end_page = mf_ultralight_get_config_page_num(write_data->type) - 1;
uint8_t end_page = mf_ultralight_get_write_end_page(write_data->type);
if(instance->current_page == end_page) {
instance->state = MfUltralightPollerStateWriteSuccess;
break;
Expand Down
2 changes: 1 addition & 1 deletion targets/f18/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,64.0,,
Version,+,64.1,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
Header,+,applications/services/cli/cli.h,,
Expand Down
3 changes: 2 additions & 1 deletion targets/f7/api_symbols.csv
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,64.0,,
Version,+,64.1,,
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,,
Expand Down Expand Up @@ -2533,6 +2533,7 @@ Function,+,mf_ultralight_get_pages_total,uint16_t,MfUltralightType
Function,+,mf_ultralight_get_pwd_page_num,uint8_t,MfUltralightType
Function,+,mf_ultralight_get_type_by_version,MfUltralightType,MfUltralightVersion*
Function,+,mf_ultralight_get_uid,const uint8_t*,"const MfUltralightData*, size_t*"
Function,+,mf_ultralight_get_write_end_page,uint8_t,MfUltralightType
Function,+,mf_ultralight_is_all_data_read,_Bool,const MfUltralightData*
Function,+,mf_ultralight_is_counter_configured,_Bool,const MfUltralightData*
Function,+,mf_ultralight_is_equal,_Bool,"const MfUltralightData*, const MfUltralightData*"
Expand Down