From 4229aab7e9da94a68c4662dbdbe37468f47df218 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 25 Apr 2023 17:50:41 +0100 Subject: [PATCH] Update subbrute --- .../external/subghz_bruteforcer/subbrute.c | 5 ++++- .../subghz_bruteforcer/subbrute_device.c | 4 +--- .../subghz_bruteforcer/subbrute_protocols.c | 21 +++++++------------ .../subghz_bruteforcer/subbrute_protocols.h | 4 +--- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/applications/external/subghz_bruteforcer/subbrute.c b/applications/external/subghz_bruteforcer/subbrute.c index 59d2c1ccb..99334c05e 100644 --- a/applications/external/subghz_bruteforcer/subbrute.c +++ b/applications/external/subghz_bruteforcer/subbrute.c @@ -185,7 +185,8 @@ int32_t subbrute_app(void* p) { // Auto switch to internal radio if external radio is not available furi_delay_ms(15); if(!furi_hal_subghz_check_radio()) { - furi_hal_subghz_set_radio_type(SubGhzRadioInternal); + furi_hal_subghz_select_radio_type(SubGhzRadioInternal); + furi_hal_subghz_init_radio_type(SubGhzRadioInternal); } furi_hal_power_suppress_charge_enter(); @@ -195,6 +196,8 @@ int32_t subbrute_app(void* p) { furi_hal_power_suppress_charge_exit(); // Disable power for External CC1101 if it was enabled and module is connected furi_hal_subghz_disable_ext_power(); + // Reinit SPI handles for internal radio / nfc + furi_hal_subghz_init_radio_type(SubGhzRadioInternal); subbrute_free(instance); diff --git a/applications/external/subghz_bruteforcer/subbrute_device.c b/applications/external/subghz_bruteforcer/subbrute_device.c index 0971c380e..192b8bfa0 100644 --- a/applications/external/subghz_bruteforcer/subbrute_device.c +++ b/applications/external/subghz_bruteforcer/subbrute_device.c @@ -104,7 +104,6 @@ bool subbrute_device_save_file(SubBruteDevice* instance, const char* dev_file_na instance->current_step, instance->file_protocol_info->bits, instance->file_protocol_info->te, - instance->file_protocol_info->repeat, instance->bit_index, instance->key_from_file, instance->two_bytes); @@ -116,8 +115,7 @@ bool subbrute_device_save_file(SubBruteDevice* instance, const char* dev_file_na instance->protocol_info->file, instance->current_step, instance->protocol_info->bits, - instance->protocol_info->te, - instance->protocol_info->repeat); + instance->protocol_info->te); } result = true; diff --git a/applications/external/subghz_bruteforcer/subbrute_protocols.c b/applications/external/subghz_bruteforcer/subbrute_protocols.c index 6c6781b78..1f3e45129 100644 --- a/applications/external/subghz_bruteforcer/subbrute_protocols.c +++ b/applications/external/subghz_bruteforcer/subbrute_protocols.c @@ -522,9 +522,9 @@ static const char* subbrute_protocol_file_types[] = { * Values to not use less memory for packet parse operations */ static const char* subbrute_key_file_start_no_tail = - "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\nRepeat: %d\n"; + "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\n"; static const char* subbrute_key_file_start_with_tail = - "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\nTE: %d\nRepeat: %d\n"; + "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\nKey: %s\nTE: %d\n"; static const char* subbrute_key_small_no_tail = "Bit: %d\nKey: %s\nRepeat: %d\n"; //static const char* subbrute_key_small_raw = // "Filetype: Flipper SubGhz Key File\nVersion: 1\nFrequency: %u\nPreset: %s\nProtocol: %s\nBit: %d\n"; @@ -771,8 +771,7 @@ void subbrute_protocol_default_generate_file( SubBruteFileProtocol file, uint64_t step, uint8_t bits, - uint32_t te, - uint8_t repeat) { + uint32_t te) { FuriString* candidate = furi_string_alloc(); subbrute_protocol_create_candidate_for_default(candidate, file, step); @@ -790,8 +789,7 @@ void subbrute_protocol_default_generate_file( subbrute_protocol_file(file), bits, furi_string_get_cstr(candidate), - te, - repeat); + te); } else { stream_write_format( stream, @@ -800,8 +798,7 @@ void subbrute_protocol_default_generate_file( subbrute_protocol_preset(preset), subbrute_protocol_file(file), bits, - furi_string_get_cstr(candidate), - repeat); + furi_string_get_cstr(candidate)); } furi_string_free(candidate); @@ -815,7 +812,6 @@ void subbrute_protocol_file_generate_file( uint64_t step, uint8_t bits, uint32_t te, - uint8_t repeat, uint8_t bit_index, uint64_t file_key, bool two_bytes) { @@ -826,6 +822,7 @@ void subbrute_protocol_file_generate_file( candidate, step, bit_index, file_key, two_bytes); stream_clean(stream); + if(te) { stream_write_format( stream, @@ -835,8 +832,7 @@ void subbrute_protocol_file_generate_file( subbrute_protocol_file(file), bits, furi_string_get_cstr(candidate), - te, - repeat); + te); } else { stream_write_format( stream, @@ -845,8 +841,7 @@ void subbrute_protocol_file_generate_file( subbrute_protocol_preset(preset), subbrute_protocol_file(file), bits, - furi_string_get_cstr(candidate), - repeat); + furi_string_get_cstr(candidate)); } furi_string_free(candidate); diff --git a/applications/external/subghz_bruteforcer/subbrute_protocols.h b/applications/external/subghz_bruteforcer/subbrute_protocols.h index 2f41b185b..066040b10 100644 --- a/applications/external/subghz_bruteforcer/subbrute_protocols.h +++ b/applications/external/subghz_bruteforcer/subbrute_protocols.h @@ -110,8 +110,7 @@ void subbrute_protocol_default_generate_file( SubBruteFileProtocol file, uint64_t step, uint8_t bits, - uint32_t te, - uint8_t repeat); + uint32_t te); void subbrute_protocol_file_generate_file( Stream* stream, uint32_t frequency, @@ -120,7 +119,6 @@ void subbrute_protocol_file_generate_file( uint64_t step, uint8_t bits, uint32_t te, - uint8_t repeat, uint8_t bit_index, uint64_t file_key, bool two_bytes);