فهرست منبع

support save pt2262 file

SpenserCai 10 ماه پیش
والد
کامیت
7e415b26fb
6فایلهای تغییر یافته به همراه12 افزوده شده و 10 حذف شده
  1. BIN
      .DS_Store
  2. 1 1
      helpers/subbrute_worker.c
  3. 1 0
      scenes/subbrute_scene_setup_extra.c
  4. 5 4
      subbrute_device.c
  5. 4 4
      subbrute_device.h
  6. 1 1
      subbrute_protocols.c

BIN
.DS_Store


+ 1 - 1
helpers/subbrute_worker.c

@@ -19,6 +19,7 @@ SubBruteWorker* subbrute_worker_alloc(const SubGhzDevice* radio_device) {
     instance->initiated = false;
     instance->last_time_tx_data = 0;
     instance->load_index = 0;
+    instance->opencode = 0;
 
     instance->thread = furi_thread_alloc();
     furi_thread_set_name(instance->thread, "SubBruteAttackWorker");
@@ -89,7 +90,6 @@ void subbrute_worker_set_opencode(SubBruteWorker* instance, uint8_t opencode) {
     //
     //     return false;
     // }
-
     instance->opencode = opencode;
 
     // return true;

+ 1 - 0
scenes/subbrute_scene_setup_extra.c

@@ -191,6 +191,7 @@ static void setup_extra_opencode_callback(VariableItem* item) {
     furi_assert(instance);
     const uint8_t value_index = variable_item_get_current_value_index(item);
     subbrute_worker_set_opencode(instance->worker, opencode_values[value_index]);
+    instance->device->opencode = opencode_values[value_index];
     variable_item_set_current_value_text(item, opencode_names[value_index]);
 }
 

+ 5 - 4
subbrute_device.c

@@ -78,9 +78,10 @@ uint64_t subbrute_device_add_step(SubBruteDevice* instance, int8_t step) {
 bool subbrute_device_save_file(SubBruteDevice* instance, const char* dev_file_name) {
     furi_assert(instance);
 
-#ifdef FURI_DEBUG
-    FURI_LOG_D(TAG, "subbrute_device_save_file: %s", dev_file_name);
-#endif
+    // #ifdef FURI_DEBUG
+    FURI_LOG_W(TAG, "subbrute_device_save_file: %s", dev_file_name);
+    FURI_LOG_W(TAG, "opencode: %d", instance->opencode);
+    // #endif
 
     Storage* storage = furi_record_open(RECORD_STORAGE);
     FlipperFormat* file = flipper_format_file_alloc(storage);
@@ -112,7 +113,7 @@ bool subbrute_device_save_file(SubBruteDevice* instance, const char* dev_file_na
                 instance->current_step,
                 instance->protocol_info->bits,
                 instance->protocol_info->te,
-                instance->protocol_info->opencode);
+                instance->opencode);
         }
 
         result = true;

+ 4 - 4
subbrute_device.h

@@ -9,8 +9,8 @@
 #include <lib/subghz/environment.h>
 
 #define SUBBRUTE_MAX_LEN_NAME 64
-#define SUBBRUTE_PATH EXT_PATH("subghz")
-#define SUBBRUTE_FILE_EXT ".sub"
+#define SUBBRUTE_PATH         EXT_PATH("subghz")
+#define SUBBRUTE_FILE_EXT     ".sub"
 
 /**
  * @enum SubBruteFileResult
@@ -51,7 +51,7 @@ typedef struct {
 
     uint64_t current_step; /**< Current step */
 
-     /** @see @c SubGhz service for more info */
+    /** @see @c SubGhz service for more info */
     SubGhzReceiver* receiver; /**< Receiver */
     SubGhzProtocolDecoderBase* decoder_result; /**< Decoder result */
     SubGhzEnvironment* environment; /**< Environment */
@@ -65,7 +65,7 @@ typedef struct {
     uint64_t key_from_file; /**< Key from file */
     uint64_t current_key_from_file; /**< Current key from file */
     bool two_bytes; /**< Two bytes key */
-
+    uint8_t opencode; /**< Opencode */
     uint8_t bit_index; /**< Index of a group to bruteforce in loaded file */
 } SubBruteDevice;
 

+ 1 - 1
subbrute_protocols.c

@@ -902,7 +902,7 @@ void subbrute_protocol_default_generate_file(
     subbrute_protocol_create_candidate_for_default(candidate, file, step, opencode);
 
     //#ifdef FURI_DEBUG
-    FURI_LOG_D(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
+    FURI_LOG_W(TAG, "candidate: %s, step: %lld", furi_string_get_cstr(candidate), step);
     //#endif
     stream_clean(stream);