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

* Added new function which returns end block for write operation
* Enabled write menu item also for Ultralight 11 and 21
* Fix api_symbols.csv for f18
* Bump Api Symbols

Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
RebornedBrain 2024-06-08 16:38:02 +03:00 committed by GitHub
parent 2f9ca172e3
commit ba3beeddeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 24 additions and 4 deletions

View file

@ -191,7 +191,8 @@ static void nfc_scene_read_and_saved_menu_on_enter_mf_ultralight(NfcApp* instanc
instance); instance);
} else if( } else if(
data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 || data->type == MfUltralightTypeNTAG213 || data->type == MfUltralightTypeNTAG215 ||
data->type == MfUltralightTypeNTAG216) { data->type == MfUltralightTypeNTAG216 || data->type == MfUltralightTypeUL11 ||
data->type == MfUltralightTypeUL21) {
submenu_add_item( submenu_add_item(
submenu, submenu,
"Write", "Write",

View file

@ -570,6 +570,22 @@ uint16_t mf_ultralight_get_config_page_num(MfUltralightType type) {
return mf_ultralight_features[type].config_page; 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) { uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type) {
furi_check(type < MfUltralightTypeNum); furi_check(type < MfUltralightTypeNum);

View file

@ -210,6 +210,8 @@ uint32_t mf_ultralight_get_feature_support_set(MfUltralightType type);
uint16_t mf_ultralight_get_config_page_num(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); uint8_t mf_ultralight_get_pwd_page_num(MfUltralightType type);
bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page_num); bool mf_ultralight_is_page_pwd_or_pack(MfUltralightType type, uint16_t page_num);

View file

@ -616,7 +616,7 @@ static NfcCommand mf_ultralight_poller_handler_write_pages(MfUltralightPoller* i
do { do {
const MfUltralightData* write_data = instance->mfu_event.data->write_data; 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) { if(instance->current_page == end_page) {
instance->state = MfUltralightPollerStateWriteSuccess; instance->state = MfUltralightPollerStateWriteSuccess;
break; break;

View file

@ -1,5 +1,5 @@
entry,status,name,type,params 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.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,, Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli.h,,

1 entry status name type params
2 Version + 64.0 64.1
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/bt/bt_service/bt_keys_storage.h
5 Header + applications/services/cli/cli.h

View file

@ -1,5 +1,5 @@
entry,status,name,type,params entry,status,name,type,params
Version,+,64.0,, Version,+,64.1,,
Header,+,applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h,, 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.h,,
Header,+,applications/services/bt/bt_service/bt_keys_storage.h,, Header,+,applications/services/bt/bt_service/bt_keys_storage.h,,
@ -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_pwd_page_num,uint8_t,MfUltralightType
Function,+,mf_ultralight_get_type_by_version,MfUltralightType,MfUltralightVersion* 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_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_all_data_read,_Bool,const MfUltralightData*
Function,+,mf_ultralight_is_counter_configured,_Bool,const MfUltralightData* Function,+,mf_ultralight_is_counter_configured,_Bool,const MfUltralightData*
Function,+,mf_ultralight_is_equal,_Bool,"const MfUltralightData*, const MfUltralightData*" Function,+,mf_ultralight_is_equal,_Bool,"const MfUltralightData*, const MfUltralightData*"

1 entry status name type params
2 Version + 64.0 64.1
3 Header + applications/drivers/subghz/cc1101_ext/cc1101_ext_interconnect.h
4 Header + applications/services/bt/bt_service/bt.h
5 Header + applications/services/bt/bt_service/bt_keys_storage.h
2533 Function + mf_ultralight_get_pwd_page_num uint8_t MfUltralightType
2534 Function + mf_ultralight_get_type_by_version MfUltralightType MfUltralightVersion*
2535 Function + mf_ultralight_get_uid const uint8_t* const MfUltralightData*, size_t*
2536 Function + mf_ultralight_get_write_end_page uint8_t MfUltralightType
2537 Function + mf_ultralight_is_all_data_read _Bool const MfUltralightData*
2538 Function + mf_ultralight_is_counter_configured _Bool const MfUltralightData*
2539 Function + mf_ultralight_is_equal _Bool const MfUltralightData*, const MfUltralightData*