From 054245c980c7da2a89d87106e8f2dbcb764c582c Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 02:32:53 +0300 Subject: [PATCH 1/6] Remove unneeded include --- firmware/targets/f7/furi_hal/furi_hal_idle_timer.h | 1 - 1 file changed, 1 deletion(-) diff --git a/firmware/targets/f7/furi_hal/furi_hal_idle_timer.h b/firmware/targets/f7/furi_hal/furi_hal_idle_timer.h index 36b45755a..9f91db14e 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_idle_timer.h +++ b/firmware/targets/f7/furi_hal/furi_hal_idle_timer.h @@ -3,7 +3,6 @@ #include #include #include -#include // Timer used for tickless idle #define FURI_HAL_IDLE_TIMER_MAX 0xFFFF From c4010a6c780614f1a5faaead6caa0052ce39d57d Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 02:58:28 +0300 Subject: [PATCH 2/6] Update rfid fuzzer readme --- applications/external/flipfrid/README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/applications/external/flipfrid/README.md b/applications/external/flipfrid/README.md index 69fdb3e66..83d849454 100644 --- a/applications/external/flipfrid/README.md +++ b/applications/external/flipfrid/README.md @@ -1,10 +1,10 @@ # Flipfrid -Basic EM4100 and HIDProx Fuzzer. +Basic LFRFID Fuzzer. ## Why -Flipfrid is a simple Rfid fuzzer using EM4100 protocol (125khz). +Flipfrid is a simple Rfid fuzzer using lfrfid protocols (125khz). Objective is to provide a simple to use fuzzer to test readers by emulating various cards. - EM4100 cards use a 1 byte customer id and 4 bytes card id. @@ -14,12 +14,16 @@ Objective is to provide a simple to use fuzzer to test readers by emulating vari 1) Select the Protocol with the left and right arrows 2) Select the Mode with the up and down arrows +3) Set TD (Time delay) between ID switch if you need, or left it as is +4) Click Start ### Info -There are 2 Protocols: +There are 4 Protocols: - EM4100 - HIDProx +- PAC/Stanley +- H10301 There are 4 modes: - Default Values: Try factory/default keys and emulate one after the other. @@ -28,8 +32,5 @@ There are 4 modes: - Uids list: Iterate over an input text file (one uid per line) and emulate one after the other. - - TODO : -- blank screen on back press - Add second byte test to `BF customer id` From 654a622607dcade641b8825574da1744e314376c Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 03:05:04 +0300 Subject: [PATCH 3/6] Move counter incr out of debug, change max value to 3 making it not that harmful if user don't understand what it does --- .../scenes/subghz_scene_ext_module_settings.c | 67 +++++++------------ 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c index 963483db3..e91ebd47f 100644 --- a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c @@ -31,14 +31,11 @@ const char* const debug_pin_text[DEBUG_P_COUNT] = { "17(1W)", }; -#define DEBUG_COUNTER_COUNT 6 +#define DEBUG_COUNTER_COUNT 3 const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = { "+1", "+2", "+3", - "+4", - "+5", - "+10", }; static void subghz_scene_ext_module_changed(VariableItem* item) { @@ -80,15 +77,6 @@ static void subghz_scene_receiver_config_set_debug_counter(VariableItem* item) { case 2: furi_hal_subghz_set_rolling_counter_mult(3); break; - case 3: - furi_hal_subghz_set_rolling_counter_mult(4); - break; - case 4: - furi_hal_subghz_set_rolling_counter_mult(5); - break; - case 5: - furi_hal_subghz_set_rolling_counter_mult(10); - break; default: break; } @@ -157,6 +145,28 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { variable_item_set_current_value_index(item, value_index_time); variable_item_set_current_value_text(item, timestamp_names_text[value_index_time]); + item = variable_item_list_add( + subghz->variable_item_list, + "Counter incr.", + DEBUG_COUNTER_COUNT, + subghz_scene_receiver_config_set_debug_counter, + subghz); + switch(furi_hal_subghz_get_rolling_counter_mult()) { + case 1: + value_index_cnt = 0; + break; + case 2: + value_index_cnt = 1; + break; + case 3: + value_index_cnt = 2; + break; + default: + break; + } + variable_item_set_current_value_index(item, value_index_cnt); + variable_item_set_current_value_text(item, debug_counter_text[value_index_cnt]); + if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { item = variable_item_list_add( subghz->variable_item_list, @@ -167,37 +177,6 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { value_index_dpin = subghz_txrx_get_debug_pin_state(subghz->txrx); variable_item_set_current_value_index(item, value_index_dpin); variable_item_set_current_value_text(item, debug_pin_text[value_index_dpin]); - - item = variable_item_list_add( - subghz->variable_item_list, - "Counter incr.", - DEBUG_COUNTER_COUNT, - subghz_scene_receiver_config_set_debug_counter, - subghz); - switch(furi_hal_subghz_get_rolling_counter_mult()) { - case 1: - value_index_cnt = 0; - break; - case 2: - value_index_cnt = 1; - break; - case 3: - value_index_cnt = 2; - break; - case 4: - value_index_cnt = 3; - break; - case 5: - value_index_cnt = 4; - break; - case 10: - value_index_cnt = 5; - break; - default: - break; - } - variable_item_set_current_value_index(item, value_index_cnt); - variable_item_set_current_value_text(item, debug_counter_text[value_index_cnt]); } view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdVariableItemList); From a1fa5224a3ea71f366bba584a7336abb25eaaf15 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 03:15:15 +0300 Subject: [PATCH 4/6] Infrared external output move out of debug and add power option --- applications/main/infrared/infrared.c | 5 ++++ .../scenes/infrared_scene_debug_settings.c | 26 +++++++++++++++++++ .../infrared/scenes/infrared_scene_start.c | 18 ++++++------- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/applications/main/infrared/infrared.c b/applications/main/infrared/infrared.c index a88306cc5..b2be5f1af 100644 --- a/applications/main/infrared/infrared.c +++ b/applications/main/infrared/infrared.c @@ -246,6 +246,11 @@ static void infrared_free(Infrared* infrared) { furi_string_free(infrared->file_path); + // Disable 5v power if was enabled for external module + if(furi_hal_power_is_otg_enabled()) { + furi_hal_power_disable_otg(); + } + free(infrared); } diff --git a/applications/main/infrared/scenes/infrared_scene_debug_settings.c b/applications/main/infrared/scenes/infrared_scene_debug_settings.c index 0bc830788..bef666275 100644 --- a/applications/main/infrared/scenes/infrared_scene_debug_settings.c +++ b/applications/main/infrared/scenes/infrared_scene_debug_settings.c @@ -18,6 +18,22 @@ static void infrared_scene_debug_settings_changed(VariableItem* item) { furi_hal_infrared_set_debug_out(value_index_ir); } + +static void infrared_scene_debug_settings_power_changed(VariableItem* item) { + bool value = variable_item_get_current_value_index(item); + if(value) { + for(int i = 0; i < 5 && !furi_hal_power_is_otg_enabled(); i++) { + furi_hal_power_enable_otg(); + furi_delay_ms(10); + } + } else { + if(furi_hal_power_is_otg_enabled()) { + furi_hal_power_disable_otg(); + } + } + variable_item_set_current_value_text(item, value ? "ON" : "OFF"); +} + static void infrared_debug_settings_start_var_list_enter_callback(void* context, uint32_t index) { Infrared* infrared = context; view_dispatcher_send_custom_event(infrared->view_dispatcher, index); @@ -42,6 +58,16 @@ void infrared_scene_debug_settings_on_enter(void* context) { variable_item_set_current_value_index(item, value_index_ir); variable_item_set_current_value_text(item, infrared_debug_cfg_variables_text[value_index_ir]); + item = variable_item_list_add( + variable_item_list, + "Ext Module 5v", + 2, + infrared_scene_debug_settings_power_changed, + infrared); + bool enabled = furi_hal_power_is_otg_enabled(); + variable_item_set_current_value_index(item, enabled); + variable_item_set_current_value_text(item, enabled ? "ON" : "OFF"); + view_dispatcher_switch_to_view(infrared->view_dispatcher, InfraredViewVariableItemList); } diff --git a/applications/main/infrared/scenes/infrared_scene_start.c b/applications/main/infrared/scenes/infrared_scene_start.c index 816d57294..a89974ba2 100644 --- a/applications/main/infrared/scenes/infrared_scene_start.c +++ b/applications/main/infrared/scenes/infrared_scene_start.c @@ -3,10 +3,10 @@ enum SubmenuIndex { SubmenuIndexUniversalRemotes, SubmenuIndexLearnNewRemote, - SubmenuIndexLearnNewRemoteRaw, SubmenuIndexSavedRemotes, - SubmenuIndexDebug, - SubmenuIndexDebugSettings + SubmenuIndexDebugSettings, + SubmenuIndexLearnNewRemoteRaw, + SubmenuIndexDebug }; static void infrared_scene_start_submenu_callback(void* context, uint32_t index) { @@ -37,6 +37,12 @@ void infrared_scene_start_on_enter(void* context) { SubmenuIndexSavedRemotes, infrared_scene_start_submenu_callback, infrared); + submenu_add_item( + submenu, + "GPIO Settings", + SubmenuIndexDebugSettings, + infrared_scene_start_submenu_callback, + infrared); if(infrared->app_state.is_debug_enabled) { submenu_add_item( @@ -51,12 +57,6 @@ void infrared_scene_start_on_enter(void* context) { SubmenuIndexDebug, infrared_scene_start_submenu_callback, infrared); - submenu_add_item( - submenu, - "Debug Settings", - SubmenuIndexDebugSettings, - infrared_scene_start_submenu_callback, - infrared); } const uint32_t submenu_index = From d5100476ac6e2dcd3dc22d42d578b3497da196cb Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 03:50:55 +0300 Subject: [PATCH 5/6] cleanup ext module settings --- .../scenes/subghz_scene_ext_module_settings.c | 49 +++++++++---------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c index e91ebd47f..fbdb22180 100644 --- a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c @@ -1,12 +1,6 @@ #include "../subghz_i.h" #include "../helpers/subghz_custom_event.h" -static uint8_t value_index_exm; -static uint8_t value_index_dpin; -static uint8_t value_index_cnt; -static uint8_t value_index_pwr; -static uint8_t value_index_time; - #define EXT_MODULES_COUNT (sizeof(radio_modules_variables_text) / sizeof(char* const)) const char* const radio_modules_variables_text[] = { "Internal", @@ -40,7 +34,7 @@ const char* const debug_counter_text[DEBUG_COUNTER_COUNT] = { static void subghz_scene_ext_module_changed(VariableItem* item) { SubGhz* subghz = variable_item_get_context(item); - value_index_exm = variable_item_get_current_value_index(item); + uint8_t value_index_exm = variable_item_get_current_value_index(item); variable_item_set_current_value_text(item, radio_modules_variables_text[value_index_exm]); @@ -114,16 +108,17 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { SubGhz* subghz = context; VariableItemList* variable_item_list = subghz->variable_item_list; + uint8_t value_index; - value_index_exm = furi_hal_subghz.radio_type; + value_index = furi_hal_subghz.radio_type; VariableItem* item = variable_item_list_add( variable_item_list, "Module", EXT_MODULES_COUNT, subghz_scene_ext_module_changed, subghz); variable_item_list_set_enter_callback( variable_item_list, subghz_ext_module_start_var_list_enter_callback, subghz); - variable_item_set_current_value_index(item, value_index_exm); - variable_item_set_current_value_text(item, radio_modules_variables_text[value_index_exm]); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, radio_modules_variables_text[value_index]); item = variable_item_list_add( subghz->variable_item_list, @@ -131,9 +126,9 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { EXT_MOD_POWER_COUNT, subghz_scene_receiver_config_set_ext_mod_power, subghz); - value_index_pwr = furi_hal_subghz_get_external_power_disable(); - variable_item_set_current_value_index(item, value_index_pwr); - variable_item_set_current_value_text(item, ext_mod_power_text[value_index_pwr]); + value_index = furi_hal_subghz_get_external_power_disable(); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, ext_mod_power_text[value_index]); item = variable_item_list_add( subghz->variable_item_list, @@ -141,9 +136,9 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { TIMESTAMP_NAMES_COUNT, subghz_scene_receiver_config_set_timestamp_file_names, subghz); - value_index_time = furi_hal_subghz_get_timestamp_file_names(); - variable_item_set_current_value_index(item, value_index_time); - variable_item_set_current_value_text(item, timestamp_names_text[value_index_time]); + value_index = furi_hal_subghz_get_timestamp_file_names(); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, timestamp_names_text[value_index]); item = variable_item_list_add( subghz->variable_item_list, @@ -153,19 +148,19 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { subghz); switch(furi_hal_subghz_get_rolling_counter_mult()) { case 1: - value_index_cnt = 0; + value_index = 0; break; case 2: - value_index_cnt = 1; + value_index = 1; break; case 3: - value_index_cnt = 2; + value_index = 2; break; default: break; } - variable_item_set_current_value_index(item, value_index_cnt); - variable_item_set_current_value_text(item, debug_counter_text[value_index_cnt]); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, debug_counter_text[value_index]); if(furi_hal_rtc_is_flag_set(FuriHalRtcFlagDebug)) { item = variable_item_list_add( @@ -174,9 +169,9 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { DEBUG_P_COUNT, subghz_scene_receiver_config_set_debug_pin, subghz); - value_index_dpin = subghz_txrx_get_debug_pin_state(subghz->txrx); - variable_item_set_current_value_index(item, value_index_dpin); - variable_item_set_current_value_text(item, debug_pin_text[value_index_dpin]); + value_index = subghz_txrx_get_debug_pin_state(subghz->txrx); + variable_item_set_current_value_index(item, value_index); + variable_item_set_current_value_text(item, debug_pin_text[value_index]); } view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdVariableItemList); @@ -188,14 +183,14 @@ bool subghz_scene_ext_module_settings_on_event(void* context, SceneManagerEvent UNUSED(event); // Set selected radio module - furi_hal_subghz_select_radio_type(value_index_exm); - furi_hal_subghz_init_radio_type(value_index_exm); + furi_hal_subghz_select_radio_type(subghz->last_settings->external_module_enabled); + furi_hal_subghz_init_radio_type(subghz->last_settings->external_module_enabled); furi_hal_subghz_enable_ext_power(); // Check if module is present, if no -> show error if(!furi_hal_subghz_check_radio()) { - value_index_exm = 0; + subghz->last_settings->external_module_enabled = false; furi_hal_subghz_select_radio_type(SubGhzRadioInternal); furi_hal_subghz_init_radio_type(SubGhzRadioInternal); furi_string_set(subghz->error_str, "Please connect\nexternal radio"); From 3881de74eb388ef7a462212c37b3871512d2f6f5 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Thu, 11 May 2023 03:54:53 +0300 Subject: [PATCH 6/6] rename settings scene --- applications/main/subghz/scenes/subghz_scene_config.h | 2 +- ..._ext_module_settings.c => subghz_scene_radio_settings.c} | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) rename applications/main/subghz/scenes/{subghz_scene_ext_module_settings.c => subghz_scene_radio_settings.c} (96%) diff --git a/applications/main/subghz/scenes/subghz_scene_config.h b/applications/main/subghz/scenes/subghz_scene_config.h index 6fb183d60..269ec4c72 100644 --- a/applications/main/subghz/scenes/subghz_scene_config.h +++ b/applications/main/subghz/scenes/subghz_scene_config.h @@ -23,7 +23,7 @@ ADD_SCENE(subghz, set_fix, SetFix) ADD_SCENE(subghz, set_cnt, SetCnt) ADD_SCENE(subghz, set_seed, SetSeed) ADD_SCENE(subghz, frequency_analyzer, FrequencyAnalyzer) -ADD_SCENE(subghz, ext_module_settings, ExtModuleSettings) +ADD_SCENE(subghz, radio_settings, ExtModuleSettings) ADD_SCENE(subghz, read_raw, ReadRAW) ADD_SCENE(subghz, more_raw, MoreRAW) ADD_SCENE(subghz, decode_raw, DecodeRAW) diff --git a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c b/applications/main/subghz/scenes/subghz_scene_radio_settings.c similarity index 96% rename from applications/main/subghz/scenes/subghz_scene_ext_module_settings.c rename to applications/main/subghz/scenes/subghz_scene_radio_settings.c index fbdb22180..8e8d05019 100644 --- a/applications/main/subghz/scenes/subghz_scene_ext_module_settings.c +++ b/applications/main/subghz/scenes/subghz_scene_radio_settings.c @@ -104,7 +104,7 @@ static void subghz_scene_receiver_config_set_timestamp_file_names(VariableItem* subghz_last_settings_save(subghz->last_settings); } -void subghz_scene_ext_module_settings_on_enter(void* context) { +void subghz_scene_radio_settings_on_enter(void* context) { SubGhz* subghz = context; VariableItemList* variable_item_list = subghz->variable_item_list; @@ -177,7 +177,7 @@ void subghz_scene_ext_module_settings_on_enter(void* context) { view_dispatcher_switch_to_view(subghz->view_dispatcher, SubGhzViewIdVariableItemList); } -bool subghz_scene_ext_module_settings_on_event(void* context, SceneManagerEvent event) { +bool subghz_scene_radio_settings_on_event(void* context, SceneManagerEvent event) { SubGhz* subghz = context; UNUSED(subghz); UNUSED(event); @@ -200,7 +200,7 @@ bool subghz_scene_ext_module_settings_on_event(void* context, SceneManagerEvent return false; } -void subghz_scene_ext_module_settings_on_exit(void* context) { +void subghz_scene_radio_settings_on_exit(void* context) { SubGhz* subghz = context; variable_item_list_reset(subghz->variable_item_list); }