From 379d3c2008a70239cb426a072a651c9d6ca238ea Mon Sep 17 00:00:00 2001 From: KorDen Date: Thu, 4 Jul 2024 22:42:55 +0300 Subject: [PATCH 1/6] LFRFID: add DEZ 10 display form for EM4100 --- lib/lfrfid/protocols/protocol_em4100.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/lfrfid/protocols/protocol_em4100.c b/lib/lfrfid/protocols/protocol_em4100.c index 08b4ec9e0..c6b88fff5 100644 --- a/lib/lfrfid/protocols/protocol_em4100.c +++ b/lib/lfrfid/protocols/protocol_em4100.c @@ -347,11 +347,13 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { uint8_t* data = protocol->data; furi_string_printf( result, - "FC: %03u\n" - "Card: %05hu (RF/%hhu)", + "FC: %03u Card: %05hu CL:%hhu\n" + "DEZ 10: %010lu", data[2], (uint16_t)((data[3] << 8) | (data[4])), - protocol->clock_per_bit); + protocol->clock_per_bit, + (uint32_t)((data[2] << 16) | (data[3] << 8) | (data[4])) + ); }; const ProtocolBase protocol_em4100 = { From 223de97d8c3783d6164467a47d3d936774befcaa Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 4 Jul 2024 22:51:33 +0300 Subject: [PATCH 2/6] NFC: Cache plugin name not full path, saves some RAM [ci skip] by Willy-JL --- .../main/nfc/helpers/nfc_supported_cards.c | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/applications/main/nfc/helpers/nfc_supported_cards.c b/applications/main/nfc/helpers/nfc_supported_cards.c index 1e0e7ba6b..04372e2ad 100644 --- a/applications/main/nfc/helpers/nfc_supported_cards.c +++ b/applications/main/nfc/helpers/nfc_supported_cards.c @@ -24,7 +24,7 @@ typedef enum { } NfcSupportedCardsPluginFeature; typedef struct { - FuriString* path; + FuriString* name; NfcProtocol protocol; NfcSupportedCardsPluginFeature feature; } NfcSupportedCardsPluginCache; @@ -73,7 +73,7 @@ void nfc_supported_cards_free(NfcSupportedCards* instance) { !NfcSupportedCardsPluginCache_end_p(iter); NfcSupportedCardsPluginCache_next(iter)) { NfcSupportedCardsPluginCache* plugin_cache = NfcSupportedCardsPluginCache_ref(iter); - furi_string_free(plugin_cache->path); + furi_string_free(plugin_cache->name); } NfcSupportedCardsPluginCache_clear(instance->plugins_cache_arr); @@ -111,16 +111,21 @@ static void nfc_supported_cards_load_context_free(NfcSupportedCardsLoadContext* static const NfcSupportedCardsPlugin* nfc_supported_cards_get_plugin( NfcSupportedCardsLoadContext* instance, - const FuriString* path, + const char* name, const ElfApiInterface* api_interface) { furi_assert(instance); - furi_assert(path); + furi_assert(name); const NfcSupportedCardsPlugin* plugin = NULL; do { if(instance->app) flipper_application_free(instance->app); instance->app = flipper_application_alloc(instance->storage, api_interface); - if(flipper_application_preload(instance->app, furi_string_get_cstr(path)) != + + // Reconstruct path + path_concat(NFC_SUPPORTED_CARDS_PLUGINS_PATH, name, instance->file_path); + furi_string_cat(instance->file_path, NFC_SUPPORTED_CARDS_PLUGIN_SUFFIX); + + if(flipper_application_preload(instance->app, furi_string_get_cstr(instance->file_path)) != FlipperApplicationPreloadStatusSuccess) break; if(!flipper_application_is_plugin(instance->app)) break; @@ -155,9 +160,11 @@ static const NfcSupportedCardsPlugin* nfc_supported_cards_get_next_plugin( if(!furi_string_end_with_str(instance->file_path, NFC_SUPPORTED_CARDS_PLUGIN_SUFFIX)) continue; - path_concat(NFC_SUPPORTED_CARDS_PLUGINS_PATH, instance->file_name, instance->file_path); + size_t trim_suffix = + furi_string_size(instance->file_path) - strlen(NFC_SUPPORTED_CARDS_PLUGIN_SUFFIX); + instance->file_name[trim_suffix] = '\0'; - plugin = nfc_supported_cards_get_plugin(instance, instance->file_path, api_interface); + plugin = nfc_supported_cards_get_plugin(instance, instance->file_name, api_interface); } while(plugin == NULL); //-V654 return plugin; @@ -181,7 +188,7 @@ void nfc_supported_cards_load_cache(NfcSupportedCards* instance) { if(plugin == NULL) break; //-V547 NfcSupportedCardsPluginCache plugin_cache = {}; //-V779 - plugin_cache.path = furi_string_alloc_set(instance->load_context->file_path); + plugin_cache.name = furi_string_alloc_set(instance->load_context->file_name); plugin_cache.protocol = plugin->protocol; if(plugin->verify) { plugin_cache.feature |= NfcSupportedCardsPluginFeatureHasVerify; @@ -233,7 +240,7 @@ bool nfc_supported_cards_read(NfcSupportedCards* instance, NfcDevice* device, Nf const ElfApiInterface* api_interface = composite_api_resolver_get(instance->api_resolver); const NfcSupportedCardsPlugin* plugin = nfc_supported_cards_get_plugin( - instance->load_context, plugin_cache->path, api_interface); + instance->load_context, furi_string_get_cstr(plugin_cache->name), api_interface); if(plugin == NULL) continue; if(plugin->verify) { @@ -281,7 +288,7 @@ bool nfc_supported_cards_parse( const ElfApiInterface* api_interface = composite_api_resolver_get(instance->api_resolver); const NfcSupportedCardsPlugin* plugin = nfc_supported_cards_get_plugin( - instance->load_context, plugin_cache->path, api_interface); + instance->load_context, furi_string_get_cstr(plugin_cache->name), api_interface); if(plugin == NULL) continue; if(plugin->parse) { From f7a393ffdbde2151a69a497386260c047967ec19 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 4 Jul 2024 22:58:16 +0300 Subject: [PATCH 3/6] upd changelog --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b4f6b6eec..113e189b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,12 +2,15 @@ - NFC: - OFW: Ultralight C authentication with des key - EMV Transactions less nested, hide if unavailable (by @Willy-JL | PR #771) -* LF RFID: Update T5577 password list (by @korden32 | PR #774) +- LF RFID: + - Update T5577 password list (by @korden32 | PR #774) + - Add DEZ 10 display form for EM4100 (by @korden32 | PR #776) * JS: Refactor widget and keyboard modules, fix crash (by @Willy-JL | PR #770) * OFW: Event Loop Timers * OFW: Updater: resource compression * Apps: **Check out more Apps updates and fixes by following** [this link](https://github.com/xMasterX/all-the-plugins/commits/dev) ## Other changes +* NFC: Cache plugin name not full path, saves some RAM (by @Willy-JL) * OFW: copro: bumped to 1.20.0 * OFW: input_srv: Put input state data on the stack of the service * OFW: Coalesce some allocations From 9c8ab2bf3bcbdb46199f10004a7cc9308077a6eb Mon Sep 17 00:00:00 2001 From: Mykhailo Shevchuk Date: Fri, 5 Jul 2024 01:05:48 +0300 Subject: [PATCH 4/6] Updated to DEZ 8 --- lib/lfrfid/protocols/protocol_em4100.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lfrfid/protocols/protocol_em4100.c b/lib/lfrfid/protocols/protocol_em4100.c index c6b88fff5..1b04b2a8c 100644 --- a/lib/lfrfid/protocols/protocol_em4100.c +++ b/lib/lfrfid/protocols/protocol_em4100.c @@ -348,7 +348,7 @@ void protocol_em4100_render_data(ProtocolEM4100* protocol, FuriString* result) { furi_string_printf( result, "FC: %03u Card: %05hu CL:%hhu\n" - "DEZ 10: %010lu", + "DEZ 8: %08lu", data[2], (uint16_t)((data[3] << 8) | (data[4])), protocol->clock_per_bit, From 6436235f4148d75a7cc11eb427c4045e361600a6 Mon Sep 17 00:00:00 2001 From: Mykhailo Shevchuk Date: Fri, 5 Jul 2024 01:07:46 +0300 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 113e189b1..4b656fbe4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - EMV Transactions less nested, hide if unavailable (by @Willy-JL | PR #771) - LF RFID: - Update T5577 password list (by @korden32 | PR #774) - - Add DEZ 10 display form for EM4100 (by @korden32 | PR #776) + - Add DEZ 8 display form for EM4100 (by @korden32 | PR #776 & #777) * JS: Refactor widget and keyboard modules, fix crash (by @Willy-JL | PR #770) * OFW: Event Loop Timers * OFW: Updater: resource compression From 923130ffdb09e8de95b9b931d88dea659c51f165 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Fri, 5 Jul 2024 05:53:20 +0300 Subject: [PATCH 6/6] upd changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b656fbe4..67d94e0da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ - EMV Transactions less nested, hide if unavailable (by @Willy-JL | PR #771) - LF RFID: - Update T5577 password list (by @korden32 | PR #774) - - Add DEZ 8 display form for EM4100 (by @korden32 | PR #776 & #777) + - Add DEZ 8 display form for EM4100 (by @korden32 | PR #776 & (#777 by @mishamyte)) * JS: Refactor widget and keyboard modules, fix crash (by @Willy-JL | PR #770) * OFW: Event Loop Timers * OFW: Updater: resource compression