From 202596ad3868caa5a214ef4bb85e70c688d9ccce Mon Sep 17 00:00:00 2001 From: yocvito Date: Sun, 1 Jan 2023 02:17:40 +0100 Subject: [PATCH 01/36] add buggy extra config UI for bad usb (for implementing BLE and UART) --- applications/main/bad_usb/bad_usb_app.c | 50 ++++- applications/main/bad_usb/bad_usb_app_i.h | 22 +- .../main/bad_usb/bad_usb_custom_event.h | 11 + applications/main/bad_usb/bad_usb_script.c | 8 +- applications/main/bad_usb/bad_usb_script.h | 6 +- .../bad_usb/scenes/bad_usb_scene_config.c | 198 ++++++++++++++++-- .../bad_usb/scenes/bad_usb_scene_config.h | 2 + .../main/bad_usb/scenes/bad_usb_scene_error.c | 6 +- .../main/bad_usb/scenes/bad_usb_scene_work.c | 2 +- .../main/gpio/scenes/gpio_scene_start.c | 8 +- firmware/targets/f7/ble_glue/gap.c | 2 +- firmware/targets/f7/furi_hal/furi_hal_bt.c | 2 +- .../targets/f7/furi_hal/furi_hal_bt_hid.c | 21 +- 13 files changed, 302 insertions(+), 36 deletions(-) create mode 100644 applications/main/bad_usb/bad_usb_custom_event.h diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index bb29d3be5..d537f7728 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -5,8 +5,14 @@ #include #include +// ble hid +#include +#include + #define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/" BAD_USB_SETTINGS_FILE_NAME +#define BAD_USB_LOGFILE_PATH BAD_USB_APP_BASE_FOLDER "/debug.log" + static bool bad_usb_app_custom_event_callback(void* context, uint32_t event) { furi_assert(context); BadUsbApp* app = context; @@ -54,6 +60,16 @@ static void bad_usb_save_settings(BadUsbApp* app) { BadUsbApp* bad_usb_app_alloc(char* arg) { BadUsbApp* app = malloc(sizeof(BadUsbApp)); + Storage* storage = furi_record_open(RECORD_STORAGE); + File* file = storage_file_alloc(storage); + if(!storage_file_open(file, BAD_USB_LOGFILE_PATH, FSAM_WRITE, FSOM_OPEN_APPEND)) { + FURI_LOG_E("BadUsbApp", "Can't open debug log file"); + storage_file_close(file); + app->debug_file = NULL; + } else { + app->debug_file = file; + } + app->bad_usb_script = NULL; app->file_path = furi_string_alloc(); @@ -86,9 +102,19 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { view_dispatcher_add_view( app->view_dispatcher, BadUsbAppViewError, widget_get_view(app->widget)); - app->submenu = submenu_alloc(); + // app->submenu = submenu_alloc(); + // view_dispatcher_add_view( + // app->view_dispatcher, BadUsbAppViewConfig, submenu_get_view(app->submenu)); + + app->variable_item_list = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfig, submenu_get_view(app->submenu)); + app->view_dispatcher, + BadUsbAppViewConfig, + variable_item_list_get_view(app->variable_item_list)); + app->menu_idx = 0; + for(int i = 0; i < NUM_CONF_OPT; i++) { + app->menu_opt_idx[i] = 0; + } app->bad_usb_view = bad_usb_alloc(); view_dispatcher_add_view( @@ -96,6 +122,10 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + // default injection mode is USB + app->mode = BadUsbModeUSB; + F_DEBUG(app, "Starting BadUSB app\r\n"); + if(furi_hal_usb_is_locked()) { app->error = BadUsbAppErrorCloseRpc; scene_manager_next_scene(app->scene_manager, BadUsbSceneError); @@ -121,6 +151,10 @@ void bad_usb_app_free(BadUsbApp* app) { app->bad_usb_script = NULL; } + // BLE HID + F_DEBUG(app, "Stopping BLE HID"); + furi_hal_bt_hid_stop(); + // Views view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork); bad_usb_free(app->bad_usb_view); @@ -130,8 +164,12 @@ void bad_usb_app_free(BadUsbApp* app) { widget_free(app->widget); // Submenu + // view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfig); + // submenu_free(app->submenu); + + // Variable Item List view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfig); - submenu_free(app->submenu); + variable_item_list_free(app->variable_item_list); // View dispatcher view_dispatcher_free(app->view_dispatcher); @@ -147,6 +185,12 @@ void bad_usb_app_free(BadUsbApp* app) { furi_string_free(app->file_path); furi_string_free(app->keyboard_layout); + if(app->debug_file) { + storage_file_close(app->debug_file); + storage_file_free(app->debug_file); + } + furi_record_close(RECORD_STORAGE); + free(app); } diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index eda67eae5..09778a8f1 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -3,6 +3,10 @@ #include "bad_usb_app.h" #include "scenes/bad_usb_scene.h" #include "bad_usb_script.h" +#include "bad_usb_custom_event.h" +#include "bad_usb_script.h" + +#include #include #include @@ -20,11 +24,16 @@ #define BAD_USB_APP_SCRIPT_EXTENSION ".txt" #define BAD_USB_APP_LAYOUT_EXTENSION ".kl" +#define NUM_CONF_ITEM 3 // modify here if you add new item in config menu +#define NUM_CONF_OPT BadUsbModeNb // for now, scaled on hid mode (ble or usb) + typedef enum { BadUsbAppErrorNoFiles, BadUsbAppErrorCloseRpc, } BadUsbAppError; +#define F_DEBUG(app, s) do { if(app->debug_file) { storage_file_write(app->debug_file, s, strlen(s)); } } while(0) + struct BadUsbApp { Gui* gui; ViewDispatcher* view_dispatcher; @@ -32,17 +41,26 @@ struct BadUsbApp { NotificationApp* notifications; DialogsApp* dialogs; Widget* widget; - Submenu* submenu; + + //Submenu* submenu; + VariableItemList* variable_item_list; + uint8_t menu_idx; + uint8_t menu_opt_idx[NUM_CONF_OPT]; BadUsbAppError error; FuriString* file_path; FuriString* keyboard_layout; BadUsb* bad_usb_view; BadUsbScript* bad_usb_script; + BadUsbMode mode; + + File *debug_file; }; typedef enum { BadUsbAppViewError, BadUsbAppViewWork, BadUsbAppViewConfig, -} BadUsbAppView; \ No newline at end of file + // for ble hid related information + BadUsbAppViewConfigBle +} BadUsbAppView; diff --git a/applications/main/bad_usb/bad_usb_custom_event.h b/applications/main/bad_usb/bad_usb_custom_event.h new file mode 100644 index 000000000..95773b805 --- /dev/null +++ b/applications/main/bad_usb/bad_usb_custom_event.h @@ -0,0 +1,11 @@ +#pragma once + +typedef enum { + BadUsbCustomEventKeyboardLayout, + BadUsbCustomEventModeUSB, + BadUsbCustomEventModeBLE, + BadUsbCustomEventModeUART, + BadUsbCustomEventConfigBle, + BadUsbCustomEventErrorBack, + BadUsbCustomEventNb, +} BadUsbCustomEvent; \ No newline at end of file diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index aad79a329..9389d6044 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -8,6 +8,10 @@ #include "bad_usb_script.h" #include + +#include +#include + #define TAG "BadUSB" #define WORKER_TAG TAG "Worker" #define FILE_BUFFER_LEN 16 @@ -720,7 +724,7 @@ void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, FuriString* layou storage_file_free(layout_file); } -void bad_usb_script_toggle(BadUsbScript* bad_usb) { +void bad_usb_script_toggle(BadUsbScript* bad_usb, BadUsbMode mode) { furi_assert(bad_usb); furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtToggle); } @@ -728,4 +732,4 @@ void bad_usb_script_toggle(BadUsbScript* bad_usb) { BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb) { furi_assert(bad_usb); return &(bad_usb->st); -} +} \ No newline at end of file diff --git a/applications/main/bad_usb/bad_usb_script.h b/applications/main/bad_usb/bad_usb_script.h index 1e4d98fe7..399c4a06c 100644 --- a/applications/main/bad_usb/bad_usb_script.h +++ b/applications/main/bad_usb/bad_usb_script.h @@ -29,6 +29,8 @@ typedef struct { char error[64]; } BadUsbState; +typedef enum { BadUsbModeUSB, BadUsbModeBLE, BadUsbModeUART, BadUsbModeNb } BadUsbMode; + BadUsbScript* bad_usb_script_open(FuriString* file_path); void bad_usb_script_close(BadUsbScript* bad_usb); @@ -39,9 +41,7 @@ void bad_usb_script_start(BadUsbScript* bad_usb); void bad_usb_script_stop(BadUsbScript* bad_usb); -void bad_usb_script_toggle(BadUsbScript* bad_usb); - -BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb); +void bad_usb_script_toggle(BadUsbScript* bad_usb, BadUsbMode mode); #ifdef __cplusplus } diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.c b/applications/main/bad_usb/scenes/bad_usb_scene_config.c index 2a9f2f76c..4dfe0eabd 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config.c @@ -1,53 +1,219 @@ #include "../bad_usb_app_i.h" #include "furi_hal_power.h" #include "furi_hal_usb.h" +#include "../bad_usb_script.h" -enum SubmenuIndex { - SubmenuIndexKeyboardLayout, +// enum SubmenuIndex { +// SubmenuIndexKeyboardLayout, +// SubmenuIndexInjectionMode, +// SubmenuIndexBleConfig +// }; + +enum VariableListIndex { + VariableListIndexKeyboardLayout, + VariableListIndexInjectionMode, + VariableListIndexBleConfig }; -void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) { +typedef struct BadUsbConfigItem { + const char* name; + uint8_t num_options_menu; + const char* options_menu[NUM_CONF_OPT]; +} BadUsbConfigItem; + +const BadUsbCustomEvent bad_usb_custom_events_mode[NUM_CONF_OPT] = { + BadUsbCustomEventModeUSB, + BadUsbCustomEventModeBLE, + BadUsbCustomEventModeUART +}; + +#define NUM_BAD_USB_CONFIG_ITEMS 3 +const BadUsbConfigItem bad_usb_config_items[NUM_BAD_USB_CONFIG_ITEMS] = { + {"Keyboard layout", 1, {""}}, + {"Injection mode", 3, {"USB", "BLE", "UART"}}, + {"BLE Config", 1, {""}}, +}; + +// void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) { +// BadUsbApp* bad_usb = context; +// view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); +// } + +void bad_usb_scene_config_var_list_callback(void* context, uint32_t index) { BadUsbApp* bad_usb = context; view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); } +void bad_usb_scene_config_var_list_enter_callback(void* context, uint32_t index) { + BadUsbApp* bad_usb = context; + + F_DEBUG(bad_usb, "[+] bad_usb_scene_config_var_list_enter_callback\r\n"); + + if (index == VariableListIndexKeyboardLayout) { + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, BadUsbCustomEventKeyboardLayout); + } else if (index == VariableListIndexInjectionMode) { + int menu_opt_idx = bad_usb->menu_opt_idx[index]; + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, bad_usb_custom_events_mode[menu_opt_idx]); + } else if (index == VariableListIndexBleConfig) { + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, BadUsbCustomEventConfigBle); + } + + F_DEBUG(bad_usb, "[-] bad_usb_scene_config_var_list_enter_callback\r\n"); +} + +void bad_usb_scene_config_var_list_change_callback(VariableItem *item) { + furi_assert(item); + BadUsbApp* bad_usb = variable_item_get_context(item); + furi_assert(bad_usb); + + F_DEBUG(bad_usb, "[+] bad_usb_scene_config_var_list_change_callback\r\n"); + BadUsbConfigItem *menu_item = &bad_usb_config_items[bad_usb->menu_idx]; + uint8_t item_index = variable_item_get_current_value_index(item); + furi_assert(item_index < menu_item->num_options_menu); + variable_item_set_current_value_text(item, menu_item->options_menu[item_index]); + bad_usb->menu_opt_idx[bad_usb->menu_idx] = item_index; + F_DEBUG(bad_usb, "[-] bad_usb_scene_config_var_list_change_callback\r\n"); +} + void bad_usb_scene_config_on_enter(void* context) { BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; + //Submenu* submenu = bad_usb->submenu; + char toggle_label[32]; + VariableItemList *item_list = bad_usb->variable_item_list; + VariableItem *item = NULL; - submenu_add_item( - submenu, - "Keyboard layout", - SubmenuIndexKeyboardLayout, - bad_usb_scene_config_submenu_callback, - bad_usb); + char debug_buf[256]; - submenu_set_selected_item( - submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); + F_DEBUG(bad_usb, "[+] BadUsbSceneConfig on_enter\r\n"); + + F_DEBUG(bad_usb, "Setting up variable item list\r\n"); + variable_item_list_set_enter_callback( + item_list, bad_usb_scene_config_var_list_enter_callback, bad_usb); + + for (int i=0; imenu_opt_idx[i]); + variable_item_set_current_value_text( + item, bad_usb_config_items[i].options_menu[bad_usb->menu_opt_idx[i]]); + + snprintf(debug_buf, sizeof(debug_buf), "Added item %s, index %d, opt_idx %d\r\n", + bad_usb_config_items[i].name, i, bad_usb->menu_opt_idx[i]); + F_DEBUG(bad_usb, debug_buf); + } + + variable_item_list_set_selected_item( + item_list, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); + + + // submenu_add_item( + // submenu, "Keyboard layout", + // SubmenuIndexKeyboardLayout, + // bad_usb_scene_config_submenu_callback, + // bad_usb); + + // furi_assert(bad_usb->bad_usb_script); + // // switch for choising Bad-USB or Bad-BLE + // BadUsbScriptMode hid_mode = bad_usb_script_get_hid_mode(bad_usb->bad_usb_script); + // furi_assert(hid_mode < BadUsbScriptModeNb); + // snprintf(toggle_label, sizeof(toggle_label), "Toggle Mode: %s", ducky_mode_names[hid_mode]); + // submenu_add_item( + // submenu, + // toggle_label, + // SubmenuIndexInjectionMode, + // bad_usb_scene_config_submenu_callback, + // bad_usb); + + // submenu_add_item( + // submenu, "BLE Config", + // SubmenuIndexBleConfig, + // bad_usb_scene_config_submenu_callback, + // bad_usb); + + // submenu_set_selected_item( + // submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfig); + + F_DEBUG(bad_usb, "[-] BadUsbSceneConfig on_enter\r\n"); } bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) { + // BadUsbApp* bad_usb = context; + // bool consumed = false; + + // if(event.type == SceneManagerEventTypeCustom) { + // scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event); + // consumed = true; + // if(event.event == SubmenuIndexKeyboardLayout) { + // scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); + // } else if (event.event == SubmenuIndexInjectionMode) { + // BadUsbScriptMode hid_mode = bad_usb_script_get_hid_mode(bad_usb->bad_usb_script); + // if (hid_mode == BadUsbScriptModeUSB) { + // bad_usb_script_set_hid_mode(bad_usb->bad_usb_script, BadUsbScriptModeBLE); + // } else { + // bad_usb_script_set_hid_mode(bad_usb->bad_usb_script, BadUsbScriptModeUSB); + // } + // scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfig); + // } else if (event.event == SubmenuIndexBleConfig) { + // //scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBleHid); + // } else { + // furi_crash("Unknown key type"); + // } + // } + + // return consumed; + furi_assert(context); BadUsbApp* bad_usb = context; bool consumed = false; + char debug_buf[256]; + F_DEBUG(bad_usb, "[+] BadUsbSceneConfig on_event\r\n"); if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event); consumed = true; - if(event.event == SubmenuIndexKeyboardLayout) { + if(event.event == BadUsbCustomEventKeyboardLayout) { + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, bad_usb->menu_idx); scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); + } else if(event.event == BadUsbCustomEventModeUSB) { + F_DEBUG(bad_usb, "mode usb triggered !\r\n"); + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, bad_usb->menu_idx); + bad_usb->mode = BadUsbModeUSB; + } else if (event.event == BadUsbCustomEventModeBLE) { + F_DEBUG(bad_usb, "mode ble triggered !\r\n"); + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, bad_usb->menu_idx); + bad_usb->mode = BadUsbModeBLE; + } else if (event.event == BadUsbCustomEventModeUART) { + F_DEBUG(bad_usb, "mode uart triggered !\r\n"); + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, bad_usb->menu_idx); + bad_usb->mode = BadUsbModeUART; + } else if (event.event == BadUsbCustomEventConfigBle) { + //scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBleHid); } else { furi_crash("Unknown key type"); } + } else if(event.type == SceneManagerEventTypeTick) { + bad_usb->menu_idx = variable_item_list_get_selected_item_index(bad_usb->variable_item_list); + snprintf(debug_buf, sizeof(debug_buf), "menu_idx: %d\r\n", bad_usb->menu_idx); + F_DEBUG(bad_usb, debug_buf); + consumed = true; } + F_DEBUG(bad_usb, "[-] BadUsbSceneConfig on_event\r\n"); return consumed; } void bad_usb_scene_config_on_exit(void* context) { BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; + //Submenu* submenu = bad_usb->submenu; + + //submenu_reset(submenu); + + VariableItemList *item_list = bad_usb->variable_item_list; + variable_item_list_reset(item_list); - submenu_reset(submenu); } diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.h b/applications/main/bad_usb/scenes/bad_usb_scene_config.h index 423aedc51..f2af3bfcc 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.h +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config.h @@ -3,3 +3,5 @@ ADD_SCENE(bad_usb, work, Work) ADD_SCENE(bad_usb, error, Error) ADD_SCENE(bad_usb, config, Config) ADD_SCENE(bad_usb, config_layout, ConfigLayout) +// BLE HID config +// ADD_SCENE(bad_usb, config_ble_hid, ConfigBleHid) diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_error.c b/applications/main/bad_usb/scenes/bad_usb_scene_error.c index 866339513..686f71147 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_error.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_error.c @@ -1,8 +1,8 @@ #include "../bad_usb_app_i.h" -typedef enum { - BadUsbCustomEventErrorBack, -} BadUsbCustomEvent; +// typedef enum { +// BadUsbCustomEventErrorBack, +// } BadUsbCustomEvent; static void bad_usb_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_work.c b/applications/main/bad_usb/scenes/bad_usb_scene_work.c index 2971c01e9..e5ed52e93 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_work.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_work.c @@ -19,7 +19,7 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig); consumed = true; } else if(event.event == InputKeyOk) { - bad_usb_script_toggle(app->bad_usb_script); + bad_usb_script_toggle(app->bad_usb_script, app->mode); consumed = true; } } else if(event.type == SceneManagerEventTypeTick) { diff --git a/applications/main/gpio/scenes/gpio_scene_start.c b/applications/main/gpio/scenes/gpio_scene_start.c index 08b77238f..c06d7b5c6 100644 --- a/applications/main/gpio/scenes/gpio_scene_start.c +++ b/applications/main/gpio/scenes/gpio_scene_start.c @@ -1,3 +1,6 @@ +#ifndef __GPIO_SCENE_START_H__ +#define __GPIO_SCENE_START_H__ + #include "../gpio_app_i.h" #include "furi_hal_power.h" #include "furi_hal_usb.h" @@ -35,7 +38,8 @@ static void gpio_scene_start_var_list_enter_callback(void* context, uint32_t ind } } -static void gpio_scene_start_var_list_change_callback(VariableItem* item) { +static void +gpio_scene_start_var_list_change_callback(VariableItem* item) { GpioApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); @@ -117,3 +121,5 @@ void gpio_scene_start_on_exit(void* context) { GpioApp* app = context; variable_item_list_reset(app->var_item_list); } + +#endif // __GPIO_SCENE_START_H__ \ No newline at end of file diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 8ef037d6b..9f166e154 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -313,7 +313,7 @@ static void gap_init_svc(Gap* gap) { // Initialize GATT interface aci_gatt_init(); // Initialize GAP interface - // Skip fist symbol AD_TYPE_COMPLETE_LOCAL_NAME + // Skip first symbol AD_TYPE_COMPLETE_LOCAL_NAME char* name = gap->service.adv_name + 1; aci_gap_init( GAP_PERIPHERAL_ROLE, diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index 0857fe4ee..6dfbe5880 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -73,7 +73,7 @@ FuriHalBtProfileConfig profile_config[FuriHalBtProfileNumber] = { .supervisor_timeout = 0, }, }, - }, + } }; FuriHalBtProfileConfig* current_profile = NULL; diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c index ab3855f42..5b5a90ed7 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c @@ -139,9 +139,24 @@ void furi_hal_bt_hid_start() { hid_svc_start(); } // Configure HID Keyboard - kb_report = malloc(sizeof(FuriHalBtHidKbReport)); - mouse_report = malloc(sizeof(FuriHalBtHidMouseReport)); - consumer_report = malloc(sizeof(FuriHalBtHidConsumerReport)); + // + // this will also be called by Bad-usb now, so we need to prevent memory leak + // I dont know for now, how apps and mains interacts together, so lets add some + // protection in case a crash in one doesn't affect the other + if(kb_report) + memset(kb_report, 0, sizeof(FuriHalBtHidKbReport)); + else + kb_report = malloc(sizeof(FuriHalBtHidKbReport)); + + if(mouse_report) + memset(mouse_report, 0, sizeof(FuriHalBtHidMouseReport)); + else + mouse_report = malloc(sizeof(FuriHalBtHidMouseReport)); + if(consumer_report) + memset(consumer_report, 0, sizeof(FuriHalBtHidConsumerReport)); + else + consumer_report = malloc(sizeof(FuriHalBtHidConsumerReport)); + // Configure Report Map characteristic hid_svc_update_report_map( furi_hal_bt_hid_report_map_data, sizeof(furi_hal_bt_hid_report_map_data)); From b0c2cba2a05000c5fddbb977281d82fcfa104c7a Mon Sep 17 00:00:00 2001 From: yocvito Date: Thu, 5 Jan 2023 14:20:02 +0100 Subject: [PATCH 02/36] Adds basic bad BLE app (cannot modify adv name yet, cannot efficiently send keys with harcoded timeouts between press/release) --- applications/main/bad_ble/application.fam | 18 + applications/main/bad_ble/bad_ble_app.c | 161 ++++ applications/main/bad_ble/bad_ble_app.h | 11 + applications/main/bad_ble/bad_ble_app_i.h | 50 ++ applications/main/bad_ble/bad_ble_script.c | 783 ++++++++++++++++++ applications/main/bad_ble/bad_ble_script.h | 49 ++ .../main/bad_ble/bad_ble_settings_filename.h | 3 + applications/main/bad_ble/badusb_10px.png | Bin 0 -> 576 bytes .../bad_ble/images/ActiveConnection_50x64.png | Bin 0 -> 3842 bytes .../main/bad_ble/images/Clock_18x18.png | Bin 0 -> 1083 bytes .../main/bad_ble/images/Error_18x18.png | Bin 0 -> 1083 bytes .../main/bad_ble/images/EviSmile1_18x21.png | Bin 0 -> 3645 bytes .../main/bad_ble/images/EviSmile2_18x21.png | Bin 0 -> 3649 bytes .../main/bad_ble/images/EviWaiting1_18x21.png | Bin 0 -> 13020 bytes .../main/bad_ble/images/EviWaiting2_18x21.png | Bin 0 -> 12913 bytes .../main/bad_ble/images/Percent_10x14.png | Bin 0 -> 3624 bytes .../main/bad_ble/images/SDQuestion_35x43.png | Bin 0 -> 1950 bytes .../main/bad_ble/images/Smile_18x18.png | Bin 0 -> 1080 bytes .../main/bad_ble/images/UsbTree_48x22.png | Bin 0 -> 3653 bytes .../main/bad_ble/images/badusb_10px.png | Bin 0 -> 576 bytes .../main/bad_ble/images/keyboard_10px.png | Bin 0 -> 147 bytes .../main/bad_ble/scenes/bad_ble_scene.c | 30 + .../main/bad_ble/scenes/bad_ble_scene.h | 29 + .../bad_ble/scenes/bad_ble_scene_config.c | 52 ++ .../bad_ble/scenes/bad_ble_scene_config.h | 5 + .../scenes/bad_ble_scene_config_layout.c | 47 ++ .../main/bad_ble/scenes/bad_ble_scene_error.c | 83 ++ .../scenes/bad_ble_scene_file_select.c | 51 ++ .../main/bad_ble/scenes/bad_ble_scene_work.c | 54 ++ applications/main/bad_ble/switch_ble.py | 24 + .../main/bad_ble/views/bad_ble_view.c | 237 ++++++ .../main/bad_ble/views/bad_ble_view.h | 21 + 32 files changed, 1708 insertions(+) create mode 100644 applications/main/bad_ble/application.fam create mode 100644 applications/main/bad_ble/bad_ble_app.c create mode 100644 applications/main/bad_ble/bad_ble_app.h create mode 100644 applications/main/bad_ble/bad_ble_app_i.h create mode 100644 applications/main/bad_ble/bad_ble_script.c create mode 100644 applications/main/bad_ble/bad_ble_script.h create mode 100644 applications/main/bad_ble/bad_ble_settings_filename.h create mode 100644 applications/main/bad_ble/badusb_10px.png create mode 100644 applications/main/bad_ble/images/ActiveConnection_50x64.png create mode 100644 applications/main/bad_ble/images/Clock_18x18.png create mode 100644 applications/main/bad_ble/images/Error_18x18.png create mode 100644 applications/main/bad_ble/images/EviSmile1_18x21.png create mode 100644 applications/main/bad_ble/images/EviSmile2_18x21.png create mode 100644 applications/main/bad_ble/images/EviWaiting1_18x21.png create mode 100644 applications/main/bad_ble/images/EviWaiting2_18x21.png create mode 100644 applications/main/bad_ble/images/Percent_10x14.png create mode 100644 applications/main/bad_ble/images/SDQuestion_35x43.png create mode 100644 applications/main/bad_ble/images/Smile_18x18.png create mode 100644 applications/main/bad_ble/images/UsbTree_48x22.png create mode 100644 applications/main/bad_ble/images/badusb_10px.png create mode 100644 applications/main/bad_ble/images/keyboard_10px.png create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene.c create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene.h create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config.c create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config.h create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_error.c create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_file_select.c create mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_work.c create mode 100644 applications/main/bad_ble/switch_ble.py create mode 100644 applications/main/bad_ble/views/bad_ble_view.c create mode 100644 applications/main/bad_ble/views/bad_ble_view.h diff --git a/applications/main/bad_ble/application.fam b/applications/main/bad_ble/application.fam new file mode 100644 index 000000000..ac4106eac --- /dev/null +++ b/applications/main/bad_ble/application.fam @@ -0,0 +1,18 @@ +App( + appid="bad_ble", + name="Bad BLE", + apptype=FlipperAppType.EXTERNAL, + entry_point="bad_ble_app", + cdefines=["APP_BAD_BLE"], + requires=[ + "gui", + "dialogs", + ], + stack_size=2 * 1024, + # icon="A_BadUsb_14", + order=70, + fap_category="Main", + fap_icon="badusb_10px.png", + fap_icon_assets="images", + fap_libs=["assets"], +) diff --git a/applications/main/bad_ble/bad_ble_app.c b/applications/main/bad_ble/bad_ble_app.c new file mode 100644 index 000000000..47ea7b4d5 --- /dev/null +++ b/applications/main/bad_ble/bad_ble_app.c @@ -0,0 +1,161 @@ +#include "bad_ble_app_i.h" +#include "bad_ble_settings_filename.h" +#include +#include +#include +#include + +#include +#include + +#define BAD_BLE_SETTINGS_PATH BAD_BLE_APP_BASE_FOLDER "/" BAD_BLE_SETTINGS_FILE_NAME + +static bool bad_ble_app_custom_event_callback(void* context, uint32_t event) { + furi_assert(context); + BadBleApp* app = context; + return scene_manager_handle_custom_event(app->scene_manager, event); +} + +static bool bad_ble_app_back_event_callback(void* context) { + furi_assert(context); + BadBleApp* app = context; + return scene_manager_handle_back_event(app->scene_manager); +} + +static void bad_ble_app_tick_event_callback(void* context) { + furi_assert(context); + BadBleApp* app = context; + scene_manager_handle_tick_event(app->scene_manager); +} + +static void bad_ble_load_settings(BadBleApp* app) { + File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + if(storage_file_open(settings_file, BAD_BLE_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { + char chr; + while((storage_file_read(settings_file, &chr, 1) == 1) && + !storage_file_eof(settings_file) && !isspace(chr)) { + furi_string_push_back(app->keyboard_layout, chr); + } + } + storage_file_close(settings_file); + storage_file_free(settings_file); +} + +static void bad_ble_save_settings(BadBleApp* app) { + File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + if(storage_file_open(settings_file, BAD_BLE_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) { + storage_file_write( + settings_file, + furi_string_get_cstr(app->keyboard_layout), + furi_string_size(app->keyboard_layout)); + storage_file_write(settings_file, "\n", 1); + } + storage_file_close(settings_file); + storage_file_free(settings_file); +} + +BadBleApp* bad_ble_app_alloc(char* arg) { + BadBleApp* app = malloc(sizeof(BadBleApp)); + + app->bad_ble_script = NULL; + + app->file_path = furi_string_alloc(); + app->keyboard_layout = furi_string_alloc(); + if(arg && strlen(arg)) { + furi_string_set(app->file_path, arg); + } + + bad_ble_load_settings(app); + + app->gui = furi_record_open(RECORD_GUI); + app->notifications = furi_record_open(RECORD_NOTIFICATION); + app->dialogs = furi_record_open(RECORD_DIALOGS); + + app->view_dispatcher = view_dispatcher_alloc(); + view_dispatcher_enable_queue(app->view_dispatcher); + + app->scene_manager = scene_manager_alloc(&bad_ble_scene_handlers, app); + + view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + view_dispatcher_set_tick_event_callback( + app->view_dispatcher, bad_ble_app_tick_event_callback, 500); + view_dispatcher_set_custom_event_callback( + app->view_dispatcher, bad_ble_app_custom_event_callback); + view_dispatcher_set_navigation_event_callback( + app->view_dispatcher, bad_ble_app_back_event_callback); + + // Custom Widget + app->widget = widget_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadBleAppViewError, widget_get_view(app->widget)); + + app->submenu = submenu_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadBleAppViewConfig, submenu_get_view(app->submenu)); + + app->bad_ble_view = bad_ble_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadBleAppViewWork, bad_ble_get_view(app->bad_ble_view)); + + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + + Bt* bt = furi_record_open(RECORD_BT); + app->bt = bt; + if(!furi_string_empty(app->file_path)) { + app->bad_ble_script = bad_ble_script_open(app->file_path, bt); + bad_ble_script_set_keyboard_layout(app->bad_ble_script, app->keyboard_layout); + scene_manager_next_scene(app->scene_manager, BadBleSceneWork); + } else { + furi_string_set(app->file_path, BAD_BLE_APP_BASE_FOLDER); + scene_manager_next_scene(app->scene_manager, BadBleSceneFileSelect); + } + + return app; +} + +void bad_ble_app_free(BadBleApp* app) { + furi_assert(app); + + if(app->bad_ble_script) { + bad_ble_script_close(app->bad_ble_script); + app->bad_ble_script = NULL; + } + + // Views + view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewWork); + bad_ble_free(app->bad_ble_view); + + // Custom Widget + view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewError); + widget_free(app->widget); + + // Submenu + view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewConfig); + submenu_free(app->submenu); + + // View dispatcher + view_dispatcher_free(app->view_dispatcher); + scene_manager_free(app->scene_manager); + + // Close records + furi_record_close(RECORD_GUI); + furi_record_close(RECORD_NOTIFICATION); + furi_record_close(RECORD_DIALOGS); + furi_record_close(RECORD_BT); + + bad_ble_save_settings(app); + + furi_string_free(app->file_path); + furi_string_free(app->keyboard_layout); + + free(app); +} + +int32_t bad_ble_app(void* p) { + BadBleApp* bad_ble_app = bad_ble_app_alloc((char*)p); + + view_dispatcher_run(bad_ble_app->view_dispatcher); + + bad_ble_app_free(bad_ble_app); + return 0; +} diff --git a/applications/main/bad_ble/bad_ble_app.h b/applications/main/bad_ble/bad_ble_app.h new file mode 100644 index 000000000..11954836e --- /dev/null +++ b/applications/main/bad_ble/bad_ble_app.h @@ -0,0 +1,11 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct BadBleApp BadBleApp; + +#ifdef __cplusplus +} +#endif diff --git a/applications/main/bad_ble/bad_ble_app_i.h b/applications/main/bad_ble/bad_ble_app_i.h new file mode 100644 index 000000000..1fd172988 --- /dev/null +++ b/applications/main/bad_ble/bad_ble_app_i.h @@ -0,0 +1,50 @@ +#pragma once + +#include "bad_ble_app.h" +#include "scenes/bad_ble_scene.h" +#include "bad_ble_script.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "views/bad_ble_view.h" + +#define BAD_BLE_APP_BASE_FOLDER ANY_PATH("BadUsb") +#define BAD_BLE_APP_PATH_LAYOUT_FOLDER BAD_BLE_APP_BASE_FOLDER "/layouts" +#define BAD_BLE_APP_SCRIPT_EXTENSION ".txt" +#define BAD_BLE_APP_LAYOUT_EXTENSION ".kl" + +typedef enum { + BadBleAppErrorNoFiles, + BadBleAppErrorCloseRpc, +} BadBleAppError; + +struct BadBleApp { + Gui* gui; + ViewDispatcher* view_dispatcher; + SceneManager* scene_manager; + NotificationApp* notifications; + DialogsApp* dialogs; + Widget* widget; + Submenu* submenu; + + BadBleAppError error; + FuriString* file_path; + FuriString* keyboard_layout; + BadBle* bad_ble_view; + BadBleScript* bad_ble_script; + + Bt* bt; +}; + +typedef enum { + BadBleAppViewError, + BadBleAppViewWork, + BadBleAppViewConfig, +} BadBleAppView; \ No newline at end of file diff --git a/applications/main/bad_ble/bad_ble_script.c b/applications/main/bad_ble/bad_ble_script.c new file mode 100644 index 000000000..6489b54f7 --- /dev/null +++ b/applications/main/bad_ble/bad_ble_script.c @@ -0,0 +1,783 @@ +#include +#include +#include +#include +#include +#include +#include +#include "bad_ble_script.h" +#include + +#include + +#define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") + +#define TAG "BadBle" +#define WORKER_TAG TAG "Worker" +#define FILE_BUFFER_LEN 16 + +#define SCRIPT_STATE_ERROR (-1) +#define SCRIPT_STATE_END (-2) +#define SCRIPT_STATE_NEXT_LINE (-3) + +#define BADBLE_ASCII_TO_KEY(script, x) \ + (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE) + +typedef enum { + WorkerEvtToggle = (1 << 0), + WorkerEvtEnd = (1 << 1), + WorkerEvtConnect = (1 << 2), + WorkerEvtDisconnect = (1 << 3), +} WorkerEvtFlags; + + +typedef enum { + LevelRssi122_100, + LevelRssi99_80, + LevelRssi79_60, + LevelRssi59_40, + LevelRssi39_0, + LevelRssiNum, +} LevelRssiDelays; + +const uint8_t bt_hid_delays[LevelRssiNum] = { + 75, // LevelRssi122_100 + 50, // LevelRssi99_80 + 35, // LevelRssi79_60 + 25, // LevelRssi59_40 + 10, // LevelRssi39_0 +}; + +struct BadBleScript { + BadBleState st; + FuriString* file_path; + uint32_t defdelay; + uint16_t layout[128]; + FuriThread* thread; + uint8_t file_buf[FILE_BUFFER_LEN + 1]; + uint8_t buf_start; + uint8_t buf_len; + bool file_end; + FuriString* line; + + FuriString* line_prev; + uint32_t repeat_cnt; + + File* debug_file; + Bt* bt; +}; + +typedef struct { + char* name; + uint16_t keycode; +} DuckyKey; + +static const DuckyKey ducky_keys[] = { + {"CTRL-ALT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_ALT}, + {"CTRL-SHIFT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT}, + {"ALT-SHIFT", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT}, + {"ALT-GUI", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_GUI}, + {"GUI-SHIFT", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT}, + + {"CTRL", KEY_MOD_LEFT_CTRL}, + {"CONTROL", KEY_MOD_LEFT_CTRL}, + {"SHIFT", KEY_MOD_LEFT_SHIFT}, + {"ALT", KEY_MOD_LEFT_ALT}, + {"GUI", KEY_MOD_LEFT_GUI}, + {"WINDOWS", KEY_MOD_LEFT_GUI}, + + {"DOWNARROW", HID_KEYBOARD_DOWN_ARROW}, + {"DOWN", HID_KEYBOARD_DOWN_ARROW}, + {"LEFTARROW", HID_KEYBOARD_LEFT_ARROW}, + {"LEFT", HID_KEYBOARD_LEFT_ARROW}, + {"RIGHTARROW", HID_KEYBOARD_RIGHT_ARROW}, + {"RIGHT", HID_KEYBOARD_RIGHT_ARROW}, + {"UPARROW", HID_KEYBOARD_UP_ARROW}, + {"UP", HID_KEYBOARD_UP_ARROW}, + + {"ENTER", HID_KEYBOARD_RETURN}, + {"BREAK", HID_KEYBOARD_PAUSE}, + {"PAUSE", HID_KEYBOARD_PAUSE}, + {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK}, + {"DELETE", HID_KEYBOARD_DELETE}, + {"BACKSPACE", HID_KEYPAD_BACKSPACE}, + {"END", HID_KEYBOARD_END}, + {"ESC", HID_KEYBOARD_ESCAPE}, + {"ESCAPE", HID_KEYBOARD_ESCAPE}, + {"HOME", HID_KEYBOARD_HOME}, + {"INSERT", HID_KEYBOARD_INSERT}, + {"NUMLOCK", HID_KEYPAD_NUMLOCK}, + {"PAGEUP", HID_KEYBOARD_PAGE_UP}, + {"PAGEDOWN", HID_KEYBOARD_PAGE_DOWN}, + {"PRINTSCREEN", HID_KEYBOARD_PRINT_SCREEN}, + {"SCROLLLOCK", HID_KEYBOARD_SCROLL_LOCK}, + {"SPACE", HID_KEYBOARD_SPACEBAR}, + {"TAB", HID_KEYBOARD_TAB}, + {"MENU", HID_KEYBOARD_APPLICATION}, + {"APP", HID_KEYBOARD_APPLICATION}, + + {"F1", HID_KEYBOARD_F1}, + {"F2", HID_KEYBOARD_F2}, + {"F3", HID_KEYBOARD_F3}, + {"F4", HID_KEYBOARD_F4}, + {"F5", HID_KEYBOARD_F5}, + {"F6", HID_KEYBOARD_F6}, + {"F7", HID_KEYBOARD_F7}, + {"F8", HID_KEYBOARD_F8}, + {"F9", HID_KEYBOARD_F9}, + {"F10", HID_KEYBOARD_F10}, + {"F11", HID_KEYBOARD_F11}, + {"F12", HID_KEYBOARD_F12}, +}; + +static const char ducky_cmd_comment[] = {"REM"}; +static const char ducky_cmd_id[] = {"ID"}; +static const char ducky_cmd_delay[] = {"DELAY "}; +static const char ducky_cmd_string[] = {"STRING "}; +static const char ducky_cmd_defdelay_1[] = {"DEFAULT_DELAY "}; +static const char ducky_cmd_defdelay_2[] = {"DEFAULTDELAY "}; +static const char ducky_cmd_repeat[] = {"REPEAT "}; +static const char ducky_cmd_sysrq[] = {"SYSRQ "}; + +static const char ducky_cmd_altchar[] = {"ALTCHAR "}; +static const char ducky_cmd_altstr_1[] = {"ALTSTRING "}; +static const char ducky_cmd_altstr_2[] = {"ALTCODE "}; + +static const char ducky_cmd_lang[] = {"DUCKY_LANG"}; + +static const uint8_t numpad_keys[10] = { + HID_KEYPAD_0, + HID_KEYPAD_1, + HID_KEYPAD_2, + HID_KEYPAD_3, + HID_KEYPAD_4, + HID_KEYPAD_5, + HID_KEYPAD_6, + HID_KEYPAD_7, + HID_KEYPAD_8, + HID_KEYPAD_9, +}; + +/** + * @brief Wait until there are enough free slots in the keyboard buffer + * + * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) +*/ +static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { + uint32_t start = furi_get_tick(); + uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; + while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { + furi_delay_ms(100); + + if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { + break; + } + } +} + +static bool ducky_get_number(const char* param, uint32_t* val) { + uint32_t value = 0; + if(sscanf(param, "%lu", &value) == 1) { + *val = value; + return true; + } + return false; +} + +static uint32_t ducky_get_command_len(const char* line) { + uint32_t len = strlen(line); + for(uint32_t i = 0; i < len; i++) { + if(line[i] == ' ') return i; + } + return 0; +} + +static bool ducky_is_line_end(const char chr) { + return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); +} + +static void ducky_numlock_on() { + if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); + FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); + furi_delay_ms(25); + furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); + } +} + +static bool ducky_numpad_press(const char num) { + if((num < '0') || (num > '9')) return false; + + uint16_t key = numpad_keys[num - '0']; + bt_hid_hold_while_keyboard_buffer_full(1, -1); + FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); + + furi_hal_bt_hid_kb_press(key); + FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); + furi_delay_ms(25); + furi_hal_bt_hid_kb_release(key); + + return true; +} + +static bool ducky_altchar(const char* charcode) { + uint8_t i = 0; + bool state = false; + + FURI_LOG_I(WORKER_TAG, "char %s", charcode); + + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); + + while(!ducky_is_line_end(charcode[i])) { + state = ducky_numpad_press(charcode[i]); + if(state == false) break; + i++; + } + + furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT); + return state; +} + +static bool ducky_altstring(const char* param) { + uint32_t i = 0; + bool state = false; + + while(param[i] != '\0') { + if((param[i] < ' ') || (param[i] > '~')) { + i++; + continue; // Skip non-printable chars + } + + char temp_str[4]; + snprintf(temp_str, 4, "%u", param[i]); + + state = ducky_altchar(temp_str); + if(state == false) break; + i++; + } + return state; +} + +static bool ducky_string(BadBleScript* bad_ble, const char* param) { + uint32_t i = 0; + while(param[i] != '\0') { + uint16_t keycode = BADBLE_ASCII_TO_KEY(bad_ble, param[i]); + if(keycode != HID_KEYBOARD_NONE) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(keycode); + FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); + furi_delay_ms(25); + furi_hal_bt_hid_kb_release(keycode); + } + i++; + } + return true; +} + +static uint16_t ducky_get_keycode(BadBleScript* bad_ble, const char* param, bool accept_chars) { + for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) { + size_t key_cmd_len = strlen(ducky_keys[i].name); + if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) && + (ducky_is_line_end(param[key_cmd_len]))) { + return ducky_keys[i].keycode; + } + } + if((accept_chars) && (strlen(param) > 0)) { + return (BADBLE_ASCII_TO_KEY(bad_ble, param[0]) & 0xFF); + } + return 0; +} + +static int32_t + ducky_parse_line(BadBleScript* bad_ble, FuriString* line, char* error, size_t error_len) { + uint32_t line_len = furi_string_size(line); + const char* line_tmp = furi_string_get_cstr(line); + bool state = false; + + if(line_len == 0) { + return SCRIPT_STATE_NEXT_LINE; // Skip empty lines + } + + FURI_LOG_D(WORKER_TAG, "line:%s", line_tmp); + + // General commands + if(strncmp(line_tmp, ducky_cmd_comment, strlen(ducky_cmd_comment)) == 0) { + // REM - comment line + return (0); + } else if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { + // ID - executed in ducky_script_preload + return (0); + } else if(strncmp(line_tmp, ducky_cmd_lang, strlen(ducky_cmd_lang)) == 0) { + // DUCKY_LANG - ignore command to retain compatibility with existing scripts + return (0); + } else if(strncmp(line_tmp, ducky_cmd_delay, strlen(ducky_cmd_delay)) == 0) { + // DELAY + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + uint32_t delay_val = 0; + state = ducky_get_number(line_tmp, &delay_val); + if((state) && (delay_val > 0)) { + return (int32_t)delay_val; + } + if(error != NULL) { + snprintf(error, error_len, "Invalid number %s", line_tmp); + } + return SCRIPT_STATE_ERROR; + } else if( + (strncmp(line_tmp, ducky_cmd_defdelay_1, strlen(ducky_cmd_defdelay_1)) == 0) || + (strncmp(line_tmp, ducky_cmd_defdelay_2, strlen(ducky_cmd_defdelay_2)) == 0)) { + // DEFAULT_DELAY + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + state = ducky_get_number(line_tmp, &bad_ble->defdelay); + if(!state && error != NULL) { + snprintf(error, error_len, "Invalid number %s", line_tmp); + } + return (state) ? (0) : SCRIPT_STATE_ERROR; + } else if(strncmp(line_tmp, ducky_cmd_string, strlen(ducky_cmd_string)) == 0) { + // STRING + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + state = ducky_string(bad_ble, line_tmp); + if(!state && error != NULL) { + snprintf(error, error_len, "Invalid string %s", line_tmp); + } + return (state) ? (0) : SCRIPT_STATE_ERROR; + } else if(strncmp(line_tmp, ducky_cmd_altchar, strlen(ducky_cmd_altchar)) == 0) { + // ALTCHAR + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + ducky_numlock_on(); + state = ducky_altchar(line_tmp); + if(!state && error != NULL) { + snprintf(error, error_len, "Invalid altchar %s", line_tmp); + } + return (state) ? (0) : SCRIPT_STATE_ERROR; + } else if( + (strncmp(line_tmp, ducky_cmd_altstr_1, strlen(ducky_cmd_altstr_1)) == 0) || + (strncmp(line_tmp, ducky_cmd_altstr_2, strlen(ducky_cmd_altstr_2)) == 0)) { + // ALTSTRING + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + ducky_numlock_on(); + state = ducky_altstring(line_tmp); + if(!state && error != NULL) { + snprintf(error, error_len, "Invalid altstring %s", line_tmp); + } + return (state) ? (0) : SCRIPT_STATE_ERROR; + } else if(strncmp(line_tmp, ducky_cmd_repeat, strlen(ducky_cmd_repeat)) == 0) { + // REPEAT + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + state = ducky_get_number(line_tmp, &bad_ble->repeat_cnt); + if(!state && error != NULL) { + snprintf(error, error_len, "Invalid number %s", line_tmp); + } + return (state) ? (0) : SCRIPT_STATE_ERROR; + } else if(strncmp(line_tmp, ducky_cmd_sysrq, strlen(ducky_cmd_sysrq)) == 0) { + // SYSRQ + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + uint16_t key = ducky_get_keycode(bad_ble, line_tmp, true); + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + furi_hal_bt_hid_kb_press(key); + FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); + furi_delay_ms(25); + furi_hal_bt_hid_kb_release(key); + furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + return (0); + } else { + // Special keys + modifiers + uint16_t key = ducky_get_keycode(bad_ble, line_tmp, false); + if(key == HID_KEYBOARD_NONE) { + if(error != NULL) { + snprintf(error, error_len, "No keycode defined for %s", line_tmp); + } + return SCRIPT_STATE_ERROR; + } + if((key & 0xFF00) != 0) { + // It's a modifier key + line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; + key |= ducky_get_keycode(bad_ble, line_tmp, true); + } + FURI_LOG_I(WORKER_TAG, "Special key pressed %x\r\n", key); + furi_hal_bt_hid_kb_press(key); + FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); + furi_delay_ms(25); + furi_hal_bt_hid_kb_release(key); + return (0); + } +} + +static bool ducky_script_preload(BadBleScript* bad_ble, File* script_file) { + uint8_t ret = 0; + uint32_t line_len = 0; + + furi_string_reset(bad_ble->line); + + do { + ret = storage_file_read(script_file, bad_ble->file_buf, FILE_BUFFER_LEN); + for(uint16_t i = 0; i < ret; i++) { + if(bad_ble->file_buf[i] == '\n' && line_len > 0) { + bad_ble->st.line_nb++; + line_len = 0; + } else { + if(bad_ble->st.line_nb == 0) { // Save first line + furi_string_push_back(bad_ble->line, bad_ble->file_buf[i]); + } + line_len++; + } + } + if(storage_file_eof(script_file)) { + if(line_len > 0) { + bad_ble->st.line_nb++; + break; + } + } + } while(ret > 0); + + storage_file_seek(script_file, 0, true); + furi_string_reset(bad_ble->line); + + return true; +} + +static int32_t ducky_script_execute_next(BadBleScript* bad_ble, File* script_file) { + int32_t delay_val = 0; + + if(bad_ble->repeat_cnt > 0) { + bad_ble->repeat_cnt--; + delay_val = ducky_parse_line( + bad_ble, bad_ble->line_prev, bad_ble->st.error, sizeof(bad_ble->st.error)); + if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line + return 0; + } else if(delay_val < 0) { // Script error + bad_ble->st.error_line = bad_ble->st.line_cur - 1; + FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_ble->st.line_cur - 1U); + return SCRIPT_STATE_ERROR; + } else { + return (delay_val + bad_ble->defdelay); + } + } + + furi_string_set(bad_ble->line_prev, bad_ble->line); + furi_string_reset(bad_ble->line); + + while(1) { + if(bad_ble->buf_len == 0) { + bad_ble->buf_len = storage_file_read(script_file, bad_ble->file_buf, FILE_BUFFER_LEN); + if(storage_file_eof(script_file)) { + if((bad_ble->buf_len < FILE_BUFFER_LEN) && (bad_ble->file_end == false)) { + bad_ble->file_buf[bad_ble->buf_len] = '\n'; + bad_ble->buf_len++; + bad_ble->file_end = true; + } + } + + bad_ble->buf_start = 0; + if(bad_ble->buf_len == 0) return SCRIPT_STATE_END; + } + for(uint8_t i = bad_ble->buf_start; i < (bad_ble->buf_start + bad_ble->buf_len); i++) { + if(bad_ble->file_buf[i] == '\n' && furi_string_size(bad_ble->line) > 0) { + bad_ble->st.line_cur++; + bad_ble->buf_len = bad_ble->buf_len + bad_ble->buf_start - (i + 1); + bad_ble->buf_start = i + 1; + furi_string_trim(bad_ble->line); + delay_val = ducky_parse_line( + bad_ble, bad_ble->line, bad_ble->st.error, sizeof(bad_ble->st.error)); + if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line + return 0; + } else if(delay_val < 0) { + bad_ble->st.error_line = bad_ble->st.line_cur; + if(delay_val == SCRIPT_STATE_NEXT_LINE) { + snprintf( + bad_ble->st.error, sizeof(bad_ble->st.error), "Forbidden empty line"); + FURI_LOG_E( + WORKER_TAG, "Forbidden empty line at line %u", bad_ble->st.line_cur); + } else { + FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_ble->st.line_cur); + } + return SCRIPT_STATE_ERROR; + } else { + return (delay_val + bad_ble->defdelay); + } + } else { + furi_string_push_back(bad_ble->line, bad_ble->file_buf[i]); + } + } + bad_ble->buf_len = 0; + if(bad_ble->file_end) return SCRIPT_STATE_END; + } + + return 0; +} + +static void bad_ble_hid_state_callback(BtStatus status, void* context) { + furi_assert(context); + BadBleScript* bad_ble = (BadBleScript*)context; + bool state = (status == BtStatusConnected); + + if(state == true) + furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtConnect); + else + furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtDisconnect); +} + +static int32_t bad_ble_worker(void* context) { + BadBleScript* bad_ble = context; + + BadBleWorkerState worker_state = BadBleStateInit; + int32_t delay_val = 0; + + // init ble hid + bt_disconnect(bad_ble->bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_storage_path(bad_ble->bt, HID_BT_KEYS_STORAGE_PATH); + + //bt_set_adv_name(bad_ble->bt, "Keyboard K99"); + + furi_hal_bt_modify_profile_adv_name("Keyboard K99", BtProfileHidKeyboard); + + if(!bt_set_profile(bad_ble->bt, BtProfileHidKeyboard)) { + FURI_LOG_E(TAG, "Failed to switch to HID profile"); + return -1; + } + + furi_hal_bt_start_advertising(); + + FURI_LOG_I(WORKER_TAG, "Init"); + File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + bad_ble->line = furi_string_alloc(); + bad_ble->line_prev = furi_string_alloc(); + + bt_set_status_changed_callback(bad_ble->bt, bad_ble_hid_state_callback, bad_ble); + while(1) { + if(worker_state == BadBleStateInit) { // State: initialization + if(storage_file_open( + script_file, + furi_string_get_cstr(bad_ble->file_path), + FSAM_READ, + FSOM_OPEN_EXISTING)) { + if((ducky_script_preload(bad_ble, script_file)) && (bad_ble->st.line_nb > 0)) { + worker_state = BadBleStateNotConnected; // Ready to run + } else { + worker_state = BadBleStateScriptError; // Script preload error + } + } else { + FURI_LOG_E(WORKER_TAG, "File open error"); + worker_state = BadBleStateFileError; // File open error + } + bad_ble->st.state = worker_state; + + } else if(worker_state == BadBleStateNotConnected) { // State: ble not connected + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, + FuriFlagWaitAny, + FuriWaitForever); + furi_check((flags & FuriFlagError) == 0); + if(flags & WorkerEvtEnd) { + break; + } else if(flags & WorkerEvtConnect) { + worker_state = BadBleStateIdle; // Ready to run + } else if(flags & WorkerEvtToggle) { + worker_state = BadBleStateWillRun; // Will run when ble is connected + } + bad_ble->st.state = worker_state; + + } else if(worker_state == BadBleStateIdle) { // State: ready to start + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, + FuriFlagWaitAny, + FuriWaitForever); + furi_check((flags & FuriFlagError) == 0); + if(flags & WorkerEvtEnd) { + break; + } else if(flags & WorkerEvtToggle) { // Start executing script + DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); + delay_val = 0; + bad_ble->buf_len = 0; + bad_ble->st.line_cur = 0; + bad_ble->defdelay = 0; + bad_ble->repeat_cnt = 0; + bad_ble->file_end = false; + storage_file_seek(script_file, 0, true); + worker_state = BadBleStateRunning; + } else if(flags & WorkerEvtDisconnect) { + worker_state = BadBleStateNotConnected; // ble disconnected + } + bad_ble->st.state = worker_state; + + } else if(worker_state == BadBleStateWillRun) { // State: start on connection + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, + FuriFlagWaitAny, + FuriWaitForever); + furi_check((flags & FuriFlagError) == 0); + if(flags & WorkerEvtEnd) { + break; + } else if(flags & WorkerEvtConnect) { // Start executing script + DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); + delay_val = 0; + bad_ble->buf_len = 0; + bad_ble->st.line_cur = 0; + bad_ble->defdelay = 0; + bad_ble->repeat_cnt = 0; + bad_ble->file_end = false; + storage_file_seek(script_file, 0, true); + // extra time for PC to recognize Flipper as keyboard + furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); + worker_state = BadBleStateRunning; + } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution + worker_state = BadBleStateNotConnected; + } + bad_ble->st.state = worker_state; + + } else if(worker_state == BadBleStateRunning) { // State: running + uint16_t delay_cur = (delay_val > 1000) ? (1000) : (delay_val); + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, FuriFlagWaitAny, delay_cur); + delay_val -= delay_cur; + if(!(flags & FuriFlagError)) { + if(flags & WorkerEvtEnd) { + break; + } else if(flags & WorkerEvtToggle) { + worker_state = BadBleStateIdle; // Stop executing script + furi_hal_bt_hid_kb_release_all(); + } else if(flags & WorkerEvtDisconnect) { + worker_state = BadBleStateNotConnected; // ble disconnected + furi_hal_bt_hid_kb_release_all(); + } + bad_ble->st.state = worker_state; + continue; + } else if( + (flags == (unsigned)FuriFlagErrorTimeout) || + (flags == (unsigned)FuriFlagErrorResource)) { + if(delay_val > 0) { + bad_ble->st.delay_remain--; + continue; + } + bad_ble->st.state = BadBleStateRunning; + delay_val = ducky_script_execute_next(bad_ble, script_file); + if(delay_val == SCRIPT_STATE_ERROR) { // Script error + delay_val = 0; + worker_state = BadBleStateScriptError; + bad_ble->st.state = worker_state; + } else if(delay_val == SCRIPT_STATE_END) { // End of script + delay_val = 0; + worker_state = BadBleStateIdle; + bad_ble->st.state = BadBleStateDone; + furi_hal_bt_hid_kb_release_all(); + continue; + } else if(delay_val > 1000) { + bad_ble->st.state = BadBleStateDelay; // Show long delays + bad_ble->st.delay_remain = delay_val / 1000; + } + } else { + furi_check((flags & FuriFlagError) == 0); + } + + } else if( + (worker_state == BadBleStateFileError) || + (worker_state == BadBleStateScriptError)) { // State: error + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd, FuriFlagWaitAny, FuriWaitForever); // Waiting for exit command + furi_check((flags & FuriFlagError) == 0); + if(flags & WorkerEvtEnd) { + break; + } + } + } + + // release all keys + bt_hid_hold_while_keyboard_buffer_full(6, 3000); + + // stop ble + bt_set_status_changed_callback(bad_ble->bt, NULL, NULL); + + bt_disconnect(bad_ble->bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_default_path(bad_ble->bt); + + if(!bt_set_profile(bad_ble->bt, BtProfileSerial)) { + FURI_LOG_E(TAG, "Failed to switch to Serial profile"); + } + + storage_file_close(script_file); + storage_file_free(script_file); + furi_string_free(bad_ble->line); + furi_string_free(bad_ble->line_prev); + + FURI_LOG_I(WORKER_TAG, "End"); + + return 0; +} + +static void bad_ble_script_set_default_keyboard_layout(BadBleScript* bad_ble) { + furi_assert(bad_ble); + memset(bad_ble->layout, HID_KEYBOARD_NONE, sizeof(bad_ble->layout)); + memcpy(bad_ble->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_ble->layout))); +} + +BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt) { + furi_assert(file_path); + + BadBleScript* bad_ble = malloc(sizeof(BadBleScript)); + bad_ble->file_path = furi_string_alloc(); + furi_string_set(bad_ble->file_path, file_path); + bad_ble_script_set_default_keyboard_layout(bad_ble); + + bad_ble->st.state = BadBleStateInit; + bad_ble->st.error[0] = '\0'; + + bad_ble->bt = bt; + + bad_ble->thread = furi_thread_alloc_ex("BadBleWorker", 2048, bad_ble_worker, bad_ble); + furi_thread_start(bad_ble->thread); + return bad_ble; +} //-V773 + +void bad_ble_script_close(BadBleScript* bad_ble) { + furi_assert(bad_ble); + furi_record_close(RECORD_STORAGE); + furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtEnd); + furi_thread_join(bad_ble->thread); + furi_thread_free(bad_ble->thread); + furi_string_free(bad_ble->file_path); + free(bad_ble); +} + +void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path) { + furi_assert(bad_ble); + + if((bad_ble->st.state == BadBleStateRunning) || (bad_ble->st.state == BadBleStateDelay)) { + // do not update keyboard layout while a script is running + return; + } + + File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); + if(!furi_string_empty(layout_path)) { + if(storage_file_open( + layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { + uint16_t layout[128]; + if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) { + memcpy(bad_ble->layout, layout, sizeof(layout)); + } + } + storage_file_close(layout_file); + } else { + bad_ble_script_set_default_keyboard_layout(bad_ble); + } + storage_file_free(layout_file); +} + +void bad_ble_script_toggle(BadBleScript* bad_ble) { + furi_assert(bad_ble); + furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtToggle); +} + +BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble) { + furi_assert(bad_ble); + return &(bad_ble->st); +} diff --git a/applications/main/bad_ble/bad_ble_script.h b/applications/main/bad_ble/bad_ble_script.h new file mode 100644 index 000000000..f1553e1db --- /dev/null +++ b/applications/main/bad_ble/bad_ble_script.h @@ -0,0 +1,49 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct BadBleScript BadBleScript; + +typedef enum { + BadBleStateInit, + BadBleStateNotConnected, + BadBleStateIdle, + BadBleStateWillRun, + BadBleStateRunning, + BadBleStateDelay, + BadBleStateDone, + BadBleStateScriptError, + BadBleStateFileError, +} BadBleWorkerState; + +typedef struct { + BadBleWorkerState state; + uint16_t line_cur; + uint16_t line_nb; + uint32_t delay_remain; + uint16_t error_line; + char error[64]; +} BadBleState; + +BadBleScript* bad_ble_script_open(FuriString* file_path, Bt *bt); + +void bad_ble_script_close(BadBleScript* bad_ble); + +void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path); + +void bad_ble_script_start(BadBleScript* bad_ble); + +void bad_ble_script_stop(BadBleScript* bad_ble); + +void bad_ble_script_toggle(BadBleScript* bad_ble); + +BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble); + +#ifdef __cplusplus +} +#endif diff --git a/applications/main/bad_ble/bad_ble_settings_filename.h b/applications/main/bad_ble/bad_ble_settings_filename.h new file mode 100644 index 000000000..73245ad5f --- /dev/null +++ b/applications/main/bad_ble/bad_ble_settings_filename.h @@ -0,0 +1,3 @@ +#pragma once + +#define BAD_BLE_SETTINGS_FILE_NAME ".BadBle.settings" diff --git a/applications/main/bad_ble/badusb_10px.png b/applications/main/bad_ble/badusb_10px.png new file mode 100644 index 0000000000000000000000000000000000000000..037474aa3bc9c2e1aca79a68483e69980432bcf5 GIT binary patch literal 576 zcmV-G0>AxEX>4Tx04R}tkv&MmKpe$i(`rSk4t5Z6$WWau6cusQDionYs1;guFuC*#nlvOW zE{=k0!NHHks)LKOt`4q(Aou~|=;Wm6A|?JWDYS_3;J6>}?mh0_0Yan9G%FATG`(u3 z5^*t;T@{0`5D-8=V(6BcWz0!Z5}xDh9zMR_MR}I@xj#prnzI<-6NzV;VOEJZh^IHJ z2Iqa^Fe}O`@j3ChNf#u3C`-Nm{=@yu+qV-Xlle$#1U1~DPPFA zta9Gstd(o5bx;1nP)=W2<~q$0B(R7jND!f*h7!uCB1)@HiiH&I$36VRj$a~|Laq`R zITlcX2HEk0|H1EWt^DMKn-q!zT`#u%F$x5Cfo9#dzmILZc>?&Kfh)c3uQY&}Ptxmc zEph}5Yy%h9ZB5w&E_Z;TCqp)6NAlAY@_FF>jJ_!g4Bi60Yi@6?eVjf3Y3eF@0~{Oz zV+G1y_jq?tXK(+WY4!I5C=YUpXXIhH00006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru<^lu`HWXkp{t5s906j@WK~xyijZi@f05Awj>HlAL zr$MwDdI>{Qf+U53tOUR#xOeyy)jcQo#JNRv)7r6DVVK|+*(cmT+R+EbO(O#X#REG4 O0000&vafZq~f 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 literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/Error_18x18.png b/applications/main/bad_ble/images/Error_18x18.png new file mode 100644 index 0000000000000000000000000000000000000000..16a5a74d96686c9ff2d9d96984a285f3885cffbe GIT binary patch literal 1083 zcmbVLO=#0l91nDeA53H@GKcca5EPcrrb`o6$JVsAu+G{QR&T!My{=(RUY5MA>A)Sl zdD4@f#M8iCym|7VCs7c=gNnj#9z6JU@F>)meoPNz2Ls9f|6cyT-~an|dGX5V(KAOm zjvFl&tO}E3@q0MIzVO5rW@4P?YIKP-Xd4EYn?t0ILD7XPxPl?-ti8fB9GBQ|sx?|G zEtocOMHt(Nk?S)w$IZ+}KD1Xc1$DgQcp3i3(`P(zP=;SlmE@A2#Z9NM8Q`VO#j3rz zY8!~3y$og|lM%R>LJ+wvFEpbJ-{Uoz9$!m5=$X*f4Bro`Rw{!m2{6z_MX+UA2D%|4 zSci7KJ_S@+RU}!H6itw2GijKb1_lq$+y$s%R;>KM89Qb8CZ)b9N$qx9Y$rt$tVoJs z7?P|?swyxGA?$b*MuHbk4jC*Q+JWO!hj<`ngmtn`Gdv5mpM&d{N_)g!IH(k>nG``^ zQbbvD-8iwHbx14tZy5Vpht-acr3wzodSJ7LG$w~&R=k59#fB^z^J?I*uE3T>>~$A= zv}k2`_D4hxGLuL*QZ`HpN(v?gZCb}d+E%e($Qrg470Wh8L!SNcdRo!)nwHX%a#B%p z*|~I9OY7;JrO#Vx(vXMPq8C!=*?8#NVZH}g?Le%V4KSo6s1ni|jzPIeC<&Xy2dXNj zz{L`@9WTDQ6nCkgw1op_1EYLET+l1C>Fg7Np-(rEjMD;|PN}R0nkLjCM1rR3EG3vi zX~a_KYA3hc1AOxR-^6tGo!e{*7ot=XaSLN&)^x7*$R z_;8nL#iBJ=jXt&Rz8&Mh$jFComtIimxkqQi literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/EviSmile1_18x21.png b/applications/main/bad_ble/images/EviSmile1_18x21.png new file mode 100644 index 0000000000000000000000000000000000000000..987af32587ca7fbada8810abd0cabf788c9c04f9 GIT binary patch literal 3645 zcmaJ@c{r49`+jVNvLs6g(}=gS%#5X&jC~n3n8r3LF~(ppOJgu2q@R35_LW|Hk{iz2EPT_xnA^@jUl^U-xyM*Lh#p^&H229c^tPBq$>Y0DzDs z(iFoP#W=47KM&^{EMeUb0D>k&6BD$hi3x~Gqj(T~2>`(8$*>K?#xG0i4=fWz9E`hX zpCFwa{svK}Y|+~Q?uw|GVO>O|po6%?o^+&r?d48EWJct0)}b;_qZ^T@qwLS> z{7~r2dma+Ro|#$uyjC%hKC#})Y!eCFBc>cTp6w0jVj}e5-3l=_$lAurFm4ItATLOC zyy=Z6UmXC<@-P{p^d|=ET#qRLH$d%FKPXl|v=v^CR(1qHaljy0Y+@HzECy&$w`&jw z8ukHCY@fLc0to=%%M3OK0}q9O>7SPRd_Z?We4iB1oxQ(+AGpN@q#Uw1$ZhxvaJ9dL zQRS|A17xub!RovApB)@NF#N{%sWDFKu&9T?C^$ViO>r-Bf(O;Q z8vtZh+Fx(#7{pGDj}DD{O!%^Y)@5({%u>Mm2j&JgD{gZ00;1M!>>ih~u`V8JJ=YWe zYM+8LK#v39HL&8W*(;EBTJS^AN)%IP-B3RB9=btKZolBJT{B8<_bQl$de+y%zo zan4A^c{Q52?ya+itFgTeAdMUAH!3V(373jb@qFU;H+-3|AamngmR~zvOT;-WDch%A zrbHeQ_98p4{p2@)IuLRr8XwjU6ZW|I1$Xx5H8a=iSQ+JdN&FaA+aX39FNZxAAR$|m ziDUC0Rsb4ed#zxvmVc^JOPZufQ?6Q0=Z93HCvn*eGD$BN=nt1SOa74D;qz_h zy{HKgFCBSbV=IJlWrF zu}J!vvnchQ-NkNKI0n_?KN>6T3)8{RHpk+>`P?Cvwa;D|%HPxERUTLCmD6sS^GBKT zk87SI+6*au4;E#=8%ygeq0dJT=SI}%&8^L?8?8FrlHil-QQltik>1?gpxVdkW;ISn z>vpF5Wa6s6RP?UjinwoJ+KV z(HAZ2n6^6&p4Rjtzc8(^HXw~OAU-S}bGYO1qAj@xHoZPAIGsAZV@7ugx1_X0T56MP z-Y+KCb)0@Ym`3++4)CQ`Oyv$~y)CFMcsuFnDeHO9FJnPl>cPp_Cb8szWGP!x-inr?1`qbZys0(?tW~H7c+vxlj!8ZCiyNn$^-#n6$mzMWt zA$9_CF5sNgxwT4pn`i0DnO#s)LvQVw!OEr!u5f(>VYPLVNB^BZ_uZho*Qy>=fd>#( zilJShDWN;pGuMuHq(F76^t}fKX0DIccGn`VkN9y<_@-*6kEYrs(eXuNec3Oi z#wS~wG6VITw4Gvubt3MFB^Mivg@cUIkbO2|d1NcOz4KSnB5cg6vTtRddRkg`Lhtr? zhC||#PXF-`lU1*)Hs=2CGzDxhD$F?P+bGwee6g(Xptd=8MCG!hR$@UyV-vaP=joSt30$JPJ=;6E^NhpABT|VjEGjF% z=+_hTvhiU@YnRU8MJB1I=j(~m_cK$-soW_tYuTy#@rg=rqs|XkXN3x7=WdP3x{ywM zrQZwkUW{%jX?fqmqm9#^In(@t)jNOhXwFhl#zp5QhmFEVrBz>)d%CLo11~HHhs#ME z|H@97u6VA(aP+A(3t1$0{J7j7BjYApUOgV#UuF?#Qc8k^p-plP8~}Nqx7WBqy|2xo<1V{#%S#I9|I49FN~nS-D`c@_qJsq1uV@- z1q%K^^*IN{Fdna0^=y3KxhnGgV#(%HLJeu~murn{+gm3Qwy?mp%*}+YkJpAeESfDk z70nfI#bhWb$O_3+&bzn959Jl-?QMG>>afL}@_RHfura)LvJJc5J-cfqs;#<+S+GE3 zKPq?(uUD*BsAy#(<{qpUw)Tdw%h=@u^_2=Kht>@@(F^UX`1-sLHp}`G!JF%lyK!E?`g>&ZHW(XMcrwiQ&0sc!A)(Qd|4X6eT0@Z@RwA7$bxTY>#OAGY(1LlOIxqHAdrsjVK zA6 z|JD1i#C~>6DglBa_)+|6cuwU!6t_cB;U+W!j!vQ3Q7FE@(}?z>&?$ai6e>tVLtPtm z$O?xilD92~|Abgs!7a&tbQ~E^urx)0IV9>tqC4E&*j!f=3N_QxG}48^%uIBkFqqL% zV_ltNrpJu5pxVE&rWCwCi9n|R#=8F(YyLm6+wDN2aw3}&Xv6@5yE%|EA?HtkM6(LO5a|+qL~awf=45G|=|+pVs9p{%L*!nbYw! zPHVr=lndtk7CX==J2TF>bpz;$-{9P{0hFbwksYJwX0(x54TzuT+16GGDbaY=SluIl z*8wy)F{3dLE6B<4vfMGWLv!?5{($nH!b7Zn`7JGnx`c*hRl8U3%schbr$UN(_W>@C V0A_Pz|1^geur#waEi!h!{2vr@XiES9 literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/EviSmile2_18x21.png b/applications/main/bad_ble/images/EviSmile2_18x21.png new file mode 100644 index 0000000000000000000000000000000000000000..7e28c9f018a0f2cb572e5f5ce1db2e5c71511dd9 GIT binary patch literal 3649 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 NjisGMnc1oH{{vTjXlVcd literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/EviWaiting1_18x21.png b/applications/main/bad_ble/images/EviWaiting1_18x21.png new file mode 100644 index 0000000000000000000000000000000000000000..d39d2173329d5317fc2cdfb18738922a5eeec6fe GIT binary patch literal 13020 zcmeHtWmKEnwswHx6xSBF;u?K@kVKDD&NJqhXVir?y9ON=pw&~ zk#8~-G~}lnI#(G0KvCzbZ;a3dd(peXVYUuVPYXMWuui|;dj7Iu_=m|}) zKfd2B`cT=~j>Q*o?QbIH!9EF#<*ubxm~tsikMg*FHl%EXP?W=a0D-2;lX7mUx>G)jke>E zEvrjV)a^>otnN2y9Pyh#*T2?Hh-0|>tq#2Sao8Ssc>>LGCtV+&yO@nispP4Mhf;li z6#%EeciX6OXgKv)_o4ugB513{c;3>U$e<^p}ZhFcIUstx^$`XB0UXO`Jl?o{4wMC<^` zy29|dDrz3VyIv3cD#kQ(9q2vW>#^*!Z`XR=?)c_W-Q5}4emN%`IgD{w`M%?_*dRi< z5BJ?vT6@;l-Fuq*cAfr+=C49>OOCNsCPOBdT+*6+QKKW_EXN;EQ`79;WhYzgdP1_O zYu;5>9VkOk(i|2U*yTIr@B6kE9YTgBPO+pkU-aWaJCk1Acc@y^pYIDsk=~TSjp-b$%?;Csc*`J1t=oS?4Bi>+!@AwNf1|!>KH`xYGTLYQ(W_= z5Jl3oDiff3U^OApug_=DQ`5al5y!9Ge>SY+$fd}`pDT<%&H~T$a=Y@CL1cc8^yjB7 zjNMy4{3<++EUQ=(Dc$R8=o!-`B%Ei%S1z$xx(7uVs9};KYe$>A=(iDdc}JZnH*2@A zI!-UAZ>~>d7&XhCCL&UvSaTowGO*%_DCGq?A82vMjmxE#*Yo#pLwd%i*@~=|RBi z+oA520ElG2%$M9*k91|%=B zWe7RAr%hk(rm17rUxh$fXSZ#;Nc7}Uxz4d}86Wm)- z%&u_mYqObRe!iX@qf9R{ewaV?DvaDXw*XJ|qeR&{Ar-&AG%l+!Pom+=ucZBniQ{|G zC#2U?5V8-PW{c;aOmtMJm$M&;pjPr=3WPnrasr>Fc&ePgxWkzt16NBqW8)+;3wa)w?E38-wZ8*}g)KVeT$jeH~%^p(3#Lv5XX z9p|f-*4#ZNutG4lOPVlTY$44L>31DD&5O?y;Mi5hHfQ-VsF*NwmoMx``Z$WaDb6rS zUwk^#N3_Xg8BRQmoND!PWmS=9cD(|c`b{AjKa_f-OGl(0Idv1%kt^#?(h#K8$BHqUwabtVLA>j!pg|5rVnybxU2oMbtbK-ZdP)Qhgv>Z!79cwuhON1 z*C_^@2vxRts+8Du*EoLIKW;A2K&aNik zE88qA6QO##+v6WELuu{h~wLUQ_?>i49j8) zSCiwnFSkW}SqaQ#sO#NBd4a})^2N%QbjJ@~S|DVl$`zT$GNUGS8Fsga{aX;$i-LB- z`E<|&df({k6)1G#0Oazz#iPNB^t-@R;RUWL3-O4Vqd)86hyL;dcAo7~?gOfJle;WK zN#^N(>MV%(ketF~QZ;mwMo@t>gE)hbyvsJORM1cfb_w|vs!%wl_k@fnahhx4QQ}~d#Vo!}6HnO2iZbBo38zr`=6*PtQu$U50wmnRJ~)h@ zNuM|Mhx*7lOzUH+wPL_<77AE8^tz8RmN)Cc7Oy}! zL53aVkc35o4#j%^L^wvk%^i=_a7qCks#8`5|3cPUO!K&c+dF8-hCZDP)V6prxt&wC z=!k)%(h$d7CAm*KOEPbJR%C0N7Y64Ps6u}z230J`iS3aR|ZRH zFY946<%nJ=$y)w+U$sfowcZ~1#!mgA8eu%-764}vo=yeL4=QVs zQKx7khN0}X%$cS5_|)5!<{{~ZL!r%zy(rW!Pu9u>ymfhvsKrXVAuDBc$;Ed>=FCfL z8YW*9vWZ7sMJ6TPLKWGmS#}#th~_u6x(x<9N*+lCO&U$egs5c)zZntiMSM7Y7qdE2 zS51)YpBF|+HxNwuTo;vZ;EMKbyuaO3-`%G~jIM)3)Up`huhx|My62s4HamseW@E|V7}Z*3SHUeR zDq-fRl5c-xv*IePj)(%+tiKaqj*x(LpQ}J*`%XCMLkQno?7hs&;=@)1(u!`YQhSaDz!XGjjOluTY7Ktu`xi?%W$Y1ub z^SOy#ym`kuNjBMU*ji7ux(jAC&KuUr;eMl|c){~A|2d0E5Y9eHWsp&E?t8-zcf|n? zgXlKo-?93xs{LGMil&NI(<)xuF@25%tKf-;uk=W!z2P87iOxAGO*&ly2IrtWPsJlr4=3qZ&9xg_6KfkLUZHk56dGtDNM@F*A~5c}AFK=NRRX>`BA438lR5 z1eC5JSr90;00A<5^=nIWXM(5pn)UPS%-)TS`Nr&@HOkZm$3C?S_~t#-ytP67${@B* z-D>3LaUVfU`?S6&sD3h^y{tF1cLVE}wv_Y=+fw2Kdm7UiLCl+U`+OtZWy+<+0(aj$A2n%dd^x$Hf6${c9qLKe8bg}4 z<{Es@a;=|$Kw9lFCPmFO77b&(kJ00JLE}plC;ie+T&$z7mKzLio;P!ju#oyxX}QR6 zI?*tl$BkgENOid z-5S;QdBSWO@z@f@YMYwo3Hd0^Cueql;pD-YIAWVq`N7J{gBtVwt*6^~5Az=->~>Z= z@sx^p> z2v6227*`WEnj%!%h@(Rl3t(8!pyFRXN!->?EFqUXrrut9;30eW9-}+Ne3b9#zBa0S z*D~#R!$vWcEs>m{YPrJuiPn_k1flE{puhh3OOe z;!uZ~E%42!r_5IA=u3-pECQme9C)an47D;olSE%~WWYstzbQZU_aDg~;9j53pOxySm0`l*4IA_D0z!qlNT$sLW$#Z0N& z#_v$`Y1&cctxnllgQj`#>0)?oAB z76evGq%3rWb@TQ2Yj#~8zkCv_-zWGW%QYw9J_EIsQ9;_(2ga@f!|GH~AuD{<<2-zY zHPSsWDyBb#g;j0kGBQAKwq-pT5_dkIoH_7z+AgICyU@^D_P&%#zTM9Jj&&Z2A> zFR{L`?9qgD3SVH~poL9Md>HO-VO%wmQJ;#`)x*oPm>r@JetWt-m#!-!93D~JYr|#V z{XSP%Lqy7|e<+lO>3+c(dvVjs~u z7ptCPHS^Hs>9Ko%QaKFHmg53Pe`sqn~>x-$7xO0JwljTg6?K;Vf#eGk)gGNt`@l#2aTru=^ z%BaVzUTUfp+g7zmW}~`2m%i}L-^mgP9QT4Qee8UWA7N!?a#8WtBdH@HM}vWVY@w5D zRRfO*BB>XSJN4R4p}#!0@bU6ctFqhb5c&66nF?$w%|7|@ms(VcfF&YH=2ZvgIlL&; z@mXft$ewseEV_kpBkd(t!GmX6^o(KK*`J=1vY>Qfj1gYb-YkCjUPq0E$`l&!efG_$ zCmZAsHUSxajuTfu+ty8&9u5U;e$LP^Po657m;PZMJVeyBRW?bE{$7EzBoZb`Xb4{Z z#u!8+*+j1rs!s6kj(EwsK922k>zK>p8!f3*LPmMM>1!sE{$`2H9)Fh&o$@M&3GO|M zRXrM|DAjSiQCTa3eEW=I8*_Yhrg-fPN=|@?Ti}fRWl8unp$%w%Itfw3vsS>OIo5F( z?4c$XLMqy3mAA@GW%@v>wun};X-C9w_$q4i`YTy#NJqT>QvPM;q@-fQ(Sm+R0y?-C z2ShwtpRd{K7a!2O-^PxeKC2@205zLyj$9)KI=TE(SfY7g!S%!1R{3R-*89nzV5h~8 z=@^C&Xm6-}byPm?J|Q$DRX-bK+nhZWVMD&+0}O}EQwr8_eRDZ zKjzAfWd921>c81!U{=Do+rycreq|td)#}~M9V`6OeQjPwd&WmId5Z~x3*G%A+#1@3i6b_`jHaFMG-0UKyDzM z+-M~LM`y_u*JciGA646I=x4I_5(NQNNIqC#ZssZ^I)YWXYyu%@Rs@O9Ng@SZ>2}CtMe!*uSYSp9GH2gG!&hM~Q$2?YFzSJbCrLZlD zF@4LDy)nypwP}54tZFPn_(wB#F)E#t*#0+$y3-D$3C(N z=)ic|xYvUYtYZZOo5ngVZ|pJa2_SU7a+@|KLhleiM2%Gs7&f=OD#cXi4uPUkJvmSD z)G^N<&?S6l*X#4(!u2|vBSO&BOd@11vN$zs!UG8s*RknUrerBDzany4yq@}QriD;u z4X#aLdZ1kFtfcr_zfWM>zklx&Q}&}ABHPbB)NNXsyPHE=n=9pXJlCVEiTze5sc_zApd?<_zP$0ef1;cp$4V0xAfGq$G%-7ZjX#CO zVDkA}J!_eWL%fr&)wU~~yW%pSu=n;l*+hZKlB@TuSbE*^dv+g_Cp95 zefI{|;FhYqSxy{5Q#&I=RRLf012SYEH>COTivztdg*&X;#HvrQk9+*q2HwKTTl( zTjCG2+06J*YKbz4>5C5Bo(W<-qYA5l9NmaQ%z<$bWd(scVx8gL zj4M-AAU!})25npB{w5m9$2%WB64e0+R?tvo*&^?_S@ExgkjA4Z&{L2G)#Oknhm>1A zD8}%}Ap(X9yHX;8AuB*pOrGEYt2>J*x_tOqLG0gf24x7t!g~qHbR!V-^1amW!;Rzb ze?dc+C(@=)#$u6|Q$Zz@*~!r@rY?QDool;kw#kOL*8sRHUz?+2PkcerkU%1TQVD=v(pt?!$FC>>8o?Z*^XG(W=qFs+UkD@4XP(!oVUL4-u0ycj+r@^&S; z1aD?+B8E5d#097hGV}4Y1$6b%DhWlsW~3O3iu~H@$+-P=WZ|oMskw%^!uh2-nA(}e zQj-RgY>#nHh%}TO^M=NTHvtGP5LIRjkCIW&%Tb!ms!gI}(F-z+&|Jtf{y54&b!t|! zD%2{fs{0dhV&PQX&%lM1#$}*s>YeDjUGR6-PW&Hmo)A7Eeu6F@=O4>YwSGQAf9vUZwSd8#l9;}jyiXN8<~#aVWm2xL$W{5zI?-&GY<6rA{jgFk zs9yb~$E4D>$+qZSdBH;TQC)}E)iC?eYId^d=uEY0wJf#Rem639n%w(iXq#Kd0vF&5 zj|*`FZUZfYmTlH4;VI72imCNtpW?$QwaNJ@rOBld!AbwgiOJd$uae~n8HY57Fvl;C zcgIBE93t?Y;|8erUnPn~Y%ETP2@L_6fJXNF6V#)xrpKqhPxOzMj)U?~^k2T+%grop zmcI-;Ex6 z;wUHVCSqbcZUrAAh4c$(2!3+*ox>BZ5_!n~hX1}m#1PFO`g-F~1otSpCb?V;M$CP6 z;)$g64ku`w={R>NH!gQ0SGEb2ahI8M)pqTLy)!J+<&(XC&r@p>dp-LJ$kChfbnclC z-KX>B-_4in-)wk}_`BG-^wcguye6_9(^|!$3F6pRZbsb#B}38 zoNY6`&&QNtf7yZ@blE9cf{>vQ z#WqO>R~4(?)A+`tyBoM0Ug065L8E)QXYJ2AQp5e};;;#DE3gA8!6Z6_W353AR(&C< z=oO63j021Z3h4@}dA|8%`6PKS^B?ti_ayhIK+3I+x-Fw8B1t+udLV20YcE%eC@#1b z>s=+XO&h;zIX@@vVtK`)Ogt9FAH^MYAeQ?IWB7PH=ylD*qB^I2 zo_&%mOc*9C@t~h~LyNhdHRXY%ny1E6mPGn$mTtm#{g34OxLHLPMbocaG;uW+vQOD1 zS(_!%UL>Ts>8lVGVqXf>2p$PUR1H=|R}~Drda-9N%z{HK1eKqQdEeLtoEw=8>Qs1d zDUh+2s+V-cDgruF$%1F`!K~`%zH1CT`0jtyY8hFYPX zMmrTerjjk)u%Y0Zuo?%)K(=ZgE?&QS9$O2o1jDh6yvmb+9kUp+XvHoO;X0?{g~)lf zSL%yvS!x;Hbqy5wT#V%=ul|)Vhhb|iGRr5=#w>kno z2W$mLqWKTS4GnQ;a6`*o-xPR!w`y-2SoRK__|)z623A!2f)+J`If6Fu<@w%8hit@? z=kMaG{q4>zoH1+i3rM!jm&B%0###2_c4(#Uc~{r=ye?XMGH`H4Hz8^0ZvNGK4!b=n zk0e`jJ^PhZipTcW)|UxL^F!Z*S5cDg<-AR>Z%(6gM;m@4nOkSO(mqQkSCzQK6mga| z7P}2!TuaKg?q>OwlU3%M6mv#@_V6B z#1V?1w}#p|xJWV{G`2F*JJ?7v8VPCeX}HQm?HyEn;ZQwaO?`;3BSg%GQCbQ|!W)Dn zaE2nl^xn=+F76<2NycBiAmsJWZeB+EUl4?&B%`s0HoZIy4y6b30D1Vh6}=ri1sJ7p z=q2Dbwjf;vrQa!#ElEau1i}@>%j@Ok#p5N&1B2V~@{5Uy@$w1q3J7o`5!~)RE(owU zw~IT|Pm13-6rk=9xPvRg0p>#glM`$W^FT;4G9t(6ewMUL>X#8RA;{LmeNIiMI!LGdgJbb*)&i`cLj!^Xc zbH2Z|aMwpZhr_E2b%%MtAy7q6s0)JWuamkXbfJH0@;{(J!vBfD)yc#CuZ#9@hyLvP z<+ziLEiclmUrYb%q{^xq+JD&m+y^@cXV+gAKhb|h+Ccumxq85zeqn4Nyig~oGtv`x zBs2d%;gR-#82qg>zsP?n4N`zXJbtpMDo8RSdw6UdY(Pq)3c`X)qM|@SSy6s|MR`#^ zetubDIWbWY1rb>wpU_{-RbAW>U>6AVALb57b0E;h7L1H0ZV1pC$_?ZfwdNMH7U1I+ z;IkIx7Zl)w@&O@#q0oXmAoBt2^mi)}vV{ongCPRkg4RMp+(2u7L2fZH#FiT>Dq;(? z5w)=u6BYPH^;1lcthTBoqW}-zpFP@6V1z9U?kvfu?%?9#{pWzbgELeQ0sbizzp$W) zC=e)$bWB)Oh+p(ikRcTAjtupmocw$|zmM2JKuSnPFf!yEoWXWbURM{pUnWTPK=N=X z7y*Op!(dL5j6c^z|I_qW0?|wSo*E!^7zF$?g?@pdHb1lL_xzFr+wuNtO7Q+G@c+Z4 zXAkpo`JeIp3H^gb7LM?O!5y{WTGo%D5X8Uc`8)6*OuER*=8k~-sQx!j{a-kV-$GFZ zX$yn<{AGSUsM~L?-^!1Z!!N1m>3^j>2n_kDq9mg`*b{2=YYUJ%{x$@$2fNrok+t>r zy!c1I!{3CfAdnAYD+(0l78VhJa3cf3mfKoX%!V5%DgY4@;X~FbVc~yfcZb;`yufg% ztQ|6Oko%0x+h6-k&-N?I*#8;rWe-Izl9Nvm#K*_@+xF5+@ct~H|8P&@XMNDn0R2^f z-!)Ny!X1#_DZydRzkL5ysX#XWbwf%0DogpcYr`$ z++qJ}>3@a%wq1X@`yto-TOabSio8kl{&AQ7JzRfg^#9`P_cZuloB>JwpGp2Leg7lZ zf8_eN6!^Em|B0^u$n|e2@Na?t6J7t`SN77L~l0$9an+)c;9a+DZRZZS8{^eP~v1|B4dJsqoRU?V`GD5l`ss3 nQ0V!FVYmG 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 literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/SDQuestion_35x43.png b/applications/main/bad_ble/images/SDQuestion_35x43.png new file mode 100644 index 0000000000000000000000000000000000000000..9b9c9a58e3257f926677533f8cc99ffb19dd74f5 GIT binary patch literal 1950 zcmcIlTWs7!6g5TAQV0(rqPBcsIS921UeDNG@7i=zCA)d7sMC-vG>8gyJRa{_+4UIP z$!=1i2t*O^Q!1)9DGybMBGF3a6SW|L6h5LVfJD{LegT4thW>zPQHvPws{yrXept!t zv3=&;bMHMf^XAC#V8_NS8##{a$PeX4*}aQh-5b`i|CfLH7_-|w{?PLw$KCsIeBHqv zeQy)T-TjJN7>~xyod%|r1hT0`619rY&>XjYN6klgf<(MUimsOtE`R=|z`J%v*qt1RpF9hwQq*vxPN&rD$57IyUT+iM0RsE`QpwMy9wjao*i^BQa%zm^2P4v8i*LT?<9 zA2&z%EDZ>+C4h(lkolCJfSRgm;7MKvGLS%0g0cuT1E>Z}@y(yWq6M~NjOGTKvDi~a zC`FNPNK&<0O;nWx4T=)fbzK6oB+DX0h~cysp_=H0T`h(j331^1kxM;3W<(a9j4}dK z+DM_|w`skwSteF6sfK(BCP1803uv0FLo1awI*j_KSd^yTn-YhGX`e`=B&3r8CjC>y zi@I9D{1T05SfaPk*8co2g*I*n^e2OIy*xISNSRa^cgV1?uFp5J0YMQB3Y3;xjT&i1 zyC$M##e?pUVhLRKj&_L)9?Wld>u%HCq;SStTN}Y*kccThRe>U`i)-U2J}i z;>oxY@%)BuZHgI3yPAgMs43vsNJP47iHfQ!qLpHl$)u9T2onYB=@#3rz-223l~=OH zs_a-*O3@VL0MW4s7KyDoOqHyNDzSA4a2n~Dsk#w2OUpDcsm-dZtbCu(W=8_*xMlVs z93AZA^Zi*3>Y66X2`KP3HXIsM5Hp%vK}90@UNN>klflv*azobR>E=QjBQG^aWtXqJ z(?B?06d3`>ZXmYMeC^(>%xg-hL0c^mM!Jei8nBQ$Q56NGx5!#@TNg^V5+9y5Z&x22##B&{B?u64ye+M3KZ=XlsY71%@jTp=Dy zHDISkcY5&@J8>5Bx!%I~{^i3@-@m}$cNaW+{nKk_j+x(U>F+k}c?6!^@X+fADi3lO z_rLKG{`yum;ZU>ayk!Z+q>VzZOn^bqQ>?UO0Drz@_TNg$rjt zNcQEpt?wS&gMaKe^8V2SorGL{ZtT%R?yPd~`n9FG(}zAOOPl5My;t&Z3(*F9I?g}- zvp)ag@#QCe{o%9hrGrn+&dpu9`rFcD;MqUV>^-?JG4|Gpeamy-PL6)jzu5T`{Cd7~ fwr}T&J8Rt1;5!ej|9##1_yo=O59dzx?S1thQe1#H literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/images/Smile_18x18.png b/applications/main/bad_ble/images/Smile_18x18.png new file mode 100644 index 0000000000000000000000000000000000000000..d2aae0dc37f4fd3453e3254e4a9cd33e753019b9 GIT binary patch literal 1080 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 O0000gN=z( mnGc5;aHhO3XW%q4U|?wcz_Hx?k)a$=ErX}4pUXO@geCyYPARJZ literal 0 HcmV?d00001 diff --git a/applications/main/bad_ble/scenes/bad_ble_scene.c b/applications/main/bad_ble/scenes/bad_ble_scene.c new file mode 100644 index 000000000..351bb1e79 --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene.c @@ -0,0 +1,30 @@ +#include "bad_ble_scene.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const bad_ble_scene_on_enter_handlers[])(void*) = { +#include "bad_ble_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const bad_ble_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "bad_ble_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const bad_ble_scene_on_exit_handlers[])(void* context) = { +#include "bad_ble_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers bad_ble_scene_handlers = { + .on_enter_handlers = bad_ble_scene_on_enter_handlers, + .on_event_handlers = bad_ble_scene_on_event_handlers, + .on_exit_handlers = bad_ble_scene_on_exit_handlers, + .scene_num = BadBleSceneNum, +}; diff --git a/applications/main/bad_ble/scenes/bad_ble_scene.h b/applications/main/bad_ble/scenes/bad_ble_scene.h new file mode 100644 index 000000000..25b19fc4b --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene.h @@ -0,0 +1,29 @@ +#pragma once + +#include + +// Generate scene id and total number +#define ADD_SCENE(prefix, name, id) BadBleScene##id, +typedef enum { +#include "bad_ble_scene_config.h" + BadBleSceneNum, +} BadBleScene; +#undef ADD_SCENE + +extern const SceneManagerHandlers bad_ble_scene_handlers; + +// Generate scene on_enter handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); +#include "bad_ble_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_event handlers declaration +#define ADD_SCENE(prefix, name, id) \ + bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); +#include "bad_ble_scene_config.h" +#undef ADD_SCENE + +// Generate scene on_exit handlers declaration +#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); +#include "bad_ble_scene_config.h" +#undef ADD_SCENE diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config.c b/applications/main/bad_ble/scenes/bad_ble_scene_config.c new file mode 100644 index 000000000..d1bbac5ee --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config.c @@ -0,0 +1,52 @@ +#include "../bad_ble_app_i.h" +#include "furi_hal_power.h" + +enum SubmenuIndex { + SubmenuIndexKeyboardLayout, +}; + +void bad_ble_scene_config_submenu_callback(void* context, uint32_t index) { + BadBleApp* bad_ble = context; + view_dispatcher_send_custom_event(bad_ble->view_dispatcher, index); +} + +void bad_ble_scene_config_on_enter(void* context) { + BadBleApp* bad_ble = context; + Submenu* submenu = bad_ble->submenu; + + submenu_add_item( + submenu, + "Keyboard layout", + SubmenuIndexKeyboardLayout, + bad_ble_scene_config_submenu_callback, + bad_ble); + + submenu_set_selected_item( + submenu, scene_manager_get_scene_state(bad_ble->scene_manager, BadBleSceneConfig)); + + view_dispatcher_switch_to_view(bad_ble->view_dispatcher, BadBleAppViewConfig); +} + +bool bad_ble_scene_config_on_event(void* context, SceneManagerEvent event) { + BadBleApp* bad_ble = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(bad_ble->scene_manager, BadBleSceneConfig, event.event); + consumed = true; + if(event.event == SubmenuIndexKeyboardLayout) { + scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigLayout); + } else { + furi_crash("Unknown key type"); + } + } + + return consumed; +} + +void bad_ble_scene_config_on_exit(void* context) { + BadBleApp* bad_ble = context; + Submenu* submenu = bad_ble->submenu; + + submenu_reset(submenu); +} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config.h b/applications/main/bad_ble/scenes/bad_ble_scene_config.h new file mode 100644 index 000000000..addd8d9fa --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config.h @@ -0,0 +1,5 @@ +ADD_SCENE(bad_ble, file_select, FileSelect) +ADD_SCENE(bad_ble, work, Work) +ADD_SCENE(bad_ble, error, Error) +ADD_SCENE(bad_ble, config, Config) +ADD_SCENE(bad_ble, config_layout, ConfigLayout) diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c new file mode 100644 index 000000000..aabb1b900 --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c @@ -0,0 +1,47 @@ +#include "../bad_ble_app_i.h" +#include "furi_hal_power.h" +#include + +static bool bad_ble_layout_select(BadBleApp* bad_ble) { + furi_assert(bad_ble); + + FuriString* predefined_path; + predefined_path = furi_string_alloc(); + if(!furi_string_empty(bad_ble->keyboard_layout)) { + furi_string_set(predefined_path, bad_ble->keyboard_layout); + } else { + furi_string_set(predefined_path, BAD_BLE_APP_PATH_LAYOUT_FOLDER); + } + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options( + &browser_options, BAD_BLE_APP_LAYOUT_EXTENSION, &I_keyboard_10px); + + // Input events and views are managed by file_browser + bool res = dialog_file_browser_show( + bad_ble->dialogs, bad_ble->keyboard_layout, predefined_path, &browser_options); + + furi_string_free(predefined_path); + return res; +} + +void bad_ble_scene_config_layout_on_enter(void* context) { + BadBleApp* bad_ble = context; + + if(bad_ble_layout_select(bad_ble)) { + bad_ble_script_set_keyboard_layout(bad_ble->bad_ble_script, bad_ble->keyboard_layout); + } + scene_manager_previous_scene(bad_ble->scene_manager); +} + +bool bad_ble_scene_config_layout_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + // BadBleApp* bad_ble = context; + return false; +} + +void bad_ble_scene_config_layout_on_exit(void* context) { + UNUSED(context); + // BadBleApp* bad_ble = context; +} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_error.c b/applications/main/bad_ble/scenes/bad_ble_scene_error.c new file mode 100644 index 000000000..fb8524eb1 --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_error.c @@ -0,0 +1,83 @@ +#include "../bad_ble_app_i.h" +#include "../../../settings/desktop_settings/desktop_settings_app.h" + +typedef enum { + BadBleCustomEventErrorBack, +} BadBleCustomEvent; + +static void + bad_ble_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { + furi_assert(context); + BadBleApp* app = context; + + if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) { + view_dispatcher_send_custom_event(app->view_dispatcher, BadBleCustomEventErrorBack); + } +} + +void bad_ble_scene_error_on_enter(void* context) { + BadBleApp* app = context; + DesktopSettings* settings = malloc(sizeof(DesktopSettings)); + DESKTOP_SETTINGS_LOAD(settings); + + if(app->error == BadBleAppErrorNoFiles) { + widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43); + widget_add_string_multiline_element( + app->widget, + 81, + 4, + AlignCenter, + AlignTop, + FontSecondary, + "No SD card or\napp data found.\nThis app will not\nwork without\nrequired files."); + widget_add_button_element( + app->widget, GuiButtonTypeLeft, "Back", bad_ble_scene_error_event_callback, app); + } else if(app->error == BadBleAppErrorCloseRpc) { + widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); + if (settings->sfw_mode) { + widget_add_string_multiline_element( + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); + widget_add_string_multiline_element( + app->widget, + 3, + 30, + AlignLeft, + AlignTop, + FontSecondary, + "Disconnect from\nPC or phone to\nuse this function."); + } + else { + widget_add_string_multiline_element( + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "I am not\na whore!"); + widget_add_string_multiline_element( + app->widget, + 3, + 30, + AlignLeft, + AlignTop, + FontSecondary, + "Pull out from\nPC or phone to\nuse me like this."); + } + } + + view_dispatcher_switch_to_view(app->view_dispatcher, BadBleAppViewError); + free(settings); +} + +bool bad_ble_scene_error_on_event(void* context, SceneManagerEvent event) { + BadBleApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == BadBleCustomEventErrorBack) { + view_dispatcher_stop(app->view_dispatcher); + consumed = true; + } + } + return consumed; +} + +void bad_ble_scene_error_on_exit(void* context) { + BadBleApp* app = context; + widget_reset(app->widget); +} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c b/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c new file mode 100644 index 000000000..d60f6a246 --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c @@ -0,0 +1,51 @@ +#include "../bad_ble_app_i.h" +#include "furi_hal_power.h" +#include + +static bool bad_ble_file_select(BadBleApp* bad_ble) { + furi_assert(bad_ble); + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options( + &browser_options, BAD_BLE_APP_SCRIPT_EXTENSION, &I_badusb_10px); + browser_options.base_path = BAD_BLE_APP_BASE_FOLDER; + browser_options.skip_assets = true; + + // Input events and views are managed by file_browser + bool res = dialog_file_browser_show( + bad_ble->dialogs, bad_ble->file_path, bad_ble->file_path, &browser_options); + + return res; +} + +void bad_ble_scene_file_select_on_enter(void* context) { + BadBleApp* bad_ble = context; + + // furi_hal_ble_disable(); + if(bad_ble->bad_ble_script) { + bad_ble_script_close(bad_ble->bad_ble_script); + bad_ble->bad_ble_script = NULL; + } + + if(bad_ble_file_select(bad_ble)) { + bad_ble->bad_ble_script = bad_ble_script_open(bad_ble->file_path, bad_ble->bt); + bad_ble_script_set_keyboard_layout(bad_ble->bad_ble_script, bad_ble->keyboard_layout); + + scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneWork); + } else { + // furi_hal_ble_enable(); + view_dispatcher_stop(bad_ble->view_dispatcher); + } +} + +bool bad_ble_scene_file_select_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + // BadBleApp* bad_ble = context; + return false; +} + +void bad_ble_scene_file_select_on_exit(void* context) { + UNUSED(context); + // BadBleApp* bad_ble = context; +} \ No newline at end of file diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_work.c b/applications/main/bad_ble/scenes/bad_ble_scene_work.c new file mode 100644 index 000000000..a2c009fc3 --- /dev/null +++ b/applications/main/bad_ble/scenes/bad_ble_scene_work.c @@ -0,0 +1,54 @@ +#include "../bad_ble_script.h" +#include "../bad_ble_app_i.h" +#include "../views/bad_ble_view.h" +#include "furi_hal.h" +#include "toolbox/path.h" + +void bad_ble_scene_work_button_callback(InputKey key, void* context) { + furi_assert(context); + BadBleApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, key); +} + +bool bad_ble_scene_work_on_event(void* context, SceneManagerEvent event) { + BadBleApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == InputKeyLeft) { + scene_manager_next_scene(app->scene_manager, BadBleSceneConfig); + consumed = true; + } else if(event.event == InputKeyOk) { + bad_ble_script_toggle(app->bad_ble_script); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeTick) { + bad_ble_set_state(app->bad_ble_view, bad_ble_script_get_state(app->bad_ble_script)); + } + return consumed; +} + +void bad_ble_scene_work_on_enter(void* context) { + BadBleApp* app = context; + + FuriString* file_name; + file_name = furi_string_alloc(); + path_extract_filename(app->file_path, file_name, true); + bad_ble_set_file_name(app->bad_ble_view, furi_string_get_cstr(file_name)); + furi_string_free(file_name); + + FuriString* layout; + layout = furi_string_alloc(); + path_extract_filename(app->keyboard_layout, layout, true); + bad_ble_set_layout(app->bad_ble_view, furi_string_get_cstr(layout)); + furi_string_free(layout); + + bad_ble_set_state(app->bad_ble_view, bad_ble_script_get_state(app->bad_ble_script)); + + bad_ble_set_button_callback(app->bad_ble_view, bad_ble_scene_work_button_callback, app); + view_dispatcher_switch_to_view(app->view_dispatcher, BadBleAppViewWork); +} + +void bad_ble_scene_work_on_exit(void* context) { + UNUSED(context); +} diff --git a/applications/main/bad_ble/switch_ble.py b/applications/main/bad_ble/switch_ble.py new file mode 100644 index 000000000..32ed65492 --- /dev/null +++ b/applications/main/bad_ble/switch_ble.py @@ -0,0 +1,24 @@ +import os +import re + +def analyze_and_replace(directory): + # Recursively search for .c and .h files in the given directory + for root, dirs, files in os.walk(directory): + for file in files: + if file.endswith(".c") or file.endswith(".h"): + # Read the contents of the file + with open(os.path.join(root, file), "r") as f: + contents = f.read() + + # Replace all occurrences of "BadUsb" and "bad_usb" with "BadBle" and "bad_ble" + contents = contents.replace("usb", "ble") + contents = contents.replace("USB", "BLE") + contents = contents.replace("Usb", "Ble") + + + # Write the modified contents back to the file + with open(os.path.join(root, file), "w") as f: + f.write(contents) + +# Test the function with a sample directory +analyze_and_replace(".") diff --git a/applications/main/bad_ble/views/bad_ble_view.c b/applications/main/bad_ble/views/bad_ble_view.c new file mode 100644 index 000000000..fa5c099a5 --- /dev/null +++ b/applications/main/bad_ble/views/bad_ble_view.c @@ -0,0 +1,237 @@ +#include "bad_ble_view.h" +#include "../bad_ble_script.h" +#include +#include +#include +#include "../../../settings/desktop_settings/desktop_settings_app.h" + +#define MAX_NAME_LEN 64 + +struct BadBle { + View* view; + BadBleButtonCallback callback; + void* context; +}; + +typedef struct { + char file_name[MAX_NAME_LEN]; + char layout[MAX_NAME_LEN]; + BadBleState state; + uint8_t anim_frame; +} BadBleModel; + +static void bad_ble_draw_callback(Canvas* canvas, void* _model) { + BadBleModel* model = _model; + + FuriString* disp_str; + disp_str = furi_string_alloc_set(model->file_name); + elements_string_fit_width(canvas, disp_str, 128 - 2); + canvas_set_font(canvas, FontSecondary); + canvas_draw_str(canvas, 2, 8, furi_string_get_cstr(disp_str)); + DesktopSettings* settings = malloc(sizeof(DesktopSettings)); + DESKTOP_SETTINGS_LOAD(settings); + + if(strlen(model->layout) == 0) { + furi_string_set(disp_str, "(default)"); + } else { + furi_string_reset(disp_str); + furi_string_push_back(disp_str, '('); + for(size_t i = 0; i < strlen(model->layout); i++) + furi_string_push_back(disp_str, model->layout[i]); + furi_string_push_back(disp_str, ')'); + } + elements_string_fit_width(canvas, disp_str, 128 - 2); + canvas_draw_str( + canvas, 2, 8 + canvas_current_font_height(canvas), furi_string_get_cstr(disp_str)); + + furi_string_reset(disp_str); + + canvas_draw_icon(canvas, 22, 24, &I_UsbTree_48x22); + + if((model->state.state == BadBleStateIdle) || (model->state.state == BadBleStateDone) || + (model->state.state == BadBleStateNotConnected)) { + if (settings->sfw_mode) { + elements_button_center(canvas, "Start"); + } + else { + elements_button_center(canvas, "Cum"); + } + } else if((model->state.state == BadBleStateRunning) || (model->state.state == BadBleStateDelay)) { + elements_button_center(canvas, "Stop"); + } else if(model->state.state == BadBleStateWillRun) { + elements_button_center(canvas, "Cancel"); + } + + if((model->state.state == BadBleStateNotConnected) || + (model->state.state == BadBleStateIdle) || (model->state.state == BadBleStateDone)) { + elements_button_left(canvas, "Config"); + } + + if(model->state.state == BadBleStateNotConnected) { + canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); + canvas_set_font(canvas, FontPrimary); + if (settings->sfw_mode) { + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect me"); + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to a computer"); + } + else { + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Plug me"); + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "in, Daddy"); + } + } else if(model->state.state == BadBleStateWillRun) { + canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); + canvas_set_font(canvas, FontPrimary); + if (settings->sfw_mode) { + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); + } + else { + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum"); + } + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect"); + } else if(model->state.state == BadBleStateFileError) { + canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "File"); + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "ERROR"); + } else if(model->state.state == BadBleStateScriptError) { + canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:"); + canvas_set_font(canvas, FontSecondary); + furi_string_printf(disp_str, "line %u", model->state.error_line); + canvas_draw_str_aligned( + canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); + furi_string_reset(disp_str); + canvas_draw_str_aligned(canvas, 127, 56, AlignRight, AlignBottom, model->state.error); + } else if(model->state.state == BadBleStateIdle) { + canvas_draw_icon(canvas, 4, 26, &I_Smile_18x18); + canvas_set_font(canvas, FontBigNumbers); + canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "0"); + canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); + } else if(model->state.state == BadBleStateRunning) { + if(model->anim_frame == 0) { + canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); + } else { + canvas_draw_icon(canvas, 4, 23, &I_EviSmile2_18x21); + } + canvas_set_font(canvas, FontBigNumbers); + furi_string_printf( + disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); + canvas_draw_str_aligned( + canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); + furi_string_reset(disp_str); + canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); + } else if(model->state.state == BadBleStateDone) { + canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); + canvas_set_font(canvas, FontBigNumbers); + canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "100"); + furi_string_reset(disp_str); + canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); + } else if(model->state.state == BadBleStateDelay) { + if(model->anim_frame == 0) { + canvas_draw_icon(canvas, 4, 23, &I_EviWaiting1_18x21); + } else { + canvas_draw_icon(canvas, 4, 23, &I_EviWaiting2_18x21); + } + canvas_set_font(canvas, FontBigNumbers); + furi_string_printf( + disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); + canvas_draw_str_aligned( + canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); + furi_string_reset(disp_str); + canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); + canvas_set_font(canvas, FontSecondary); + furi_string_printf(disp_str, "delay %lus", model->state.delay_remain); + canvas_draw_str_aligned( + canvas, 127, 50, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); + furi_string_reset(disp_str); + } else { + canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); + } + + furi_string_free(disp_str); + free(settings); +} + +static bool bad_ble_input_callback(InputEvent* event, void* context) { + furi_assert(context); + BadBle* bad_ble = context; + bool consumed = false; + + if(event->type == InputTypeShort) { + if((event->key == InputKeyLeft) || (event->key == InputKeyOk)) { + consumed = true; + furi_assert(bad_ble->callback); + bad_ble->callback(event->key, bad_ble->context); + } + } + + return consumed; +} + +BadBle* bad_ble_alloc() { + BadBle* bad_ble = malloc(sizeof(BadBle)); + + bad_ble->view = view_alloc(); + view_allocate_model(bad_ble->view, ViewModelTypeLocking, sizeof(BadBleModel)); + view_set_context(bad_ble->view, bad_ble); + view_set_draw_callback(bad_ble->view, bad_ble_draw_callback); + view_set_input_callback(bad_ble->view, bad_ble_input_callback); + + return bad_ble; +} + +void bad_ble_free(BadBle* bad_ble) { + furi_assert(bad_ble); + view_free(bad_ble->view); + free(bad_ble); +} + +View* bad_ble_get_view(BadBle* bad_ble) { + furi_assert(bad_ble); + return bad_ble->view; +} + +void bad_ble_set_button_callback(BadBle* bad_ble, BadBleButtonCallback callback, void* context) { + furi_assert(bad_ble); + furi_assert(callback); + with_view_model( + bad_ble->view, + BadBleModel * model, + { + UNUSED(model); + bad_ble->callback = callback; + bad_ble->context = context; + }, + true); +} + +void bad_ble_set_file_name(BadBle* bad_ble, const char* name) { + furi_assert(name); + with_view_model( + bad_ble->view, + BadBleModel * model, + { strlcpy(model->file_name, name, MAX_NAME_LEN); }, + true); +} + +void bad_ble_set_layout(BadBle* bad_ble, const char* layout) { + furi_assert(layout); + with_view_model( + bad_ble->view, + BadBleModel * model, + { strlcpy(model->layout, layout, MAX_NAME_LEN); }, + true); +} + +void bad_ble_set_state(BadBle* bad_ble, BadBleState* st) { + furi_assert(st); + with_view_model( + bad_ble->view, + BadBleModel * model, + { + memcpy(&(model->state), st, sizeof(BadBleState)); + model->anim_frame ^= 1; + }, + true); +} diff --git a/applications/main/bad_ble/views/bad_ble_view.h b/applications/main/bad_ble/views/bad_ble_view.h new file mode 100644 index 000000000..ccbd1d97b --- /dev/null +++ b/applications/main/bad_ble/views/bad_ble_view.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include "../bad_ble_script.h" + +typedef struct BadBle BadBle; +typedef void (*BadBleButtonCallback)(InputKey key, void* context); + +BadBle* bad_ble_alloc(); + +void bad_ble_free(BadBle* bad_ble); + +View* bad_ble_get_view(BadBle* bad_ble); + +void bad_ble_set_button_callback(BadBle* bad_ble, BadBleButtonCallback callback, void* context); + +void bad_ble_set_file_name(BadBle* bad_ble, const char* name); + +void bad_ble_set_layout(BadBle* bad_ble, const char* layout); + +void bad_ble_set_state(BadBle* bad_ble, BadBleState* st); From ce3305193f5d34d425507966f2205606ffb73d2a Mon Sep 17 00:00:00 2001 From: yocvito Date: Thu, 5 Jan 2023 20:32:46 +0100 Subject: [PATCH 03/36] Adds hal modifications --- firmware/targets/f7/api_symbols.csv | 6 ++-- firmware/targets/f7/furi_hal/furi_hal_bt.c | 14 ++++++-- .../targets/f7/furi_hal/furi_hal_bt_hid.c | 35 +++++++++---------- .../targets/furi_hal_include/furi_hal_bt.h | 2 ++ .../furi_hal_include/furi_hal_bt_hid.h | 9 +++++ 5 files changed, 44 insertions(+), 22 deletions(-) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 3276f1950..b9ffdcb0d 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,11.3,, +Version,v,12.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -572,7 +572,7 @@ Function,+,bt_disconnect,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*" -Function,+,bt_set_profile,_Bool,"Bt*, BtProfile" +Function,?,bt_set_profile,_Bool,"Bt*, BtProfile" Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*" Function,+,buffered_file_stream_alloc,Stream*,Storage* Function,+,buffered_file_stream_close,_Bool,Stream* @@ -1000,6 +1000,7 @@ Function,+,furi_hal_bt_get_transmitted_packets,uint32_t, Function,+,furi_hal_bt_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release_all,_Bool, +Function,?,furi_hal_bt_hid_kb_free_slots,_Bool,uint8_t Function,+,furi_hal_bt_hid_kb_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release_all,_Bool, @@ -1016,6 +1017,7 @@ Function,+,furi_hal_bt_is_alive,_Bool, Function,+,furi_hal_bt_is_ble_gatt_gap_supported,_Bool, Function,+,furi_hal_bt_is_testing_supported,_Bool, Function,+,furi_hal_bt_lock_core2,void, +Function,?,furi_hal_bt_modify_profile_adv_name,void,"const char*, FuriHalBtProfile" Function,+,furi_hal_bt_nvm_sram_sem_acquire,void, Function,+,furi_hal_bt_nvm_sram_sem_release,void, Function,+,furi_hal_bt_reinit,void, diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index 6dfbe5880..c5ceedba2 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -219,8 +219,10 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb, // Change MAC address for HID profile config->mac_address[2]++; // Change name Flipper -> Control - const char* clicker_str = "Control"; - memcpy(&config->adv_name[1], clicker_str, strlen(clicker_str)); + if (strlen(&config->adv_name[1]) > 1) { + const char* clicker_str = "Control"; + memcpy(&config->adv_name[1], clicker_str, strlen(clicker_str)); + } } if(!gap_init(config, event_cb, context)) { gap_thread_stop(); @@ -444,3 +446,11 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode) { FURI_LOG_E(TAG, "Failed to switch C2 mode: %d", fw_start_res); return false; } + +void furi_hal_bt_modify_profile_adv_name(const char* name, FuriHalBtProfile profile) { + furi_assert(name); + furi_assert(strlen(name) < FURI_HAL_VERSION_DEVICE_NAME_LENGTH); + furi_assert(profile < FuriHalBtProfileNumber); + + strncpy(profile_config[profile].config.adv_name, name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH); +} diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c index 5b5a90ed7..501704420 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c @@ -138,24 +138,10 @@ void furi_hal_bt_hid_start() { if(!hid_svc_is_started()) { hid_svc_start(); } - // Configure HID Keyboard - // - // this will also be called by Bad-usb now, so we need to prevent memory leak - // I dont know for now, how apps and mains interacts together, so lets add some - // protection in case a crash in one doesn't affect the other - if(kb_report) - memset(kb_report, 0, sizeof(FuriHalBtHidKbReport)); - else - kb_report = malloc(sizeof(FuriHalBtHidKbReport)); - if(mouse_report) - memset(mouse_report, 0, sizeof(FuriHalBtHidMouseReport)); - else - mouse_report = malloc(sizeof(FuriHalBtHidMouseReport)); - if(consumer_report) - memset(consumer_report, 0, sizeof(FuriHalBtHidConsumerReport)); - else - consumer_report = malloc(sizeof(FuriHalBtHidConsumerReport)); + kb_report = malloc(sizeof(FuriHalBtHidKbReport)); + mouse_report = malloc(sizeof(FuriHalBtHidMouseReport)); + consumer_report = malloc(sizeof(FuriHalBtHidConsumerReport)); // Configure Report Map characteristic hid_svc_update_report_map( @@ -195,17 +181,30 @@ void furi_hal_bt_hid_stop() { bool furi_hal_bt_hid_kb_press(uint16_t button) { furi_assert(kb_report); - for(uint8_t i = 0; i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { + uint8_t i; + for(i = 0; i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { if(kb_report->key[i] == 0) { kb_report->key[i] = button & 0xFF; break; } } + if(i == FURI_HAL_BT_HID_KB_MAX_KEYS) { + return false; + } kb_report->mods |= (button >> 8); return hid_svc_update_input_report( ReportNumberKeyboard, (uint8_t*)kb_report, sizeof(FuriHalBtHidKbReport)); } +bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots) { + furi_assert(kb_report); + for(uint8_t i = 0; n_empty_slots > 0 && i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { + if(kb_report->key[i] == 0) + n_empty_slots--; + } + return (n_empty_slots == 0); +} + bool furi_hal_bt_hid_kb_release(uint16_t button) { furi_assert(kb_report); for(uint8_t i = 0; i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index 800fc3fe3..9c884b234 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -224,6 +224,8 @@ uint32_t furi_hal_bt_get_transmitted_packets(); */ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode); +void furi_hal_bt_modify_profile_adv_name(const char* name, FuriHalBtProfile profile); + #ifdef __cplusplus } #endif diff --git a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h index 4e74bbda7..e7b40f079 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h @@ -86,6 +86,15 @@ bool furi_hal_bt_hid_consumer_key_release(uint16_t button); */ bool furi_hal_bt_hid_consumer_key_release_all(); +/** + * @brief Check if keyboard buffer has free slots + * + * @param n_emptry_slots number of empty slots in buffer to consider buffer is not full + * + * @return true if there is enough free slots in buffer +*/ +bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots); + #ifdef __cplusplus } #endif From a7c64bf936be1f6c4832a854413c5c06cdec7805 Mon Sep 17 00:00:00 2001 From: johnvizzz Date: Wed, 18 Jan 2023 18:25:11 +0100 Subject: [PATCH 04/36] fix api_symbols.csv --- firmware/targets/f7/api_symbols.csv | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 42ea150df..877e20b05 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -603,7 +603,15 @@ Function,+,byte_input_set_result_callback,void,"ByteInput*, ByteInputCallback, B Function,-,bzero,void,"void*, size_t" Function,-,calloc,void*,"size_t, size_t" Function,+,canvas_clear,void,Canvas* +<<<<<<< HEAD Function,+,canvas_commit,void,Canvas* +======= +<<<<<<< HEAD +Function,-,canvas_commit,void,Canvas* +======= +Function,+,canvas_commit,void,Canvas* +>>>>>>> b11b9f1b3 (Gui: Direct Draw API (#2215)) +>>>>>>> e04f2b4ce (api_symbols) Function,+,canvas_current_font_height,uint8_t,Canvas* Function,+,canvas_draw_bitmap,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" Function,+,canvas_draw_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" @@ -632,7 +640,15 @@ Function,+,canvas_glyph_width,uint8_t,"Canvas*, char" Function,+,canvas_height,uint8_t,Canvas* Function,-,canvas_init,Canvas*, Function,+,canvas_invert_color,void,Canvas* +<<<<<<< HEAD Function,+,canvas_reset,void,Canvas* +======= +<<<<<<< HEAD +Function,-,canvas_reset,void,Canvas* +======= +Function,+,canvas_reset,void,Canvas* +>>>>>>> b11b9f1b3 (Gui: Direct Draw API (#2215)) +>>>>>>> e04f2b4ce (api_symbols) Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool" Function,+,canvas_set_color,void,"Canvas*, Color" Function,+,canvas_set_font,void,"Canvas*, Font" From d518f9fa5baa0b8377bb5e38d339a38d6f8d5474 Mon Sep 17 00:00:00 2001 From: yocvito Date: Wed, 25 Jan 2023 23:44:47 +0100 Subject: [PATCH 05/36] Reverse mac address layout in mac changing scene (bad ble) --- .../main/bad_ble/scenes/bad_ble_scene_config_mac.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c index 2b05d7c59..a9ee7e34c 100644 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c @@ -2,6 +2,16 @@ #define TAG "BadBleConfigMac" +static uint8_t* reverse_mac_addr(uint8_t* mac) { + uint8_t tmp; + for(int i = 0; i < 3; i++) { + tmp = mac[i]; + mac[i] = mac[5 - i]; + mac[5 - i] = tmp; + } + return mac; +} + void bad_ble_scene_config_mac_byte_input_callback(void* context) { BadBleApp* bad_ble = context; @@ -19,7 +29,7 @@ void bad_ble_scene_config_mac_on_enter(void* context) { bad_ble_scene_config_mac_byte_input_callback, NULL, bad_ble, - bad_ble->mac, + reverse_mac_addr(bad_ble->mac), GAP_MAC_ADDR_SIZE); view_dispatcher_switch_to_view(bad_ble->view_dispatcher, BadBleAppViewConfigMac); } @@ -30,7 +40,7 @@ bool bad_ble_scene_config_mac_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == BadBleAppCustomEventByteInputDone) { - bt_set_profile_mac_address(bad_ble->bt, bad_ble->mac); + bt_set_profile_mac_address(bad_ble->bt, reverse_mac_addr(bad_ble->mac)); scene_manager_previous_scene(bad_ble->scene_manager); consumed = true; } From a88053964e25555c84d1935bccb27c6de3a1029b Mon Sep 17 00:00:00 2001 From: yocvito Date: Thu, 26 Jan 2023 22:54:15 +0100 Subject: [PATCH 06/36] Bluetooth timeout is now dynamic thanks to rssi analyzing --- applications/main/bad_ble/bad_ble_script.c | 81 +- .../main/bad_ble/scenes/bad_ble_scene_error.c | 34 +- .../main/bad_ble/views/bad_ble_view.c | 24 +- applications/services/bt/bt_service/bt.c | 16 + applications/services/bt/bt_service/bt.h | 8 + firmware/targets/f7/api_symbols.csv | 7 +- firmware/targets/f7/ble_glue/gap.c | 37 + firmware/targets/f7/ble_glue/gap.h | 2 + firmware/targets/f7/furi_hal/furi_hal_bt.c | 31 +- .../targets/furi_hal_include/furi_hal_bt.h | 12 +- flipper.log | 3146 +++++++++++++++++ 11 files changed, 3325 insertions(+), 73 deletions(-) create mode 100644 flipper.log diff --git a/applications/main/bad_ble/bad_ble_script.c b/applications/main/bad_ble/bad_ble_script.c index 5c3e8ce1b..73f4dd6c6 100644 --- a/applications/main/bad_ble/bad_ble_script.c +++ b/applications/main/bad_ble/bad_ble_script.c @@ -38,14 +38,15 @@ typedef enum { LevelRssi59_40, LevelRssi39_0, LevelRssiNum, -} LevelRssiDelays; + LevelRssiError = 0xFF, +} LevelRssiRange; const uint8_t bt_hid_delays[LevelRssiNum] = { - 45, // LevelRssi122_100 - 41, // LevelRssi99_80 - 37, // LevelRssi79_60 - 33, // LevelRssi59_40 - 30, // LevelRssi39_0 + 30, // LevelRssi122_100 + 25, // LevelRssi99_80 + 20, // LevelRssi79_60 + 17, // LevelRssi59_40 + 14, // LevelRssi39_0 }; struct BadBleScript { @@ -158,6 +159,37 @@ static const uint8_t numpad_keys[10] = { HID_KEYPAD_9, }; +uint8_t bt_timeout = 0; + +static LevelRssiRange bt_remote_rssi_range(Bt *bt) { + + BtRssi rssi_data = { 0 }; + + if (!bt_remote_rssi(bt, &rssi_data)) + return LevelRssiError; + + if (rssi_data.rssi <= 39) + return LevelRssi39_0; + else if (rssi_data.rssi <= 59) + return LevelRssi59_40; + else if (rssi_data.rssi <= 79) + return LevelRssi79_60; + else if (rssi_data.rssi <= 99) + return LevelRssi99_80; + else if (rssi_data.rssi <= 122) + return LevelRssi122_100; + + return LevelRssiError; +} + +static inline void update_bt_timeout(Bt *bt) { + + LevelRssiRange r = bt_remote_rssi_range(bt); + if (r < LevelRssiNum) { + bt_timeout = bt_hid_delays[r]; + } +} + /** * @brief Wait until there are enough free slots in the keyboard buffer * @@ -200,8 +232,8 @@ static void ducky_numlock_on() { if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); - FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); - furi_delay_ms(25); + + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); } } @@ -212,10 +244,8 @@ static bool ducky_numpad_press(const char num) { uint16_t key = numpad_keys[num - '0']; bt_hid_hold_while_keyboard_buffer_full(1, -1); FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); - furi_hal_bt_hid_kb_press(key); - FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); - furi_delay_ms(25); + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); return true; @@ -267,8 +297,8 @@ static bool ducky_string(BadBleScript* bad_ble, const char* param) { if(keycode != HID_KEYBOARD_NONE) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(keycode); - FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); - furi_delay_ms(25); + + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(keycode); } i++; @@ -377,8 +407,8 @@ static int32_t bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); furi_hal_bt_hid_kb_press(key); - FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); - furi_delay_ms(25); + + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); return (0); @@ -398,8 +428,8 @@ static int32_t } FURI_LOG_I(WORKER_TAG, "Special key pressed %x\r\n", key); furi_hal_bt_hid_kb_press(key); - FURI_LOG_I(WORKER_TAG, "BT RSSI: %f\r", (double)furi_hal_bt_get_rssi()); - furi_delay_ms(25); + + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); return (0); } @@ -513,9 +543,13 @@ static void bad_ble_hid_state_callback(BtStatus status, void* context) { BadBleScript* bad_ble = (BadBleScript*)context; bool state = (status == BtStatusConnected); - if(state == true) + if(state == true) { + LevelRssiRange r = bt_remote_rssi_range(bad_ble->bt); + if (r != LevelRssiError) { + bt_timeout = bt_hid_delays[r]; + } furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtConnect); - else + } else furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtDisconnect); } @@ -525,6 +559,8 @@ static int32_t bad_ble_worker(void* context) { BadBleWorkerState worker_state = BadBleStateInit; int32_t delay_val = 0; + bt_timeout = bt_hid_delays[LevelRssi39_0]; + // init ble hid bt_disconnect(bad_ble->bt); @@ -625,6 +661,10 @@ static int32_t bad_ble_worker(void* context) { storage_file_seek(script_file, 0, true); // extra time for PC to recognize Flipper as keyboard furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); + + update_bt_timeout(bad_ble->bt); + FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); + worker_state = BadBleStateRunning; } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution worker_state = BadBleStateNotConnected; @@ -685,6 +725,9 @@ static int32_t bad_ble_worker(void* context) { break; } } + + update_bt_timeout(bad_ble->bt); + FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } // release all keys diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_error.c b/applications/main/bad_ble/scenes/bad_ble_scene_error.c index 7460c4042..a212f2087 100644 --- a/applications/main/bad_ble/scenes/bad_ble_scene_error.c +++ b/applications/main/bad_ble/scenes/bad_ble_scene_error.c @@ -30,30 +30,16 @@ void bad_ble_scene_error_on_enter(void* context) { app->widget, GuiButtonTypeLeft, "Back", bad_ble_scene_error_event_callback, app); } else if(app->error == BadBleAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); - if (settings->sfw_mode) { - widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); - widget_add_string_multiline_element( - app->widget, - 3, - 30, - AlignLeft, - AlignTop, - FontSecondary, - "Disconnect from\nPC or phone to\nuse this function."); - } - else { - widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "I am not\na whore!"); - widget_add_string_multiline_element( - app->widget, - 3, - 30, - AlignLeft, - AlignTop, - FontSecondary, - "Pull out from\nPC or phone to\nuse me like this."); - } + widget_add_string_multiline_element( + app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); + widget_add_string_multiline_element( + app->widget, + 3, + 30, + AlignLeft, + AlignTop, + FontSecondary, + "Disconnect from\nPC or phone to\nuse this function."); } view_dispatcher_switch_to_view(app->view_dispatcher, BadBleAppViewError); diff --git a/applications/main/bad_ble/views/bad_ble_view.c b/applications/main/bad_ble/views/bad_ble_view.c index fa5c099a5..2690b6702 100644 --- a/applications/main/bad_ble/views/bad_ble_view.c +++ b/applications/main/bad_ble/views/bad_ble_view.c @@ -50,12 +50,7 @@ static void bad_ble_draw_callback(Canvas* canvas, void* _model) { if((model->state.state == BadBleStateIdle) || (model->state.state == BadBleStateDone) || (model->state.state == BadBleStateNotConnected)) { - if (settings->sfw_mode) { - elements_button_center(canvas, "Start"); - } - else { - elements_button_center(canvas, "Cum"); - } + elements_button_center(canvas, "Start"); } else if((model->state.state == BadBleStateRunning) || (model->state.state == BadBleStateDelay)) { elements_button_center(canvas, "Stop"); } else if(model->state.state == BadBleStateWillRun) { @@ -70,23 +65,12 @@ static void bad_ble_draw_callback(Canvas* canvas, void* _model) { if(model->state.state == BadBleStateNotConnected) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); - if (settings->sfw_mode) { - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect me"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to a computer"); - } - else { - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Plug me"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "in, Daddy"); - } + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect me"); + canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to a computer"); } else if(model->state.state == BadBleStateWillRun) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); - if (settings->sfw_mode) { - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); - } - else { - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will cum"); - } + canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect"); } else if(model->state.state == BadBleStateFileError) { canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index a85238fdf..a993b6cae 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -428,6 +428,22 @@ const uint8_t *bt_get_profile_mac_address(Bt *bt) { } } +bool bt_remote_rssi(Bt *bt, BtRssi *rssi) { + furi_assert(bt); + UNUSED(rssi); + + uint8_t rssi_val; + uint32_t since = furi_hal_bt_get_conn_rssi(&rssi_val); + + if (since == 0) + return false; + + rssi->rssi = rssi_val; + rssi->since = since; + + return true; +} + int32_t bt_srv(void* p) { UNUSED(p); Bt* bt = bt_alloc(); diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index 4320e007e..2e6bbf1bb 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -23,6 +23,12 @@ typedef enum { BtProfileHidKeyboard, } BtProfile; +typedef struct { + uint8_t rssi; + uint32_t since; +} BtRssi; + + typedef void (*BtStatusChangedCallback)(BtStatus status, void* context); /** Change BLE Profile @@ -42,6 +48,8 @@ const char *bt_get_profile_adv_name(Bt *bt); void bt_set_profile_mac_address(Bt *bt, const uint8_t mac[6]); const uint8_t *bt_get_profile_mac_address(Bt *bt); +bool bt_remote_rssi(Bt *bt, BtRssi *rssi); + /** Disconnect from Central * diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 7c1a203cc..a5ce0b489 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,v,12.7,, +Version,v,12.12,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -575,6 +575,7 @@ Function,?,bt_get_profile_adv_name,const char*,Bt* Function,?,bt_get_profile_mac_address,const uint8_t*,Bt* Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*" +Function,?,bt_remote_rssi,_Bool,"Bt*, BtRssi*" Function,?,bt_set_profile,_Bool,"Bt*, BtProfile" Function,?,bt_set_profile_adv_name,void,"Bt*, const char*, ..." Function,?,bt_set_profile_mac_address,void,"Bt*, const uint8_t[6]" @@ -999,6 +1000,7 @@ Function,+,furi_hal_bt_change_app,_Bool,"FuriHalBtProfile, GapEventCallback, voi Function,+,furi_hal_bt_clear_white_list,_Bool, Function,+,furi_hal_bt_dump_state,void,FuriString* Function,+,furi_hal_bt_ensure_c2_mode,_Bool,BleGlueC2Mode +Function,?,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* Function,+,furi_hal_bt_get_key_storage_buff,void,"uint8_t**, uint16_t*" Function,?,furi_hal_bt_get_profile_adv_name,const char*,FuriHalBtProfile Function,?,furi_hal_bt_get_profile_mac_addr,const uint8_t*,FuriHalBtProfile @@ -1035,7 +1037,7 @@ Function,+,furi_hal_bt_serial_start,void, Function,+,furi_hal_bt_serial_stop,void, Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t" Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*" -Function,?,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + 8 + ( 8 + 1 ) )]" +Function,?,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" Function,?,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" Function,+,furi_hal_bt_start_advertising,void, Function,+,furi_hal_bt_start_app,_Bool,"FuriHalBtProfile, GapEventCallback, void*" @@ -1578,6 +1580,7 @@ Function,-,gamma,double,double Function,-,gamma_r,double,"double, int*" Function,-,gammaf,float,float Function,-,gammaf_r,float,"float, int*" +Function,?,gap_get_remote_conn_rssi,uint32_t,int8_t* Function,-,gap_get_state,GapState, Function,-,gap_init,_Bool,"GapConfig*, GapEventCallback, void*" Function,-,gap_start_advertising,void, diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 2bfd2ff3a..8023b8915 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -27,6 +27,8 @@ typedef struct { GapConfig* config; GapConnectionParams connection_params; GapState state; + int8_t conn_rssi; + uint32_t time_rssi_sample; FuriMutex* state_mutex; GapEventCallback on_event_cb; void* context; @@ -52,6 +54,16 @@ static const uint8_t gap_erk[16] = static Gap* gap = NULL; +static inline void fetch_rssi() { + uint8_t ret_rssi = 127; + if (hci_read_rssi(gap->service.connection_handle, &ret_rssi) == BLE_STATUS_SUCCESS) { + gap->conn_rssi = (int8_t) ret_rssi; + gap->time_rssi_sample = furi_get_tick(); + return; + } + FURI_LOG_E(TAG, "Failed to read RSSI"); +} + static void gap_advertise_start(GapState new_state); static int32_t gap_app(void* context); @@ -125,6 +137,9 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { gap->connection_params.supervisor_timeout = event->Supervision_Timeout; FURI_LOG_I(TAG, "Connection parameters event complete"); gap_verify_connection_parameters(gap); + + // save rssi for current connection + fetch_rssi(); break; } @@ -151,6 +166,7 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { gap->connection_params.slave_latency = event->Conn_Latency; gap->connection_params.supervisor_timeout = event->Supervision_Timeout; + // Stop advertising as connection completed furi_timer_stop(gap->advertise_timer); @@ -159,6 +175,9 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { gap->service.connection_handle = event->Connection_Handle; gap_verify_connection_parameters(gap); + + fetch_rssi(); + // Start pairing by sending security request aci_gap_slave_security_req(event->Connection_Handle); } break; @@ -243,6 +262,8 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { pairing_complete->Status); aci_gap_terminate(gap->service.connection_handle, 5); } else { + fetch_rssi(); + FURI_LOG_I(TAG, "Pairing complete"); GapEvent event = {.type = GapEventTypeConnected}; gap->on_event_cb(event, gap->context); //-V595 @@ -495,6 +516,9 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { gap->service.connection_handle = 0xFFFF; gap->enable_adv = true; + gap->conn_rssi = 127; + gap->time_rssi_sample = 0; + // Thread configuration gap->thread = furi_thread_alloc_ex("BleGapDriver", 1024, gap_app, gap); furi_thread_start(gap->thread); @@ -514,6 +538,19 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { return true; } +uint32_t gap_get_remote_conn_rssi(int8_t *rssi) { + if (gap && gap->state == GapStateConnected) { + fetch_rssi(); + *rssi = gap->conn_rssi; + + FURI_LOG_D(TAG, "RSSI: %d", *rssi); + + if (gap->time_rssi_sample) + return furi_get_tick() - gap->time_rssi_sample; + } + return 0; +} + GapState gap_get_state() { GapState state; if(gap) { diff --git a/firmware/targets/f7/ble_glue/gap.h b/firmware/targets/f7/ble_glue/gap.h index 1e207299f..3b9ca5b28 100644 --- a/firmware/targets/f7/ble_glue/gap.h +++ b/firmware/targets/f7/ble_glue/gap.h @@ -81,6 +81,8 @@ GapState gap_get_state(); void gap_thread_stop(); +uint32_t gap_get_remote_conn_rssi(int8_t *rssi); + #ifdef __cplusplus } #endif diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index 61939e12d..f01b66d14 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -200,14 +200,14 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb, break; } GapConfig* config = &profile_config[profile].config; - if (strlen(&(profile_config[profile].config.adv_name[1])) == 0) { + if(strlen(&(profile_config[profile].config.adv_name[1])) == 0) { // Set advertise name strlcpy( profile_config[profile].config.adv_name, furi_hal_version_get_ble_local_device_name_ptr(), FURI_HAL_VERSION_DEVICE_NAME_LENGTH); } - // Configure GAP + // Configure GAP if(profile == FuriHalBtProfileSerial) { // Set mac address memcpy( @@ -425,6 +425,23 @@ float furi_hal_bt_get_rssi() { return val; } +/** fill the RSSI of the remote host of the bt connection and returns the time since + * the beginning of the connection + * +*/ +uint32_t furi_hal_bt_get_conn_rssi(uint8_t *rssi) { + + int8_t ret_rssi = 0; + uint32_t since = gap_get_remote_conn_rssi(&ret_rssi); + + if (ret_rssi == 127 || since == 0) + return 0; + + *rssi = (uint8_t) abs(ret_rssi); + + return since; +} + uint32_t furi_hal_bt_get_transmitted_packets() { uint32_t packets = 0; aci_hal_le_tx_test_packet_number(&packets); @@ -450,13 +467,14 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode) { return false; } -void furi_hal_bt_set_profile_adv_name(FuriHalBtProfile profile, const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH]) { +void furi_hal_bt_set_profile_adv_name( + FuriHalBtProfile profile, + const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1]) { furi_assert(profile < FuriHalBtProfileNumber); furi_assert(name); - memcpy(&(profile_config[profile].config.adv_name[1]), - name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH); - + memcpy( + &(profile_config[profile].config.adv_name[1]), name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1); } const char* furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile) { @@ -471,7 +489,6 @@ void furi_hal_bt_set_profile_mac_addr( furi_assert(mac_addr); memcpy(profile_config[profile].config.mac_address, mac_addr, GAP_MAC_ADDR_SIZE); - } const uint8_t* furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile) { diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index 5127972f5..45d2a4261 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -224,14 +224,24 @@ uint32_t furi_hal_bt_get_transmitted_packets(); */ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode); -void furi_hal_bt_set_profile_adv_name(FuriHalBtProfile profile, const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH]); +/** Modify profile advertisement name and restart bluetooth + * @param[in] profile profile type + * @param[in] name new adv name +*/ +void furi_hal_bt_set_profile_adv_name(FuriHalBtProfile profile, const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1]); const char *furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile); +/** Modify profile mac address and restart bluetooth + * @param[in] profile profile type + * @param[in] mac new mac address +*/ void furi_hal_bt_set_profile_mac_addr(FuriHalBtProfile profile, const uint8_t mac_addr[GAP_MAC_ADDR_SIZE]); const uint8_t *furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile); +uint32_t furi_hal_bt_get_conn_rssi(uint8_t *rssi); + #ifdef __cplusplus } #endif diff --git a/flipper.log b/flipper.log new file mode 100644 index 000000000..f267750c0 --- /dev/null +++ b/flipper.log @@ -0,0 +1,3146 @@ + + _.-------.._ -, + .-"```"--..,,_/ /`-, -, \ + .:" /:/ /'\ \ ,_..., `. | | + / ,----/:/ /`\ _\~`_-"` _; + ' / /`"""'\ \ \.~`_-' ,-"'/ + | | | 0 | | .-' ,/` / + | ,..\ \ ,.-"` ,/` / + ; : `/`""\` ,/--==,/-----, + | `-...| -.___-Z:_______J...---; + : ` _-' + _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ +| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| +| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | +|_| |____||___||_| |_| |___||_|_\ \___||____||___| + +Welcome to Flipper Zero Command Line Interface! +Read Manual https://docs.flipperzero.one + +Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) + +>: log +Press CTRL+C to stop... +218220 [D][BrowserWorker] End +218233 [I][BtGap] Stop advertising +218237 [D][BtGap] set_non_discoverable success +218252 [I][SavedStruct] Loading "/int/.desktop.settings" +218390 [I][SavedStruct] Loading "/int/.desktop.settings" +218442 [I][FuriHalBt] Disconnect and stop advertising +218444 [I][FuriHalBt] Stop current profile services +218453 [I][FuriHalBt] Stop BLE related RTOS threads +218479 [I][FuriHalBt] Reset SHCI +218590 [I][SavedStruct] Loading "/int/.desktop.settings" +218594 [I][FuriHalBt] Start BT initialization +218601 [I][Core2] Core2 started +218604 [I][Core2] C2 boot completed, mode: Stack +218608 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +218612 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +218619 [I][Core2] Radio stack started +218623 [I][Core2] Flash activity control switched to SEM7 +218626 [I][BtGap] Advertising name: Keyboard +218629 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +218646 [D][BtBatterySvc] Updating power state characteristic +218651 [I][BtGap] Start advertising +218654 [I][SavedStruct] Loading "/int/.bt.settings" +218671 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +218681 [I][FuriHalBt] Disconnect and stop advertising +218683 [I][BtGap] Stop advertising +218686 [D][BtGap] set_non_discoverable success +218689 [I][FuriHalBt] Stop current profile services +218698 [I][FuriHalBt] Stop BLE related RTOS threads +218723 [I][FuriHalBt] Reset SHCI +218748 [I][SavedStruct] Loading "/int/.desktop.settings" +218790 [I][SavedStruct] Loading "/int/.desktop.settings" +218837 [I][FuriHalBt] Start BT initialization +218842 [I][Core2] Core2 started +218844 [I][Core2] C2 boot completed, mode: Stack +218847 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +218849 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +218854 [I][Core2] Radio stack started +218856 [I][Core2] Flash activity control switched to SEM7 +218859 [I][BtGap] Advertising name: Rumik1 +218861 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +218879 [D][BtBatterySvc] Updating power state characteristic +218889 [I][BtSrv] Bt App started +218891 [I][BtGap] Start advertising +218894 [I][BadBleWorker] Init +218896 [I][SavedStruct] Loading "/int/.desktop.settings" +218923 [I][BadBleWorker] BLE Key timeout : 16 +218990 [I][SavedStruct] Loading "/int/.desktop.settings" +219190 [I][SavedStruct] Loading "/int/.desktop.settings" +219248 [I][SavedStruct] Loading "/int/.desktop.settings" +219285 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +219287 [I][BtGap] Rssi: 295 +219390 [D][BtGap] Slave security initiated +219392 [I][SavedStruct] Loading "/int/.desktop.settings" +219508 [I][BtGap] Pairing complete +219511 [D][BtBatterySvc] Updating battery level characteristic +219515 [I][BadBleWorker] BLE Key timeout : 16 +219590 [I][SavedStruct] Loading "/int/.desktop.settings" +219687 [I][BtGap] Rx MTU size: 414 +219748 [I][SavedStruct] Loading "/int/.desktop.settings" +219790 [I][SavedStruct] Loading "/int/.desktop.settings" +219990 [I][SavedStruct] Loading "/int/.desktop.settings" +220190 [I][SavedStruct] Loading "/int/.desktop.settings" +220248 [I][SavedStruct] Loading "/int/.desktop.settings" +220282 [I][BtGap] Connection parameters event complete +220284 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +220287 [W][BtGap] Unsupported connection interval. Request connection parameters update +220290 [I][BtGap] Rssi: 298 +220335 [D][BtGap] Connection parameters accepted +220390 [I][SavedStruct] Loading "/int/.desktop.settings" +220498 [I][BtGap] Connection parameters event complete +220500 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +220506 [I][BtGap] Rssi: 293 +220590 [I][SavedStruct] Loading "/int/.desktop.settings" +220748 [I][SavedStruct] Loading "/int/.desktop.settings" +220790 [I][SavedStruct] Loading "/int/.desktop.settings" +220990 [I][SavedStruct] Loading "/int/.desktop.settings" +221190 [I][SavedStruct] Loading "/int/.desktop.settings" +221248 [I][SavedStruct] Loading "/int/.desktop.settings" +221390 [I][SavedStruct] Loading "/int/.desktop.settings" +221590 [I][SavedStruct] Loading "/int/.desktop.settings" +221748 [I][SavedStruct] Loading "/int/.desktop.settings" +221790 [I][SavedStruct] Loading "/int/.desktop.settings" +221990 [I][SavedStruct] Loading "/int/.desktop.settings" +222190 [I][SavedStruct] Loading "/int/.desktop.settings" +222248 [I][SavedStruct] Loading "/int/.desktop.settings" +222390 [I][SavedStruct] Loading "/int/.desktop.settings" +222590 [I][SavedStruct] Loading "/int/.desktop.settings" +222748 [I][SavedStruct] Loading "/int/.desktop.settings" +222790 [I][SavedStruct] Loading "/int/.desktop.settings" +222990 [I][SavedStruct] Loading "/int/.desktop.settings" +223190 [I][SavedStruct] Loading "/int/.desktop.settings" +223248 [I][SavedStruct] Loading "/int/.desktop.settings" +223390 [I][SavedStruct] Loading "/int/.desktop.settings" +223590 [I][SavedStruct] Loading "/int/.desktop.settings" +223748 [I][SavedStruct] Loading "/int/.desktop.settings" +223790 [I][SavedStruct] Loading "/int/.desktop.settings" +223990 [I][SavedStruct] Loading "/int/.desktop.settings" +224190 [I][SavedStruct] Loading "/int/.desktop.settings" +224248 [I][SavedStruct] Loading "/int/.desktop.settings" +224390 [I][SavedStruct] Loading "/int/.desktop.settings" +224590 [I][SavedStruct] Loading "/int/.desktop.settings" +224748 [I][SavedStruct] Loading "/int/.desktop.settings" +224790 [I][SavedStruct] Loading "/int/.desktop.settings" +224990 [I][SavedStruct] Loading "/int/.desktop.settings" +225190 [I][SavedStruct] Loading "/int/.desktop.settings" +225248 [I][SavedStruct] Loading "/int/.desktop.settings" +225390 [I][SavedStruct] Loading "/int/.desktop.settings" +225590 [I][SavedStruct] Loading "/int/.desktop.settings" +225748 [I][SavedStruct] Loading "/int/.desktop.settings" +225790 [I][SavedStruct] Loading "/int/.desktop.settings" +225990 [I][SavedStruct] Loading "/int/.desktop.settings" +226190 [I][SavedStruct] Loading "/int/.desktop.settings" +226248 [I][SavedStruct] Loading "/int/.desktop.settings" +226390 [I][SavedStruct] Loading "/int/.desktop.settings" +226596 [I][SavedStruct] Loading "/int/.desktop.settings" +226748 [I][SavedStruct] Loading "/int/.desktop.settings" +226790 [I][SavedStruct] Loading "/int/.desktop.settings" +226990 [I][SavedStruct] Loading "/int/.desktop.settings" +227190 [I][SavedStruct] Loading "/int/.desktop.settings" +227248 [I][SavedStruct] Loading "/int/.desktop.settings" +227390 [I][SavedStruct] Loading "/int/.desktop.settings" +227590 [I][SavedStruct] Loading "/int/.desktop.settings" +227748 [I][SavedStruct] Loading "/int/.desktop.settings" +227790 [I][SavedStruct] Loading "/int/.desktop.settings" +227990 [I][SavedStruct] Loading "/int/.desktop.settings" +228190 [I][SavedStruct] Loading "/int/.desktop.settings" +228248 [I][SavedStruct] Loading "/int/.desktop.settings" +228390 [I][SavedStruct] Loading "/int/.desktop.settings" +228590 [I][SavedStruct] Loading "/int/.desktop.settings" +228748 [I][SavedStruct] Loading "/int/.desktop.settings" +228790 [I][SavedStruct] Loading "/int/.desktop.settings" +234485 [I][FuriHalBt] Disconnect and stop advertising +234489 [I][BtGap] Stop advertising +234493 [D][BtGap] terminate success +234497 [E][BtGap] set_non_discoverable failed 12 +234502 [I][FuriHalBt] Stop current profile services +234507 [I][BadBleWorker] BLE Key timeout : 16 +234526 [I][FuriHalBt] Stop BLE related RTOS threads +234551 [I][FuriHalBt] Reset SHCI +234665 [I][FuriHalBt] Start BT initialization +234670 [I][Core2] Core2 started +234672 [I][Core2] C2 boot completed, mode: Stack +234675 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +234677 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +234681 [I][Core2] Radio stack started +234683 [I][Core2] Flash activity control switched to SEM7 +234685 [I][BtGap] Advertising name: Mmm_ +234687 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +234711 [D][BtBatterySvc] Updating power state characteristic +234721 [I][BtGap] Start advertising +235977 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +235982 [I][BtGap] Rssi: 308 +236066 [D][BtGap] Slave security initiated +236187 [I][BtGap] Pairing complete +236190 [D][BtBatterySvc] Updating battery level characteristic +236195 [I][BadBleWorker] BLE Key timeout : 16 +236366 [I][BtGap] Rx MTU size: 414 +236935 [I][BtGap] Connection parameters event complete +236938 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +236941 [W][BtGap] Unsupported connection interval. Request connection parameters update +236944 [I][BtGap] Rssi: 314 +236975 [D][BtGap] Connection parameters accepted +237139 [I][BtGap] Connection parameters event complete +237141 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +237144 [I][BtGap] Rssi: 326 +240985 [I][FuriHalBt] Disconnect and stop advertising +240989 [I][BtGap] Stop advertising +240993 [D][BtGap] terminate success +240997 [E][BtGap] set_non_discoverable failed 12 +241002 [I][FuriHalBt] Stop current profile services +241007 [I][BadBleWorker] BLE Key timeout : 16 +241028 [I][FuriHalBt] Stop BLE related RTOS threads +241054 [I][FuriHalBt] Reset SHCI +241168 [I][FuriHalBt] Start BT initialization +241173 [I][Core2] Core2 started +241175 [I][Core2] C2 boot completed, mode: Stack +241178 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +241180 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +241184 [I][Core2] Radio stack started +241186 [I][Core2] Flash activity control switched to SEM7 +241188 [I][BtGap] Advertising name: Mmm_ +241190 [I][BtGap] MAC @ : 35:F2:47:26:81:88 +241212 [D][BtBatterySvc] Updating power state characteristic +241222 [I][BtGap] Start advertising +242157 [D][ViewDispatcher] View changed while key press 20010600 -> 20010708. Sending key: Back, type: Release, sequence: 0000002C to previous view port +242161 [I][SavedStruct] Loading "/int/.desktop.settings" +242190 [I][SavedStruct] Loading "/int/.desktop.settings" +242390 [I][SavedStruct] Loading "/int/.desktop.settings" +242590 [I][SavedStruct] Loading "/int/.desktop.settings" +242662 [I][SavedStruct] Loading "/int/.desktop.settings" +242790 [I][SavedStruct] Loading "/int/.desktop.settings" +242836 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +242839 [I][BtGap] Rssi: 305 +242929 [D][BtGap] Slave security initiated +242990 [I][SavedStruct] Loading "/int/.desktop.settings" +243018 [I][BtGap] Rx MTU size: 414 +243162 [I][SavedStruct] Loading "/int/.desktop.settings" +243190 [I][SavedStruct] Loading "/int/.desktop.settings" +243390 [I][SavedStruct] Loading "/int/.desktop.settings" +243524 [D][BtGap] Bond lost event. Start rebonding +243590 [I][SavedStruct] Loading "/int/.desktop.settings" +243662 [I][SavedStruct] Loading "/int/.desktop.settings" +243702 [I][BtGap] Verify numeric comparison: 382889 +243829 [I][SavedStruct] Loading "/int/.desktop.settings" +245253 [I][SavedStruct] Loading "/int/.desktop.settings" +245274 [I][SavedStruct] Loading "/int/.desktop.settings" +245390 [I][SavedStruct] Loading "/int/.desktop.settings" +245590 [I][SavedStruct] Loading "/int/.desktop.settings" +245662 [I][SavedStruct] Loading "/int/.desktop.settings" +245679 [I][BtGap] Pairing complete +245683 [D][BtBatterySvc] Updating battery level characteristic +245687 [I][BadBleWorker] BLE Key timeout : 16 +245790 [I][SavedStruct] Loading "/int/.desktop.settings" +245990 [I][SavedStruct] Loading "/int/.desktop.settings" +246162 [I][SavedStruct] Loading "/int/.desktop.settings" +246190 [I][SavedStruct] Loading "/int/.desktop.settings" +246390 [I][SavedStruct] Loading "/int/.desktop.settings" +246590 [I][SavedStruct] Loading "/int/.desktop.settings" +246660 [I][BtGap] Connection parameters event complete +246663 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +246667 [W][BtGap] Unsupported connection interval. Request connection parameters update +246670 [I][SavedStruct] Loading "/int/.desktop.settings" +246673 [I][BtGap] Rssi: 304 +246699 [D][BtGap] Connection parameters accepted +246790 [I][SavedStruct] Loading "/int/.desktop.settings" +246862 [I][BtGap] Connection parameters event complete +246866 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +246871 [I][BtGap] Rssi: 303 +246990 [I][SavedStruct] Loading "/int/.desktop.settings" +247162 [I][SavedStruct] Loading "/int/.desktop.settings" +247190 [I][SavedStruct] Loading "/int/.desktop.settings" +247390 [I][SavedStruct] Loading "/int/.desktop.settings" +247590 [I][SavedStruct] Loading "/int/.desktop.settings" +247662 [I][SavedStruct] Loading "/int/.desktop.settings" +247790 [I][SavedStruct] Loading "/int/.desktop.settings" +247990 [I][SavedStruct] Loading "/int/.desktop.settings" +248162 [I][SavedStruct] Loading "/int/.desktop.settings" +248190 [I][SavedStruct] Loading "/int/.desktop.settings" +248390 [I][SavedStruct] Loading "/int/.desktop.settings" +248590 [I][SavedStruct] Loading "/int/.desktop.settings" +248747 [D][DolphinState] icounter 1325, butthurt 0 +248750 [I][BadBleWorker] BLE Key timeout : 16 +248754 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +248757 [I][BadBleWorker] BLE Key timeout : 16 +248759 [D][BadBleWorker] line:DELAY 1000 +248763 [I][BadBleWorker] BLE Key timeout : 16 +248790 [I][SavedStruct] Loading "/int/.desktop.settings" +248990 [I][SavedStruct] Loading "/int/.desktop.settings" +249190 [I][SavedStruct] Loading "/int/.desktop.settings" +249248 [I][SavedStruct] Loading "/int/.desktop.settings" +249390 [I][SavedStruct] Loading "/int/.desktop.settings" +249590 [I][SavedStruct] Loading "/int/.desktop.settings" +249748 [I][SavedStruct] Loading "/int/.desktop.settings" +249766 [D][BadBleWorker] line:GUI SPACE +249768 [I][BadBleWorker] Special key pressed 82c + +249773 [I][BadBleWorker] BT RSSI: 0.000000 +249790 [I][SavedStruct] Loading "/int/.desktop.settings" +249794 [I][BadBleWorker] BLE Key timeout : 16 +249800 [D][BadBleWorker] line:DELAY 500 +249804 [I][BadBleWorker] BLE Key timeout : 16 +249990 [I][SavedStruct] Loading "/int/.desktop.settings" +250190 [I][SavedStruct] Loading "/int/.desktop.settings" +250248 [I][SavedStruct] Loading "/int/.desktop.settings" +250308 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +250312 [I][BadBleWorker] BT RSSI: 0.000000 +250332 [I][BadBleWorker] BT RSSI: 0.000000 +250351 [I][BadBleWorker] BT RSSI: 0.000000 +250371 [I][BadBleWorker] BT RSSI: 0.000000 +250390 [I][SavedStruct] Loading "/int/.desktop.settings" +250392 [I][BadBleWorker] BT RSSI: 0.000000 +250414 [I][BadBleWorker] BT RSSI: 0.000000 +250434 [I][BadBleWorker] BT RSSI: 0.000000 +250454 [I][BadBleWorker] BT RSSI: 0.000000 +250474 [I][BadBleWorker] BT RSSI: 0.000000 +250494 [I][BadBleWorker] BT RSSI: 0.000000 +250514 [I][BadBleWorker] BT RSSI: 0.000000 +250534 [I][BadBleWorker] BT RSSI: 0.000000 +250554 [I][BadBleWorker] BT RSSI: 0.000000 +250574 [I][BadBleWorker] BT RSSI: 0.000000 +250590 [I][SavedStruct] Loading "/int/.desktop.settings" +250596 [I][BadBleWorker] BT RSSI: 0.000000 +250618 [I][BadBleWorker] BT RSSI: 0.000000 +250638 [I][BadBleWorker] BT RSSI: 0.000000 +250658 [I][BadBleWorker] BT RSSI: 0.000000 +250678 [I][BadBleWorker] BT RSSI: 0.000000 +250698 [I][BadBleWorker] BT RSSI: 0.000000 +250718 [I][BadBleWorker] BT RSSI: 0.000000 +250737 [I][BadBleWorker] BT RSSI: 0.000000 +250748 [I][SavedStruct] Loading "/int/.desktop.settings" +250760 [I][BadBleWorker] BT RSSI: 0.000000 +250781 [I][BadBleWorker] BT RSSI: 0.000000 +250790 [I][SavedStruct] Loading "/int/.desktop.settings" +250803 [I][BadBleWorker] BT RSSI: 0.000000 +250824 [I][BadBleWorker] BT RSSI: 0.000000 +250844 [I][BadBleWorker] BT RSSI: 0.000000 +250864 [I][BadBleWorker] BT RSSI: 0.000000 +250884 [I][BadBleWorker] BT RSSI: 0.000000 +250904 [I][BadBleWorker] BT RSSI: 0.000000 +250926 [I][BadBleWorker] BT RSSI: 0.000000 +250947 [I][BadBleWorker] BT RSSI: 0.000000 +250967 [I][BadBleWorker] BT RSSI: 0.000000 +250987 [I][BadBleWorker] BT RSSI: 0.000000 +250990 [I][SavedStruct] Loading "/int/.desktop.settings" +251008 [I][BadBleWorker] BT RSSI: 0.000000 +251028 [I][BadBleWorker] BT RSSI: 0.000000 +251048 [I][BadBleWorker] BT RSSI: 0.000000 +251068 [I][BadBleWorker] BT RSSI: 0.000000 +251088 [I][BadBleWorker] BT RSSI: 0.000000 +251108 [I][BadBleWorker] BT RSSI: 0.000000 +251128 [I][BadBleWorker] BT RSSI: 0.000000 +251147 [I][BadBleWorker] BLE Key timeout : 16 +251150 [D][BadBleWorker] line:DELAY 200 +251152 [I][BadBleWorker] BLE Key timeout : 16 +251190 [I][SavedStruct] Loading "/int/.desktop.settings" +251248 [I][SavedStruct] Loading "/int/.desktop.settings" +251355 [D][BadBleWorker] line:ENTER +251357 [I][BadBleWorker] Special key pressed 28 + +251360 [I][BadBleWorker] BT RSSI: 0.000000 +251379 [I][BadBleWorker] BLE Key timeout : 16 +251382 [D][BadBleWorker] line:GUI SPACE +251384 [I][BadBleWorker] Special key pressed 82c + +251387 [I][BadBleWorker] BT RSSI: 0.000000 +251391 [I][SavedStruct] Loading "/int/.desktop.settings" +251408 [I][BadBleWorker] BLE Key timeout : 16 +251411 [D][BadBleWorker] line:DELAY 500 +251413 [I][BadBleWorker] BLE Key timeout : 16 +251590 [I][SavedStruct] Loading "/int/.desktop.settings" +251748 [I][SavedStruct] Loading "/int/.desktop.settings" +251790 [I][SavedStruct] Loading "/int/.desktop.settings" +251915 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +251919 [I][BadBleWorker] BT RSSI: 0.000000 +251941 [I][BadBleWorker] BT RSSI: 0.000000 +251962 [I][BadBleWorker] BT RSSI: 0.000000 +251982 [I][BadBleWorker] BT RSSI: 0.000000 +251990 [I][SavedStruct] Loading "/int/.desktop.settings" +252004 [I][BadBleWorker] BT RSSI: 0.000000 +252026 [I][BadBleWorker] BT RSSI: 0.000000 +252046 [I][BadBleWorker] BT RSSI: 0.000000 +252066 [I][BadBleWorker] BT RSSI: 0.000000 +252086 [I][BadBleWorker] BT RSSI: 0.000000 +252106 [I][BadBleWorker] BT RSSI: 0.000000 +252126 [I][BadBleWorker] BT RSSI: 0.000000 +252146 [I][BadBleWorker] BT RSSI: 0.000000 +252166 [I][BadBleWorker] BT RSSI: 0.000000 +252186 [I][BadBleWorker] BT RSSI: 0.000000 +252190 [I][SavedStruct] Loading "/int/.desktop.settings" +252207 [I][BadBleWorker] BT RSSI: 0.000000 +252227 [I][BadBleWorker] BT RSSI: 0.000000 +252248 [I][BadBleWorker] BT RSSI: 0.000000 +252251 [I][SavedStruct] Loading "/int/.desktop.settings" +252269 [I][BadBleWorker] BT RSSI: 0.000000 +252289 [I][BadBleWorker] BT RSSI: 0.000000 +252309 [I][BadBleWorker] BT RSSI: 0.000000 +252329 [I][BadBleWorker] BT RSSI: 0.000000 +252348 [I][BadBleWorker] BT RSSI: 0.000000 +252368 [I][BadBleWorker] BT RSSI: 0.000000 +252388 [I][BadBleWorker] BT RSSI: 0.000000 +252391 [I][SavedStruct] Loading "/int/.desktop.settings" +252409 [I][BadBleWorker] BT RSSI: 0.000000 +252429 [I][BadBleWorker] BT RSSI: 0.000000 +252449 [I][BadBleWorker] BT RSSI: 0.000000 +252469 [I][BadBleWorker] BT RSSI: 0.000000 +252489 [I][BadBleWorker] BT RSSI: 0.000000 +252509 [I][BadBleWorker] BT RSSI: 0.000000 +252529 [I][BadBleWorker] BT RSSI: 0.000000 +252549 [I][BadBleWorker] BT RSSI: 0.000000 +252569 [I][BadBleWorker] BT RSSI: 0.000000 +252590 [I][SavedStruct] Loading "/int/.desktop.settings" +252592 [I][BadBleWorker] BT RSSI: 0.000000 +252614 [I][BadBleWorker] BT RSSI: 0.000000 +252634 [I][BadBleWorker] BT RSSI: 0.000000 +252654 [I][BadBleWorker] BT RSSI: 0.000000 +252674 [I][BadBleWorker] BT RSSI: 0.000000 +252694 [I][BadBleWorker] BT RSSI: 0.000000 +252714 [I][BadBleWorker] BT RSSI: 0.000000 +252733 [I][BadBleWorker] BT RSSI: 0.000000 +252748 [I][SavedStruct] Loading "/int/.desktop.settings" +252754 [I][BadBleWorker] BLE Key timeout : 16 +252758 [D][BadBleWorker] line:DELAY 200 +252763 [I][BadBleWorker] BLE Key timeout : 16 +252790 [I][SavedStruct] Loading "/int/.desktop.settings" +252967 [D][BadBleWorker] line:ENTER +252969 [I][BadBleWorker] Special key pressed 28 + +252972 [I][BadBleWorker] BT RSSI: 0.000000 +252990 [I][SavedStruct] Loading "/int/.desktop.settings" +252993 [I][BadBleWorker] BLE Key timeout : 16 +253000 [D][BadBleWorker] line:GUI SPACE +253002 [I][BadBleWorker] Special key pressed 82c + +253007 [I][BadBleWorker] BT RSSI: 0.000000 +253028 [I][BadBleWorker] BLE Key timeout : 16 +253031 [D][BadBleWorker] line:DELAY 500 +253033 [I][BadBleWorker] BLE Key timeout : 16 +253190 [I][SavedStruct] Loading "/int/.desktop.settings" +253248 [I][SavedStruct] Loading "/int/.desktop.settings" +253390 [I][SavedStruct] Loading "/int/.desktop.settings" +253536 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +253540 [I][BadBleWorker] BT RSSI: 0.000000 +253560 [I][BadBleWorker] BT RSSI: 0.000000 +253580 [I][BadBleWorker] BT RSSI: 0.000000 +253590 [I][SavedStruct] Loading "/int/.desktop.settings" +253602 [I][BadBleWorker] BT RSSI: 0.000000 +253624 [I][BadBleWorker] BT RSSI: 0.000000 +253644 [I][BadBleWorker] BT RSSI: 0.000000 +253664 [I][BadBleWorker] BT RSSI: 0.000000 +253684 [I][BadBleWorker] BT RSSI: 0.000000 +253704 [I][BadBleWorker] BT RSSI: 0.000000 +253724 [I][BadBleWorker] BT RSSI: 0.000000 +253743 [I][BadBleWorker] BT RSSI: 0.000000 +253748 [I][SavedStruct] Loading "/int/.desktop.settings" +253765 [I][BadBleWorker] BT RSSI: 0.000000 +253785 [I][BadBleWorker] BT RSSI: 0.000000 +253790 [I][SavedStruct] Loading "/int/.desktop.settings" +253807 [I][BadBleWorker] BT RSSI: 0.000000 +253827 [I][BadBleWorker] BT RSSI: 0.000000 +253847 [I][BadBleWorker] BT RSSI: 0.000000 +253867 [I][BadBleWorker] BT RSSI: 0.000000 +253887 [I][BadBleWorker] BT RSSI: 0.000000 +253907 [I][BadBleWorker] BT RSSI: 0.000000 +253927 [I][BadBleWorker] BT RSSI: 0.000000 +253947 [I][BadBleWorker] BT RSSI: 0.000000 +253969 [I][BadBleWorker] BT RSSI: 0.000000 +253990 [I][SavedStruct] Loading "/int/.desktop.settings" +253993 [I][BadBleWorker] BT RSSI: 0.000000 +254015 [I][BadBleWorker] BT RSSI: 0.000000 +254035 [I][BadBleWorker] BT RSSI: 0.000000 +254055 [I][BadBleWorker] BT RSSI: 0.000000 +254075 [I][BadBleWorker] BT RSSI: 0.000000 +254095 [I][BadBleWorker] BT RSSI: 0.000000 +254115 [I][BadBleWorker] BT RSSI: 0.000000 +254135 [I][BadBleWorker] BT RSSI: 0.000000 +254155 [I][BadBleWorker] BT RSSI: 0.000000 +254174 [I][BadBleWorker] BT RSSI: 0.000000 +254190 [I][SavedStruct] Loading "/int/.desktop.settings" +254196 [I][BadBleWorker] BT RSSI: 0.000000 +254217 [I][BadBleWorker] BT RSSI: 0.000000 +254237 [I][BadBleWorker] BT RSSI: 0.000000 +254248 [I][SavedStruct] Loading "/int/.desktop.settings" +254259 [I][BadBleWorker] BT RSSI: 0.000000 +254281 [I][BadBleWorker] BT RSSI: 0.000000 +254300 [I][BadBleWorker] BT RSSI: 0.000000 +254320 [I][BadBleWorker] BT RSSI: 0.000000 +254340 [I][BadBleWorker] BT RSSI: 0.000000 +254360 [I][BadBleWorker] BT RSSI: 0.000000 +254379 [I][BadBleWorker] BLE Key timeout : 16 +254383 [D][BadBleWorker] line:DELAY 200 +254386 [I][BadBleWorker] BLE Key timeout : 16 +254390 [I][SavedStruct] Loading "/int/.desktop.settings" +254588 [D][BadBleWorker] line:ENTER +254590 [I][BadBleWorker] Special key pressed 28 + +254593 [I][SavedStruct] Loading "/int/.desktop.settings" +254596 [I][BadBleWorker] BT RSSI: 0.000000 +254617 [I][BadBleWorker] BLE Key timeout : 16 +254621 [D][BadBleWorker] line:GUI SPACE +254623 [I][BadBleWorker] Special key pressed 82c + +254627 [I][BadBleWorker] BT RSSI: 0.000000 +254646 [I][BadBleWorker] BLE Key timeout : 16 +254650 [D][BadBleWorker] line:DELAY 500 +254653 [I][BadBleWorker] BLE Key timeout : 16 +254748 [I][SavedStruct] Loading "/int/.desktop.settings" +254790 [I][SavedStruct] Loading "/int/.desktop.settings" +254990 [I][SavedStruct] Loading "/int/.desktop.settings" +255155 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +255159 [I][BadBleWorker] BT RSSI: 0.000000 +255179 [I][BadBleWorker] BT RSSI: 0.000000 +255190 [I][SavedStruct] Loading "/int/.desktop.settings" +255201 [I][BadBleWorker] BT RSSI: 0.000000 +255223 [I][BadBleWorker] BT RSSI: 0.000000 +255243 [I][BadBleWorker] BT RSSI: 0.000000 +255248 [I][SavedStruct] Loading "/int/.desktop.settings" +255265 [I][BadBleWorker] BT RSSI: 0.000000 +255286 [I][BadBleWorker] BT RSSI: 0.000000 +255306 [I][BadBleWorker] BT RSSI: 0.000000 +255326 [I][BadBleWorker] BT RSSI: 0.000000 +255346 [I][BadBleWorker] BT RSSI: 0.000000 +255366 [I][BadBleWorker] BT RSSI: 0.000000 +255386 [I][BadBleWorker] BT RSSI: 0.000000 +255390 [I][SavedStruct] Loading "/int/.desktop.settings" +255407 [I][BadBleWorker] BT RSSI: 0.000000 +255427 [I][BadBleWorker] BT RSSI: 0.000000 +255446 [I][BadBleWorker] BT RSSI: 0.000000 +255466 [I][BadBleWorker] BT RSSI: 0.000000 +255485 [I][BadBleWorker] BT RSSI: 0.000000 +255505 [I][BadBleWorker] BT RSSI: 0.000000 +255525 [I][BadBleWorker] BT RSSI: 0.000000 +255545 [I][BadBleWorker] BT RSSI: 0.000000 +255565 [I][BadBleWorker] BT RSSI: 0.000000 +255585 [I][BadBleWorker] BT RSSI: 0.000000 +255590 [I][SavedStruct] Loading "/int/.desktop.settings" +255607 [I][BadBleWorker] BT RSSI: 0.000000 +255628 [I][BadBleWorker] BT RSSI: 0.000000 +255648 [I][BadBleWorker] BT RSSI: 0.000000 +255668 [I][BadBleWorker] BT RSSI: 0.000000 +255688 [I][BadBleWorker] BT RSSI: 0.000000 +255708 [I][BadBleWorker] BT RSSI: 0.000000 +255728 [I][BadBleWorker] BT RSSI: 0.000000 +255748 [I][SavedStruct] Loading "/int/.desktop.settings" +255750 [I][BadBleWorker] BT RSSI: 0.000000 +255772 [I][BadBleWorker] BT RSSI: 0.000000 +255790 [I][SavedStruct] Loading "/int/.desktop.settings" +255794 [I][BadBleWorker] BT RSSI: 0.000000 +255816 [I][BadBleWorker] BT RSSI: 0.000000 +255836 [I][BadBleWorker] BT RSSI: 0.000000 +255856 [I][BadBleWorker] BT RSSI: 0.000000 +255876 [I][BadBleWorker] BT RSSI: 0.000000 +255896 [I][BadBleWorker] BT RSSI: 0.000000 +255915 [I][BadBleWorker] BT RSSI: 0.000000 +255935 [I][BadBleWorker] BT RSSI: 0.000000 +255955 [I][BadBleWorker] BT RSSI: 0.000000 +255975 [I][BadBleWorker] BT RSSI: 0.000000 +255996 [I][BadBleWorker] BLE Key timeout : 16 +256000 [D][BadBleWorker] line:DELAY 200 +256003 [I][BadBleWorker] BLE Key timeout : 16 +256006 [I][SavedStruct] Loading "/int/.desktop.settings" +256190 [I][SavedStruct] Loading "/int/.desktop.settings" +256207 [D][BadBleWorker] line:ENTER +256209 [I][BadBleWorker] Special key pressed 28 + +256213 [I][BadBleWorker] BT RSSI: 0.000000 +256232 [I][BadBleWorker] BLE Key timeout : 16 +256236 [I][BadBleWorker] BLE Key timeout : 16 +256248 [I][SavedStruct] Loading "/int/.desktop.settings" +256390 [I][SavedStruct] Loading "/int/.desktop.settings" +256590 [I][SavedStruct] Loading "/int/.desktop.settings" +256748 [I][SavedStruct] Loading "/int/.desktop.settings" +256790 [I][SavedStruct] Loading "/int/.desktop.settings" +256990 [I][SavedStruct] Loading "/int/.desktop.settings" +257190 [I][SavedStruct] Loading "/int/.desktop.settings" +257248 [I][SavedStruct] Loading "/int/.desktop.settings" +257390 [I][SavedStruct] Loading "/int/.desktop.settings" +257436 [I][BtGap] Stop advertising +257439 [D][BtGap] terminate success +257442 [E][BtGap] set_non_discoverable failed 12 +257446 [I][SavedStruct] Loading "/int/.desktop.settings" +257590 [I][SavedStruct] Loading "/int/.desktop.settings" +257646 [I][SavedStruct] Loading "/int/.bt.settings" +257659 [I][SavedStruct] Loading "/int/.bt.keys" +257669 [I][FuriHalBt] Disconnect and stop advertising +257671 [I][FuriHalBt] Stop current profile services +257683 [I][FuriHalBt] Stop BLE related RTOS threads +257707 [I][FuriHalBt] Reset SHCI +257790 [I][SavedStruct] Loading "/int/.desktop.settings" +257821 [I][FuriHalBt] Start BT initialization +257826 [I][Core2] Core2 started +257828 [I][Core2] C2 boot completed, mode: Stack +257831 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +257833 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +257837 [I][Core2] Radio stack started +257839 [I][Core2] Flash activity control switched to SEM7 +257841 [I][BtGap] Advertising name: Keyboard +257843 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +257860 [D][BtBatterySvc] Updating power state characteristic +257866 [I][BtSrv] Bt App started +257868 [I][BtGap] Start advertising +257871 [I][BadBleWorker] End +257873 [I][SavedStruct] Loading "/int/.desktop.settings" +257893 [D][BrowserWorker] Start +257909 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +257911 [D][BrowserWorker] Load offset: 0 cnt: 50 +257983 [D][GuiSrv] ViewPort changed while key press 2000D718 -> 20010BD0. Discarding key: Back, type: Short, sequence: 00000031 +257987 [D][GuiSrv] ViewPort changed while key press 2000D718 -> 20010BD0. Sending key: Back, type: Release, sequence: 00000031 to previous view port +258434 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 +258438 [D][BrowserWorker] Load offset: 0 cnt: 50 +278749 [I][Dolphin] Flush stats +278751 [I][SavedStruct] Saving "/int/.dolphin.state" +278762 [D][StorageInt] Device erase: page 2, translated page: cf +278771 [D][StorageInt] Device sync: skipping +278774 [I][DolphinState] State saved +317982 [D][BtGap] set_non_discoverable success +377984 [D][BtGap] set_non_discoverable success + + _.-------.._ -, + .-"```"--..,,_/ /`-, -, \ + .:" /:/ /'\ \ ,_..., `. | | + / ,----/:/ /`\ _\~`_-"` _; + ' / /`"""'\ \ \.~`_-' ,-"'/ + | | | 0 | | .-' ,/` / + | ,..\ \ ,.-"` ,/` / + ; : `/`""\` ,/--==,/-----, + | `-...| -.___-Z:_______J...---; + : ` _-' + _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ +| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| +| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | +|_| |____||___||_| |_| |___||_|_\ \___||____||___| + +Welcome to Flipper Zero Command Line Interface! +Read Manual https://docs.flipperzero.one + +Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) + +>: log +Press CTRL+C to stop... +48839 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 +48842 [D][BrowserWorker] Load offset: 0 cnt: 50 +51685 [D][BrowserWorker] End +51698 [I][BtGap] Stop advertising +51702 [D][BtGap] set_non_discoverable success +51716 [I][SavedStruct] Loading "/int/.desktop.settings" +51843 [I][SavedStruct] Loading "/int/.desktop.settings" +51908 [I][FuriHalBt] Disconnect and stop advertising +51910 [I][FuriHalBt] Stop current profile services +51919 [I][FuriHalBt] Stop BLE related RTOS threads +51943 [I][FuriHalBt] Reset SHCI +52043 [I][SavedStruct] Loading "/int/.desktop.settings" +52057 [I][FuriHalBt] Start BT initialization +52063 [I][Core2] Core2 started +52065 [I][Core2] C2 boot completed, mode: Stack +52068 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +52070 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +52074 [I][Core2] Radio stack started +52077 [I][Core2] Flash activity control switched to SEM7 +52079 [I][BtGap] Advertising name: Keyboard +52082 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +52098 [D][BtBatterySvc] Updating power state characteristic +52104 [I][BtGap] Start advertising +52106 [I][SavedStruct] Loading "/int/.bt.settings" +52124 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +52134 [I][FuriHalBt] Disconnect and stop advertising +52136 [I][BtGap] Stop advertising +52139 [D][BtGap] set_non_discoverable success +52142 [I][FuriHalBt] Stop current profile services +52152 [I][FuriHalBt] Stop BLE related RTOS threads +52177 [I][FuriHalBt] Reset SHCI +52212 [I][SavedStruct] Loading "/int/.desktop.settings" +52243 [I][SavedStruct] Loading "/int/.desktop.settings" +52291 [I][FuriHalBt] Start BT initialization +52296 [I][Core2] Core2 started +52298 [I][Core2] C2 boot completed, mode: Stack +52301 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +52303 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +52308 [I][Core2] Radio stack started +52310 [I][Core2] Flash activity control switched to SEM7 +52314 [I][BtGap] Advertising name: Rumik1 +52316 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +52333 [D][BtBatterySvc] Updating power state characteristic +52342 [I][BtSrv] Bt App started +52343 [I][BtGap] Start advertising +52347 [I][BadBleWorker] Init +52351 [I][SavedStruct] Loading "/int/.desktop.settings" +52378 [I][BadBleWorker] BLE Key timeout : 16 +52443 [I][SavedStruct] Loading "/int/.desktop.settings" +52643 [I][SavedStruct] Loading "/int/.desktop.settings" +52712 [I][SavedStruct] Loading "/int/.desktop.settings" +52843 [I][SavedStruct] Loading "/int/.desktop.settings" +53043 [I][SavedStruct] Loading "/int/.desktop.settings" +53243 [I][SavedStruct] Loading "/int/.desktop.settings" +53861 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +53865 [I][BtGap] Rssi: 302 +53954 [D][BtGap] Slave security initiated +54073 [I][BtGap] Pairing complete +54076 [D][BtBatterySvc] Updating battery level characteristic +54079 [I][BadBleWorker] BLE Key timeout : 16 +54252 [I][BtGap] Rx MTU size: 414 +54822 [I][BtGap] Connection parameters event complete +54824 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +54826 [W][BtGap] Unsupported connection interval. Request connection parameters update +54829 [I][BtGap] Rssi: 290 +54859 [D][BtGap] Connection parameters accepted +55022 [I][BtGap] Connection parameters event complete +55025 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +55027 [I][BtGap] Rssi: 293 +59176 [I][FuriHalBt] Disconnect and stop advertising +59180 [I][BtGap] Stop advertising +59184 [D][BtGap] terminate success +59188 [E][BtGap] set_non_discoverable failed 12 +59193 [I][FuriHalBt] Stop current profile services +59198 [I][BadBleWorker] BLE Key timeout : 16 +59216 [I][FuriHalBt] Stop BLE related RTOS threads +59240 [I][FuriHalBt] Reset SHCI +59354 [I][FuriHalBt] Start BT initialization +59360 [I][Core2] Core2 started +59363 [I][Core2] C2 boot completed, mode: Stack +59366 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +59368 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +59372 [I][Core2] Radio stack started +59375 [I][Core2] Flash activity control switched to SEM7 +59377 [I][BtGap] Advertising name: Kkk +59380 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +59397 [D][BtBatterySvc] Updating power state characteristic +59407 [I][BtGap] Start advertising +60280 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +60282 [I][BtGap] Rssi: 302 +60374 [D][BtGap] Slave security initiated +60495 [I][BtGap] Pairing complete +60498 [D][BtBatterySvc] Updating battery level characteristic +60500 [I][BadBleWorker] BLE Key timeout : 16 +60673 [I][BtGap] Rx MTU size: 414 +61244 [I][BtGap] Connection parameters event complete +61248 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +61252 [W][BtGap] Unsupported connection interval. Request connection parameters update +61258 [I][BtGap] Rssi: 297 +61284 [D][BtGap] Connection parameters accepted +61448 [I][BtGap] Connection parameters event complete +61452 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +61456 [I][BtGap] Rssi: 298 +66066 [I][BtGap] Disconnect from client. Reason: 13 +66069 [I][BadBleWorker] BLE Key timeout : 16 +69485 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +69489 [I][BtGap] Rssi: 297 +69600 [D][BtGap] Slave security initiated +69720 [I][BtGap] Pairing complete +69723 [D][BtBatterySvc] Updating battery level characteristic +69727 [I][BadBleWorker] BLE Key timeout : 16 +69900 [I][BtGap] Rx MTU size: 414 +71400 [I][BtGap] Connection parameters event complete +71402 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +71405 [W][BtGap] Unsupported connection interval. Request connection parameters update +71408 [I][BtGap] Rssi: 296 +71438 [D][BtGap] Connection parameters accepted +71603 [I][BtGap] Connection parameters event complete +71605 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +71609 [I][BtGap] Rssi: 299 +73790 [I][BtGap] Disconnect from client. Reason: 13 +73792 [I][BadBleWorker] BLE Key timeout : 16 +80587 [I][FuriHalBt] Disconnect and stop advertising +80591 [I][BtGap] Stop advertising +80595 [D][BtGap] set_non_discoverable success +80600 [I][FuriHalBt] Stop current profile services +80621 [I][FuriHalBt] Stop BLE related RTOS threads +80647 [I][FuriHalBt] Reset SHCI +80762 [I][FuriHalBt] Start BT initialization +80767 [I][Core2] Core2 started +80769 [I][Core2] C2 boot completed, mode: Stack +80772 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +80774 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +80778 [I][Core2] Radio stack started +80781 [I][Core2] Flash activity control switched to SEM7 +80783 [I][BtGap] Advertising name: Kkk +80786 [I][BtGap] MAC @ : 35:F2:47:26:11:11 +80803 [D][BtBatterySvc] Updating power state characteristic +80813 [I][BtGap] Start advertising +81988 [D][ViewDispatcher] View changed while key press 200101B0 -> 200102B8. Sending key: Back, type: Release, sequence: 00000028 to previous view port +81992 [I][SavedStruct] Loading "/int/.desktop.settings" +82043 [I][SavedStruct] Loading "/int/.desktop.settings" +82243 [I][SavedStruct] Loading "/int/.desktop.settings" +82443 [I][SavedStruct] Loading "/int/.desktop.settings" +82493 [I][SavedStruct] Loading "/int/.desktop.settings" +82643 [I][SavedStruct] Loading "/int/.desktop.settings" +82843 [I][SavedStruct] Loading "/int/.desktop.settings" +82993 [I][SavedStruct] Loading "/int/.desktop.settings" +83043 [I][SavedStruct] Loading "/int/.desktop.settings" +83243 [I][SavedStruct] Loading "/int/.desktop.settings" +83443 [I][SavedStruct] Loading "/int/.desktop.settings" +83493 [I][SavedStruct] Loading "/int/.desktop.settings" +83643 [I][SavedStruct] Loading "/int/.desktop.settings" +83843 [I][SavedStruct] Loading "/int/.desktop.settings" +83993 [I][SavedStruct] Loading "/int/.desktop.settings" +84043 [I][SavedStruct] Loading "/int/.desktop.settings" +84243 [I][SavedStruct] Loading "/int/.desktop.settings" +84443 [I][SavedStruct] Loading "/int/.desktop.settings" +84493 [I][SavedStruct] Loading "/int/.desktop.settings" +84643 [I][SavedStruct] Loading "/int/.desktop.settings" +84843 [I][SavedStruct] Loading "/int/.desktop.settings" +84993 [I][SavedStruct] Loading "/int/.desktop.settings" +85043 [I][SavedStruct] Loading "/int/.desktop.settings" +85243 [I][SavedStruct] Loading "/int/.desktop.settings" +85443 [I][SavedStruct] Loading "/int/.desktop.settings" +85493 [I][SavedStruct] Loading "/int/.desktop.settings" +85643 [I][SavedStruct] Loading "/int/.desktop.settings" +85843 [I][SavedStruct] Loading "/int/.desktop.settings" +85993 [I][SavedStruct] Loading "/int/.desktop.settings" +86043 [I][SavedStruct] Loading "/int/.desktop.settings" +86243 [I][SavedStruct] Loading "/int/.desktop.settings" +86443 [I][SavedStruct] Loading "/int/.desktop.settings" +86493 [I][SavedStruct] Loading "/int/.desktop.settings" +86643 [I][SavedStruct] Loading "/int/.desktop.settings" +86843 [I][SavedStruct] Loading "/int/.desktop.settings" +86993 [I][SavedStruct] Loading "/int/.desktop.settings" +87043 [I][SavedStruct] Loading "/int/.desktop.settings" +87243 [I][SavedStruct] Loading "/int/.desktop.settings" +87443 [I][SavedStruct] Loading "/int/.desktop.settings" +87493 [I][SavedStruct] Loading "/int/.desktop.settings" +87643 [I][SavedStruct] Loading "/int/.desktop.settings" +87843 [I][SavedStruct] Loading "/int/.desktop.settings" +87993 [I][SavedStruct] Loading "/int/.desktop.settings" +88043 [I][SavedStruct] Loading "/int/.desktop.settings" +88243 [I][SavedStruct] Loading "/int/.desktop.settings" +88443 [I][SavedStruct] Loading "/int/.desktop.settings" +88493 [I][SavedStruct] Loading "/int/.desktop.settings" +88643 [I][SavedStruct] Loading "/int/.desktop.settings" +88843 [I][SavedStruct] Loading "/int/.desktop.settings" +88993 [I][SavedStruct] Loading "/int/.desktop.settings" +89043 [I][SavedStruct] Loading "/int/.desktop.settings" +89243 [I][SavedStruct] Loading "/int/.desktop.settings" +89443 [I][SavedStruct] Loading "/int/.desktop.settings" +89493 [I][SavedStruct] Loading "/int/.desktop.settings" +89643 [I][SavedStruct] Loading "/int/.desktop.settings" +89843 [I][SavedStruct] Loading "/int/.desktop.settings" +89993 [I][SavedStruct] Loading "/int/.desktop.settings" +90043 [I][SavedStruct] Loading "/int/.desktop.settings" +90243 [I][SavedStruct] Loading "/int/.desktop.settings" +90443 [I][SavedStruct] Loading "/int/.desktop.settings" +90493 [I][SavedStruct] Loading "/int/.desktop.settings" +90643 [I][SavedStruct] Loading "/int/.desktop.settings" +90843 [I][SavedStruct] Loading "/int/.desktop.settings" +90993 [I][SavedStruct] Loading "/int/.desktop.settings" +91043 [I][SavedStruct] Loading "/int/.desktop.settings" +91243 [I][SavedStruct] Loading "/int/.desktop.settings" +91443 [I][SavedStruct] Loading "/int/.desktop.settings" +91493 [I][SavedStruct] Loading "/int/.desktop.settings" +91643 [I][SavedStruct] Loading "/int/.desktop.settings" +91843 [I][SavedStruct] Loading "/int/.desktop.settings" +91993 [I][SavedStruct] Loading "/int/.desktop.settings" +92043 [I][SavedStruct] Loading "/int/.desktop.settings" +92243 [I][SavedStruct] Loading "/int/.desktop.settings" +92443 [I][SavedStruct] Loading "/int/.desktop.settings" +92493 [I][SavedStruct] Loading "/int/.desktop.settings" +92643 [I][SavedStruct] Loading "/int/.desktop.settings" +92843 [I][SavedStruct] Loading "/int/.desktop.settings" +92993 [I][SavedStruct] Loading "/int/.desktop.settings" +93043 [I][SavedStruct] Loading "/int/.desktop.settings" +93243 [I][SavedStruct] Loading "/int/.desktop.settings" +93443 [I][SavedStruct] Loading "/int/.desktop.settings" +93493 [I][SavedStruct] Loading "/int/.desktop.settings" +93643 [I][SavedStruct] Loading "/int/.desktop.settings" +93843 [I][SavedStruct] Loading "/int/.desktop.settings" +93993 [I][SavedStruct] Loading "/int/.desktop.settings" +94043 [I][SavedStruct] Loading "/int/.desktop.settings" +94243 [I][SavedStruct] Loading "/int/.desktop.settings" +94443 [I][SavedStruct] Loading "/int/.desktop.settings" +94493 [I][SavedStruct] Loading "/int/.desktop.settings" +94643 [I][SavedStruct] Loading "/int/.desktop.settings" +94843 [I][SavedStruct] Loading "/int/.desktop.settings" +94993 [I][SavedStruct] Loading "/int/.desktop.settings" +95043 [I][SavedStruct] Loading "/int/.desktop.settings" +95243 [I][SavedStruct] Loading "/int/.desktop.settings" +95443 [I][SavedStruct] Loading "/int/.desktop.settings" +95493 [I][SavedStruct] Loading "/int/.desktop.settings" +95643 [I][SavedStruct] Loading "/int/.desktop.settings" +95843 [I][SavedStruct] Loading "/int/.desktop.settings" +95993 [I][SavedStruct] Loading "/int/.desktop.settings" +96043 [I][SavedStruct] Loading "/int/.desktop.settings" +96243 [I][SavedStruct] Loading "/int/.desktop.settings" +96443 [I][SavedStruct] Loading "/int/.desktop.settings" +96493 [I][SavedStruct] Loading "/int/.desktop.settings" +96643 [I][SavedStruct] Loading "/int/.desktop.settings" +96846 [I][SavedStruct] Loading "/int/.desktop.settings" +96913 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +96916 [I][BtGap] Rssi: 324 +96993 [I][SavedStruct] Loading "/int/.desktop.settings" +97006 [D][BtGap] Slave security initiated +97043 [I][SavedStruct] Loading "/int/.desktop.settings" +97094 [I][BtGap] Rx MTU size: 414 +97243 [I][SavedStruct] Loading "/int/.desktop.settings" +97443 [I][SavedStruct] Loading "/int/.desktop.settings" +97493 [I][SavedStruct] Loading "/int/.desktop.settings" +97601 [D][BtGap] Bond lost event. Start rebonding +97643 [I][SavedStruct] Loading "/int/.desktop.settings" +97780 [I][BtGap] Verify numeric comparison: 898056 +100222 [I][SavedStruct] Loading "/int/.desktop.settings" +100243 [I][SavedStruct] Loading "/int/.desktop.settings" +100264 [I][SavedStruct] Loading "/int/.desktop.settings" +100443 [I][SavedStruct] Loading "/int/.desktop.settings" +100493 [I][SavedStruct] Loading "/int/.desktop.settings" +100643 [I][SavedStruct] Loading "/int/.desktop.settings" +100657 [I][BtGap] Pairing complete +100661 [D][BtBatterySvc] Updating battery level characteristic +100666 [I][BadBleWorker] BLE Key timeout : 16 +100843 [I][SavedStruct] Loading "/int/.desktop.settings" +100993 [I][SavedStruct] Loading "/int/.desktop.settings" +101043 [I][SavedStruct] Loading "/int/.desktop.settings" +101243 [I][SavedStruct] Loading "/int/.desktop.settings" +101443 [I][SavedStruct] Loading "/int/.desktop.settings" +101493 [I][SavedStruct] Loading "/int/.desktop.settings" +101643 [I][SavedStruct] Loading "/int/.desktop.settings" +101668 [I][BtGap] Connection parameters event complete +101670 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +101673 [W][BtGap] Unsupported connection interval. Request connection parameters update +101677 [I][BtGap] Rssi: 345 +101707 [D][BtGap] Connection parameters accepted +101843 [I][SavedStruct] Loading "/int/.desktop.settings" +101870 [I][BtGap] Connection parameters event complete +101873 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +101875 [I][BtGap] Rssi: 337 +101993 [I][SavedStruct] Loading "/int/.desktop.settings" +102043 [I][SavedStruct] Loading "/int/.desktop.settings" +102243 [I][SavedStruct] Loading "/int/.desktop.settings" +102443 [I][SavedStruct] Loading "/int/.desktop.settings" +102493 [I][SavedStruct] Loading "/int/.desktop.settings" +102643 [I][SavedStruct] Loading "/int/.desktop.settings" +102843 [I][SavedStruct] Loading "/int/.desktop.settings" +102993 [I][SavedStruct] Loading "/int/.desktop.settings" +103043 [I][SavedStruct] Loading "/int/.desktop.settings" +103243 [I][SavedStruct] Loading "/int/.desktop.settings" +103443 [I][SavedStruct] Loading "/int/.desktop.settings" +103493 [I][SavedStruct] Loading "/int/.desktop.settings" +103643 [I][SavedStruct] Loading "/int/.desktop.settings" +103843 [I][SavedStruct] Loading "/int/.desktop.settings" +103993 [I][SavedStruct] Loading "/int/.desktop.settings" +104043 [I][SavedStruct] Loading "/int/.desktop.settings" +104243 [I][SavedStruct] Loading "/int/.desktop.settings" +104443 [I][SavedStruct] Loading "/int/.desktop.settings" +104493 [I][SavedStruct] Loading "/int/.desktop.settings" +104643 [I][SavedStruct] Loading "/int/.desktop.settings" +104843 [I][SavedStruct] Loading "/int/.desktop.settings" +104993 [I][SavedStruct] Loading "/int/.desktop.settings" +105043 [I][SavedStruct] Loading "/int/.desktop.settings" +105243 [I][SavedStruct] Loading "/int/.desktop.settings" +105443 [I][SavedStruct] Loading "/int/.desktop.settings" +105493 [I][SavedStruct] Loading "/int/.desktop.settings" +105643 [I][SavedStruct] Loading "/int/.desktop.settings" +105843 [I][SavedStruct] Loading "/int/.desktop.settings" +105993 [I][SavedStruct] Loading "/int/.desktop.settings" +106043 [I][SavedStruct] Loading "/int/.desktop.settings" +106243 [I][SavedStruct] Loading "/int/.desktop.settings" +106443 [I][SavedStruct] Loading "/int/.desktop.settings" +106493 [I][SavedStruct] Loading "/int/.desktop.settings" +106643 [I][SavedStruct] Loading "/int/.desktop.settings" +106843 [I][SavedStruct] Loading "/int/.desktop.settings" +106993 [I][SavedStruct] Loading "/int/.desktop.settings" +107043 [I][SavedStruct] Loading "/int/.desktop.settings" +107243 [I][SavedStruct] Loading "/int/.desktop.settings" +107443 [I][SavedStruct] Loading "/int/.desktop.settings" +107493 [I][SavedStruct] Loading "/int/.desktop.settings" +107643 [I][SavedStruct] Loading "/int/.desktop.settings" +107843 [I][SavedStruct] Loading "/int/.desktop.settings" +107995 [I][SavedStruct] Loading "/int/.desktop.settings" +108043 [I][SavedStruct] Loading "/int/.desktop.settings" +108243 [I][SavedStruct] Loading "/int/.desktop.settings" +108443 [I][SavedStruct] Loading "/int/.desktop.settings" +108493 [I][SavedStruct] Loading "/int/.desktop.settings" +108643 [I][SavedStruct] Loading "/int/.desktop.settings" +108843 [I][SavedStruct] Loading "/int/.desktop.settings" +108993 [I][SavedStruct] Loading "/int/.desktop.settings" +109043 [I][SavedStruct] Loading "/int/.desktop.settings" +109243 [I][SavedStruct] Loading "/int/.desktop.settings" +109443 [I][SavedStruct] Loading "/int/.desktop.settings" +109536 [D][DolphinState] icounter 1325, butthurt 0 +109539 [I][BadBleWorker] BLE Key timeout : 16 +109543 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +109546 [I][BadBleWorker] BLE Key timeout : 16 +109549 [D][BadBleWorker] line:DELAY 1000 +109552 [I][BadBleWorker] BLE Key timeout : 16 +109643 [I][SavedStruct] Loading "/int/.desktop.settings" +109843 [I][SavedStruct] Loading "/int/.desktop.settings" +110037 [I][SavedStruct] Loading "/int/.desktop.settings" +110055 [I][SavedStruct] Loading "/int/.desktop.settings" +110243 [I][SavedStruct] Loading "/int/.desktop.settings" +110443 [I][SavedStruct] Loading "/int/.desktop.settings" +110537 [I][SavedStruct] Loading "/int/.desktop.settings" +110555 [D][BadBleWorker] line:GUI SPACE +110557 [I][BadBleWorker] Special key pressed 82c + +110578 [I][BadBleWorker] BLE Key timeout : 16 +110582 [D][BadBleWorker] line:DELAY 500 +110585 [I][BadBleWorker] BLE Key timeout : 16 +110643 [I][SavedStruct] Loading "/int/.desktop.settings" +110843 [I][SavedStruct] Loading "/int/.desktop.settings" +111039 [I][SavedStruct] Loading "/int/.desktop.settings" +111066 [I][SavedStruct] Loading "/int/.desktop.settings" +111088 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +111243 [I][SavedStruct] Loading "/int/.desktop.settings" +111443 [I][SavedStruct] Loading "/int/.desktop.settings" +111537 [I][SavedStruct] Loading "/int/.desktop.settings" +111643 [I][SavedStruct] Loading "/int/.desktop.settings" +111792 [E][BtHid] Failed updating report characteristic: 100 +111811 [E][BtHid] Failed updating report characteristic: 100 +111814 [E][BtHid] Failed updating report characteristic: 100 +111833 [E][BtHid] Failed updating report characteristic: 100 +111836 [I][BadBleWorker] BLE Key timeout : 16 +111838 [D][BadBleWorker] line:DELAY 200 +111840 [I][BadBleWorker] BLE Key timeout : 16 +111843 [I][SavedStruct] Loading "/int/.desktop.settings" +112037 [I][SavedStruct] Loading "/int/.desktop.settings" +112044 [D][BadBleWorker] line:ENTER +112046 [I][BadBleWorker] Special key pressed 28 + +112069 [I][BadBleWorker] BLE Key timeout : 16 +112072 [D][BadBleWorker] line:GUI SPACE +112074 [I][BadBleWorker] Special key pressed 82c + +112077 [I][SavedStruct] Loading "/int/.desktop.settings" +112095 [I][BadBleWorker] BLE Key timeout : 16 +112099 [D][BadBleWorker] line:DELAY 500 +112102 [I][BadBleWorker] BLE Key timeout : 16 +112243 [I][SavedStruct] Loading "/int/.desktop.settings" +112443 [I][SavedStruct] Loading "/int/.desktop.settings" +112537 [I][SavedStruct] Loading "/int/.desktop.settings" +112605 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +112643 [I][SavedStruct] Loading "/int/.desktop.settings" +112843 [I][SavedStruct] Loading "/int/.desktop.settings" +113037 [I][SavedStruct] Loading "/int/.desktop.settings" +113055 [I][SavedStruct] Loading "/int/.desktop.settings" +113243 [I][SavedStruct] Loading "/int/.desktop.settings" +113347 [I][BadBleWorker] BLE Key timeout : 16 +113351 [D][BadBleWorker] line:DELAY 200 +113354 [I][BadBleWorker] BLE Key timeout : 16 +113443 [I][SavedStruct] Loading "/int/.desktop.settings" +113537 [I][SavedStruct] Loading "/int/.desktop.settings" +113557 [D][BadBleWorker] line:ENTER +113559 [I][BadBleWorker] Special key pressed 28 + +113579 [I][BadBleWorker] BLE Key timeout : 16 +113583 [D][BadBleWorker] line:GUI SPACE +113585 [I][BadBleWorker] Special key pressed 82c + +113605 [I][BadBleWorker] BLE Key timeout : 16 +113608 [D][BadBleWorker] line:DELAY 500 +113610 [I][BadBleWorker] BLE Key timeout : 16 +113643 [I][SavedStruct] Loading "/int/.desktop.settings" +113843 [I][SavedStruct] Loading "/int/.desktop.settings" +114037 [I][SavedStruct] Loading "/int/.desktop.settings" +114055 [I][SavedStruct] Loading "/int/.desktop.settings" +114113 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +114243 [I][SavedStruct] Loading "/int/.desktop.settings" +114443 [I][SavedStruct] Loading "/int/.desktop.settings" +114537 [I][SavedStruct] Loading "/int/.desktop.settings" +114643 [I][SavedStruct] Loading "/int/.desktop.settings" +114843 [I][SavedStruct] Loading "/int/.desktop.settings" +114853 [I][BadBleWorker] BLE Key timeout : 16 +114861 [D][BadBleWorker] line:DELAY 200 +114865 [I][BadBleWorker] BLE Key timeout : 16 +115037 [I][SavedStruct] Loading "/int/.desktop.settings" +115055 [I][SavedStruct] Loading "/int/.desktop.settings" +115069 [D][BadBleWorker] line:ENTER +115071 [I][BadBleWorker] Special key pressed 28 + +115093 [I][BadBleWorker] BLE Key timeout : 16 +115097 [D][BadBleWorker] line:GUI SPACE +115100 [I][BadBleWorker] Special key pressed 82c + +115122 [I][BadBleWorker] BLE Key timeout : 16 +115126 [D][BadBleWorker] line:DELAY 500 +115129 [I][BadBleWorker] BLE Key timeout : 16 +115243 [I][SavedStruct] Loading "/int/.desktop.settings" +115443 [I][SavedStruct] Loading "/int/.desktop.settings" +115537 [I][SavedStruct] Loading "/int/.desktop.settings" +115632 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +115643 [I][SavedStruct] Loading "/int/.desktop.settings" +115843 [I][SavedStruct] Loading "/int/.desktop.settings" +116037 [I][SavedStruct] Loading "/int/.desktop.settings" +116055 [I][SavedStruct] Loading "/int/.desktop.settings" +116243 [I][SavedStruct] Loading "/int/.desktop.settings" +116369 [I][BadBleWorker] BLE Key timeout : 16 +116372 [D][BadBleWorker] line:DELAY 200 +116374 [I][BadBleWorker] BLE Key timeout : 16 +116443 [I][SavedStruct] Loading "/int/.desktop.settings" +116537 [I][SavedStruct] Loading "/int/.desktop.settings" +116577 [D][BadBleWorker] line:ENTER +116579 [I][BadBleWorker] Special key pressed 28 + +116599 [I][BadBleWorker] BLE Key timeout : 16 +116603 [I][BadBleWorker] BLE Key timeout : 16 +116643 [I][SavedStruct] Loading "/int/.desktop.settings" +116843 [I][SavedStruct] Loading "/int/.desktop.settings" +117037 [I][SavedStruct] Loading "/int/.desktop.settings" +117056 [I][SavedStruct] Loading "/int/.desktop.settings" +117243 [I][SavedStruct] Loading "/int/.desktop.settings" +117443 [I][SavedStruct] Loading "/int/.desktop.settings" +117537 [I][SavedStruct] Loading "/int/.desktop.settings" +117643 [I][SavedStruct] Loading "/int/.desktop.settings" +117843 [I][SavedStruct] Loading "/int/.desktop.settings" +118037 [I][SavedStruct] Loading "/int/.desktop.settings" +118056 [I][SavedStruct] Loading "/int/.desktop.settings" +118243 [I][SavedStruct] Loading "/int/.desktop.settings" +118443 [I][SavedStruct] Loading "/int/.desktop.settings" +118537 [I][SavedStruct] Loading "/int/.desktop.settings" +118643 [I][SavedStruct] Loading "/int/.desktop.settings" +118843 [I][SavedStruct] Loading "/int/.desktop.settings" +119037 [I][SavedStruct] Loading "/int/.desktop.settings" +119056 [I][SavedStruct] Loading "/int/.desktop.settings" +119243 [I][SavedStruct] Loading "/int/.desktop.settings" +119443 [I][SavedStruct] Loading "/int/.desktop.settings" +119537 [I][SavedStruct] Loading "/int/.desktop.settings" +119643 [I][SavedStruct] Loading "/int/.desktop.settings" +119843 [I][SavedStruct] Loading "/int/.desktop.settings" +120037 [I][SavedStruct] Loading "/int/.desktop.settings" +120056 [I][SavedStruct] Loading "/int/.desktop.settings" +120243 [I][SavedStruct] Loading "/int/.desktop.settings" +120443 [I][SavedStruct] Loading "/int/.desktop.settings" +120537 [I][SavedStruct] Loading "/int/.desktop.settings" +120643 [I][SavedStruct] Loading "/int/.desktop.settings" +120843 [I][SavedStruct] Loading "/int/.desktop.settings" +121037 [I][SavedStruct] Loading "/int/.desktop.settings" +121056 [I][SavedStruct] Loading "/int/.desktop.settings" +121243 [I][SavedStruct] Loading "/int/.desktop.settings" +121443 [I][SavedStruct] Loading "/int/.desktop.settings" +121537 [I][SavedStruct] Loading "/int/.desktop.settings" +121643 [I][SavedStruct] Loading "/int/.desktop.settings" +121843 [I][SavedStruct] Loading "/int/.desktop.settings" +122037 [I][SavedStruct] Loading "/int/.desktop.settings" +122056 [I][SavedStruct] Loading "/int/.desktop.settings" +122243 [I][SavedStruct] Loading "/int/.desktop.settings" +122443 [I][SavedStruct] Loading "/int/.desktop.settings" +122537 [I][SavedStruct] Loading "/int/.desktop.settings" +122643 [I][SavedStruct] Loading "/int/.desktop.settings" +122843 [I][SavedStruct] Loading "/int/.desktop.settings" +123037 [I][SavedStruct] Loading "/int/.desktop.settings" +123056 [I][SavedStruct] Loading "/int/.desktop.settings" +123243 [I][SavedStruct] Loading "/int/.desktop.settings" +123443 [I][SavedStruct] Loading "/int/.desktop.settings" +123537 [I][SavedStruct] Loading "/int/.desktop.settings" +123643 [I][SavedStruct] Loading "/int/.desktop.settings" +123843 [I][SavedStruct] Loading "/int/.desktop.settings" +124037 [I][SavedStruct] Loading "/int/.desktop.settings" +124056 [I][SavedStruct] Loading "/int/.desktop.settings" +124243 [I][SavedStruct] Loading "/int/.desktop.settings" +124335 [I][BtGap] Stop advertising +124338 [D][BtGap] terminate success +124341 [E][BtGap] set_non_discoverable failed 12 +124345 [I][SavedStruct] Loading "/int/.desktop.settings" +124443 [I][SavedStruct] Loading "/int/.desktop.settings" +124483 [I][BtGap] Disconnect from client. Reason: 16 +124545 [I][SavedStruct] Loading "/int/.bt.settings" +124558 [I][SavedStruct] Loading "/int/.bt.keys" +124567 [I][FuriHalBt] Disconnect and stop advertising +124571 [I][FuriHalBt] Stop current profile services +124582 [I][FuriHalBt] Stop BLE related RTOS threads +124606 [I][FuriHalBt] Reset SHCI +124643 [I][SavedStruct] Loading "/int/.desktop.settings" +124720 [I][FuriHalBt] Start BT initialization +124725 [I][Core2] Core2 started +124727 [I][Core2] C2 boot completed, mode: Stack +124730 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +124732 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +124736 [I][Core2] Radio stack started +124738 [I][Core2] Flash activity control switched to SEM7 +124740 [I][BtGap] Advertising name: Keyboard +124742 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +124753 [E][BtGap] Message queue get error: -4 +124762 [D][BtBatterySvc] Updating power state characteristic +124768 [I][BtSrv] Bt App started +124770 [I][BtGap] Start advertising +124772 [I][BadBleWorker] End +124774 [I][SavedStruct] Loading "/int/.desktop.settings" +124785 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +124790 [I][BtGap] Rssi: 328 +124801 [D][BrowserWorker] Start +124803 [I][SavedStruct] Loading "/int/.desktop.settings" +124834 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +124836 [D][BrowserWorker] Load offset: 0 cnt: 50 +124880 [D][BtGap] Slave security initiated +124999 [I][BtGap] Pairing complete +125003 [I][BtSrv] Open RPC connection +125006 [D][RpcSrv] Session started +125008 [D][BtBatterySvc] Updating battery level characteristic +125025 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 +125028 [D][BrowserWorker] Load offset: 0 cnt: 50 +125146 [I][BtGap] Rx MTU size: 414 +125268 [D][BrowserWorker] End +125270 [I][SavedStruct] Loading "/int/.desktop.settings" +125315 [I][fap_loader_app] FAP app returned: 0 +125347 [I][LoaderSrv] Application stopped. Free heap: 118720 +125376 [I][AnimationStorage] Custom Manifest selected +126074 [I][AnimationManager] Select 'SPIRAL' animation +126078 [I][AnimationManager] Load animation 'SPIRAL' +126102 [I][SavedStruct] Loading "/int/.desktop.settings" +127063 [D][BtSerialSvc] Received 57 bytes +127066 [D][BtSerialSvc] Available buff size: 967 +127069 [D][RpcStorage] Read +127123 [D][RpcStorage] Stat +127183 [D][RpcStorage] Info +127243 [D][BtSerialSvc] Received 12 bytes +127245 [D][BtSerialSvc] Available buff size: 1012 +127247 [D][RpcStorage] Info +127301 [D][BtSerialSvc] Received 23 bytes +127303 [D][BtSerialSvc] Available buff size: 1001 +127306 [D][RpcSystem] SetDatetime +127359 [D][BtSerialSvc] Received 29 bytes +127361 [D][BtSerialSvc] Available buff size: 995 +127364 [D][RpcStorage] Stat +127446 [D][BtSerialSvc] Received 11 bytes +127448 [D][BtSerialSvc] Available buff size: 1013 +127451 [D][RpcStorage] List +127745 [D][BtSerialSvc] Received 18 bytes +127747 [D][BtSerialSvc] Available buff size: 1006 +127749 [D][RpcStorage] List +127983 [D][BtSerialSvc] Received 18 bytes +127985 [D][BtSerialSvc] Available buff size: 1006 +127988 [D][RpcStorage] List +128041 [D][BtSerialSvc] Received 15 bytes +128043 [D][BtSerialSvc] Available buff size: 1009 +128046 [D][RpcStorage] List +128219 [D][BtSerialSvc] Received 15 bytes +128222 [D][BtSerialSvc] Available buff size: 1009 +128225 [D][RpcStorage] List +128399 [D][BtSerialSvc] Received 20 bytes +128403 [D][BtSerialSvc] Available buff size: 1004 +128408 [D][RpcStorage] List +128576 [D][BtSerialSvc] Received 19 bytes +128578 [D][BtSerialSvc] Available buff size: 1005 +128580 [D][RpcStorage] List +128633 [D][BtSerialSvc] Received 27 bytes +128635 [D][BtSerialSvc] Available buff size: 997 +128639 [D][RpcStorage] Md5sum +129503 [D][BtSerialSvc] Received 37 bytes +129505 [D][BtSerialSvc] Available buff size: 987 +129512 [D][RpcStorage] Md5sum +129591 [D][BtSerialSvc] Received 38 bytes +129593 [D][BtSerialSvc] Available buff size: 986 +129600 [D][RpcStorage] Md5sum +129678 [D][BtSerialSvc] Received 37 bytes +129680 [D][BtSerialSvc] Available buff size: 987 +129683 [D][RpcStorage] Md5sum +129736 [D][BtSerialSvc] Received 38 bytes +129738 [D][BtSerialSvc] Available buff size: 986 +129741 [D][RpcStorage] Md5sum +129794 [D][BtSerialSvc] Received 36 bytes +129796 [D][BtSerialSvc] Available buff size: 988 +129799 [D][RpcStorage] Md5sum +130032 [D][BtSerialSvc] Received 36 bytes +130034 [D][BtSerialSvc] Available buff size: 988 +130037 [D][RpcStorage] Md5sum +130120 [D][BtSerialSvc] Received 36 bytes +130122 [D][BtSerialSvc] Available buff size: 988 +130125 [D][RpcStorage] Md5sum + +>: + _.-------.._ -, + .-"```"--..,,_/ /`-, -, \ + .:" /:/ /'\ \ ,_..., `. | | + / ,----/:/ /`\ _\~`_-"` _; + ' / /`"""'\ \ \.~`_-' ,-"'/ + | | | 0 | | .-' ,/` / + | ,..\ \ ,.-"` ,/` / + ; : `/`""\` ,/--==,/-----, + | `-...| -.___-Z:_______J...---; + : ` _-' + _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ +| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| +| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | +|_| |____||___||_| |_| |___||_|_\ \___||____||___| + +Welcome to Flipper Zero Command Line Interface! +Read Manual https://docs.flipperzero.one + +Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) + +>: log +Press CTRL+C to stop... +25524 [D][BrowserWorker] End +25537 [I][BtGap] Stop advertising +25541 [D][BtGap] set_non_discoverable success +25555 [I][SavedStruct] Loading "/int/.desktop.settings" +25706 [I][SavedStruct] Loading "/int/.desktop.settings" +25747 [I][FuriHalBt] Disconnect and stop advertising +25749 [I][FuriHalBt] Stop current profile services +25758 [I][FuriHalBt] Stop BLE related RTOS threads +25782 [I][FuriHalBt] Reset SHCI +25896 [I][FuriHalBt] Start BT initialization +25901 [I][Core2] Core2 started +25903 [I][Core2] C2 boot completed, mode: Stack +25906 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +25908 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +25912 [I][SavedStruct] Loading "/int/.desktop.settings" +25915 [I][Core2] Radio stack started +25921 [I][Core2] Flash activity control switched to SEM7 +25925 [I][BtGap] Advertising name: Keyboard +25928 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +25950 [D][BtBatterySvc] Updating power state characteristic +25956 [I][BtGap] Start advertising +25958 [I][SavedStruct] Loading "/int/.bt.settings" +25975 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +25984 [I][FuriHalBt] Disconnect and stop advertising +25986 [I][BtGap] Stop advertising +25989 [D][BtGap] set_non_discoverable success +25992 [I][FuriHalBt] Stop current profile services +26001 [I][FuriHalBt] Stop BLE related RTOS threads +26026 [I][FuriHalBt] Reset SHCI +26051 [I][SavedStruct] Loading "/int/.desktop.settings" +26106 [I][SavedStruct] Loading "/int/.desktop.settings" +26140 [I][FuriHalBt] Start BT initialization +26145 [I][Core2] Core2 started +26147 [I][Core2] C2 boot completed, mode: Stack +26150 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +26152 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +26156 [I][Core2] Radio stack started +26159 [I][Core2] Flash activity control switched to SEM7 +26161 [I][BtGap] Advertising name: Rumik1 +26164 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +26181 [D][BtBatterySvc] Updating power state characteristic +26190 [I][BtSrv] Bt App started +26192 [I][BtGap] Start advertising +26195 [I][BadBleWorker] Init +26197 [I][SavedStruct] Loading "/int/.desktop.settings" +26224 [I][BadBleWorker] BLE Key timeout : 16 +26306 [I][SavedStruct] Loading "/int/.desktop.settings" +26506 [I][SavedStruct] Loading "/int/.desktop.settings" +26551 [I][SavedStruct] Loading "/int/.desktop.settings" +26706 [I][SavedStruct] Loading "/int/.desktop.settings" +26909 [I][SavedStruct] Loading "/int/.desktop.settings" +27051 [I][SavedStruct] Loading "/int/.desktop.settings" +27106 [I][SavedStruct] Loading "/int/.desktop.settings" +27306 [I][SavedStruct] Loading "/int/.desktop.settings" +27506 [I][SavedStruct] Loading "/int/.desktop.settings" +27551 [I][SavedStruct] Loading "/int/.desktop.settings" +27706 [I][SavedStruct] Loading "/int/.desktop.settings" +27906 [I][SavedStruct] Loading "/int/.desktop.settings" +28051 [I][SavedStruct] Loading "/int/.desktop.settings" +28106 [I][SavedStruct] Loading "/int/.desktop.settings" +28306 [I][SavedStruct] Loading "/int/.desktop.settings" +28506 [I][SavedStruct] Loading "/int/.desktop.settings" +28551 [I][SavedStruct] Loading "/int/.desktop.settings" +28706 [I][SavedStruct] Loading "/int/.desktop.settings" +28906 [I][SavedStruct] Loading "/int/.desktop.settings" +29051 [I][SavedStruct] Loading "/int/.desktop.settings" +29106 [I][SavedStruct] Loading "/int/.desktop.settings" +29306 [I][SavedStruct] Loading "/int/.desktop.settings" +29506 [I][SavedStruct] Loading "/int/.desktop.settings" +29551 [I][SavedStruct] Loading "/int/.desktop.settings" +29706 [I][SavedStruct] Loading "/int/.desktop.settings" +29906 [I][SavedStruct] Loading "/int/.desktop.settings" +30051 [I][SavedStruct] Loading "/int/.desktop.settings" +30106 [I][SavedStruct] Loading "/int/.desktop.settings" +30306 [I][SavedStruct] Loading "/int/.desktop.settings" +30506 [I][SavedStruct] Loading "/int/.desktop.settings" +30551 [I][SavedStruct] Loading "/int/.desktop.settings" +30706 [I][SavedStruct] Loading "/int/.desktop.settings" +30906 [I][SavedStruct] Loading "/int/.desktop.settings" +31051 [I][SavedStruct] Loading "/int/.desktop.settings" +31106 [I][SavedStruct] Loading "/int/.desktop.settings" +31306 [I][SavedStruct] Loading "/int/.desktop.settings" +31506 [I][SavedStruct] Loading "/int/.desktop.settings" +31551 [I][SavedStruct] Loading "/int/.desktop.settings" +31706 [I][SavedStruct] Loading "/int/.desktop.settings" +31906 [I][SavedStruct] Loading "/int/.desktop.settings" +32051 [I][SavedStruct] Loading "/int/.desktop.settings" +32106 [I][SavedStruct] Loading "/int/.desktop.settings" +32306 [I][SavedStruct] Loading "/int/.desktop.settings" +32506 [I][SavedStruct] Loading "/int/.desktop.settings" +32551 [I][SavedStruct] Loading "/int/.desktop.settings" +32706 [I][SavedStruct] Loading "/int/.desktop.settings" +32906 [I][SavedStruct] Loading "/int/.desktop.settings" +33051 [I][SavedStruct] Loading "/int/.desktop.settings" +33106 [I][SavedStruct] Loading "/int/.desktop.settings" +33306 [I][SavedStruct] Loading "/int/.desktop.settings" +33506 [I][SavedStruct] Loading "/int/.desktop.settings" +33551 [I][SavedStruct] Loading "/int/.desktop.settings" +33706 [I][SavedStruct] Loading "/int/.desktop.settings" +33906 [I][SavedStruct] Loading "/int/.desktop.settings" +34051 [I][SavedStruct] Loading "/int/.desktop.settings" +34106 [I][SavedStruct] Loading "/int/.desktop.settings" +34306 [I][SavedStruct] Loading "/int/.desktop.settings" +34506 [I][SavedStruct] Loading "/int/.desktop.settings" +34551 [I][SavedStruct] Loading "/int/.desktop.settings" +34706 [I][SavedStruct] Loading "/int/.desktop.settings" +34906 [I][SavedStruct] Loading "/int/.desktop.settings" +35051 [I][SavedStruct] Loading "/int/.desktop.settings" +35106 [I][SavedStruct] Loading "/int/.desktop.settings" +35306 [I][SavedStruct] Loading "/int/.desktop.settings" +35506 [I][SavedStruct] Loading "/int/.desktop.settings" +35551 [I][SavedStruct] Loading "/int/.desktop.settings" +35706 [I][SavedStruct] Loading "/int/.desktop.settings" +35906 [I][SavedStruct] Loading "/int/.desktop.settings" +36051 [I][SavedStruct] Loading "/int/.desktop.settings" +36106 [I][SavedStruct] Loading "/int/.desktop.settings" +36306 [I][SavedStruct] Loading "/int/.desktop.settings" +36506 [I][SavedStruct] Loading "/int/.desktop.settings" +36551 [I][SavedStruct] Loading "/int/.desktop.settings" +36706 [I][SavedStruct] Loading "/int/.desktop.settings" +36906 [I][SavedStruct] Loading "/int/.desktop.settings" +37051 [I][SavedStruct] Loading "/int/.desktop.settings" +37106 [I][SavedStruct] Loading "/int/.desktop.settings" +37306 [I][SavedStruct] Loading "/int/.desktop.settings" +37506 [I][SavedStruct] Loading "/int/.desktop.settings" +37551 [I][SavedStruct] Loading "/int/.desktop.settings" +37706 [I][SavedStruct] Loading "/int/.desktop.settings" +37906 [I][SavedStruct] Loading "/int/.desktop.settings" +38053 [I][SavedStruct] Loading "/int/.desktop.settings" +38106 [I][SavedStruct] Loading "/int/.desktop.settings" +38306 [I][SavedStruct] Loading "/int/.desktop.settings" +38506 [I][SavedStruct] Loading "/int/.desktop.settings" +38551 [I][SavedStruct] Loading "/int/.desktop.settings" +38706 [I][SavedStruct] Loading "/int/.desktop.settings" +38906 [I][SavedStruct] Loading "/int/.desktop.settings" +39051 [I][SavedStruct] Loading "/int/.desktop.settings" +39106 [I][SavedStruct] Loading "/int/.desktop.settings" +39256 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +39258 [I][BtGap] Rssi: 334 +39306 [I][SavedStruct] Loading "/int/.desktop.settings" +39344 [D][BtGap] Slave security initiated +39435 [I][BtGap] Rx MTU size: 414 +39506 [I][SavedStruct] Loading "/int/.desktop.settings" +39551 [I][SavedStruct] Loading "/int/.desktop.settings" +39706 [I][SavedStruct] Loading "/int/.desktop.settings" +39906 [I][SavedStruct] Loading "/int/.desktop.settings" +39941 [D][BtGap] Bond lost event. Start rebonding +40051 [I][SavedStruct] Loading "/int/.desktop.settings" +40106 [I][SavedStruct] Loading "/int/.desktop.settings" +40119 [I][BtGap] Verify numeric comparison: 448118 +41993 [I][SavedStruct] Loading "/int/.desktop.settings" +42014 [I][SavedStruct] Loading "/int/.desktop.settings" +42051 [I][SavedStruct] Loading "/int/.desktop.settings" +42106 [I][SavedStruct] Loading "/int/.desktop.settings" +42306 [I][SavedStruct] Loading "/int/.desktop.settings" +42453 [I][BtKeyStorage] Base address: 200301E0. Start update address: 20030938. Size changed: 4 +42456 [I][SavedStruct] Saving "/ext/apps/Tools/.bt_hid.keys" +42458 [I][BtGap] Pairing complete +42506 [I][BtKeyStorage] Base address: 200301E0. Start update address: 20030938. Size changed: 88 +42508 [I][SavedStruct] Saving "/ext/apps/Tools/.bt_hid.keys" +42540 [D][BtGap] RSSI: -81 +42542 [D][BtBatterySvc] Updating battery level characteristic +42544 [I][SavedStruct] Loading "/int/.desktop.settings" +42547 [D][BtGap] RSSI: -81 +42551 [I][BadBleWorker] BLE Key timeout : 33 +42569 [I][SavedStruct] Loading "/int/.desktop.settings" +42706 [I][SavedStruct] Loading "/int/.desktop.settings" +42906 [I][SavedStruct] Loading "/int/.desktop.settings" +43068 [I][SavedStruct] Loading "/int/.desktop.settings" +43106 [I][SavedStruct] Loading "/int/.desktop.settings" +43306 [I][SavedStruct] Loading "/int/.desktop.settings" +43506 [I][SavedStruct] Loading "/int/.desktop.settings" +43514 [I][BtGap] Connection parameters event complete +43518 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +43522 [W][BtGap] Unsupported connection interval. Request connection parameters update +43528 [I][BtGap] Rssi: 358 +43568 [I][SavedStruct] Loading "/int/.desktop.settings" +43570 [D][BtGap] Connection parameters accepted +43706 [I][SavedStruct] Loading "/int/.desktop.settings" +43731 [I][BtGap] Connection parameters event complete +43735 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +43737 [I][BtGap] Rssi: 337 +43906 [I][SavedStruct] Loading "/int/.desktop.settings" +44068 [I][SavedStruct] Loading "/int/.desktop.settings" +44106 [I][SavedStruct] Loading "/int/.desktop.settings" +44306 [I][SavedStruct] Loading "/int/.desktop.settings" +44506 [I][SavedStruct] Loading "/int/.desktop.settings" +44568 [I][SavedStruct] Loading "/int/.desktop.settings" +44706 [I][SavedStruct] Loading "/int/.desktop.settings" +44906 [I][SavedStruct] Loading "/int/.desktop.settings" +45068 [I][SavedStruct] Loading "/int/.desktop.settings" +45106 [I][SavedStruct] Loading "/int/.desktop.settings" +45306 [I][SavedStruct] Loading "/int/.desktop.settings" +45337 [D][DolphinState] icounter 1325, butthurt 0 +45340 [D][BtGap] RSSI: -92 +45341 [I][BadBleWorker] BLE Key timeout : 16 +45346 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +45348 [D][BtGap] RSSI: -92 +45350 [I][BadBleWorker] BLE Key timeout : 16 +45352 [D][BadBleWorker] line:DELAY 1000 +45354 [D][BtGap] RSSI: -92 +45355 [I][BadBleWorker] BLE Key timeout : 16 +45506 [I][SavedStruct] Loading "/int/.desktop.settings" +45706 [I][SavedStruct] Loading "/int/.desktop.settings" +45838 [I][SavedStruct] Loading "/int/.desktop.settings" +45906 [I][SavedStruct] Loading "/int/.desktop.settings" +46106 [I][SavedStruct] Loading "/int/.desktop.settings" +46306 [I][SavedStruct] Loading "/int/.desktop.settings" +46338 [I][SavedStruct] Loading "/int/.desktop.settings" +46357 [D][BadBleWorker] line:GUI SPACE +46359 [I][BadBleWorker] Special key pressed 82c + +46380 [D][BtGap] RSSI: -96 +46382 [I][BadBleWorker] BLE Key timeout : 16 +46385 [D][BadBleWorker] line:DELAY 500 +46388 [D][BtGap] RSSI: -96 +46390 [I][BadBleWorker] BLE Key timeout : 16 +46506 [I][SavedStruct] Loading "/int/.desktop.settings" +46706 [I][SavedStruct] Loading "/int/.desktop.settings" +46838 [I][SavedStruct] Loading "/int/.desktop.settings" +46892 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +46906 [I][SavedStruct] Loading "/int/.desktop.settings" +47106 [I][SavedStruct] Loading "/int/.desktop.settings" +47306 [I][SavedStruct] Loading "/int/.desktop.settings" +47308 [E][BtHid] Failed updating report characteristic: 100 +47313 [E][BtHid] Failed updating report characteristic: 100 +47334 [E][BtHid] Failed updating report characteristic: 100 +47338 [I][SavedStruct] Loading "/int/.desktop.settings" +47340 [E][BtHid] Failed updating report characteristic: 100 +47469 [E][BtHid] Failed updating report characteristic: 100 +47472 [E][BtHid] Failed updating report characteristic: 100 +47491 [E][BtHid] Failed updating report characteristic: 100 +47494 [E][BtHid] Failed updating report characteristic: 100 +47506 [I][SavedStruct] Loading "/int/.desktop.settings" +47513 [E][BtHid] Failed updating report characteristic: 100 +47516 [E][BtHid] Failed updating report characteristic: 100 +47537 [E][BtHid] Failed updating report characteristic: 100 +47540 [E][BtHid] Failed updating report characteristic: 100 +47559 [E][BtHid] Failed updating report characteristic: 100 +47562 [E][BtHid] Failed updating report characteristic: 100 +47581 [E][BtHid] Failed updating report characteristic: 100 +47584 [E][BtHid] Failed updating report characteristic: 100 +47603 [E][BtHid] Failed updating report characteristic: 100 +47606 [E][BtHid] Failed updating report characteristic: 100 +47625 [E][BtHid] Failed updating report characteristic: 100 +47628 [E][BtHid] Failed updating report characteristic: 100 +47682 [D][BtGap] RSSI: -97 +47684 [I][BadBleWorker] BLE Key timeout : 16 +47686 [D][BadBleWorker] line:DELAY 200 +47688 [D][BtGap] RSSI: -97 +47690 [I][BadBleWorker] BLE Key timeout : 16 +47706 [I][SavedStruct] Loading "/int/.desktop.settings" +47838 [I][SavedStruct] Loading "/int/.desktop.settings" +47892 [D][BadBleWorker] line:ENTER +47894 [I][BadBleWorker] Special key pressed 28 + +47906 [I][SavedStruct] Loading "/int/.desktop.settings" +47916 [D][BtGap] RSSI: -91 +47918 [I][BadBleWorker] BLE Key timeout : 16 +47922 [D][BadBleWorker] line:GUI SPACE +47924 [I][BadBleWorker] Special key pressed 82c + +47948 [D][BtGap] RSSI: -91 +47950 [I][BadBleWorker] BLE Key timeout : 16 +47953 [D][BadBleWorker] line:DELAY 500 +47956 [D][BtGap] RSSI: -91 +47958 [I][BadBleWorker] BLE Key timeout : 16 +48106 [I][SavedStruct] Loading "/int/.desktop.settings" +48306 [I][SavedStruct] Loading "/int/.desktop.settings" +48338 [I][SavedStruct] Loading "/int/.desktop.settings" +48460 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +48506 [I][SavedStruct] Loading "/int/.desktop.settings" +48706 [I][SavedStruct] Loading "/int/.desktop.settings" +48787 [E][BtHid] Failed updating report characteristic: 100 +48790 [E][BtHid] Failed updating report characteristic: 100 +48809 [E][BtHid] Failed updating report characteristic: 100 +48812 [E][BtHid] Failed updating report characteristic: 100 +48831 [E][BtHid] Failed updating report characteristic: 100 +48834 [E][BtHid] Failed updating report characteristic: 100 +48838 [I][SavedStruct] Loading "/int/.desktop.settings" +48854 [E][BtHid] Failed updating report characteristic: 100 +48859 [E][BtHid] Failed updating report characteristic: 100 +48878 [E][BtHid] Failed updating report characteristic: 100 +48881 [E][BtHid] Failed updating report characteristic: 100 +48900 [E][BtHid] Failed updating report characteristic: 100 +48903 [E][BtHid] Failed updating report characteristic: 100 +48907 [I][SavedStruct] Loading "/int/.desktop.settings" +48923 [E][BtHid] Failed updating report characteristic: 100 +48928 [E][BtHid] Failed updating report characteristic: 100 +48947 [E][BtHid] Failed updating report characteristic: 100 +48950 [E][BtHid] Failed updating report characteristic: 100 +48969 [E][BtHid] Failed updating report characteristic: 100 +48972 [E][BtHid] Failed updating report characteristic: 100 +48991 [E][BtHid] Failed updating report characteristic: 100 +48994 [E][BtHid] Failed updating report characteristic: 100 +49103 [E][BtHid] Failed updating report characteristic: 100 +49106 [I][SavedStruct] Loading "/int/.desktop.settings" +49123 [E][BtHid] Failed updating report characteristic: 100 +49127 [E][BtHid] Failed updating report characteristic: 100 +49146 [E][BtHid] Failed updating report characteristic: 100 +49149 [E][BtHid] Failed updating report characteristic: 100 +49168 [E][BtHid] Failed updating report characteristic: 100 +49171 [E][BtHid] Failed updating report characteristic: 100 +49190 [E][BtHid] Failed updating report characteristic: 100 +49193 [E][BtHid] Failed updating report characteristic: 100 +49213 [E][BtHid] Failed updating report characteristic: 100 +49218 [E][BtHid] Failed updating report characteristic: 100 +49238 [E][BtHid] Failed updating report characteristic: 100 +49241 [E][BtHid] Failed updating report characteristic: 100 +49260 [E][BtHid] Failed updating report characteristic: 100 +49280 [D][BtGap] RSSI: -90 +49282 [I][BadBleWorker] BLE Key timeout : 16 +49285 [D][BadBleWorker] line:DELAY 200 +49288 [D][BtGap] RSSI: -90 +49290 [I][BadBleWorker] BLE Key timeout : 16 +49306 [I][SavedStruct] Loading "/int/.desktop.settings" +49338 [I][SavedStruct] Loading "/int/.desktop.settings" +49492 [D][BadBleWorker] line:ENTER +49494 [I][BadBleWorker] Special key pressed 28 + +49506 [I][SavedStruct] Loading "/int/.desktop.settings" +49516 [D][BtGap] RSSI: -96 +49518 [I][BadBleWorker] BLE Key timeout : 16 +49527 [D][BadBleWorker] line:GUI SPACE +49529 [I][BadBleWorker] Special key pressed 82c + +49550 [D][BtGap] RSSI: -97 +49552 [I][BadBleWorker] BLE Key timeout : 16 +49555 [D][BadBleWorker] line:DELAY 500 +49557 [D][BtGap] RSSI: -97 +49558 [I][BadBleWorker] BLE Key timeout : 16 +49706 [I][SavedStruct] Loading "/int/.desktop.settings" +49838 [I][SavedStruct] Loading "/int/.desktop.settings" +49906 [I][SavedStruct] Loading "/int/.desktop.settings" +50060 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +50106 [I][SavedStruct] Loading "/int/.desktop.settings" +50306 [I][SavedStruct] Loading "/int/.desktop.settings" +50338 [I][SavedStruct] Loading "/int/.desktop.settings" +50506 [I][SavedStruct] Loading "/int/.desktop.settings" +50706 [I][SavedStruct] Loading "/int/.desktop.settings" +50796 [D][BtGap] RSSI: -91 +50798 [I][BadBleWorker] BLE Key timeout : 16 +50801 [D][BadBleWorker] line:DELAY 200 +50804 [D][BtGap] RSSI: -91 +50806 [I][BadBleWorker] BLE Key timeout : 16 +50838 [I][SavedStruct] Loading "/int/.desktop.settings" +50906 [I][SavedStruct] Loading "/int/.desktop.settings" +51008 [D][BadBleWorker] line:ENTER +51010 [I][BadBleWorker] Special key pressed 28 + +51029 [D][BtGap] RSSI: -95 +51031 [I][BadBleWorker] BLE Key timeout : 16 +51034 [D][BadBleWorker] line:GUI SPACE +51036 [I][BadBleWorker] Special key pressed 82c + +51056 [D][BtGap] RSSI: -85 +51058 [I][BadBleWorker] BLE Key timeout : 33 +51061 [D][BadBleWorker] line:DELAY 500 +51064 [D][BtGap] RSSI: -85 +51066 [I][BadBleWorker] BLE Key timeout : 33 +51106 [I][SavedStruct] Loading "/int/.desktop.settings" +51306 [I][SavedStruct] Loading "/int/.desktop.settings" +51338 [I][SavedStruct] Loading "/int/.desktop.settings" +51506 [I][SavedStruct] Loading "/int/.desktop.settings" +51568 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +51706 [I][SavedStruct] Loading "/int/.desktop.settings" +51838 [I][SavedStruct] Loading "/int/.desktop.settings" +51906 [I][SavedStruct] Loading "/int/.desktop.settings" +52106 [I][SavedStruct] Loading "/int/.desktop.settings" +52306 [I][SavedStruct] Loading "/int/.desktop.settings" +52338 [I][SavedStruct] Loading "/int/.desktop.settings" +52506 [I][SavedStruct] Loading "/int/.desktop.settings" +52706 [I][SavedStruct] Loading "/int/.desktop.settings" +52838 [I][SavedStruct] Loading "/int/.desktop.settings" +52906 [I][SavedStruct] Loading "/int/.desktop.settings" +53007 [D][BtGap] RSSI: -79 +53009 [I][BadBleWorker] BLE Key timeout : 33 +53012 [D][BadBleWorker] line:DELAY 200 +53014 [D][BtGap] RSSI: -79 +53016 [I][BadBleWorker] BLE Key timeout : 33 +53106 [I][SavedStruct] Loading "/int/.desktop.settings" +53218 [D][BadBleWorker] line:ENTER +53220 [I][BadBleWorker] Special key pressed 28 + +53257 [D][BtGap] RSSI: -80 +53259 [I][BadBleWorker] BLE Key timeout : 33 +53263 [D][BtGap] RSSI: -80 +53265 [I][BadBleWorker] BLE Key timeout : 33 +53306 [I][SavedStruct] Loading "/int/.desktop.settings" +53338 [I][SavedStruct] Loading "/int/.desktop.settings" +53506 [I][SavedStruct] Loading "/int/.desktop.settings" +53706 [I][SavedStruct] Loading "/int/.desktop.settings" +53838 [I][SavedStruct] Loading "/int/.desktop.settings" +53906 [I][SavedStruct] Loading "/int/.desktop.settings" +54106 [I][SavedStruct] Loading "/int/.desktop.settings" +54306 [I][SavedStruct] Loading "/int/.desktop.settings" +54338 [I][SavedStruct] Loading "/int/.desktop.settings" +54506 [I][SavedStruct] Loading "/int/.desktop.settings" +54706 [I][SavedStruct] Loading "/int/.desktop.settings" +54838 [I][SavedStruct] Loading "/int/.desktop.settings" +54906 [I][SavedStruct] Loading "/int/.desktop.settings" +55106 [I][SavedStruct] Loading "/int/.desktop.settings" +55306 [I][SavedStruct] Loading "/int/.desktop.settings" +55338 [I][SavedStruct] Loading "/int/.desktop.settings" +55506 [I][SavedStruct] Loading "/int/.desktop.settings" +55706 [I][SavedStruct] Loading "/int/.desktop.settings" +55838 [I][SavedStruct] Loading "/int/.desktop.settings" +55906 [I][SavedStruct] Loading "/int/.desktop.settings" +56106 [I][SavedStruct] Loading "/int/.desktop.settings" +56316 [I][SavedStruct] Loading "/int/.desktop.settings" +56338 [I][SavedStruct] Loading "/int/.desktop.settings" +56506 [I][SavedStruct] Loading "/int/.desktop.settings" +56706 [I][SavedStruct] Loading "/int/.desktop.settings" +56838 [I][SavedStruct] Loading "/int/.desktop.settings" +56906 [I][SavedStruct] Loading "/int/.desktop.settings" +57106 [I][SavedStruct] Loading "/int/.desktop.settings" +57306 [I][SavedStruct] Loading "/int/.desktop.settings" +57338 [I][SavedStruct] Loading "/int/.desktop.settings" +57506 [I][SavedStruct] Loading "/int/.desktop.settings" +57706 [I][SavedStruct] Loading "/int/.desktop.settings" +57838 [I][SavedStruct] Loading "/int/.desktop.settings" +57906 [I][SavedStruct] Loading "/int/.desktop.settings" +58083 [I][BtGap] Stop advertising +58086 [D][BtGap] terminate success +58089 [E][BtGap] set_non_discoverable failed 12 +58093 [I][SavedStruct] Loading "/int/.desktop.settings" +58112 [I][SavedStruct] Loading "/int/.desktop.settings" +58131 [I][BtGap] Disconnect from client. Reason: 16 +58293 [I][SavedStruct] Loading "/int/.bt.settings" +58307 [I][SavedStruct] Loading "/int/.bt.keys" +58317 [I][FuriHalBt] Disconnect and stop advertising +58320 [I][FuriHalBt] Stop current profile services +58324 [I][SavedStruct] Loading "/int/.desktop.settings" +58346 [I][FuriHalBt] Stop BLE related RTOS threads +58374 [I][FuriHalBt] Reset SHCI +58488 [I][FuriHalBt] Start BT initialization +58493 [I][Core2] Core2 started +58495 [I][Core2] C2 boot completed, mode: Stack +58498 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +58500 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +58504 [I][Core2] Radio stack started +58507 [I][Core2] Flash activity control switched to SEM7 +58511 [I][BtGap] Advertising name: Keyboard +58514 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +58518 [I][SavedStruct] Loading "/int/.desktop.settings" +58541 [D][BtBatterySvc] Updating power state characteristic +58547 [I][BtSrv] Bt App started +58548 [I][BtGap] Start advertising +58550 [I][BadBleWorker] End +58552 [I][SavedStruct] Loading "/int/.desktop.settings" +58573 [I][SavedStruct] Loading "/int/.desktop.settings" +58575 [D][BrowserWorker] Start +58608 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +58610 [D][BrowserWorker] Load offset: 0 cnt: 50 +58724 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 +58727 [D][BrowserWorker] Load offset: 0 cnt: 50 +59009 [D][BrowserWorker] End +59011 [I][SavedStruct] Loading "/int/.desktop.settings" +59055 [I][fap_loader_app] FAP app returned: 0 +59091 [I][LoaderSrv] Application stopped. Free heap: 127088 +59120 [I][AnimationStorage] Custom Manifest selected +59411 [I][AnimationManager] Select 'HANDS' animation +59415 [I][AnimationManager] Load animation 'HANDS' +59443 [I][SavedStruct] Loading "/int/.desktop.settings" +75339 [I][Dolphin] Flush stats +75341 [I][SavedStruct] Saving "/int/.dolphin.state" +75351 [D][StorageInt] Device erase: page 9, translated page: d6 +75439 [D][StorageInt] Device sync: skipping +75441 [I][DolphinState] State saved +77873 [I][AnimationStorage] Custom Manifest selected +78353 [I][AnimationManager] Select 'DEDSEC_AD' animation +108394 [I][AnimationStorage] Custom Manifest selected +108758 [I][AnimationManager] Select 'DEDSEC_ASCII' animation +118697 [D][BtGap] set_non_discoverable success +138798 [I][AnimationStorage] Custom Manifest selected +139612 [I][AnimationManager] Select 'MARCUS' animation +169649 [I][AnimationStorage] Custom Manifest selected +170049 [I][AnimationManager] Select 'HANDS' animation +178699 [D][BtGap] set_non_discoverable success +200094 [I][AnimationStorage] Custom Manifest selected +200963 [I][AnimationManager] Select 'SKULL' animation +231003 [I][AnimationStorage] Custom Manifest selected +231753 [I][AnimationManager] Select 'GUNS_CAR' animation +238701 [D][BtGap] set_non_discoverable success +261795 [I][AnimationStorage] Custom Manifest selected +262627 [I][AnimationManager] Select 'DEDSEC_LOGO' animation +292669 [I][AnimationStorage] Custom Manifest selected +293615 [I][AnimationManager] Select 'LOGO_WD2' animation +298703 [D][BtGap] set_non_discoverable success +323656 [I][AnimationStorage] Custom Manifest selected +324243 [I][AnimationManager] Select 'DEDSEC_OLD' animation +354285 [I][AnimationStorage] Custom Manifest selected +355074 [I][AnimationManager] Select 'SPIRAL' animation +358705 [D][BtGap] set_non_discoverable success +385114 [I][AnimationStorage] Custom Manifest selected +385501 [I][AnimationManager] Select 'HANDS' animation +415546 [I][AnimationStorage] Custom Manifest selected +416332 [I][AnimationManager] Select 'SPIRAL' animation +418707 [D][BtGap] set_non_discoverable success +446371 [I][AnimationStorage] Custom Manifest selected +446861 [I][AnimationManager] Select 'DEDSEC_AD' animation +476903 [I][AnimationStorage] Custom Manifest selected +477735 [I][AnimationManager] Select 'DEDSEC_LOGO' animation +478709 [D][BtGap] set_non_discoverable success +507777 [I][AnimationStorage] Custom Manifest selected +508256 [I][AnimationManager] Select 'DEDSEC_AD' animation +538299 [I][AnimationStorage] Custom Manifest selected +539085 [I][AnimationManager] Select 'SPIRAL' animation +539117 [D][BtGap] set_non_discoverable success +569126 [I][AnimationStorage] Custom Manifest selected +569876 [I][AnimationManager] Select 'GUNS_CAR' animation +599120 [D][BtGap] set_non_discoverable success +599918 [I][AnimationStorage] Custom Manifest selected +600830 [I][AnimationManager] Select 'REAPER_ALT' animation +630871 [I][AnimationStorage] Custom Manifest selected +631392 [I][AnimationManager] Select 'DEDSEC_TALK' animation +659122 [D][BtGap] set_non_discoverable success +661435 [I][AnimationStorage] Custom Manifest selected +662238 [I][AnimationManager] Select 'MARCUS' animation +690919 [I][LoaderSrv] Starting: Applications +690925 [I][AnimationManager] Unload animation 'MARCUS' +690948 [D][BrowserWorker] Start +690965 [D][BrowserWorker] Enter folder: /ext/apps items: 6 idx: -1 +690967 [D][BrowserWorker] Load offset: 0 cnt: 50 +717407 [D][BrowserWorker] Enter folder: /ext/apps/Tools items: 23 idx: -1 +717410 [D][BrowserWorker] Load offset: 0 cnt: 50 +718007 [D][BrowserWorker] Exit to: /ext/apps items: 6 idx: 5 +718011 [D][BrowserWorker] Load offset: 0 cnt: 50 +719124 [D][BtGap] set_non_discoverable success +719398 [D][BrowserWorker] Enter folder: /ext/apps/Main items: 8 idx: -1 +719400 [D][BrowserWorker] Load offset: 0 cnt: 50 +720667 [D][BrowserWorker] End +720679 [I][fap_loader_app] FAP Loader is loading /ext/apps/Main/bad_ble.fap +720722 [I][fap_loader_app] FAP Loader is mapping +721451 [I][elf] Total size of loaded sections: 10460 +721453 [I][fap_loader_app] Loaded in 774ms +721455 [I][fap_loader_app] FAP Loader is starting app +721483 [D][BrowserWorker] Start +721498 [D][BrowserWorker] Enter folder: /any/BadUsb items: 10 idx: -1 +721502 [D][BrowserWorker] Load offset: 0 cnt: 50 +724277 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 +724280 [D][BrowserWorker] Load offset: 0 cnt: 50 +737153 [D][BrowserWorker] End +737166 [I][BtGap] Stop advertising +737170 [D][BtGap] set_non_discoverable success +737185 [I][SavedStruct] Loading "/int/.desktop.settings" +737308 [I][SavedStruct] Loading "/int/.desktop.settings" +737327 [I][SavedStruct] Loading "/int/.desktop.settings" +737376 [I][FuriHalBt] Disconnect and stop advertising +737380 [I][FuriHalBt] Stop current profile services +737395 [I][FuriHalBt] Stop BLE related RTOS threads +737419 [I][FuriHalBt] Reset SHCI +737527 [I][SavedStruct] Loading "/int/.desktop.settings" +737533 [I][FuriHalBt] Start BT initialization +737540 [I][Core2] Core2 started +737542 [I][Core2] C2 boot completed, mode: Stack +737546 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +737550 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +737557 [I][Core2] Radio stack started +737559 [I][Core2] Flash activity control switched to SEM7 +737562 [I][BtGap] Advertising name: Keyboard +737565 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +737582 [D][BtBatterySvc] Updating power state characteristic +737587 [I][BtGap] Start advertising +737590 [I][SavedStruct] Loading "/int/.bt.settings" +737607 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +737616 [I][FuriHalBt] Disconnect and stop advertising +737618 [I][BtGap] Stop advertising +737621 [D][BtGap] set_non_discoverable success +737623 [I][FuriHalBt] Stop current profile services +737633 [I][FuriHalBt] Stop BLE related RTOS threads +737641 [I][SavedStruct] Loading "/int/.desktop.settings" +737658 [I][FuriHalBt] Reset SHCI +737683 [I][SavedStruct] Loading "/int/.desktop.settings" +737727 [I][SavedStruct] Loading "/int/.desktop.settings" +737772 [I][FuriHalBt] Start BT initialization +737777 [I][Core2] Core2 started +737779 [I][Core2] C2 boot completed, mode: Stack +737782 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +737784 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +737788 [I][Core2] Radio stack started +737790 [I][Core2] Flash activity control switched to SEM7 +737792 [I][BtGap] Advertising name: Rumik1 +737794 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +737810 [D][BtBatterySvc] Updating power state characteristic +737820 [I][BtSrv] Bt App started +737822 [I][BtGap] Start advertising +737824 [I][BadBleWorker] Init +737828 [I][SavedStruct] Loading "/int/.desktop.settings" +737834 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +737839 [I][BtGap] Rssi: 296 +737863 [D][BtGap] RSSI: -43 +737865 [I][BadBleWorker] BLE Key timeout : 41 +737921 [D][BtGap] Slave security initiated +737927 [I][SavedStruct] Loading "/int/.desktop.settings" +737974 [I][SavedStruct] Loading "/int/.desktop.settings" +738039 [I][BtGap] Pairing complete +738042 [D][BtGap] RSSI: -47 +738044 [D][BtBatterySvc] Updating battery level characteristic +738048 [D][BtGap] RSSI: -47 +738050 [I][BadBleWorker] BLE Key timeout : 41 +738127 [I][SavedStruct] Loading "/int/.desktop.settings" +738183 [I][SavedStruct] Loading "/int/.desktop.settings" +738216 [I][BtGap] Rx MTU size: 414 +738307 [I][SavedStruct] Loading "/int/.desktop.settings" +738327 [I][SavedStruct] Loading "/int/.desktop.settings" +738527 [I][SavedStruct] Loading "/int/.desktop.settings" +738640 [I][SavedStruct] Loading "/int/.desktop.settings" +738683 [I][SavedStruct] Loading "/int/.desktop.settings" +738727 [I][SavedStruct] Loading "/int/.desktop.settings" +738810 [I][BtGap] Connection parameters event complete +738813 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +738815 [W][BtGap] Unsupported connection interval. Request connection parameters update +738819 [I][BtGap] Rssi: 311 +738849 [D][BtGap] Connection parameters accepted +738927 [I][SavedStruct] Loading "/int/.desktop.settings" +738973 [I][SavedStruct] Loading "/int/.desktop.settings" +739010 [I][BtGap] Connection parameters event complete +739012 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +739015 [I][BtGap] Rssi: 328 +739127 [I][SavedStruct] Loading "/int/.desktop.settings" +739183 [I][SavedStruct] Loading "/int/.desktop.settings" +739306 [I][SavedStruct] Loading "/int/.desktop.settings" +739327 [I][SavedStruct] Loading "/int/.desktop.settings" +739527 [I][SavedStruct] Loading "/int/.desktop.settings" +739639 [I][SavedStruct] Loading "/int/.desktop.settings" +739683 [I][SavedStruct] Loading "/int/.desktop.settings" +739727 [I][SavedStruct] Loading "/int/.desktop.settings" +739927 [I][SavedStruct] Loading "/int/.desktop.settings" +739972 [I][SavedStruct] Loading "/int/.desktop.settings" +740127 [I][SavedStruct] Loading "/int/.desktop.settings" +740183 [I][SavedStruct] Loading "/int/.desktop.settings" +740305 [I][SavedStruct] Loading "/int/.desktop.settings" +740327 [I][SavedStruct] Loading "/int/.desktop.settings" +740527 [I][SavedStruct] Loading "/int/.desktop.settings" +740638 [I][SavedStruct] Loading "/int/.desktop.settings" +740683 [I][SavedStruct] Loading "/int/.desktop.settings" +740727 [I][SavedStruct] Loading "/int/.desktop.settings" +740927 [I][SavedStruct] Loading "/int/.desktop.settings" +740971 [I][SavedStruct] Loading "/int/.desktop.settings" +741127 [I][SavedStruct] Loading "/int/.desktop.settings" +741183 [I][SavedStruct] Loading "/int/.desktop.settings" +741304 [I][SavedStruct] Loading "/int/.desktop.settings" +741327 [I][SavedStruct] Loading "/int/.desktop.settings" +741527 [I][SavedStruct] Loading "/int/.desktop.settings" +741637 [I][SavedStruct] Loading "/int/.desktop.settings" +741683 [I][SavedStruct] Loading "/int/.desktop.settings" +741727 [I][SavedStruct] Loading "/int/.desktop.settings" +741927 [I][SavedStruct] Loading "/int/.desktop.settings" +741970 [I][SavedStruct] Loading "/int/.desktop.settings" +742127 [I][SavedStruct] Loading "/int/.desktop.settings" +742183 [I][SavedStruct] Loading "/int/.desktop.settings" +742303 [I][SavedStruct] Loading "/int/.desktop.settings" +742327 [I][SavedStruct] Loading "/int/.desktop.settings" +742527 [I][SavedStruct] Loading "/int/.desktop.settings" +742636 [I][SavedStruct] Loading "/int/.desktop.settings" +742727 [I][SavedStruct] Loading "/int/.desktop.settings" +742927 [I][SavedStruct] Loading "/int/.desktop.settings" +742969 [I][SavedStruct] Loading "/int/.desktop.settings" +743127 [I][SavedStruct] Loading "/int/.desktop.settings" +743302 [I][SavedStruct] Loading "/int/.desktop.settings" +743327 [I][SavedStruct] Loading "/int/.desktop.settings" +743382 [I][SavedStruct] Loading "/int/.desktop.settings" +743527 [I][SavedStruct] Loading "/int/.desktop.settings" +743635 [I][SavedStruct] Loading "/int/.desktop.settings" +743727 [I][SavedStruct] Loading "/int/.desktop.settings" +743882 [I][SavedStruct] Loading "/int/.desktop.settings" +743927 [I][SavedStruct] Loading "/int/.desktop.settings" +743968 [I][SavedStruct] Loading "/int/.desktop.settings" +744127 [I][SavedStruct] Loading "/int/.desktop.settings" +744301 [I][SavedStruct] Loading "/int/.desktop.settings" +744327 [I][SavedStruct] Loading "/int/.desktop.settings" +744382 [I][SavedStruct] Loading "/int/.desktop.settings" +744527 [I][SavedStruct] Loading "/int/.desktop.settings" +744634 [I][SavedStruct] Loading "/int/.desktop.settings" +744727 [I][SavedStruct] Loading "/int/.desktop.settings" +744882 [I][SavedStruct] Loading "/int/.desktop.settings" +744927 [I][SavedStruct] Loading "/int/.desktop.settings" +744967 [I][SavedStruct] Loading "/int/.desktop.settings" +745127 [I][SavedStruct] Loading "/int/.desktop.settings" +745300 [I][SavedStruct] Loading "/int/.desktop.settings" +745327 [I][SavedStruct] Loading "/int/.desktop.settings" +745382 [I][SavedStruct] Loading "/int/.desktop.settings" +745527 [I][SavedStruct] Loading "/int/.desktop.settings" +745633 [I][SavedStruct] Loading "/int/.desktop.settings" +745727 [I][SavedStruct] Loading "/int/.desktop.settings" +745882 [I][SavedStruct] Loading "/int/.desktop.settings" +745927 [I][SavedStruct] Loading "/int/.desktop.settings" +745966 [I][SavedStruct] Loading "/int/.desktop.settings" +746127 [I][SavedStruct] Loading "/int/.desktop.settings" +746299 [I][SavedStruct] Loading "/int/.desktop.settings" +746327 [I][SavedStruct] Loading "/int/.desktop.settings" +746382 [I][SavedStruct] Loading "/int/.desktop.settings" +746527 [I][SavedStruct] Loading "/int/.desktop.settings" +746632 [I][SavedStruct] Loading "/int/.desktop.settings" +746727 [I][SavedStruct] Loading "/int/.desktop.settings" +746882 [I][SavedStruct] Loading "/int/.desktop.settings" +746927 [I][SavedStruct] Loading "/int/.desktop.settings" +746965 [I][SavedStruct] Loading "/int/.desktop.settings" +747127 [I][SavedStruct] Loading "/int/.desktop.settings" +747298 [I][SavedStruct] Loading "/int/.desktop.settings" +747327 [I][SavedStruct] Loading "/int/.desktop.settings" +747453 [D][DolphinState] icounter 1325, butthurt 0 +747456 [D][BtGap] RSSI: -65 +747458 [I][BadBleWorker] BLE Key timeout : 37 +747462 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +747465 [D][BtGap] RSSI: -65 +747467 [I][BadBleWorker] BLE Key timeout : 37 +747470 [D][BadBleWorker] line:DELAY 1000 +747473 [D][BtGap] RSSI: -65 +747475 [I][BadBleWorker] BLE Key timeout : 37 +747527 [I][SavedStruct] Loading "/int/.desktop.settings" +747631 [I][SavedStruct] Loading "/int/.desktop.settings" +747727 [I][SavedStruct] Loading "/int/.desktop.settings" +747927 [I][SavedStruct] Loading "/int/.desktop.settings" +747954 [I][SavedStruct] Loading "/int/.desktop.settings" +747972 [I][SavedStruct] Loading "/int/.desktop.settings" +748127 [I][SavedStruct] Loading "/int/.desktop.settings" +748297 [I][SavedStruct] Loading "/int/.desktop.settings" +748327 [I][SavedStruct] Loading "/int/.desktop.settings" +748454 [I][SavedStruct] Loading "/int/.desktop.settings" +748477 [D][BadBleWorker] line:GUI SPACE +748479 [I][BadBleWorker] Special key pressed 82c + +748520 [D][BtGap] RSSI: -77 +748523 [I][BadBleWorker] BLE Key timeout : 33 +748531 [D][BadBleWorker] line:DELAY 500 +748535 [D][BtGap] RSSI: -77 +748537 [I][BadBleWorker] BLE Key timeout : 33 +748543 [I][SavedStruct] Loading "/int/.desktop.settings" +748630 [I][SavedStruct] Loading "/int/.desktop.settings" +748727 [I][SavedStruct] Loading "/int/.desktop.settings" +748927 [I][SavedStruct] Loading "/int/.desktop.settings" +748954 [I][SavedStruct] Loading "/int/.desktop.settings" +748972 [I][SavedStruct] Loading "/int/.desktop.settings" +749041 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +749127 [I][SavedStruct] Loading "/int/.desktop.settings" +749296 [I][SavedStruct] Loading "/int/.desktop.settings" +749327 [I][SavedStruct] Loading "/int/.desktop.settings" +749454 [I][SavedStruct] Loading "/int/.desktop.settings" +749527 [I][SavedStruct] Loading "/int/.desktop.settings" +749629 [I][SavedStruct] Loading "/int/.desktop.settings" +749727 [I][SavedStruct] Loading "/int/.desktop.settings" +749927 [I][SavedStruct] Loading "/int/.desktop.settings" +749954 [I][SavedStruct] Loading "/int/.desktop.settings" +749972 [I][SavedStruct] Loading "/int/.desktop.settings" +750127 [I][SavedStruct] Loading "/int/.desktop.settings" +750295 [I][SavedStruct] Loading "/int/.desktop.settings" +750327 [I][SavedStruct] Loading "/int/.desktop.settings" +750454 [I][SavedStruct] Loading "/int/.desktop.settings" +750479 [D][BtGap] RSSI: -76 +750481 [I][BadBleWorker] BLE Key timeout : 33 +750484 [D][BadBleWorker] line:DELAY 200 +750487 [D][BtGap] RSSI: -76 +750489 [I][BadBleWorker] BLE Key timeout : 33 +750527 [I][SavedStruct] Loading "/int/.desktop.settings" +750628 [I][SavedStruct] Loading "/int/.desktop.settings" +750692 [D][BadBleWorker] line:ENTER +750694 [I][BadBleWorker] Special key pressed 28 + +750727 [I][SavedStruct] Loading "/int/.desktop.settings" +750733 [D][BtGap] RSSI: -63 +750735 [I][BadBleWorker] BLE Key timeout : 37 +750738 [D][BadBleWorker] line:GUI SPACE +750740 [I][BadBleWorker] Special key pressed 82c + +750782 [D][BtGap] RSSI: -62 +750784 [I][BadBleWorker] BLE Key timeout : 37 +750788 [D][BadBleWorker] line:DELAY 500 +750791 [D][BtGap] RSSI: -62 +750793 [I][BadBleWorker] BLE Key timeout : 37 +750927 [I][SavedStruct] Loading "/int/.desktop.settings" +750954 [I][SavedStruct] Loading "/int/.desktop.settings" +750972 [I][SavedStruct] Loading "/int/.desktop.settings" +751127 [I][SavedStruct] Loading "/int/.desktop.settings" +751294 [I][SavedStruct] Loading "/int/.desktop.settings" +751304 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +751327 [I][SavedStruct] Loading "/int/.desktop.settings" +751454 [I][SavedStruct] Loading "/int/.desktop.settings" +751527 [I][SavedStruct] Loading "/int/.desktop.settings" +751627 [I][SavedStruct] Loading "/int/.desktop.settings" +751727 [I][SavedStruct] Loading "/int/.desktop.settings" +751927 [I][SavedStruct] Loading "/int/.desktop.settings" +751954 [I][SavedStruct] Loading "/int/.desktop.settings" +751972 [I][SavedStruct] Loading "/int/.desktop.settings" +752127 [I][SavedStruct] Loading "/int/.desktop.settings" +752293 [I][SavedStruct] Loading "/int/.desktop.settings" +752327 [I][SavedStruct] Loading "/int/.desktop.settings" +752454 [I][SavedStruct] Loading "/int/.desktop.settings" +752527 [I][SavedStruct] Loading "/int/.desktop.settings" +752626 [I][SavedStruct] Loading "/int/.desktop.settings" +752727 [I][SavedStruct] Loading "/int/.desktop.settings" +752908 [D][BtGap] RSSI: -54 +752910 [I][BadBleWorker] BLE Key timeout : 37 +752914 [D][BadBleWorker] line:DELAY 200 +752917 [D][BtGap] RSSI: -54 +752919 [I][BadBleWorker] BLE Key timeout : 37 +752927 [I][SavedStruct] Loading "/int/.desktop.settings" +752954 [I][SavedStruct] Loading "/int/.desktop.settings" +752972 [I][SavedStruct] Loading "/int/.desktop.settings" +753122 [D][BadBleWorker] line:ENTER +753124 [I][BadBleWorker] Special key pressed 28 + +753127 [I][SavedStruct] Loading "/int/.desktop.settings" +753166 [D][BtGap] RSSI: -54 +753168 [I][BadBleWorker] BLE Key timeout : 37 +753172 [D][BadBleWorker] line:GUI SPACE +753174 [I][BadBleWorker] Special key pressed 82c + +753215 [D][BtGap] RSSI: -55 +753217 [I][BadBleWorker] BLE Key timeout : 37 +753220 [D][BadBleWorker] line:DELAY 500 +753224 [D][BtGap] RSSI: -55 +753226 [I][BadBleWorker] BLE Key timeout : 37 +753292 [I][SavedStruct] Loading "/int/.desktop.settings" +753327 [I][SavedStruct] Loading "/int/.desktop.settings" +753527 [I][SavedStruct] Loading "/int/.desktop.settings" +753625 [I][SavedStruct] Loading "/int/.desktop.settings" +753727 [I][SavedStruct] Loading "/int/.desktop.settings" +753927 [I][SavedStruct] Loading "/int/.desktop.settings" +753958 [I][SavedStruct] Loading "/int/.desktop.settings" +753998 [I][SavedStruct] Loading "/int/.desktop.settings" +754127 [I][SavedStruct] Loading "/int/.desktop.settings" +754146 [I][BtGap] Stop advertising +754149 [D][BtGap] terminate success +754152 [E][BtGap] set_non_discoverable failed 12 +754156 [I][SavedStruct] Loading "/int/.desktop.settings" +754275 [I][BtGap] Disconnect from client. Reason: 16 +754291 [I][SavedStruct] Loading "/int/.desktop.settings" +754327 [I][SavedStruct] Loading "/int/.desktop.settings" +754356 [I][SavedStruct] Loading "/int/.bt.settings" +754370 [I][SavedStruct] Loading "/int/.bt.keys" +754380 [I][FuriHalBt] Disconnect and stop advertising +754382 [I][FuriHalBt] Stop current profile services +754393 [I][FuriHalBt] Stop BLE related RTOS threads +754417 [I][FuriHalBt] Reset SHCI +754527 [I][SavedStruct] Loading "/int/.desktop.settings" +754531 [I][FuriHalBt] Start BT initialization +754538 [I][Core2] Core2 started +754541 [I][Core2] C2 boot completed, mode: Stack +754544 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +754547 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +754554 [I][Core2] Radio stack started +754559 [I][Core2] Flash activity control switched to SEM7 +754563 [I][BtGap] Advertising name: Keyboard +754567 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +754585 [D][BtBatterySvc] Updating power state characteristic +754591 [I][BtSrv] Bt App started +754592 [I][BtGap] Start advertising +754596 [I][BadBleWorker] End +754599 [I][SavedStruct] Loading "/int/.desktop.settings" +754630 [I][SavedStruct] Loading "/int/.desktop.settings" +754634 [D][BrowserWorker] Start +754661 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +754664 [D][BrowserWorker] Load offset: 0 cnt: 50 + + _.-------.._ -, + .-"```"--..,,_/ /`-, -, \ + .:" /:/ /'\ \ ,_..., `. | | + / ,----/:/ /`\ _\~`_-"` _; + ' / /`"""'\ \ \.~`_-' ,-"'/ + | | | 0 | | .-' ,/` / + | ,..\ \ ,.-"` ,/` / + ; : `/`""\` ,/--==,/-----, + | `-...| -.___-Z:_______J...---; + : ` _-' + _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ +| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| +| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | +|_| |____||___||_| |_| |___||_|_\ \___||____||___| + +Welcome to Flipper Zero Command Line Interface! +Read Manual https://docs.flipperzero.one + +Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) + +>: log +Press CTRL+C to stop... +988327 [I][SavedStruct] Loading "/int/.desktop.settings" +988390 [I][SavedStruct] Loading "/int/.desktop.settings" +988527 [I][SavedStruct] Loading "/int/.desktop.settings" +988555 [I][SavedStruct] Loading "/int/.desktop.settings" +988723 [I][SavedStruct] Loading "/int/.desktop.settings" +988742 [I][SavedStruct] Loading "/int/.desktop.settings" +988927 [I][SavedStruct] Loading "/int/.desktop.settings" +989055 [I][SavedStruct] Loading "/int/.desktop.settings" +989074 [I][SavedStruct] Loading "/int/.desktop.settings" +989127 [I][SavedStruct] Loading "/int/.desktop.settings" +989327 [I][SavedStruct] Loading "/int/.desktop.settings" +989389 [I][SavedStruct] Loading "/int/.desktop.settings" +989527 [I][SavedStruct] Loading "/int/.desktop.settings" +989555 [I][SavedStruct] Loading "/int/.desktop.settings" +989722 [I][SavedStruct] Loading "/int/.desktop.settings" +989741 [I][SavedStruct] Loading "/int/.desktop.settings" +989927 [I][SavedStruct] Loading "/int/.desktop.settings" +990055 [I][SavedStruct] Loading "/int/.desktop.settings" +990074 [I][SavedStruct] Loading "/int/.desktop.settings" +990127 [I][SavedStruct] Loading "/int/.desktop.settings" +990327 [I][SavedStruct] Loading "/int/.desktop.settings" +990388 [I][SavedStruct] Loading "/int/.desktop.settings" +990527 [I][SavedStruct] Loading "/int/.desktop.settings" +990558 [I][BtGap] Stop advertising +990561 [D][BtGap] terminate success +990564 [E][BtGap] set_non_discoverable failed 12 +990568 [I][SavedStruct] Loading "/int/.desktop.settings" +990720 [I][BtGap] Disconnect from client. Reason: 16 +990723 [I][SavedStruct] Loading "/int/.desktop.settings" +990743 [I][SavedStruct] Loading "/int/.desktop.settings" +990768 [I][SavedStruct] Loading "/int/.bt.settings" +990782 [I][SavedStruct] Loading "/int/.bt.keys" +990792 [I][FuriHalBt] Disconnect and stop advertising +990794 [I][FuriHalBt] Stop current profile services +990805 [I][FuriHalBt] Stop BLE related RTOS threads +990829 [I][FuriHalBt] Reset SHCI +990927 [I][SavedStruct] Loading "/int/.desktop.settings" +990943 [I][FuriHalBt] Start BT initialization +990949 [I][Core2] Core2 started +990951 [I][Core2] C2 boot completed, mode: Stack +990954 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +990956 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +990960 [I][Core2] Radio stack started +990962 [I][Core2] Flash activity control switched to SEM7 +990964 [I][BtGap] Advertising name: Keyboard +990966 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +990983 [D][BtBatterySvc] Updating power state characteristic +990989 [I][BtSrv] Bt App started +990991 [I][BtGap] Start advertising +990993 [I][BadBleWorker] End +990995 [I][SavedStruct] Loading "/int/.desktop.settings" +991016 [I][SavedStruct] Loading "/int/.desktop.settings" +991020 [D][BrowserWorker] Start +991046 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +991048 [D][BrowserWorker] Load offset: 0 cnt: 50 +995286 [D][BrowserWorker] End +995288 [I][SavedStruct] Loading "/int/.desktop.settings" +995311 [I][BtGap] Stop advertising +995315 [D][BtGap] set_non_discoverable success +995321 [I][SavedStruct] Loading "/int/.desktop.settings" +995342 [I][SavedStruct] Loading "/int/.desktop.settings" +995360 [I][SavedStruct] Loading "/int/.desktop.settings" +995383 [I][SavedStruct] Loading "/int/.desktop.settings" +995520 [I][FuriHalBt] Disconnect and stop advertising +995522 [I][FuriHalBt] Stop current profile services +995527 [I][SavedStruct] Loading "/int/.desktop.settings" +995539 [I][FuriHalBt] Stop BLE related RTOS threads +995565 [I][FuriHalBt] Reset SHCI +995679 [I][FuriHalBt] Start BT initialization +995684 [I][Core2] Core2 started +995686 [I][Core2] C2 boot completed, mode: Stack +995689 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +995691 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +995695 [I][Core2] Radio stack started +995697 [I][Core2] Flash activity control switched to SEM7 +995699 [I][BtGap] Advertising name: Keyboard +995701 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +995712 [E][BtGap] Message queue get error: -4 +995716 [I][SavedStruct] Loading "/int/.desktop.settings" +995728 [D][BtBatterySvc] Updating power state characteristic +995738 [I][BtGap] Start advertising +995741 [I][SavedStruct] Loading "/int/.bt.settings" +995745 [I][SavedStruct] Loading "/int/.desktop.settings" +995773 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +995786 [I][FuriHalBt] Disconnect and stop advertising +995789 [I][BtGap] Stop advertising +995791 [D][BtGap] set_non_discoverable success +995794 [I][FuriHalBt] Stop current profile services +995805 [I][FuriHalBt] Stop BLE related RTOS threads +995830 [I][FuriHalBt] Reset SHCI +995927 [I][SavedStruct] Loading "/int/.desktop.settings" +995944 [I][FuriHalBt] Start BT initialization +995949 [I][Core2] Core2 started +995951 [I][Core2] C2 boot completed, mode: Stack +995954 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +995956 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +995960 [I][Core2] Radio stack started +995962 [I][Core2] Flash activity control switched to SEM7 +995964 [I][BtGap] Advertising name: Rumik1 +995966 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +995984 [D][BtBatterySvc] Updating power state characteristic +995993 [I][BtSrv] Bt App started +995994 [I][BtGap] Start advertising +995998 [I][BadBleWorker] Init +996000 [I][SavedStruct] Loading "/int/.desktop.settings" +996023 [I][BadBleWorker] BLE Key timeout : 16 +996027 [I][BtGap] Stop advertising +996030 [D][BtGap] set_non_discoverable success +996034 [I][SavedStruct] Loading "/int/.desktop.settings" +996052 [I][SavedStruct] Loading "/int/.desktop.settings" +996127 [I][SavedStruct] Loading "/int/.desktop.settings" +996234 [I][SavedStruct] Loading "/int/.bt.settings" +996248 [I][SavedStruct] Loading "/int/.bt.keys" +996258 [I][FuriHalBt] Disconnect and stop advertising +996260 [I][FuriHalBt] Stop current profile services +996271 [I][FuriHalBt] Stop BLE related RTOS threads +996296 [I][FuriHalBt] Reset SHCI +996327 [I][SavedStruct] Loading "/int/.desktop.settings" +996382 [I][SavedStruct] Loading "/int/.desktop.settings" +996410 [I][FuriHalBt] Start BT initialization +996415 [I][Core2] Core2 started +996417 [I][Core2] C2 boot completed, mode: Stack +996420 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +996422 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +996426 [I][Core2] Radio stack started +996428 [I][Core2] Flash activity control switched to SEM7 +996430 [I][BtGap] Advertising name: Keyboard +996432 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +996449 [D][BtBatterySvc] Updating power state characteristic +996456 [I][BtSrv] Bt App started +996458 [I][BtGap] Start advertising +996461 [I][BadBleWorker] End +996464 [I][SavedStruct] Loading "/int/.desktop.settings" +996482 [I][SavedStruct] Loading "/int/.desktop.settings" +996485 [D][BrowserWorker] Start +996510 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 6 +996512 [D][BrowserWorker] Load offset: 0 cnt: 50 +996800 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 +996803 [D][BrowserWorker] Load offset: 0 cnt: 50 +999551 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 +999553 [D][BrowserWorker] Load offset: 0 cnt: 50 +1001657 [D][BrowserWorker] End +1001660 [I][SavedStruct] Loading "/int/.desktop.settings" +1001680 [I][BtGap] Stop advertising +1001685 [D][BtGap] set_non_discoverable success +1001692 [I][SavedStruct] Loading "/int/.desktop.settings" +1001710 [I][SavedStruct] Loading "/int/.desktop.settings" +1001726 [I][SavedStruct] Loading "/int/.desktop.settings" +1001744 [I][SavedStruct] Loading "/int/.desktop.settings" +1001890 [I][FuriHalBt] Disconnect and stop advertising +1001892 [I][FuriHalBt] Stop current profile services +1001902 [I][FuriHalBt] Stop BLE related RTOS threads +1001926 [I][FuriHalBt] Reset SHCI +1001929 [I][SavedStruct] Loading "/int/.desktop.settings" +1002040 [I][FuriHalBt] Start BT initialization +1002044 [I][SavedStruct] Loading "/int/.desktop.settings" +1002046 [I][Core2] Core2 started +1002049 [I][Core2] C2 boot completed, mode: Stack +1002053 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +1002057 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +1002063 [I][Core2] Radio stack started +1002066 [I][Core2] Flash activity control switched to SEM7 +1002070 [I][BtGap] Advertising name: Keyboard +1002074 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +1002095 [D][BtBatterySvc] Updating power state characteristic +1002102 [I][BtGap] Start advertising +1002104 [I][SavedStruct] Loading "/int/.bt.settings" +1002121 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +1002130 [I][FuriHalBt] Disconnect and stop advertising +1002132 [I][BtGap] Stop advertising +1002136 [D][BtGap] set_non_discoverable success +1002139 [I][SavedStruct] Loading "/int/.desktop.settings" +1002141 [I][FuriHalBt] Stop current profile services +1002158 [I][FuriHalBt] Stop BLE related RTOS threads +1002183 [I][FuriHalBt] Reset SHCI +1002209 [I][SavedStruct] Loading "/int/.desktop.settings" +1002297 [I][FuriHalBt] Start BT initialization +1002302 [I][Core2] Core2 started +1002305 [I][Core2] C2 boot completed, mode: Stack +1002308 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +1002310 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +1002314 [I][Core2] Radio stack started +1002316 [I][Core2] Flash activity control switched to SEM7 +1002318 [I][BtGap] Advertising name: Rumik1 +1002321 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +1002327 [I][SavedStruct] Loading "/int/.desktop.settings" +1002348 [D][BtBatterySvc] Updating power state characteristic +1002357 [I][BtSrv] Bt App started +1002359 [I][BtGap] Start advertising +1002362 [I][BadBleWorker] Init +1002364 [I][SavedStruct] Loading "/int/.desktop.settings" +1002393 [I][BadBleWorker] BLE Key timeout : 16 +1002396 [I][SavedStruct] Loading "/int/.desktop.settings" +1002527 [I][SavedStruct] Loading "/int/.desktop.settings" +1002709 [I][SavedStruct] Loading "/int/.desktop.settings" +1002729 [I][SavedStruct] Loading "/int/.desktop.settings" +1002750 [I][SavedStruct] Loading "/int/.desktop.settings" +1002927 [I][SavedStruct] Loading "/int/.desktop.settings" +1002929 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +1002934 [I][BtGap] Rssi: 315 +1003036 [D][BtGap] Slave security initiated +1003042 [I][SavedStruct] Loading "/int/.desktop.settings" +1003127 [I][SavedStruct] Loading "/int/.desktop.settings" +1003155 [I][BtGap] Pairing complete +1003158 [D][BtGap] RSSI: -55 +1003160 [D][BtBatterySvc] Updating battery level characteristic +1003163 [D][BtGap] RSSI: -55 +1003165 [I][BadBleWorker] BLE Key timeout : 37 +1003209 [I][SavedStruct] Loading "/int/.desktop.settings" +1003327 [I][SavedStruct] Loading "/int/.desktop.settings" +1003331 [I][BtGap] Rx MTU size: 414 +1003375 [I][SavedStruct] Loading "/int/.desktop.settings" +1003527 [I][SavedStruct] Loading "/int/.desktop.settings" +1003708 [I][SavedStruct] Loading "/int/.desktop.settings" +1003727 [I][SavedStruct] Loading "/int/.desktop.settings" +1003746 [I][SavedStruct] Loading "/int/.desktop.settings" +1003894 [I][BtGap] Connection parameters event complete +1003896 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +1003899 [W][BtGap] Unsupported connection interval. Request connection parameters update +1003903 [I][BtGap] Rssi: 314 +1003927 [I][SavedStruct] Loading "/int/.desktop.settings" +1003933 [D][BtGap] Connection parameters accepted +1004041 [I][SavedStruct] Loading "/int/.desktop.settings" +1004095 [I][BtGap] Connection parameters event complete +1004097 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +1004100 [I][BtGap] Rssi: 317 +1004127 [I][SavedStruct] Loading "/int/.desktop.settings" +1004225 [I][SavedStruct] Loading "/int/.desktop.settings" +1004327 [I][SavedStruct] Loading "/int/.desktop.settings" +1004374 [I][SavedStruct] Loading "/int/.desktop.settings" +1004527 [I][SavedStruct] Loading "/int/.desktop.settings" +1004707 [I][SavedStruct] Loading "/int/.desktop.settings" +1004726 [I][SavedStruct] Loading "/int/.desktop.settings" +1004745 [I][SavedStruct] Loading "/int/.desktop.settings" +1004927 [I][SavedStruct] Loading "/int/.desktop.settings" +1005040 [I][SavedStruct] Loading "/int/.desktop.settings" +1005127 [I][SavedStruct] Loading "/int/.desktop.settings" +1005225 [I][SavedStruct] Loading "/int/.desktop.settings" +1005327 [I][SavedStruct] Loading "/int/.desktop.settings" +1005373 [I][SavedStruct] Loading "/int/.desktop.settings" +1005527 [I][SavedStruct] Loading "/int/.desktop.settings" +1005706 [I][SavedStruct] Loading "/int/.desktop.settings" +1005727 [I][SavedStruct] Loading "/int/.desktop.settings" +1005800 [D][DolphinState] icounter 1325, butthurt 0 +1005803 [D][BtGap] RSSI: -57 +1005805 [I][BadBleWorker] BLE Key timeout : 37 +1005809 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +1005812 [D][BtGap] RSSI: -57 +1005814 [I][BadBleWorker] BLE Key timeout : 37 +1005817 [D][BadBleWorker] line:DELAY 1000 +1005820 [D][BtGap] RSSI: -57 +1005822 [I][BadBleWorker] BLE Key timeout : 37 +1005927 [I][SavedStruct] Loading "/int/.desktop.settings" +1006039 [I][SavedStruct] Loading "/int/.desktop.settings" +1006127 [I][SavedStruct] Loading "/int/.desktop.settings" +1006301 [I][SavedStruct] Loading "/int/.desktop.settings" +1006327 [I][SavedStruct] Loading "/int/.desktop.settings" +1006372 [I][SavedStruct] Loading "/int/.desktop.settings" +1006527 [I][SavedStruct] Loading "/int/.desktop.settings" +1006705 [I][SavedStruct] Loading "/int/.desktop.settings" +1006727 [I][SavedStruct] Loading "/int/.desktop.settings" +1006801 [I][SavedStruct] Loading "/int/.desktop.settings" +1006824 [D][BadBleWorker] line:GUI SPACE +1006826 [I][BadBleWorker] Special key pressed 82c + +1006867 [D][BtGap] RSSI: -62 +1006869 [I][BadBleWorker] BLE Key timeout : 37 +1006873 [D][BadBleWorker] line:DELAY 500 +1006875 [D][BtGap] RSSI: -62 +1006877 [I][BadBleWorker] BLE Key timeout : 37 +1006927 [I][SavedStruct] Loading "/int/.desktop.settings" +1007039 [I][SavedStruct] Loading "/int/.desktop.settings" +1007127 [I][SavedStruct] Loading "/int/.desktop.settings" +1007301 [I][SavedStruct] Loading "/int/.desktop.settings" +1007327 [I][SavedStruct] Loading "/int/.desktop.settings" +1007371 [I][SavedStruct] Loading "/int/.desktop.settings" +1007388 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +1007527 [I][SavedStruct] Loading "/int/.desktop.settings" +1007704 [I][SavedStruct] Loading "/int/.desktop.settings" +1007727 [I][SavedStruct] Loading "/int/.desktop.settings" +1007801 [I][SavedStruct] Loading "/int/.desktop.settings" +1007927 [I][SavedStruct] Loading "/int/.desktop.settings" +1008037 [I][SavedStruct] Loading "/int/.desktop.settings" +1008127 [I][SavedStruct] Loading "/int/.desktop.settings" +1008301 [I][SavedStruct] Loading "/int/.desktop.settings" +1008327 [I][SavedStruct] Loading "/int/.desktop.settings" +1008370 [I][SavedStruct] Loading "/int/.desktop.settings" +1008527 [I][SavedStruct] Loading "/int/.desktop.settings" +1008703 [I][SavedStruct] Loading "/int/.desktop.settings" +1008727 [I][SavedStruct] Loading "/int/.desktop.settings" +1008801 [I][SavedStruct] Loading "/int/.desktop.settings" +1008927 [I][SavedStruct] Loading "/int/.desktop.settings" +1008996 [D][BtGap] RSSI: -79 +1008997 [I][BadBleWorker] BLE Key timeout : 33 +1008999 [D][BadBleWorker] line:DELAY 200 +1009001 [D][BtGap] RSSI: -74 +1009004 [I][BadBleWorker] BLE Key timeout : 33 +1009036 [I][SavedStruct] Loading "/int/.desktop.settings" +1009127 [I][SavedStruct] Loading "/int/.desktop.settings" +1009207 [D][BadBleWorker] line:ENTER +1009209 [I][BadBleWorker] Special key pressed 28 + +1009246 [D][BtGap] RSSI: -79 +1009248 [I][BadBleWorker] BLE Key timeout : 33 +1009252 [D][BadBleWorker] line:GUI SPACE +1009254 [I][BadBleWorker] Special key pressed 82c + +1009291 [D][BtGap] RSSI: -75 +1009293 [I][BadBleWorker] BLE Key timeout : 33 +1009297 [D][BadBleWorker] line:DELAY 500 +1009299 [D][BtGap] RSSI: -75 +1009302 [I][BadBleWorker] BLE Key timeout : 33 +1009305 [I][SavedStruct] Loading "/int/.desktop.settings" +1009327 [I][SavedStruct] Loading "/int/.desktop.settings" +1009369 [I][SavedStruct] Loading "/int/.desktop.settings" +1009527 [I][SavedStruct] Loading "/int/.desktop.settings" +1009702 [I][SavedStruct] Loading "/int/.desktop.settings" +1009727 [I][SavedStruct] Loading "/int/.desktop.settings" +1009801 [I][SavedStruct] Loading "/int/.desktop.settings" +1009813 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +1009927 [I][SavedStruct] Loading "/int/.desktop.settings" +1010035 [I][SavedStruct] Loading "/int/.desktop.settings" +1010127 [I][SavedStruct] Loading "/int/.desktop.settings" +1010301 [I][SavedStruct] Loading "/int/.desktop.settings" +1010327 [I][SavedStruct] Loading "/int/.desktop.settings" +1010368 [I][SavedStruct] Loading "/int/.desktop.settings" +1010527 [I][SavedStruct] Loading "/int/.desktop.settings" +1010701 [I][SavedStruct] Loading "/int/.desktop.settings" +1010727 [I][SavedStruct] Loading "/int/.desktop.settings" +1010801 [I][SavedStruct] Loading "/int/.desktop.settings" +1010927 [I][SavedStruct] Loading "/int/.desktop.settings" +1011034 [I][SavedStruct] Loading "/int/.desktop.settings" +1011127 [I][SavedStruct] Loading "/int/.desktop.settings" +1011254 [D][BtGap] RSSI: -85 +1011256 [I][BadBleWorker] BLE Key timeout : 33 +1011260 [D][BadBleWorker] line:DELAY 200 +1011262 [D][BtGap] RSSI: -85 +1011264 [I][BadBleWorker] BLE Key timeout : 33 +1011301 [I][SavedStruct] Loading "/int/.desktop.settings" +1011327 [I][SavedStruct] Loading "/int/.desktop.settings" +1011367 [I][SavedStruct] Loading "/int/.desktop.settings" +1011466 [D][BadBleWorker] line:ENTER +1011468 [I][BadBleWorker] Special key pressed 28 + +1011505 [D][BtGap] RSSI: -85 +1011507 [I][BadBleWorker] BLE Key timeout : 33 +1011511 [D][BadBleWorker] line:GUI SPACE +1011513 [I][BadBleWorker] Special key pressed 82c + +1011527 [I][SavedStruct] Loading "/int/.desktop.settings" +1011549 [D][BtGap] RSSI: -85 +1011551 [I][BadBleWorker] BLE Key timeout : 33 +1011555 [D][BadBleWorker] line:DELAY 500 +1011558 [D][BtGap] RSSI: -85 +1011560 [I][BadBleWorker] BLE Key timeout : 33 +1011700 [I][SavedStruct] Loading "/int/.desktop.settings" +1011727 [I][SavedStruct] Loading "/int/.desktop.settings" +1011801 [I][SavedStruct] Loading "/int/.desktop.settings" +1011927 [I][SavedStruct] Loading "/int/.desktop.settings" +1012033 [I][SavedStruct] Loading "/int/.desktop.settings" +1012062 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +1012127 [I][SavedStruct] Loading "/int/.desktop.settings" +1012301 [I][SavedStruct] Loading "/int/.desktop.settings" +1012327 [I][SavedStruct] Loading "/int/.desktop.settings" +1012366 [I][SavedStruct] Loading "/int/.desktop.settings" +1012527 [I][SavedStruct] Loading "/int/.desktop.settings" +1012699 [I][SavedStruct] Loading "/int/.desktop.settings" +1012727 [I][SavedStruct] Loading "/int/.desktop.settings" +1012801 [I][SavedStruct] Loading "/int/.desktop.settings" +1012927 [I][SavedStruct] Loading "/int/.desktop.settings" +1013032 [I][SavedStruct] Loading "/int/.desktop.settings" +1013127 [I][SavedStruct] Loading "/int/.desktop.settings" +1013301 [I][SavedStruct] Loading "/int/.desktop.settings" +1013327 [I][SavedStruct] Loading "/int/.desktop.settings" +1013365 [I][SavedStruct] Loading "/int/.desktop.settings" +1013505 [D][BtGap] RSSI: -91 +1013507 [I][BadBleWorker] BLE Key timeout : 16 +1013511 [D][BadBleWorker] line:DELAY 200 +1013513 [D][BtGap] RSSI: -91 +1013515 [I][BadBleWorker] BLE Key timeout : 16 +1013527 [I][SavedStruct] Loading "/int/.desktop.settings" +1013698 [I][SavedStruct] Loading "/int/.desktop.settings" +1013717 [D][BadBleWorker] line:ENTER +1013719 [I][BadBleWorker] Special key pressed 28 + +1013727 [I][SavedStruct] Loading "/int/.desktop.settings" +1013741 [D][BtGap] RSSI: -99 +1013743 [I][BadBleWorker] BLE Key timeout : 16 +1013749 [D][BadBleWorker] line:GUI SPACE +1013751 [I][BadBleWorker] Special key pressed 82c + +1013770 [D][BtGap] RSSI: -99 +1013772 [I][BadBleWorker] BLE Key timeout : 16 +1013776 [D][BadBleWorker] line:DELAY 500 +1013778 [D][BtGap] RSSI: -99 +1013780 [I][BadBleWorker] BLE Key timeout : 16 +1013801 [I][SavedStruct] Loading "/int/.desktop.settings" +1013927 [I][SavedStruct] Loading "/int/.desktop.settings" +1014031 [I][SavedStruct] Loading "/int/.desktop.settings" +1014134 [I][SavedStruct] Loading "/int/.desktop.settings" +1014282 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +1014301 [I][SavedStruct] Loading "/int/.desktop.settings" +1014327 [I][SavedStruct] Loading "/int/.desktop.settings" +1014364 [I][SavedStruct] Loading "/int/.desktop.settings" +1014527 [I][SavedStruct] Loading "/int/.desktop.settings" +1014593 [E][BtHid] Failed updating report characteristic: 100 +1014596 [E][BtHid] Failed updating report characteristic: 100 +1014616 [E][BtHid] Failed updating report characteristic: 100 +1014619 [E][BtHid] Failed updating report characteristic: 100 +1014640 [E][BtHid] Failed updating report characteristic: 100 +1014643 [E][BtHid] Failed updating report characteristic: 100 +1014664 [E][BtHid] Failed updating report characteristic: 100 +1014667 [E][BtHid] Failed updating report characteristic: 100 +1014688 [E][BtHid] Failed updating report characteristic: 100 +1014691 [E][BtHid] Failed updating report characteristic: 100 +1014697 [I][SavedStruct] Loading "/int/.desktop.settings" +1014712 [E][BtHid] Failed updating report characteristic: 100 +1014717 [E][BtHid] Failed updating report characteristic: 100 +1014727 [I][SavedStruct] Loading "/int/.desktop.settings" +1014739 [E][BtHid] Failed updating report characteristic: 100 +1014744 [E][BtHid] Failed updating report characteristic: 100 +1014765 [E][BtHid] Failed updating report characteristic: 100 +1014768 [E][BtHid] Failed updating report characteristic: 100 +1014789 [E][BtHid] Failed updating report characteristic: 100 +1014792 [E][BtHid] Failed updating report characteristic: 100 +1014801 [I][SavedStruct] Loading "/int/.desktop.settings" +1014814 [E][BtHid] Failed updating report characteristic: 100 +1014819 [E][BtHid] Failed updating report characteristic: 100 +1014840 [E][BtHid] Failed updating report characteristic: 100 +1014843 [E][BtHid] Failed updating report characteristic: 100 +1014862 [E][BtHid] Failed updating report characteristic: 100 +1014865 [E][BtHid] Failed updating report characteristic: 100 +1014885 [E][BtHid] Failed updating report characteristic: 100 +1014888 [E][BtHid] Failed updating report characteristic: 100 +1014907 [E][BtHid] Failed updating report characteristic: 100 +1014910 [E][BtHid] Failed updating report characteristic: 100 +1014927 [I][SavedStruct] Loading "/int/.desktop.settings" +1014931 [E][BtHid] Failed updating report characteristic: 100 +1014936 [E][BtHid] Failed updating report characteristic: 100 +1014957 [E][BtHid] Failed updating report characteristic: 100 +1014960 [E][BtHid] Failed updating report characteristic: 100 +1014981 [E][BtHid] Failed updating report characteristic: 100 +1014984 [E][BtHid] Failed updating report characteristic: 100 +1015004 [E][BtHid] Failed updating report characteristic: 100 +1015007 [E][BtHid] Failed updating report characteristic: 100 +1015027 [E][BtHid] Failed updating report characteristic: 100 +1015031 [E][BtHid] Failed updating report characteristic: 100 +1015033 [I][SavedStruct] Loading "/int/.desktop.settings" +1015051 [E][BtHid] Failed updating report characteristic: 100 +1015055 [E][BtHid] Failed updating report characteristic: 100 +1015075 [E][BtHid] Failed updating report characteristic: 100 +1015078 [E][BtHid] Failed updating report characteristic: 100 +1015099 [E][BtHid] Failed updating report characteristic: 100 +1015102 [E][BtHid] Failed updating report characteristic: 100 +1015121 [E][BtHid] Failed updating report characteristic: 100 +1015124 [E][BtHid] Failed updating report characteristic: 100 +1015129 [I][SavedStruct] Loading "/int/.desktop.settings" +1015146 [E][BtHid] Failed updating report characteristic: 100 +1015153 [E][BtHid] Failed updating report characteristic: 100 +1015174 [E][BtHid] Failed updating report characteristic: 100 +1015177 [D][BtGap] RSSI: -99 +1015179 [I][BadBleWorker] BLE Key timeout : 16 +1015181 [D][BadBleWorker] line:DELAY 200 +1015183 [D][BtGap] RSSI: -99 +1015184 [I][BadBleWorker] BLE Key timeout : 16 +1015301 [I][SavedStruct] Loading "/int/.desktop.settings" +1015327 [I][SavedStruct] Loading "/int/.desktop.settings" +1015363 [I][SavedStruct] Loading "/int/.desktop.settings" +1015386 [D][BadBleWorker] line:ENTER +1015388 [I][BadBleWorker] Special key pressed 28 + +1015391 [E][BtHid] Failed updating report characteristic: 100 +1015410 [D][BtGap] RSSI: -89 +1015412 [I][BadBleWorker] BLE Key timeout : 16 +1015416 [D][BtGap] RSSI: -89 +1015418 [I][BadBleWorker] BLE Key timeout : 16 +1015527 [I][SavedStruct] Loading "/int/.desktop.settings" +1015696 [I][SavedStruct] Loading "/int/.desktop.settings" +1015727 [I][SavedStruct] Loading "/int/.desktop.settings" +1015801 [I][SavedStruct] Loading "/int/.desktop.settings" +1015927 [I][SavedStruct] Loading "/int/.desktop.settings" +1016029 [I][SavedStruct] Loading "/int/.desktop.settings" +1016127 [I][SavedStruct] Loading "/int/.desktop.settings" +1016301 [I][SavedStruct] Loading "/int/.desktop.settings" +1016327 [I][SavedStruct] Loading "/int/.desktop.settings" +1016362 [I][SavedStruct] Loading "/int/.desktop.settings" +1016527 [I][SavedStruct] Loading "/int/.desktop.settings" +1016695 [I][SavedStruct] Loading "/int/.desktop.settings" +1016727 [I][SavedStruct] Loading "/int/.desktop.settings" +1016801 [I][SavedStruct] Loading "/int/.desktop.settings" +1016927 [I][SavedStruct] Loading "/int/.desktop.settings" +1017028 [I][SavedStruct] Loading "/int/.desktop.settings" +1017127 [I][SavedStruct] Loading "/int/.desktop.settings" +1017301 [I][SavedStruct] Loading "/int/.desktop.settings" +1017327 [I][SavedStruct] Loading "/int/.desktop.settings" +1017361 [I][SavedStruct] Loading "/int/.desktop.settings" +1017527 [I][SavedStruct] Loading "/int/.desktop.settings" +1017694 [I][SavedStruct] Loading "/int/.desktop.settings" +1017727 [I][SavedStruct] Loading "/int/.desktop.settings" +1017801 [I][SavedStruct] Loading "/int/.desktop.settings" +1017927 [I][SavedStruct] Loading "/int/.desktop.settings" +1018027 [I][SavedStruct] Loading "/int/.desktop.settings" +1018127 [I][SavedStruct] Loading "/int/.desktop.settings" +1018301 [I][SavedStruct] Loading "/int/.desktop.settings" +1018327 [I][SavedStruct] Loading "/int/.desktop.settings" +1018360 [I][SavedStruct] Loading "/int/.desktop.settings" +1018527 [I][SavedStruct] Loading "/int/.desktop.settings" +1018693 [I][SavedStruct] Loading "/int/.desktop.settings" +1018727 [I][SavedStruct] Loading "/int/.desktop.settings" +1018801 [I][SavedStruct] Loading "/int/.desktop.settings" +1018927 [I][SavedStruct] Loading "/int/.desktop.settings" +1019026 [I][SavedStruct] Loading "/int/.desktop.settings" +1019127 [I][SavedStruct] Loading "/int/.desktop.settings" +1019301 [I][SavedStruct] Loading "/int/.desktop.settings" +1019327 [I][SavedStruct] Loading "/int/.desktop.settings" +1019359 [I][SavedStruct] Loading "/int/.desktop.settings" +1019527 [I][SavedStruct] Loading "/int/.desktop.settings" +1019692 [I][SavedStruct] Loading "/int/.desktop.settings" +1019727 [I][SavedStruct] Loading "/int/.desktop.settings" +1019801 [I][SavedStruct] Loading "/int/.desktop.settings" +1019927 [I][SavedStruct] Loading "/int/.desktop.settings" +1020025 [I][SavedStruct] Loading "/int/.desktop.settings" +1020127 [I][SavedStruct] Loading "/int/.desktop.settings" +1020301 [I][SavedStruct] Loading "/int/.desktop.settings" +1020327 [I][SavedStruct] Loading "/int/.desktop.settings" +1020358 [I][SavedStruct] Loading "/int/.desktop.settings" +1020527 [I][SavedStruct] Loading "/int/.desktop.settings" +1020691 [I][SavedStruct] Loading "/int/.desktop.settings" +1020727 [I][SavedStruct] Loading "/int/.desktop.settings" +1020801 [I][SavedStruct] Loading "/int/.desktop.settings" +1020927 [I][SavedStruct] Loading "/int/.desktop.settings" +1021024 [I][SavedStruct] Loading "/int/.desktop.settings" +1021127 [I][SavedStruct] Loading "/int/.desktop.settings" +1021301 [I][SavedStruct] Loading "/int/.desktop.settings" +1021327 [I][SavedStruct] Loading "/int/.desktop.settings" +1021357 [I][SavedStruct] Loading "/int/.desktop.settings" +1021527 [I][SavedStruct] Loading "/int/.desktop.settings" +1021690 [I][SavedStruct] Loading "/int/.desktop.settings" +1021727 [I][SavedStruct] Loading "/int/.desktop.settings" +1021801 [I][SavedStruct] Loading "/int/.desktop.settings" +1021927 [I][SavedStruct] Loading "/int/.desktop.settings" +1022023 [I][SavedStruct] Loading "/int/.desktop.settings" +1022127 [I][SavedStruct] Loading "/int/.desktop.settings" +1022301 [I][SavedStruct] Loading "/int/.desktop.settings" +1022327 [I][SavedStruct] Loading "/int/.desktop.settings" +1022356 [I][SavedStruct] Loading "/int/.desktop.settings" + +>: + _.-------.._ -, + .-"```"--..,,_/ /`-, -, \ + .:" /:/ /'\ \ ,_..., `. | | + / ,----/:/ /`\ _\~`_-"` _; + ' / /`"""'\ \ \.~`_-' ,-"'/ + | | | 0 | | .-' ,/` / + | ,..\ \ ,.-"` ,/` / + ; : `/`""\` ,/--==,/-----, + | `-...| -.___-Z:_______J...---; + : ` _-' + _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ +| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| +| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | +|_| |____||___||_| |_| |___||_|_\ \___||____||___| + +Welcome to Flipper Zero Command Line Interface! +Read Manual https://docs.flipperzero.one + +Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) + +>: log +Press CTRL+C to stop... +27492 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 +27494 [D][BrowserWorker] Load offset: 0 cnt: 50 +28939 [D][BrowserWorker] End +28952 [I][BtGap] Stop advertising +28956 [D][BtGap] set_non_discoverable success +28970 [I][SavedStruct] Loading "/int/.desktop.settings" +29075 [I][SavedStruct] Loading "/int/.desktop.settings" +29162 [I][FuriHalBt] Disconnect and stop advertising +29164 [I][FuriHalBt] Stop current profile services +29173 [I][FuriHalBt] Stop BLE related RTOS threads +29197 [I][FuriHalBt] Reset SHCI +29275 [I][SavedStruct] Loading "/int/.desktop.settings" +29311 [I][FuriHalBt] Start BT initialization +29316 [I][Core2] Core2 started +29318 [I][Core2] C2 boot completed, mode: Stack +29321 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +29323 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +29327 [I][Core2] Radio stack started +29330 [I][Core2] Flash activity control switched to SEM7 +29332 [I][BtGap] Advertising name: Keyboard +29334 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +29350 [D][BtBatterySvc] Updating power state characteristic +29356 [I][BtGap] Start advertising +29358 [I][SavedStruct] Loading "/int/.bt.settings" +29376 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" +29385 [I][FuriHalBt] Disconnect and stop advertising +29387 [I][BtGap] Stop advertising +29390 [D][BtGap] set_non_discoverable success +29392 [I][FuriHalBt] Stop current profile services +29402 [I][FuriHalBt] Stop BLE related RTOS threads +29427 [I][FuriHalBt] Reset SHCI +29466 [I][SavedStruct] Loading "/int/.desktop.settings" +29482 [I][SavedStruct] Loading "/int/.desktop.settings" +29541 [I][FuriHalBt] Start BT initialization +29546 [I][Core2] Core2 started +29548 [I][Core2] C2 boot completed, mode: Stack +29551 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +29553 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +29557 [I][Core2] Radio stack started +29560 [I][Core2] Flash activity control switched to SEM7 +29562 [I][BtGap] Advertising name: Rumik1 +29565 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 +29582 [D][BtBatterySvc] Updating power state characteristic +29591 [I][BtSrv] Bt App started +29593 [I][BtGap] Start advertising +29596 [I][BadBleWorker] Init +29598 [I][SavedStruct] Loading "/int/.desktop.settings" +29625 [I][BadBleWorker] BLE Key timeout : 16 +29675 [I][SavedStruct] Loading "/int/.desktop.settings" +29875 [I][SavedStruct] Loading "/int/.desktop.settings" +29966 [I][SavedStruct] Loading "/int/.desktop.settings" +30075 [I][SavedStruct] Loading "/int/.desktop.settings" +30275 [I][SavedStruct] Loading "/int/.desktop.settings" +30466 [I][SavedStruct] Loading "/int/.desktop.settings" +30486 [I][SavedStruct] Loading "/int/.desktop.settings" +30675 [I][SavedStruct] Loading "/int/.desktop.settings" +30726 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 +30839 [D][BtGap] Slave security initiated +30875 [I][SavedStruct] Loading "/int/.desktop.settings" +30966 [I][SavedStruct] Loading "/int/.desktop.settings" +31018 [I][BtGap] Pairing complete +31021 [D][BtGap] RSSI: -47 +31023 [D][BtBatterySvc] Updating battery level characteristic +31026 [D][BtGap] RSSI: -47 +31028 [I][BadBleWorker] BLE Key timeout : 33 +31075 [I][SavedStruct] Loading "/int/.desktop.settings" +31136 [I][BtGap] Rx MTU size: 414 +31275 [I][SavedStruct] Loading "/int/.desktop.settings" +31466 [I][SavedStruct] Loading "/int/.desktop.settings" +31484 [I][SavedStruct] Loading "/int/.desktop.settings" +31675 [I][SavedStruct] Loading "/int/.desktop.settings" +31702 [I][BtGap] Connection parameters event complete +31704 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 +31706 [W][BtGap] Unsupported connection interval. Request connection parameters update +31739 [D][BtGap] Connection parameters accepted +31875 [I][SavedStruct] Loading "/int/.desktop.settings" +31902 [I][BtGap] Connection parameters event complete +31906 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 +31968 [I][SavedStruct] Loading "/int/.desktop.settings" +32075 [I][SavedStruct] Loading "/int/.desktop.settings" +32275 [I][SavedStruct] Loading "/int/.desktop.settings" +32466 [I][SavedStruct] Loading "/int/.desktop.settings" +32484 [I][SavedStruct] Loading "/int/.desktop.settings" +32675 [I][SavedStruct] Loading "/int/.desktop.settings" +32875 [I][SavedStruct] Loading "/int/.desktop.settings" +32966 [I][SavedStruct] Loading "/int/.desktop.settings" +33075 [I][SavedStruct] Loading "/int/.desktop.settings" +33275 [I][SavedStruct] Loading "/int/.desktop.settings" +33466 [I][SavedStruct] Loading "/int/.desktop.settings" +33484 [I][SavedStruct] Loading "/int/.desktop.settings" +33675 [I][SavedStruct] Loading "/int/.desktop.settings" +33875 [I][SavedStruct] Loading "/int/.desktop.settings" +33966 [I][SavedStruct] Loading "/int/.desktop.settings" +34075 [I][SavedStruct] Loading "/int/.desktop.settings" +34275 [I][SavedStruct] Loading "/int/.desktop.settings" +34466 [I][SavedStruct] Loading "/int/.desktop.settings" +34484 [I][SavedStruct] Loading "/int/.desktop.settings" +34675 [I][SavedStruct] Loading "/int/.desktop.settings" +34875 [I][SavedStruct] Loading "/int/.desktop.settings" +34966 [I][SavedStruct] Loading "/int/.desktop.settings" +35075 [I][SavedStruct] Loading "/int/.desktop.settings" +35275 [I][SavedStruct] Loading "/int/.desktop.settings" +35359 [D][DolphinState] icounter 1325, butthurt 0 +35362 [D][BtGap] RSSI: -53 +35363 [I][BadBleWorker] BLE Key timeout : 33 +35367 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone +35370 [D][BtGap] RSSI: -53 +35371 [I][BadBleWorker] BLE Key timeout : 33 +35373 [D][BadBleWorker] line:DELAY 1000 +35375 [D][BtGap] RSSI: -53 +35376 [I][BadBleWorker] BLE Key timeout : 33 +35475 [I][SavedStruct] Loading "/int/.desktop.settings" +35675 [I][SavedStruct] Loading "/int/.desktop.settings" +35860 [I][SavedStruct] Loading "/int/.desktop.settings" +35878 [I][SavedStruct] Loading "/int/.desktop.settings" +36075 [I][SavedStruct] Loading "/int/.desktop.settings" +36275 [I][SavedStruct] Loading "/int/.desktop.settings" +36360 [I][SavedStruct] Loading "/int/.desktop.settings" +36378 [D][BadBleWorker] line:GUI SPACE +36380 [I][BadBleWorker] Special key pressed 82c + +36418 [D][BtGap] RSSI: -57 +36420 [I][BadBleWorker] BLE Key timeout : 33 +36423 [D][BadBleWorker] line:DELAY 500 +36426 [D][BtGap] RSSI: -57 +36428 [I][BadBleWorker] BLE Key timeout : 33 +36475 [I][SavedStruct] Loading "/int/.desktop.settings" +36675 [I][SavedStruct] Loading "/int/.desktop.settings" +36860 [I][SavedStruct] Loading "/int/.desktop.settings" +36878 [I][SavedStruct] Loading "/int/.desktop.settings" +36930 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +37075 [I][SavedStruct] Loading "/int/.desktop.settings" +37275 [I][SavedStruct] Loading "/int/.desktop.settings" +37360 [I][SavedStruct] Loading "/int/.desktop.settings" +37475 [I][SavedStruct] Loading "/int/.desktop.settings" +37675 [I][SavedStruct] Loading "/int/.desktop.settings" +37860 [I][SavedStruct] Loading "/int/.desktop.settings" +37878 [I][SavedStruct] Loading "/int/.desktop.settings" +38075 [I][SavedStruct] Loading "/int/.desktop.settings" +38275 [I][SavedStruct] Loading "/int/.desktop.settings" +38360 [I][SavedStruct] Loading "/int/.desktop.settings" +38370 [D][BtGap] RSSI: -71 +38372 [I][BadBleWorker] BLE Key timeout : 37 +38376 [D][BadBleWorker] line:DELAY 200 +38380 [D][BtGap] RSSI: -74 +38382 [I][BadBleWorker] BLE Key timeout : 37 +38475 [I][SavedStruct] Loading "/int/.desktop.settings" +38586 [D][BadBleWorker] line:ENTER +38588 [I][BadBleWorker] Special key pressed 28 + +38629 [D][BtGap] RSSI: -88 +38631 [I][BadBleWorker] BLE Key timeout : 41 +38633 [D][BadBleWorker] line:GUI SPACE +38635 [I][BadBleWorker] Special key pressed 82c + +38675 [I][SavedStruct] Loading "/int/.desktop.settings" +38682 [D][BtGap] RSSI: -71 +38684 [I][BadBleWorker] BLE Key timeout : 37 +38688 [D][BadBleWorker] line:DELAY 500 +38692 [D][BtGap] RSSI: -71 +38694 [I][BadBleWorker] BLE Key timeout : 37 +38860 [I][SavedStruct] Loading "/int/.desktop.settings" +38878 [I][SavedStruct] Loading "/int/.desktop.settings" +39075 [I][SavedStruct] Loading "/int/.desktop.settings" +39198 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +39275 [I][SavedStruct] Loading "/int/.desktop.settings" +39360 [I][SavedStruct] Loading "/int/.desktop.settings" +39475 [I][SavedStruct] Loading "/int/.desktop.settings" +39675 [I][SavedStruct] Loading "/int/.desktop.settings" +39860 [I][SavedStruct] Loading "/int/.desktop.settings" +39878 [I][SavedStruct] Loading "/int/.desktop.settings" +40086 [I][SavedStruct] Loading "/int/.desktop.settings" +40275 [I][SavedStruct] Loading "/int/.desktop.settings" +40360 [I][SavedStruct] Loading "/int/.desktop.settings" +40475 [I][SavedStruct] Loading "/int/.desktop.settings" +40675 [I][SavedStruct] Loading "/int/.desktop.settings" +40803 [D][BtGap] RSSI: -98 +40805 [I][BadBleWorker] BLE Key timeout : 41 +40809 [D][BadBleWorker] line:DELAY 200 +40812 [D][BtGap] RSSI: -98 +40814 [I][BadBleWorker] BLE Key timeout : 41 +40860 [I][SavedStruct] Loading "/int/.desktop.settings" +40878 [I][SavedStruct] Loading "/int/.desktop.settings" +41017 [D][BadBleWorker] line:ENTER +41019 [I][BadBleWorker] Special key pressed 28 + +41063 [D][BtGap] RSSI: -89 +41065 [I][BadBleWorker] BLE Key timeout : 41 +41068 [D][BadBleWorker] line:GUI SPACE +41070 [I][BadBleWorker] Special key pressed 82c + +41075 [I][SavedStruct] Loading "/int/.desktop.settings" +41115 [D][BtGap] RSSI: -91 +41117 [I][BadBleWorker] BLE Key timeout : 41 +41119 [D][BadBleWorker] line:DELAY 500 +41121 [D][BtGap] RSSI: -91 +41122 [I][BadBleWorker] BLE Key timeout : 41 +41275 [I][SavedStruct] Loading "/int/.desktop.settings" +41360 [I][SavedStruct] Loading "/int/.desktop.settings" +41475 [I][SavedStruct] Loading "/int/.desktop.settings" +41624 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +41675 [I][SavedStruct] Loading "/int/.desktop.settings" +41860 [I][SavedStruct] Loading "/int/.desktop.settings" +41878 [I][SavedStruct] Loading "/int/.desktop.settings" +42075 [I][SavedStruct] Loading "/int/.desktop.settings" +42275 [I][SavedStruct] Loading "/int/.desktop.settings" +42360 [I][SavedStruct] Loading "/int/.desktop.settings" +42475 [I][SavedStruct] Loading "/int/.desktop.settings" +42675 [I][SavedStruct] Loading "/int/.desktop.settings" +42860 [I][SavedStruct] Loading "/int/.desktop.settings" +42878 [I][SavedStruct] Loading "/int/.desktop.settings" +43075 [I][SavedStruct] Loading "/int/.desktop.settings" +43275 [I][SavedStruct] Loading "/int/.desktop.settings" +43360 [I][SavedStruct] Loading "/int/.desktop.settings" +43389 [D][BtGap] RSSI: -85 +43391 [I][BadBleWorker] BLE Key timeout : 41 +43394 [D][BadBleWorker] line:DELAY 200 +43397 [D][BtGap] RSSI: -85 +43399 [I][BadBleWorker] BLE Key timeout : 41 +43475 [I][SavedStruct] Loading "/int/.desktop.settings" +43601 [D][BadBleWorker] line:ENTER +43603 [I][BadBleWorker] Special key pressed 28 + +43647 [D][BtGap] RSSI: -86 +43649 [I][BadBleWorker] BLE Key timeout : 41 +43652 [D][BadBleWorker] line:GUI SPACE +43654 [I][BadBleWorker] Special key pressed 82c + +43675 [I][SavedStruct] Loading "/int/.desktop.settings" +43699 [D][BtGap] RSSI: -91 +43701 [I][BadBleWorker] BLE Key timeout : 41 +43704 [D][BadBleWorker] line:DELAY 500 +43706 [D][BtGap] RSSI: -91 +43708 [I][BadBleWorker] BLE Key timeout : 41 +43860 [I][SavedStruct] Loading "/int/.desktop.settings" +43878 [I][SavedStruct] Loading "/int/.desktop.settings" +44075 [I][SavedStruct] Loading "/int/.desktop.settings" +44211 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html +44275 [I][SavedStruct] Loading "/int/.desktop.settings" +44360 [I][SavedStruct] Loading "/int/.desktop.settings" +44475 [I][SavedStruct] Loading "/int/.desktop.settings" +44675 [I][SavedStruct] Loading "/int/.desktop.settings" +44860 [I][SavedStruct] Loading "/int/.desktop.settings" +44878 [I][SavedStruct] Loading "/int/.desktop.settings" +45075 [I][SavedStruct] Loading "/int/.desktop.settings" +45275 [I][SavedStruct] Loading "/int/.desktop.settings" +45360 [I][SavedStruct] Loading "/int/.desktop.settings" +45475 [I][SavedStruct] Loading "/int/.desktop.settings" +45675 [I][SavedStruct] Loading "/int/.desktop.settings" +45860 [I][SavedStruct] Loading "/int/.desktop.settings" +45878 [I][SavedStruct] Loading "/int/.desktop.settings" +45978 [D][BtGap] RSSI: -89 +45980 [I][BadBleWorker] BLE Key timeout : 41 +45983 [D][BadBleWorker] line:DELAY 200 +45986 [D][BtGap] RSSI: -86 +45987 [I][BadBleWorker] BLE Key timeout : 41 +46075 [I][SavedStruct] Loading "/int/.desktop.settings" +46190 [D][BadBleWorker] line:ENTER +46192 [I][BadBleWorker] Special key pressed 28 + +46237 [D][BtGap] RSSI: -97 +46239 [I][BadBleWorker] BLE Key timeout : 41 +46242 [D][BtGap] RSSI: -97 +46244 [I][BadBleWorker] BLE Key timeout : 41 +46275 [I][SavedStruct] Loading "/int/.desktop.settings" +46360 [I][SavedStruct] Loading "/int/.desktop.settings" +46475 [I][SavedStruct] Loading "/int/.desktop.settings" +46675 [I][SavedStruct] Loading "/int/.desktop.settings" +46860 [I][SavedStruct] Loading "/int/.desktop.settings" +46879 [I][SavedStruct] Loading "/int/.desktop.settings" +47075 [I][SavedStruct] Loading "/int/.desktop.settings" +47275 [I][SavedStruct] Loading "/int/.desktop.settings" +47360 [I][SavedStruct] Loading "/int/.desktop.settings" +47475 [I][SavedStruct] Loading "/int/.desktop.settings" +47675 [I][SavedStruct] Loading "/int/.desktop.settings" +47860 [I][SavedStruct] Loading "/int/.desktop.settings" +47879 [I][SavedStruct] Loading "/int/.desktop.settings" +48075 [I][SavedStruct] Loading "/int/.desktop.settings" +48275 [I][SavedStruct] Loading "/int/.desktop.settings" +48360 [I][SavedStruct] Loading "/int/.desktop.settings" +48475 [I][SavedStruct] Loading "/int/.desktop.settings" +48675 [I][SavedStruct] Loading "/int/.desktop.settings" +48860 [I][SavedStruct] Loading "/int/.desktop.settings" +48879 [I][SavedStruct] Loading "/int/.desktop.settings" +49075 [I][SavedStruct] Loading "/int/.desktop.settings" +49275 [I][SavedStruct] Loading "/int/.desktop.settings" +49360 [I][SavedStruct] Loading "/int/.desktop.settings" +49475 [I][SavedStruct] Loading "/int/.desktop.settings" +49675 [I][SavedStruct] Loading "/int/.desktop.settings" +49860 [I][SavedStruct] Loading "/int/.desktop.settings" +49879 [I][SavedStruct] Loading "/int/.desktop.settings" +50075 [I][SavedStruct] Loading "/int/.desktop.settings" +50275 [I][SavedStruct] Loading "/int/.desktop.settings" +50360 [I][SavedStruct] Loading "/int/.desktop.settings" +50475 [I][SavedStruct] Loading "/int/.desktop.settings" +50675 [I][SavedStruct] Loading "/int/.desktop.settings" +50860 [I][SavedStruct] Loading "/int/.desktop.settings" +50879 [I][SavedStruct] Loading "/int/.desktop.settings" +51075 [I][SavedStruct] Loading "/int/.desktop.settings" +51275 [I][SavedStruct] Loading "/int/.desktop.settings" +51360 [I][SavedStruct] Loading "/int/.desktop.settings" +51475 [I][SavedStruct] Loading "/int/.desktop.settings" +51675 [I][SavedStruct] Loading "/int/.desktop.settings" +51860 [I][SavedStruct] Loading "/int/.desktop.settings" +51879 [I][SavedStruct] Loading "/int/.desktop.settings" +52075 [I][SavedStruct] Loading "/int/.desktop.settings" +52275 [I][SavedStruct] Loading "/int/.desktop.settings" +52360 [I][SavedStruct] Loading "/int/.desktop.settings" +52475 [I][SavedStruct] Loading "/int/.desktop.settings" +52675 [I][SavedStruct] Loading "/int/.desktop.settings" +52860 [I][SavedStruct] Loading "/int/.desktop.settings" +52879 [I][SavedStruct] Loading "/int/.desktop.settings" +53075 [I][SavedStruct] Loading "/int/.desktop.settings" +53275 [I][SavedStruct] Loading "/int/.desktop.settings" +53360 [I][SavedStruct] Loading "/int/.desktop.settings" +53475 [I][SavedStruct] Loading "/int/.desktop.settings" +53675 [I][SavedStruct] Loading "/int/.desktop.settings" +53860 [I][SavedStruct] Loading "/int/.desktop.settings" +53879 [I][SavedStruct] Loading "/int/.desktop.settings" +54075 [I][SavedStruct] Loading "/int/.desktop.settings" +54101 [I][BtGap] Stop advertising +54104 [D][BtGap] terminate success +54107 [E][BtGap] set_non_discoverable failed 12 +54111 [I][SavedStruct] Loading "/int/.desktop.settings" +54275 [I][SavedStruct] Loading "/int/.desktop.settings" +54311 [I][SavedStruct] Loading "/int/.bt.settings" +54324 [I][SavedStruct] Loading "/int/.bt.keys" +54335 [I][FuriHalBt] Disconnect and stop advertising +54337 [I][FuriHalBt] Stop current profile services +54339 [I][BtGap] Disconnect from client. Reason: 16 +54349 [I][FuriHalBt] Stop BLE related RTOS threads +54373 [I][FuriHalBt] Reset SHCI +54475 [I][SavedStruct] Loading "/int/.desktop.settings" +54487 [I][FuriHalBt] Start BT initialization +54494 [I][Core2] Core2 started +54496 [I][Core2] C2 boot completed, mode: Stack +54500 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages +54504 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages +54508 [I][Core2] Radio stack started +54511 [I][Core2] Flash activity control switched to SEM7 +54513 [I][BtGap] Advertising name: Keyboard +54516 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 +54534 [D][BtBatterySvc] Updating power state characteristic +54540 [I][BtSrv] Bt App started +54542 [I][BtGap] Start advertising +54545 [I][BadBleWorker] End +54547 [I][SavedStruct] Loading "/int/.desktop.settings" +54568 [I][SavedStruct] Loading "/int/.desktop.settings" +54570 [D][BrowserWorker] Start +54598 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 +54600 [D][BrowserWorker] Load offset: 0 cnt: 50 +54676 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 +54678 [D][BrowserWorker] Load offset: 0 cnt: 50 +54888 [D][BrowserWorker] End +54890 [I][SavedStruct] Loading "/int/.desktop.settings" +54946 [I][fap_loader_app] FAP app returned: 0 +54982 [I][LoaderSrv] Application stopped. Free heap: 140272 +55011 [I][AnimationStorage] Custom Manifest selected +55299 [I][AnimationManager] Select 'HANDS' animation +55303 [I][AnimationManager] Load animation 'HANDS' +55331 [I][SavedStruct] Loading "/int/.desktop.settings" +65361 [I][Dolphin] Flush stats +65363 [I][SavedStruct] Saving "/int/.dolphin.state" +65373 [D][StorageInt] Device erase: page 2, translated page: cf +65468 [D][StorageInt] Device sync: skipping +65473 [I][DolphinState] State saved +72183 [I][AnimationStorage] Custom Manifest selected +73040 [I][AnimationManager] Select 'SKULL' animation +103081 [I][AnimationStorage] Custom Manifest selected +104016 [I][AnimationManager] Select 'LOGO_WD2' animation +114771 [D][BtGap] set_non_discoverable success +134057 [I][AnimationStorage] Custom Manifest selected +134395 [I][AnimationManager] Select 'MUMMY' animation +164438 [I][AnimationStorage] Custom Manifest selected +164953 [I][AnimationManager] Select 'DEDSEC_TALK' animation +174773 [D][BtGap] set_non_discoverable success +194994 [I][AnimationStorage] Custom Manifest selected +195897 [I][AnimationManager] Select 'REAPER_ALT' animation +225938 [I][AnimationStorage] Custom Manifest selected +226509 [I][AnimationManager] Select 'DEDSEC_OLD' animation +234775 [D][BtGap] set_non_discoverable success +256552 [I][AnimationStorage] Custom Manifest selected +256819 [I][AnimationManager] Select 'JOIN_US' animation +286859 [I][AnimationStorage] Custom Manifest selected +287374 [I][AnimationManager] Select 'DEDSEC_TALK' animation +294777 [D][BtGap] set_non_discoverable success +317415 [I][AnimationStorage] Custom Manifest selected +318273 [I][AnimationManager] Select 'SKULL' animation +348316 [I][AnimationStorage] Custom Manifest selected +349083 [I][AnimationManager] Select 'SPIRAL' animation +354779 [D][BtGap] set_non_discoverable success +379124 [I][AnimationStorage] Custom Manifest selected +379787 [I][AnimationManager] Select 'SKULL_SPIN' animation +409828 [I][AnimationStorage] Custom Manifest selected +410316 [I][AnimationManager] Select 'DEDSEC_AD' animation +414781 [D][BtGap] set_non_discoverable success +440358 [I][AnimationStorage] Custom Manifest selected +440698 [I][AnimationManager] Select 'MUMMY' animation +470740 [I][AnimationStorage] Custom Manifest selected +471138 [I][AnimationManager] Select 'HANDS' animation +474783 [D][BtGap] set_non_discoverable success +501180 [I][AnimationStorage] Custom Manifest selected +502243 [I][AnimationManager] Select 'DEDSEC_ANIM' animation +532285 [I][AnimationStorage] Custom Manifest selected +532547 [I][AnimationManager] Select 'BOTTY_CALL' animation +534785 [D][BtGap] set_non_discoverable success +562592 [I][AnimationStorage] Custom Manifest selected +563449 [I][AnimationManager] Select 'SKULL' animation +593489 [I][AnimationStorage] Custom Manifest selected +594414 [I][AnimationManager] Select 'LOGO_WD2' animation +594787 [D][BtGap] set_non_discoverable success +624465 [I][AnimationStorage] Custom Manifest selected +624658 [I][AnimationManager] Select 'thank_you_128x64' animation +654700 [I][AnimationStorage] Custom Manifest selected +655440 [I][AnimationManager] Select 'GUNS_CAR' animation +655471 [D][BtGap] set_non_discoverable success +685480 [I][AnimationStorage] Custom Manifest selected +686535 [I][AnimationManager] Select 'DEDSEC_ANIM' animation +715480 [D][BtGap] set_non_discoverable success +716577 [I][AnimationStorage] Custom Manifest selected +717479 [I][AnimationManager] Select 'REAPER_ALT' animation +747521 [I][AnimationStorage] Custom Manifest selected +748026 [I][AnimationManager] Select 'DEDSEC_TALK' animation +775484 [D][BtGap] set_non_discoverable success +778069 [I][AnimationStorage] Custom Manifest selected +779065 [I][AnimationManager] Select 'REAPER' animation +809108 [I][AnimationStorage] Custom Manifest selected +809625 [I][AnimationManager] Select 'DEDSEC_TALK' animation +835486 [D][BtGap] set_non_discoverable success +839669 [I][AnimationStorage] Custom Manifest selected +840573 [I][AnimationManager] Select 'REAPER_ALT' animation +870614 [I][AnimationStorage] Custom Manifest selected +871392 [I][AnimationManager] Select 'SPIRAL' animation +895488 [D][BtGap] set_non_discoverable success +901433 [I][AnimationStorage] Custom Manifest selected +902487 [I][AnimationManager] Select 'DEDSEC_ANIM' animation +932529 [I][AnimationStorage] Custom Manifest selected +932843 [I][AnimationManager] Select 'FINGER' animation From a6daa2a20d7c3b96d27b965714a4086fae9753ab Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 27 Jan 2023 11:56:29 +0100 Subject: [PATCH 07/36] drop useless file and some useless line --- applications/main/bad_ble/bad_ble_app.c | 7 +- applications/main/bad_ble/bad_ble_app.h | 2 +- applications/main/bad_ble/bad_ble_app_i.h | 9 +- applications/main/bad_ble/bad_ble_script.c | 54 +- applications/main/bad_ble/bad_ble_script.h | 2 +- .../bad_ble/scenes/bad_ble_scene_config.c | 4 +- .../scenes/bad_ble_scene_config_name.c | 3 +- .../main/gpio/scenes/gpio_scene_start.c | 3 +- applications/plugins/dap_link/dap_link.c | 3 +- applications/plugins/dice/dice.c | 1 - .../plugins/orgasmotron/orgasmotron.c | 37 +- applications/plugins/protoview/app.c | 174 +- applications/plugins/protoview/app.h | 266 +- applications/plugins/protoview/app_subghz.c | 68 +- applications/plugins/protoview/crc.c | 9 +- .../plugins/protoview/custom_presets.h | 31 +- applications/plugins/protoview/data_feed.c | 17 +- applications/plugins/protoview/fields.c | 348 +- .../plugins/protoview/protocols/b4b1.c | 67 +- .../plugins/protoview/protocols/keeloq.c | 99 +- .../plugins/protoview/protocols/oregon2.c | 90 +- .../protoview/protocols/tpms/citroen.c | 46 +- .../plugins/protoview/protocols/tpms/ford.c | 49 +- .../protoview/protocols/tpms/renault.c | 104 +- .../protoview/protocols/tpms/schrader.c | 52 +- .../protocols/tpms/schrader_eg53ma4.c | 47 +- .../plugins/protoview/protocols/tpms/toyota.c | 57 +- applications/plugins/protoview/raw_samples.c | 47 +- applications/plugins/protoview/raw_samples.h | 27 +- applications/plugins/protoview/signal.c | 348 +- applications/plugins/protoview/signal_file.c | 96 +- applications/plugins/protoview/ui.c | 99 +- applications/plugins/protoview/view_build.c | 211 +- .../plugins/protoview/view_direct_sampling.c | 45 +- applications/plugins/protoview/view_info.c | 211 +- .../plugins/protoview/view_raw_signal.c | 76 +- .../plugins/protoview/view_settings.c | 74 +- applications/plugins/tama_p1/hal.c | 2 +- applications/plugins/tama_p1/tama.h | 1 - applications/plugins/tama_p1/tama_p1.c | 145 +- applications/services/bt/bt_service/bt.c | 27 +- applications/services/bt/bt_service/bt.h | 13 +- .../desktop/animations/animation_manager.c | 35 +- .../desktop/animations/animation_storage.c | 9 +- .../desktop/views/desktop_view_lock_menu.c | 2 +- .../services/dolphin/helpers/dolphin_state.c | 7 +- .../services/power/power_service/power.c | 9 +- applications/settings/about/about.c | 19 +- .../settings/dolphin_passport/passport.c | 2 +- .../scenes/xtreme_settings_scene_start.c | 76 +- .../settings/xtreme_settings/xtreme_assets.c | 207 +- .../settings/xtreme_settings/xtreme_assets.h | 7 +- .../xtreme_settings/xtreme_settings.c | 18 +- .../xtreme_settings/xtreme_settings_app.c | 20 +- firmware/targets/f7/ble_glue/gap.c | 28 +- firmware/targets/f7/ble_glue/gap.h | 2 +- firmware/targets/f7/furi_hal/furi_hal_bt.c | 14 +- .../targets/f7/furi_hal/furi_hal_bt_hid.c | 3 +- .../targets/furi_hal_include/furi_hal_bt.h | 14 +- flipper.log | 3146 ----------------- 60 files changed, 1822 insertions(+), 4867 deletions(-) delete mode 100644 flipper.log diff --git a/applications/main/bad_ble/bad_ble_app.c b/applications/main/bad_ble/bad_ble_app.c index ef1a400d6..c5a7e72d0 100644 --- a/applications/main/bad_ble/bad_ble_app.c +++ b/applications/main/bad_ble/bad_ble_app.c @@ -95,14 +95,13 @@ BadBleApp* bad_ble_app_alloc(char* arg) { view_dispatcher_set_navigation_event_callback( app->view_dispatcher, bad_ble_app_back_event_callback); - Bt* bt = furi_record_open(RECORD_BT); app->bt = bt; - const char *adv_name = bt_get_profile_adv_name(bt); + const char* adv_name = bt_get_profile_adv_name(bt); memcpy(app->name, adv_name, BAD_BLE_ADV_NAME_MAX_LEN); - const uint8_t *mac_addr = bt_get_profile_mac_address(bt); - memcpy(app->mac, mac_addr, BAD_BLE_MAC_ADDRESS_LEN); + const uint8_t* mac_addr = bt_get_profile_mac_address(bt); + memcpy(app->mac, mac_addr, BAD_BLE_MAC_ADDRESS_LEN); // Custom Widget app->widget = widget_alloc(); diff --git a/applications/main/bad_ble/bad_ble_app.h b/applications/main/bad_ble/bad_ble_app.h index 35da3ad2c..ff681e849 100644 --- a/applications/main/bad_ble/bad_ble_app.h +++ b/applications/main/bad_ble/bad_ble_app.h @@ -6,7 +6,7 @@ extern "C" { typedef struct BadBleApp BadBleApp; -void bad_ble_set_name(BadBleApp *app, const char* fmt, ...); +void bad_ble_set_name(BadBleApp* app, const char* fmt, ...); #ifdef __cplusplus } diff --git a/applications/main/bad_ble/bad_ble_app_i.h b/applications/main/bad_ble/bad_ble_app_i.h index 940706c85..fd2405c51 100644 --- a/applications/main/bad_ble/bad_ble_app_i.h +++ b/applications/main/bad_ble/bad_ble_app_i.h @@ -23,8 +23,8 @@ #define BAD_BLE_APP_SCRIPT_EXTENSION ".txt" #define BAD_BLE_APP_LAYOUT_EXTENSION ".kl" -#define BAD_BLE_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro -#define BAD_BLE_ADV_NAME_MAX_LEN 18 +#define BAD_BLE_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro +#define BAD_BLE_ADV_NAME_MAX_LEN 18 typedef enum { BadBleAppErrorNoFiles, @@ -40,12 +40,11 @@ struct BadBleApp { Widget* widget; Submenu* submenu; - TextInput *text_input; - ByteInput *byte_input; + TextInput* text_input; + ByteInput* byte_input; uint8_t mac[BAD_BLE_MAC_ADDRESS_LEN]; char name[BAD_BLE_ADV_NAME_MAX_LEN + 1]; - BadBleAppError error; FuriString* file_path; FuriString* keyboard_layout; diff --git a/applications/main/bad_ble/bad_ble_script.c b/applications/main/bad_ble/bad_ble_script.c index 73f4dd6c6..7a14c4498 100644 --- a/applications/main/bad_ble/bad_ble_script.c +++ b/applications/main/bad_ble/bad_ble_script.c @@ -30,7 +30,6 @@ typedef enum { WorkerEvtDisconnect = (1 << 3), } WorkerEvtFlags; - typedef enum { LevelRssi122_100, LevelRssi99_80, @@ -41,12 +40,15 @@ typedef enum { LevelRssiError = 0xFF, } LevelRssiRange; +/** + * Delays for waiting between HID key press and key release +*/ const uint8_t bt_hid_delays[LevelRssiNum] = { - 30, // LevelRssi122_100 - 25, // LevelRssi99_80 - 20, // LevelRssi79_60 - 17, // LevelRssi59_40 - 14, // LevelRssi39_0 + 30, // LevelRssi122_100 + 25, // LevelRssi99_80 + 20, // LevelRssi79_60 + 17, // LevelRssi59_40 + 14, // LevelRssi39_0 }; struct BadBleScript { @@ -161,31 +163,28 @@ static const uint8_t numpad_keys[10] = { uint8_t bt_timeout = 0; -static LevelRssiRange bt_remote_rssi_range(Bt *bt) { +static LevelRssiRange bt_remote_rssi_range(Bt* bt) { + BtRssi rssi_data = {0}; - BtRssi rssi_data = { 0 }; + if(!bt_remote_rssi(bt, &rssi_data)) return LevelRssiError; - if (!bt_remote_rssi(bt, &rssi_data)) - return LevelRssiError; - - if (rssi_data.rssi <= 39) + if(rssi_data.rssi <= 39) return LevelRssi39_0; - else if (rssi_data.rssi <= 59) + else if(rssi_data.rssi <= 59) return LevelRssi59_40; - else if (rssi_data.rssi <= 79) + else if(rssi_data.rssi <= 79) return LevelRssi79_60; - else if (rssi_data.rssi <= 99) + else if(rssi_data.rssi <= 99) return LevelRssi99_80; - else if (rssi_data.rssi <= 122) + else if(rssi_data.rssi <= 122) return LevelRssi122_100; - + return LevelRssiError; } -static inline void update_bt_timeout(Bt *bt) { - +static inline void update_bt_timeout(Bt* bt) { LevelRssiRange r = bt_remote_rssi_range(bt); - if (r < LevelRssiNum) { + if(r < LevelRssiNum) { bt_timeout = bt_hid_delays[r]; } } @@ -297,7 +296,7 @@ static bool ducky_string(BadBleScript* bad_ble, const char* param) { if(keycode != HID_KEYBOARD_NONE) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(keycode); - + furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(keycode); } @@ -330,8 +329,6 @@ static int32_t return SCRIPT_STATE_NEXT_LINE; // Skip empty lines } - FURI_LOG_D(WORKER_TAG, "line:%s", line_tmp); - // General commands if(strncmp(line_tmp, ducky_cmd_comment, strlen(ducky_cmd_comment)) == 0) { // REM - comment line @@ -426,7 +423,6 @@ static int32_t line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; key |= ducky_get_keycode(bad_ble, line_tmp, true); } - FURI_LOG_I(WORKER_TAG, "Special key pressed %x\r\n", key); furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); @@ -545,7 +541,7 @@ static void bad_ble_hid_state_callback(BtStatus status, void* context) { if(state == true) { LevelRssiRange r = bt_remote_rssi_range(bad_ble->bt); - if (r != LevelRssiError) { + if(r != LevelRssiError) { bt_timeout = bt_hid_delays[r]; } furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtConnect); @@ -559,9 +555,9 @@ static int32_t bad_ble_worker(void* context) { BadBleWorkerState worker_state = BadBleStateInit; int32_t delay_val = 0; + // BLE HID init bt_timeout = bt_hid_delays[LevelRssi39_0]; - // init ble hid bt_disconnect(bad_ble->bt); // Wait 2nd core to update nvm storage @@ -569,10 +565,6 @@ static int32_t bad_ble_worker(void* context) { bt_keys_storage_set_storage_path(bad_ble->bt, HID_BT_KEYS_STORAGE_PATH); - bt_set_profile_adv_name(bad_ble->bt, "Keyboard K99"); - - //furi_hal_bt_set_profile_adv_name("Keyboard K99", FuriHalBtProfileHidKeyboard); - if(!bt_set_profile(bad_ble->bt, BtProfileHidKeyboard)) { FURI_LOG_E(TAG, "Failed to switch to HID profile"); return -1; @@ -727,7 +719,7 @@ static int32_t bad_ble_worker(void* context) { } update_bt_timeout(bad_ble->bt); - FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); + FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } // release all keys diff --git a/applications/main/bad_ble/bad_ble_script.h b/applications/main/bad_ble/bad_ble_script.h index f1553e1db..5445c45ed 100644 --- a/applications/main/bad_ble/bad_ble_script.h +++ b/applications/main/bad_ble/bad_ble_script.h @@ -30,7 +30,7 @@ typedef struct { char error[64]; } BadBleState; -BadBleScript* bad_ble_script_open(FuriString* file_path, Bt *bt); +BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt); void bad_ble_script_close(BadBleScript* bad_ble); diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config.c b/applications/main/bad_ble/scenes/bad_ble_scene_config.c index b601a80af..0987b153b 100644 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config.c +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config.c @@ -52,9 +52,9 @@ bool bad_ble_scene_config_on_event(void* context, SceneManagerEvent event) { consumed = true; if(event.event == SubmenuIndexKeyboardLayout) { scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigLayout); - } else if (event.event == SubmenuIndexAdvertisementName) { + } else if(event.event == SubmenuIndexAdvertisementName) { scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigName); - } else if (event.event == SubmenuIndexMacAddress) { + } else if(event.event == SubmenuIndexMacAddress) { scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigMac); } else { furi_crash("Unknown key type"); diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c index 9fdeebe1b..ae9d16ba4 100644 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c +++ b/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c @@ -33,8 +33,7 @@ bool bad_ble_scene_config_name_on_event(void* context, SceneManagerEvent event) if(event.event == BadBleAppCustomEventTextEditResult) { bt_set_profile_adv_name(bad_ble->bt, bad_ble->name); } - scene_manager_previous_scene( - bad_ble->scene_manager); + scene_manager_previous_scene(bad_ble->scene_manager); } return consumed; } diff --git a/applications/main/gpio/scenes/gpio_scene_start.c b/applications/main/gpio/scenes/gpio_scene_start.c index c06d7b5c6..c43858a0a 100644 --- a/applications/main/gpio/scenes/gpio_scene_start.c +++ b/applications/main/gpio/scenes/gpio_scene_start.c @@ -38,8 +38,7 @@ static void gpio_scene_start_var_list_enter_callback(void* context, uint32_t ind } } -static void -gpio_scene_start_var_list_change_callback(VariableItem* item) { +static void gpio_scene_start_var_list_change_callback(VariableItem* item) { GpioApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); diff --git a/applications/plugins/dap_link/dap_link.c b/applications/plugins/dap_link/dap_link.c index c46c68788..dd684810a 100644 --- a/applications/plugins/dap_link/dap_link.c +++ b/applications/plugins/dap_link/dap_link.c @@ -486,8 +486,7 @@ int32_t dap_link_app(void* p) { if(furi_hal_usb_is_locked()) { DialogsApp* dialogs = furi_record_open(RECORD_DIALOGS); DialogMessage* message = dialog_message_alloc(); - dialog_message_set_header( - message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop); + dialog_message_set_header(message, "Connection\nis active!", 3, 2, AlignLeft, AlignTop); dialog_message_set_text( message, "Disconnect from\nPC or phone to\nuse this function.", diff --git a/applications/plugins/dice/dice.c b/applications/plugins/dice/dice.c index 61aa7b4f5..dc748b68f 100644 --- a/applications/plugins/dice/dice.c +++ b/applications/plugins/dice/dice.c @@ -467,7 +467,6 @@ int32_t dice_app(void* p) { return 255; } - ViewPort* view_port = view_port_alloc(); view_port_draw_callback_set(view_port, dice_render_callback, plugin_state); view_port_input_callback_set(view_port, dice_input_callback, plugin_state->event_queue); diff --git a/applications/plugins/orgasmotron/orgasmotron.c b/applications/plugins/orgasmotron/orgasmotron.c index b28f392f5..684fc3d95 100644 --- a/applications/plugins/orgasmotron/orgasmotron.c +++ b/applications/plugins/orgasmotron/orgasmotron.c @@ -40,7 +40,7 @@ int32_t orgasmotron_app(void* p) { PluginState* plugin_state = malloc(sizeof(PluginState)); ValueMutex state_mutex; - if (!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) { + if(!init_mutex(&state_mutex, plugin_state, sizeof(PluginState))) { FURI_LOG_E("Orgasmatron", "cannot create mutex\r\n"); free(plugin_state); return 255; @@ -61,10 +61,10 @@ int32_t orgasmotron_app(void* p) { //int mode = 0; bool processing = true; //while(furi_message_queue_get(event_queue, &event, FuriWaitForever) == FuriStatusOk) { - while (processing) { + while(processing) { FuriStatus event_status = furi_message_queue_get(event_queue, &event, 100); PluginState* plugin_state = (PluginState*)acquire_mutex_block(&state_mutex); - if (event_status == FuriStatusOk) { + if(event_status == FuriStatusOk) { if(event.key == InputKeyBack && event.type == InputTypeShort) { //Exit Application notification_message(notification, &sequence_reset_vibro); @@ -73,53 +73,58 @@ int32_t orgasmotron_app(void* p) { processing = false; //break; } - if(event.key == InputKeyOk && (event.type == InputTypePress || event.type == InputTypeRelease)) { + if(event.key == InputKeyOk && + (event.type == InputTypePress || event.type == InputTypeRelease)) { plugin_state->mode = 0; } - if(event.key == InputKeyLeft && (event.type == InputTypePress || event.type == InputTypeRelease)) { + if(event.key == InputKeyLeft && + (event.type == InputTypePress || event.type == InputTypeRelease)) { plugin_state->mode = 1; } - if(event.key == InputKeyRight && (event.type == InputTypePress || event.type == InputTypeRelease)) { + if(event.key == InputKeyRight && + (event.type == InputTypePress || event.type == InputTypeRelease)) { plugin_state->mode = 3; } - if(event.key == InputKeyUp && (event.type == InputTypePress || event.type == InputTypeRelease)) { + if(event.key == InputKeyUp && + (event.type == InputTypePress || event.type == InputTypeRelease)) { plugin_state->mode = 2; } - if(event.key == InputKeyDown && (event.type == InputTypePress || event.type == InputTypeRelease)) { + if(event.key == InputKeyDown && + (event.type == InputTypePress || event.type == InputTypeRelease)) { plugin_state->mode = 4; } } - - if (plugin_state->mode == 0) { + + if(plugin_state->mode == 0) { //Stop Vibration notification_message(notification, &sequence_reset_vibro); notification_message(notification, &sequence_reset_green); - } else if (plugin_state->mode == 1) { + } else if(plugin_state->mode == 1) { //Full power notification_message(notification, &sequence_set_vibro_on); notification_message(notification, &sequence_set_green_255); - } else if (plugin_state->mode == 2) { + } else if(plugin_state->mode == 2) { //Pulsed Vibration notification_message(notification, &sequence_set_vibro_on); notification_message(notification, &sequence_set_green_255); delay(100); notification_message(notification, &sequence_reset_vibro); - } else if (plugin_state->mode == 3) { + } else if(plugin_state->mode == 3) { //Soft power notification_message(notification, &sequence_set_vibro_on); notification_message(notification, &sequence_set_green_255); delay(50); notification_message(notification, &sequence_reset_vibro); - } else if (plugin_state->mode == 4) { + } else if(plugin_state->mode == 4) { //Special Sequence - for (int i = 0;i < 15;i++) { + for(int i = 0; i < 15; i++) { notification_message(notification, &sequence_set_vibro_on); notification_message(notification, &sequence_set_green_255); delay(50); notification_message(notification, &sequence_reset_vibro); delay(50); } - for (int i = 0;i < 2;i++) { + for(int i = 0; i < 2; i++) { notification_message(notification, &sequence_set_vibro_on); notification_message(notification, &sequence_set_green_255); delay(400); diff --git a/applications/plugins/protoview/app.c b/applications/plugins/protoview/app.c index f16457e55..d060e2242 100644 --- a/applications/plugins/protoview/app.c +++ b/applications/plugins/protoview/app.c @@ -40,8 +40,8 @@ extern const SubGhzProtocolRegistry protoview_protocol_registry; /* The callback actually just passes the control to the actual active * view callback, after setting up basic stuff like cleaning the screen * and setting color to black. */ -static void render_callback(Canvas *const canvas, void *ctx) { - ProtoViewApp *app = ctx; +static void render_callback(Canvas* const canvas, void* ctx) { + ProtoViewApp* app = ctx; /* Clear screen. */ canvas_set_color(canvas, ColorWhite); @@ -51,14 +51,25 @@ static void render_callback(Canvas *const canvas, void *ctx) { /* Call who is in charge right now. */ switch(app->current_view) { - case ViewRawPulses: render_view_raw_pulses(canvas,app); break; - case ViewInfo: render_view_info(canvas,app); break; + case ViewRawPulses: + render_view_raw_pulses(canvas, app); + break; + case ViewInfo: + render_view_info(canvas, app); + break; case ViewFrequencySettings: case ViewModulationSettings: - render_view_settings(canvas,app); break; - case ViewDirectSampling: render_view_direct_sampling(canvas,app); break; - case ViewBuildMessage: render_view_build_message(canvas,app); break; - default: furi_crash(TAG "Invalid view selected"); break; + render_view_settings(canvas, app); + break; + case ViewDirectSampling: + render_view_direct_sampling(canvas, app); + break; + case ViewBuildMessage: + render_view_build_message(canvas, app); + break; + default: + furi_crash(TAG "Invalid view selected"); + break; } /* Draw the alert box if set. */ @@ -67,10 +78,9 @@ static void render_callback(Canvas *const canvas, void *ctx) { /* Here all we do is putting the events into the queue that will be handled * in the while() loop of the app entry point function. */ -static void input_callback(InputEvent* input_event, void* ctx) -{ - ProtoViewApp *app = ctx; - furi_message_queue_put(app->event_queue,input_event,FuriWaitForever); +static void input_callback(InputEvent* input_event, void* ctx) { + ProtoViewApp* app = ctx; + furi_message_queue_put(app->event_queue, input_event, FuriWaitForever); } /* Called to switch view (when left/right is pressed). Handles @@ -80,15 +90,15 @@ static void input_callback(InputEvent* input_event, void* ctx) * The 'switchto' parameter can be the identifier of a view, or the * special views ViewGoNext and ViewGoPrev in order to move to * the logical next/prev view. */ -static void app_switch_view(ProtoViewApp *app, ProtoViewCurrentView switchto) { +static void app_switch_view(ProtoViewApp* app, ProtoViewCurrentView switchto) { /* Switch to the specified view. */ ProtoViewCurrentView old = app->current_view; - if (switchto == ViewGoNext) { + if(switchto == ViewGoNext) { app->current_view++; - if (app->current_view == ViewLast) app->current_view = 0; - } else if (switchto == ViewGoPrev) { - if (app->current_view == 0) - app->current_view = ViewLast-1; + if(app->current_view == ViewLast) app->current_view = 0; + } else if(switchto == ViewGoPrev) { + if(app->current_view == 0) + app->current_view = ViewLast - 1; else app->current_view--; } else { @@ -103,20 +113,20 @@ static void app_switch_view(ProtoViewApp *app, ProtoViewCurrentView switchto) { /* Reset the view private data each time, before calling the enter/exit * callbacks that may want to setup some state. */ - memset(app->view_privdata,0,PROTOVIEW_VIEW_PRIVDATA_LEN); + memset(app->view_privdata, 0, PROTOVIEW_VIEW_PRIVDATA_LEN); /* Call the enter/exit view callbacks if needed. */ - if (old == ViewDirectSampling) view_exit_direct_sampling(app); - if (new == ViewDirectSampling) view_enter_direct_sampling(app); - if (old == ViewBuildMessage) view_exit_build_message(app); - if (new == ViewBuildMessage) view_enter_build_message(app); - if (old == ViewInfo) view_exit_info(app); + if(old == ViewDirectSampling) view_exit_direct_sampling(app); + if(new == ViewDirectSampling) view_enter_direct_sampling(app); + if(old == ViewBuildMessage) view_exit_build_message(app); + if(new == ViewBuildMessage) view_enter_build_message(app); + if(old == ViewInfo) view_exit_info(app); /* The frequency/modulation settings are actually a single view: * as long as the user stays between the two modes of this view we * don't need to call the exit-view callback. */ - if ((old == ViewFrequencySettings && new != ViewModulationSettings) || - (old == ViewModulationSettings && new != ViewFrequencySettings)) + if((old == ViewFrequencySettings && new != ViewModulationSettings) || + (old == ViewModulationSettings && new != ViewFrequencySettings)) view_exit_settings(app); ui_dismiss_alert(app); @@ -125,7 +135,7 @@ static void app_switch_view(ProtoViewApp *app, ProtoViewCurrentView switchto) { /* Allocate the application state and initialize a number of stuff. * This is called in the entry point to create the application state. */ ProtoViewApp* protoview_app_alloc() { - ProtoViewApp *app = malloc(sizeof(ProtoViewApp)); + ProtoViewApp* app = malloc(sizeof(ProtoViewApp)); // Init shared data structures RawSamples = raw_samples_alloc(); @@ -148,10 +158,10 @@ ProtoViewApp* protoview_app_alloc() { app->show_text_input = false; app->alert_dismiss_time = 0; app->current_view = ViewRawPulses; - for (int j = 0; j < ViewLast; j++) app->current_subview[j] = 0; + for(int j = 0; j < ViewLast; j++) app->current_subview[j] = 0; app->direct_sampling_enabled = false; app->view_privdata = malloc(PROTOVIEW_VIEW_PRIVDATA_LEN); - memset(app->view_privdata,0,PROTOVIEW_VIEW_PRIVDATA_LEN); + memset(app->view_privdata, 0, PROTOVIEW_VIEW_PRIVDATA_LEN); // Signal found and visualization defaults app->signal_bestlen = 0; @@ -176,17 +186,14 @@ ProtoViewApp* protoview_app_alloc() { app->txrx->environment = subghz_environment_alloc(); subghz_environment_set_protocol_registry( app->txrx->environment, (void*)&protoview_protocol_registry); - app->txrx->receiver = - subghz_receiver_alloc_init(app->txrx->environment); - subghz_receiver_set_filter(app->txrx->receiver, - SubGhzProtocolFlag_Decodable); + app->txrx->receiver = subghz_receiver_alloc_init(app->txrx->environment); + subghz_receiver_set_filter(app->txrx->receiver, SubGhzProtocolFlag_Decodable); subghz_worker_set_overrun_callback( - app->txrx->worker, - (SubGhzWorkerOverrunCallback)subghz_receiver_reset); + app->txrx->worker, (SubGhzWorkerOverrunCallback)subghz_receiver_reset); subghz_worker_set_pair_callback( app->txrx->worker, (SubGhzWorkerPairCallback)subghz_receiver_decode); subghz_worker_set_context(app->txrx->worker, app->txrx->receiver); - + app->frequency = subghz_setting_get_default_frequency(app->setting); app->modulation = 0; /* Defaults to ProtoViewModulations[0]. */ @@ -199,7 +206,7 @@ ProtoViewApp* protoview_app_alloc() { /* Free what the application allocated. It is not clear to me if the * Flipper OS, once the application exits, will be able to reclaim space * even if we forget to free something here. */ -void protoview_app_free(ProtoViewApp *app) { +void protoview_app_free(ProtoViewApp* app) { furi_assert(app); // Put CC1101 on sleep, this also restores charging. @@ -218,7 +225,7 @@ void protoview_app_free(ProtoViewApp *app) { subghz_setting_free(app->setting); // Worker stuff. - if (!app->txrx->debug_timer_sampling) { + if(!app->txrx->debug_timer_sampling) { subghz_receiver_free(app->txrx->receiver); subghz_environment_free(app->txrx->environment); subghz_worker_free(app->txrx->worker); @@ -236,8 +243,8 @@ void protoview_app_free(ProtoViewApp *app) { /* Called periodically. Do signal processing here. Data we process here * will be later displayed by the render callback. The side effect of this * function is to scan for signals and set DetectedSamples. */ -static void timer_callback(void *ctx) { - ProtoViewApp *app = ctx; +static void timer_callback(void* ctx) { + ProtoViewApp* app = ctx; uint32_t delta, lastidx = app->signal_last_scan_idx; /* scan_for_signal(), called by this function, deals with a @@ -245,14 +252,14 @@ static void timer_callback(void *ctx) { * cross-boundaries, it is enough if we scan each time the buffer fills * for 50% more compared to the last scan. Thanks to this check we * can avoid scanning too many times to just find the same data. */ - if (lastidx < RawSamples->idx) { + if(lastidx < RawSamples->idx) { delta = RawSamples->idx - lastidx; } else { delta = RawSamples->total - lastidx + RawSamples->idx; } - if (delta < RawSamples->total/2) return; + if(delta < RawSamples->total / 2) return; app->signal_last_scan_idx = RawSamples->idx; - scan_for_signal(app,RawSamples); + scan_for_signal(app, RawSamples); } /* This is the navigation callback we use in the view dispatcher used @@ -265,7 +272,7 @@ static void timer_callback(void *ctx) { * We just need a dummy callback returning false. We believe the * implementation should be changed and if no callback is set, it should be * the same as returning false. */ -static bool keyboard_view_dispatcher_navigation_callback(void *ctx) { +static bool keyboard_view_dispatcher_navigation_callback(void* ctx) { UNUSED(ctx); return false; } @@ -273,10 +280,10 @@ static bool keyboard_view_dispatcher_navigation_callback(void *ctx) { /* App entry point, as specified in application.fam. */ int32_t protoview_app_entry(void* p) { UNUSED(p); - ProtoViewApp *app = protoview_app_alloc(); + ProtoViewApp* app = protoview_app_alloc(); /* Create a timer. We do data analysis in the callback. */ - FuriTimer *timer = furi_timer_alloc(timer_callback, FuriTimerTypePeriodic, app); + FuriTimer* timer = furi_timer_alloc(timer_callback, FuriTimerTypePeriodic, app); furi_timer_start(timer, furi_kernel_get_tick_frequency() / 8); /* Start listening to signals immediately. */ @@ -291,71 +298,68 @@ int32_t protoview_app_entry(void* p) { InputEvent input; while(app->running) { FuriStatus qstat = furi_message_queue_get(app->event_queue, &input, 100); - if (qstat == FuriStatusOk) { - if (DEBUG_MSG) FURI_LOG_E(TAG, "Main Loop - Input: type %d key %u", - input.type, input.key); + if(qstat == FuriStatusOk) { + if(DEBUG_MSG) + FURI_LOG_E(TAG, "Main Loop - Input: type %d key %u", input.type, input.key); /* Handle navigation here. Then handle view-specific inputs * in the view specific handling function. */ - if (input.type == InputTypeShort && - input.key == InputKeyBack) - { - if (app->current_view != ViewRawPulses) { + if(input.type == InputTypeShort && input.key == InputKeyBack) { + if(app->current_view != ViewRawPulses) { /* If this is not the main app view, go there. */ - app_switch_view(app,ViewRawPulses); + app_switch_view(app, ViewRawPulses); } else { /* If we are in the main app view, warn the user * they needs to long press to really quit. */ - ui_show_alert(app,"Long press to exit",1000); + ui_show_alert(app, "Long press to exit", 1000); } - } else if (input.type == InputTypeLong && - input.key == InputKeyBack) - { + } else if(input.type == InputTypeLong && input.key == InputKeyBack) { app->running = 0; - } else if (input.type == InputTypeShort && - input.key == InputKeyRight && - ui_get_current_subview(app) == 0) - { + } else if( + input.type == InputTypeShort && input.key == InputKeyRight && + ui_get_current_subview(app) == 0) { /* Go to the next view. */ - app_switch_view(app,ViewGoNext); - } else if (input.type == InputTypeShort && - input.key == InputKeyLeft && - ui_get_current_subview(app) == 0) - { + app_switch_view(app, ViewGoNext); + } else if( + input.type == InputTypeShort && input.key == InputKeyLeft && + ui_get_current_subview(app) == 0) { /* Go to the previous view. */ - app_switch_view(app,ViewGoPrev); + app_switch_view(app, ViewGoPrev); } else { /* This is where we pass the control to the currently * active view input processing. */ switch(app->current_view) { case ViewRawPulses: - process_input_raw_pulses(app,input); + process_input_raw_pulses(app, input); break; case ViewInfo: - process_input_info(app,input); + process_input_info(app, input); break; case ViewFrequencySettings: case ViewModulationSettings: - process_input_settings(app,input); + process_input_settings(app, input); break; case ViewDirectSampling: - process_input_direct_sampling(app,input); + process_input_direct_sampling(app, input); break; case ViewBuildMessage: - process_input_build_message(app,input); + process_input_build_message(app, input); + break; + default: + furi_crash(TAG "Invalid view selected"); break; - default: furi_crash(TAG "Invalid view selected"); break; } } } else { /* Useful to understand if the app is still alive when it * does not respond because of bugs. */ - if (DEBUG_MSG) { - static int c = 0; c++; - if (!(c % 20)) FURI_LOG_E(TAG, "Loop timeout"); + if(DEBUG_MSG) { + static int c = 0; + c++; + if(!(c % 20)) FURI_LOG_E(TAG, "Loop timeout"); } } - if (app->show_text_input) { + if(app->show_text_input) { /* Remove our viewport: we need to use a view dispatcher * in order to show the standard Flipper keyboard. */ gui_remove_view_port(app->gui, app->view_port); @@ -368,11 +372,11 @@ int32_t protoview_app_entry(void* p) { * otherwise when the user presses back on the keyboard to * abort, the dispatcher will not stop. */ view_dispatcher_set_navigation_event_callback( - app->view_dispatcher, - keyboard_view_dispatcher_navigation_callback); + app->view_dispatcher, keyboard_view_dispatcher_navigation_callback); app->text_input = text_input_alloc(); - view_dispatcher_set_event_callback_context(app->view_dispatcher,app); - view_dispatcher_add_view(app->view_dispatcher, 0, text_input_get_view(app->text_input)); + view_dispatcher_set_event_callback_context(app->view_dispatcher, app); + view_dispatcher_add_view( + app->view_dispatcher, 0, text_input_get_view(app->text_input)); view_dispatcher_switch_to_view(app->view_dispatcher, 0); /* Setup the text input view. The different parameters are set @@ -388,7 +392,8 @@ int32_t protoview_app_entry(void* p) { false); /* Run the dispatcher with the keyboard. */ - view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); + view_dispatcher_attach_to_gui( + app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); view_dispatcher_run(app->view_dispatcher); /* Undo all it: remove the view from the dispatcher, free it @@ -406,7 +411,7 @@ int32_t protoview_app_entry(void* p) { } /* App no longer running. Shut down and free. */ - if (app->txrx->txrx_state == TxRxStateRx) { + if(app->txrx->txrx_state == TxRxStateRx) { FURI_LOG_E(TAG, "Putting CC1101 to sleep before exiting."); radio_rx_end(app); radio_sleep(app); @@ -416,4 +421,3 @@ int32_t protoview_app_entry(void* p) { protoview_app_free(app); return 0; } - diff --git a/applications/plugins/protoview/app.h b/applications/plugins/protoview/app.h index 33bd85eb4..85007e345 100644 --- a/applications/plugins/protoview/app.h +++ b/applications/plugins/protoview/app.h @@ -66,11 +66,11 @@ typedef enum { /* ================================== RX/TX ================================= */ typedef struct { - const char *name; // Name to show to the user. - const char *id; // Identifier in the Flipper API/file. - FuriHalSubGhzPreset preset; // The preset ID. - uint8_t *custom; // If not null, a set of registers for - // the CC1101, specifying a custom preset. + const char* name; // Name to show to the user. + const char* id; // Identifier in the Flipper API/file. + FuriHalSubGhzPreset preset; // The preset ID. + uint8_t* custom; // If not null, a set of registers for + // the CC1101, specifying a custom preset. } ProtoViewModulation; extern ProtoViewModulation ProtoViewModulations[]; /* In app_subghz.c */ @@ -79,19 +79,19 @@ extern ProtoViewModulation ProtoViewModulations[]; /* In app_subghz.c */ * It receives data and we get our protocol "feed" callback called * with the level (1 or 0) and duration. */ struct ProtoViewTxRx { - bool freq_mod_changed; /* The user changed frequency and/or modulation + bool freq_mod_changed; /* The user changed frequency and/or modulation from the interface. There is to restart the radio with the right parameters. */ - SubGhzWorker* worker; /* Our background worker. */ + SubGhzWorker* worker; /* Our background worker. */ SubGhzEnvironment* environment; SubGhzReceiver* receiver; TxRxState txrx_state; /* Receiving, idle or sleeping? */ /* Timer sampling mode state. */ - bool debug_timer_sampling; /* Read data from GDO0 in a busy loop. Only + bool debug_timer_sampling; /* Read data from GDO0 in a busy loop. Only for testing. */ uint32_t last_g0_change_time; /* Last high->low (or reverse) switch. */ - bool last_g0_value; /* Current value (high or low): we are + bool last_g0_value; /* Current value (high or low): we are checking the duration in the timer handler. */ }; @@ -103,44 +103,44 @@ typedef struct ProtoViewTxRx ProtoViewTxRx; #define ALERT_MAX_LEN 32 struct ProtoViewApp { /* GUI */ - Gui *gui; - NotificationApp *notification; - ViewPort *view_port; /* We just use a raw viewport and we render + Gui* gui; + NotificationApp* notification; + ViewPort* view_port; /* We just use a raw viewport and we render everything into the low level canvas. */ - ProtoViewCurrentView current_view; /* Active left-right view ID. */ - int current_subview[ViewLast]; /* Active up-down subview ID. */ - FuriMessageQueue *event_queue; /* Keypress events go here. */ + ProtoViewCurrentView current_view; /* Active left-right view ID. */ + int current_subview[ViewLast]; /* Active up-down subview ID. */ + FuriMessageQueue* event_queue; /* Keypress events go here. */ /* Input text state. */ - ViewDispatcher *view_dispatcher; /* Used only when we want to show + ViewDispatcher* view_dispatcher; /* Used only when we want to show the text_input view for a moment. Otherwise it is set to null. */ - TextInput *text_input; + TextInput* text_input; bool show_text_input; - char *text_input_buffer; + char* text_input_buffer; uint32_t text_input_buffer_len; void (*text_input_done_callback)(void*); /* Alert state. */ - uint32_t alert_dismiss_time; /* Millisecond when the alert will be + uint32_t alert_dismiss_time; /* Millisecond when the alert will be no longer shown. Or zero if the alert is currently not set at all. */ char alert_text[ALERT_MAX_LEN]; /* Alert content. */ /* Radio related. */ - ProtoViewTxRx *txrx; /* Radio state. */ - SubGhzSetting *setting; /* A list of valid frequencies. */ + ProtoViewTxRx* txrx; /* Radio state. */ + SubGhzSetting* setting; /* A list of valid frequencies. */ /* Generic app state. */ - int running; /* Once false exists the app. */ + int running; /* Once false exists the app. */ uint32_t signal_bestlen; /* Longest coherent signal observed so far. */ uint32_t signal_last_scan_idx; /* Index of the buffer last time we performed the scan. */ - bool signal_decoded; /* Was the current signal decoded? */ - ProtoViewMsgInfo *msg_info; /* Decoded message info if not NULL. */ + bool signal_decoded; /* Was the current signal decoded? */ + ProtoViewMsgInfo* msg_info; /* Decoded message info if not NULL. */ bool direct_sampling_enabled; /* This special view needs an explicit acknowledge to work. */ - void *view_privdata; /* This is a piece of memory of total size + void* view_privdata; /* This is a piece of memory of total size PROTOVIEW_VIEW_PRIVDATA_LEN that it is initialized to zero when we switch to a a new view. While the view we are using @@ -149,12 +149,12 @@ struct ProtoViewApp { the pointer to a few specific-data structure. */ /* Raw view apps state. */ - uint32_t us_scale; /* microseconds per pixel. */ - uint32_t signal_offset; /* Long press left/right panning in raw view. */ + uint32_t us_scale; /* microseconds per pixel. */ + uint32_t signal_offset; /* Long press left/right panning in raw view. */ /* Configuration view app state. */ - uint32_t frequency; /* Current frequency. */ - uint8_t modulation; /* Current modulation ID, array index in the + uint32_t frequency; /* Current frequency. */ + uint8_t modulation; /* Current modulation ID, array index in the ProtoViewModulations table. */ }; @@ -165,18 +165,18 @@ struct ProtoViewApp { * in the message info view. */ #define PROTOVIEW_MSG_STR_LEN 32 typedef struct ProtoViewMsgInfo { - ProtoViewDecoder *decoder; /* The decoder that decoded the message. */ - ProtoViewFieldSet *fieldset; /* Decoded fields. */ + ProtoViewDecoder* decoder; /* The decoder that decoded the message. */ + ProtoViewFieldSet* fieldset; /* Decoded fields. */ /* Low level information of the detected signal: the following are filled * by the protocol decoding function: */ - uint32_t start_off; /* Pulses start offset in the bitmap. */ - uint32_t pulses_count; /* Number of pulses of the full message. */ + uint32_t start_off; /* Pulses start offset in the bitmap. */ + uint32_t pulses_count; /* Number of pulses of the full message. */ /* The following are passed already filled to the decoder. */ - uint32_t short_pulse_dur; /* Microseconds duration of the short pulse. */ + uint32_t short_pulse_dur; /* Microseconds duration of the short pulse. */ /* The following are filled by ProtoView core after the decoder returned * success. */ - uint8_t *bits; /* Bitmap with the signal. */ - uint32_t bits_bytes; /* Number of full bytes in the bitmap, that + uint8_t* bits; /* Bitmap with the signal. */ + uint32_t bits_bytes; /* Number of full bytes in the bitmap, that is 'pulses_count/8' rounded to the next integer. */ } ProtoViewMsgInfo; @@ -196,28 +196,28 @@ typedef enum { typedef struct { ProtoViewFieldType type; - uint32_t len; // Depends on type: - // Bits for integers (signed,unsigned,binary,hex). - // Number of characters for strings. - // Number of nibbles for bytes (1 for each 4 bits). - // Number of digits after dot for floats. - char *name; // Field name. + uint32_t len; // Depends on type: + // Bits for integers (signed,unsigned,binary,hex). + // Number of characters for strings. + // Number of nibbles for bytes (1 for each 4 bits). + // Number of digits after dot for floats. + char* name; // Field name. union { - char *str; // String type. - int64_t value; // Signed integer type. - uint64_t uvalue; // Unsigned integer type. - uint8_t *bytes; // Raw bytes type. - float fvalue; // Float type. + char* str; // String type. + int64_t value; // Signed integer type. + uint64_t uvalue; // Unsigned integer type. + uint8_t* bytes; // Raw bytes type. + float fvalue; // Float type. }; } ProtoViewField; typedef struct ProtoViewFieldSet { - ProtoViewField **fields; + ProtoViewField** fields; uint32_t numfields; } ProtoViewFieldSet; typedef struct ProtoViewDecoder { - const char *name; /* Protocol name. */ + const char* name; /* Protocol name. */ /* The decode function takes a buffer that is actually a bitmap, with * high and low levels represented as 0 and 1. The number of high/low * pulses represented by the bitmap is passed as the 'numbits' argument, @@ -225,15 +225,15 @@ typedef struct ProtoViewDecoder { * 'bits'. So 'numbytes' is mainly useful to pass as argument to other * functions that perform bit extraction with bound checking, such as * bitmap_get() and so forth. */ - bool (*decode)(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info); + bool (*decode)(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info); /* This method is used by the decoder to return the fields it needs * in order to build a new message. This way the message builder view * can ask the user to fill the right set of fields of the specified * type. */ - void (*get_fields)(ProtoViewFieldSet *fields); + void (*get_fields)(ProtoViewFieldSet* fields); /* This method takes the fields supported by the decoder, and * renders a message in 'samples'. */ - void (*build_message)(RawSamplesBuffer *samples, ProtoViewFieldSet *fields); + void (*build_message)(RawSamplesBuffer* samples, ProtoViewFieldSet* fields); } ProtoViewDecoder; extern RawSamplesBuffer *RawSamples, *DetectedSamples; @@ -244,76 +244,118 @@ uint32_t radio_rx(ProtoViewApp* app); void radio_idle(ProtoViewApp* app); void radio_rx_end(ProtoViewApp* app); void radio_sleep(ProtoViewApp* app); -void raw_sampling_worker_start(ProtoViewApp *app); -void raw_sampling_worker_stop(ProtoViewApp *app); -void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder, void *ctx); +void raw_sampling_worker_start(ProtoViewApp* app); +void raw_sampling_worker_stop(ProtoViewApp* app); +void radio_tx_signal(ProtoViewApp* app, FuriHalSubGhzAsyncTxCallback data_feeder, void* ctx); /* signal.c */ uint32_t duration_delta(uint32_t a, uint32_t b); -void reset_current_signal(ProtoViewApp *app); -void scan_for_signal(ProtoViewApp *app,RawSamplesBuffer *source); -bool bitmap_get(uint8_t *b, uint32_t blen, uint32_t bitpos); -void bitmap_set(uint8_t *b, uint32_t blen, uint32_t bitpos, bool val); -void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, uint8_t *s, uint32_t slen, uint32_t soff, uint32_t count); -void bitmap_set_pattern(uint8_t *b, uint32_t blen, uint32_t off, const char *pat); -void bitmap_reverse_bytes_bits(uint8_t *p, uint32_t len); -bool bitmap_match_bits(uint8_t *b, uint32_t blen, uint32_t bitpos, const char *bits); -uint32_t bitmap_seek_bits(uint8_t *b, uint32_t blen, uint32_t startpos, uint32_t maxbits, const char *bits); -uint32_t convert_from_line_code(uint8_t *buf, uint64_t buflen, uint8_t *bits, uint32_t len, uint32_t offset, const char *zero_pattern, const char *one_pattern); -uint32_t convert_from_diff_manchester(uint8_t *buf, uint64_t buflen, uint8_t *bits, uint32_t len, uint32_t off, bool previous); -void init_msg_info(ProtoViewMsgInfo *i, ProtoViewApp *app); -void free_msg_info(ProtoViewMsgInfo *i); +void reset_current_signal(ProtoViewApp* app); +void scan_for_signal(ProtoViewApp* app, RawSamplesBuffer* source); +bool bitmap_get(uint8_t* b, uint32_t blen, uint32_t bitpos); +void bitmap_set(uint8_t* b, uint32_t blen, uint32_t bitpos, bool val); +void bitmap_copy( + uint8_t* d, + uint32_t dlen, + uint32_t doff, + uint8_t* s, + uint32_t slen, + uint32_t soff, + uint32_t count); +void bitmap_set_pattern(uint8_t* b, uint32_t blen, uint32_t off, const char* pat); +void bitmap_reverse_bytes_bits(uint8_t* p, uint32_t len); +bool bitmap_match_bits(uint8_t* b, uint32_t blen, uint32_t bitpos, const char* bits); +uint32_t bitmap_seek_bits( + uint8_t* b, + uint32_t blen, + uint32_t startpos, + uint32_t maxbits, + const char* bits); +uint32_t convert_from_line_code( + uint8_t* buf, + uint64_t buflen, + uint8_t* bits, + uint32_t len, + uint32_t offset, + const char* zero_pattern, + const char* one_pattern); +uint32_t convert_from_diff_manchester( + uint8_t* buf, + uint64_t buflen, + uint8_t* bits, + uint32_t len, + uint32_t off, + bool previous); +void init_msg_info(ProtoViewMsgInfo* i, ProtoViewApp* app); +void free_msg_info(ProtoViewMsgInfo* i); /* signal_file.c */ -bool save_signal(ProtoViewApp *app, const char *filename); +bool save_signal(ProtoViewApp* app, const char* filename); /* view_*.c */ -void render_view_raw_pulses(Canvas *const canvas, ProtoViewApp *app); -void process_input_raw_pulses(ProtoViewApp *app, InputEvent input); -void render_view_settings(Canvas *const canvas, ProtoViewApp *app); -void process_input_settings(ProtoViewApp *app, InputEvent input); -void render_view_info(Canvas *const canvas, ProtoViewApp *app); -void process_input_info(ProtoViewApp *app, InputEvent input); -void render_view_direct_sampling(Canvas *const canvas, ProtoViewApp *app); -void process_input_direct_sampling(ProtoViewApp *app, InputEvent input); -void render_view_build_message(Canvas *const canvas, ProtoViewApp *app); -void process_input_build_message(ProtoViewApp *app, InputEvent input); -void view_enter_build_message(ProtoViewApp *app); -void view_exit_build_message(ProtoViewApp *app); -void view_enter_direct_sampling(ProtoViewApp *app); -void view_exit_direct_sampling(ProtoViewApp *app); -void view_exit_settings(ProtoViewApp *app); -void view_exit_info(ProtoViewApp *app); -void adjust_raw_view_scale(ProtoViewApp *app, uint32_t short_pulse_dur); +void render_view_raw_pulses(Canvas* const canvas, ProtoViewApp* app); +void process_input_raw_pulses(ProtoViewApp* app, InputEvent input); +void render_view_settings(Canvas* const canvas, ProtoViewApp* app); +void process_input_settings(ProtoViewApp* app, InputEvent input); +void render_view_info(Canvas* const canvas, ProtoViewApp* app); +void process_input_info(ProtoViewApp* app, InputEvent input); +void render_view_direct_sampling(Canvas* const canvas, ProtoViewApp* app); +void process_input_direct_sampling(ProtoViewApp* app, InputEvent input); +void render_view_build_message(Canvas* const canvas, ProtoViewApp* app); +void process_input_build_message(ProtoViewApp* app, InputEvent input); +void view_enter_build_message(ProtoViewApp* app); +void view_exit_build_message(ProtoViewApp* app); +void view_enter_direct_sampling(ProtoViewApp* app); +void view_exit_direct_sampling(ProtoViewApp* app); +void view_exit_settings(ProtoViewApp* app); +void view_exit_info(ProtoViewApp* app); +void adjust_raw_view_scale(ProtoViewApp* app, uint32_t short_pulse_dur); /* ui.c */ -int ui_get_current_subview(ProtoViewApp *app); -void ui_show_available_subviews(Canvas *canvas, ProtoViewApp *app, int last_subview); -bool ui_process_subview_updown(ProtoViewApp *app, InputEvent input, int last_subview); -void ui_show_keyboard(ProtoViewApp *app, char *buffer, uint32_t buflen, - void (*done_callback)(void*)); -void ui_dismiss_keyboard(ProtoViewApp *app); -void ui_show_alert(ProtoViewApp *app, const char *text, uint32_t ttl); -void ui_dismiss_alert(ProtoViewApp *app); -void ui_draw_alert_if_needed(Canvas *canvas, ProtoViewApp *app); -void canvas_draw_str_with_border(Canvas* canvas, uint8_t x, uint8_t y, const char* str, Color text_color, Color border_color); +int ui_get_current_subview(ProtoViewApp* app); +void ui_show_available_subviews(Canvas* canvas, ProtoViewApp* app, int last_subview); +bool ui_process_subview_updown(ProtoViewApp* app, InputEvent input, int last_subview); +void ui_show_keyboard( + ProtoViewApp* app, + char* buffer, + uint32_t buflen, + void (*done_callback)(void*)); +void ui_dismiss_keyboard(ProtoViewApp* app); +void ui_show_alert(ProtoViewApp* app, const char* text, uint32_t ttl); +void ui_dismiss_alert(ProtoViewApp* app); +void ui_draw_alert_if_needed(Canvas* canvas, ProtoViewApp* app); +void canvas_draw_str_with_border( + Canvas* canvas, + uint8_t x, + uint8_t y, + const char* str, + Color text_color, + Color border_color); /* fields.c */ -void fieldset_free(ProtoViewFieldSet *fs); -ProtoViewFieldSet *fieldset_new(void); -void fieldset_add_int(ProtoViewFieldSet *fs, const char *name, int64_t val, uint8_t bits); -void fieldset_add_uint(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits); -void fieldset_add_hex(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits); -void fieldset_add_bin(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits); -void fieldset_add_str(ProtoViewFieldSet *fs, const char *name, const char *s); -void fieldset_add_bytes(ProtoViewFieldSet *fs, const char *name, const uint8_t *bytes, uint32_t count); -void fieldset_add_float(ProtoViewFieldSet *fs, const char *name, float val, uint32_t digits_after_dot); -const char *field_get_type_name(ProtoViewField *f); -int field_to_string(char *buf, size_t len, ProtoViewField *f); -bool field_set_from_string(ProtoViewField *f, char *buf, size_t len); -bool field_incr_value(ProtoViewField *f, int incr); -void fieldset_copy_matching_fields(ProtoViewFieldSet *dst, ProtoViewFieldSet *src); -void field_set_from_field(ProtoViewField *dst, ProtoViewField *src); +void fieldset_free(ProtoViewFieldSet* fs); +ProtoViewFieldSet* fieldset_new(void); +void fieldset_add_int(ProtoViewFieldSet* fs, const char* name, int64_t val, uint8_t bits); +void fieldset_add_uint(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits); +void fieldset_add_hex(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits); +void fieldset_add_bin(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits); +void fieldset_add_str(ProtoViewFieldSet* fs, const char* name, const char* s); +void fieldset_add_bytes( + ProtoViewFieldSet* fs, + const char* name, + const uint8_t* bytes, + uint32_t count); +void fieldset_add_float( + ProtoViewFieldSet* fs, + const char* name, + float val, + uint32_t digits_after_dot); +const char* field_get_type_name(ProtoViewField* f); +int field_to_string(char* buf, size_t len, ProtoViewField* f); +bool field_set_from_string(ProtoViewField* f, char* buf, size_t len); +bool field_incr_value(ProtoViewField* f, int incr); +void fieldset_copy_matching_fields(ProtoViewFieldSet* dst, ProtoViewFieldSet* src); +void field_set_from_field(ProtoViewField* dst, ProtoViewField* src); /* crc.c */ -uint8_t crc8(const uint8_t *data, size_t len, uint8_t init, uint8_t poly); +uint8_t crc8(const uint8_t* data, size_t len, uint8_t init, uint8_t poly); diff --git a/applications/plugins/protoview/app_subghz.c b/applications/plugins/protoview/app_subghz.c index 55905e8a3..73e0e16ae 100644 --- a/applications/plugins/protoview/app_subghz.c +++ b/applications/plugins/protoview/app_subghz.c @@ -9,18 +9,20 @@ #include #include -void raw_sampling_worker_start(ProtoViewApp *app); -void raw_sampling_worker_stop(ProtoViewApp *app); +void raw_sampling_worker_start(ProtoViewApp* app); +void raw_sampling_worker_stop(ProtoViewApp* app); ProtoViewModulation ProtoViewModulations[] = { - {"OOK 650Khz", "FuriHalSubGhzPresetOok650Async", - FuriHalSubGhzPresetOok650Async, NULL}, - {"OOK 270Khz", "FuriHalSubGhzPresetOok270Async", - FuriHalSubGhzPresetOok270Async, NULL}, - {"2FSK 2.38Khz", "FuriHalSubGhzPreset2FSKDev238Async", - FuriHalSubGhzPreset2FSKDev238Async, NULL}, - {"2FSK 47.6Khz", "FuriHalSubGhzPreset2FSKDev476Async", - FuriHalSubGhzPreset2FSKDev476Async, NULL}, + {"OOK 650Khz", "FuriHalSubGhzPresetOok650Async", FuriHalSubGhzPresetOok650Async, NULL}, + {"OOK 270Khz", "FuriHalSubGhzPresetOok270Async", FuriHalSubGhzPresetOok270Async, NULL}, + {"2FSK 2.38Khz", + "FuriHalSubGhzPreset2FSKDev238Async", + FuriHalSubGhzPreset2FSKDev238Async, + NULL}, + {"2FSK 47.6Khz", + "FuriHalSubGhzPreset2FSKDev476Async", + FuriHalSubGhzPreset2FSKDev476Async, + NULL}, {"TPMS 1 (FSK)", NULL, 0, (uint8_t*)protoview_subghz_tpms1_fsk_async_regs}, {"TPMS 2 (OOK)", NULL, 0, (uint8_t*)protoview_subghz_tpms2_ook_async_regs}, {"TPMS 3 (FSK)", NULL, 0, (uint8_t*)protoview_subghz_tpms3_fsk_async_regs}, @@ -44,12 +46,10 @@ void radio_begin(ProtoViewApp* app) { /* The CC1101 preset can be either one of the standard presets, if * the modulation "custom" field is NULL, or a custom preset we * defined in custom_presets.h. */ - if (ProtoViewModulations[app->modulation].custom == NULL) { - furi_hal_subghz_load_preset( - ProtoViewModulations[app->modulation].preset); + if(ProtoViewModulations[app->modulation].custom == NULL) { + furi_hal_subghz_load_preset(ProtoViewModulations[app->modulation].preset); } else { - furi_hal_subghz_load_custom_preset( - ProtoViewModulations[app->modulation].custom); + furi_hal_subghz_load_custom_preset(ProtoViewModulations[app->modulation].custom); } furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); app->txrx->txrx_state = TxRxStateIDLE; @@ -61,10 +61,10 @@ void radio_begin(ProtoViewApp* app) { uint32_t radio_rx(ProtoViewApp* app) { furi_assert(app); if(!furi_hal_subghz_is_frequency_valid(app->frequency)) { - furi_crash(TAG" Incorrect RX frequency."); + furi_crash(TAG " Incorrect RX frequency."); } - if (app->txrx->txrx_state == TxRxStateRx) return app->frequency; + if(app->txrx->txrx_state == TxRxStateRx) return app->frequency; furi_hal_subghz_idle(); /* Put it into idle state in case it is sleeping. */ uint32_t value = furi_hal_subghz_set_frequency_and_path(app->frequency); @@ -72,10 +72,8 @@ uint32_t radio_rx(ProtoViewApp* app) { furi_hal_gpio_init(&gpio_cc1101_g0, GpioModeInput, GpioPullNo, GpioSpeedLow); furi_hal_subghz_flush_rx(); furi_hal_subghz_rx(); - if (!app->txrx->debug_timer_sampling) { - - furi_hal_subghz_start_async_rx(subghz_worker_rx_callback, - app->txrx->worker); + if(!app->txrx->debug_timer_sampling) { + furi_hal_subghz_start_async_rx(subghz_worker_rx_callback, app->txrx->worker); subghz_worker_start(app->txrx->worker); } else { raw_sampling_worker_start(app); @@ -88,8 +86,8 @@ uint32_t radio_rx(ProtoViewApp* app) { void radio_rx_end(ProtoViewApp* app) { furi_assert(app); - if (app->txrx->txrx_state == TxRxStateRx) { - if (!app->txrx->debug_timer_sampling) { + if(app->txrx->txrx_state == TxRxStateRx) { + if(!app->txrx->debug_timer_sampling) { if(subghz_worker_is_running(app->txrx->worker)) { subghz_worker_stop(app->txrx->worker); furi_hal_subghz_stop_async_rx(); @@ -105,7 +103,7 @@ void radio_rx_end(ProtoViewApp* app) { /* Put radio on sleep. */ void radio_sleep(ProtoViewApp* app) { furi_assert(app); - if (app->txrx->txrx_state == TxRxStateRx) { + if(app->txrx->txrx_state == TxRxStateRx) { /* We can't go from having an active RX worker to sleeping. * Stop the RX subsystems first. */ radio_rx_end(app); @@ -120,10 +118,10 @@ void radio_sleep(ProtoViewApp* app) { /* This function suspends the current RX state, switches to TX mode, * transmits the signal provided by the callback data_feeder, and later * restores the RX state if there was one. */ -void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder, void *ctx) { +void radio_tx_signal(ProtoViewApp* app, FuriHalSubGhzAsyncTxCallback data_feeder, void* ctx) { TxRxState oldstate = app->txrx->txrx_state; - if (oldstate == TxRxStateRx) radio_rx_end(app); + if(oldstate == TxRxStateRx) radio_rx_end(app); radio_begin(app); furi_hal_subghz_idle(); @@ -138,7 +136,7 @@ void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder furi_hal_subghz_idle(); radio_begin(app); - if (oldstate == TxRxStateRx) radio_rx(app); + if(oldstate == TxRxStateRx) radio_rx(app); } /* ============================= Raw sampling mode ============================= @@ -148,15 +146,15 @@ void radio_tx_signal(ProtoViewApp *app, FuriHalSubGhzAsyncTxCallback data_feeder * Flipper system. * ===========================================================================*/ -void protoview_timer_isr(void *ctx) { - ProtoViewApp *app = ctx; +void protoview_timer_isr(void* ctx) { + ProtoViewApp* app = ctx; bool level = furi_hal_gpio_read(&gpio_cc1101_g0); - if (app->txrx->last_g0_value != level) { + if(app->txrx->last_g0_value != level) { uint32_t now = DWT->CYCCNT; uint32_t dur = now - app->txrx->last_g0_change_time; dur /= furi_hal_cortex_instructions_per_microsecond(); - if (dur > 15000) dur = 15000; + if(dur > 15000) dur = 15000; raw_samples_add(RawSamples, app->txrx->last_g0_value, dur); app->txrx->last_g0_value = level; app->txrx->last_g0_change_time = now; @@ -164,13 +162,13 @@ void protoview_timer_isr(void *ctx) { LL_TIM_ClearFlag_UPDATE(TIM2); } -void raw_sampling_worker_start(ProtoViewApp *app) { +void raw_sampling_worker_start(ProtoViewApp* app) { UNUSED(app); LL_TIM_InitTypeDef tim_init = { - .Prescaler = 63, /* CPU frequency is ~64Mhz. */ + .Prescaler = 63, /* CPU frequency is ~64Mhz. */ .CounterMode = LL_TIM_COUNTERMODE_UP, - .Autoreload = 5, /* Sample every 5 us */ + .Autoreload = 5, /* Sample every 5 us */ }; LL_TIM_Init(TIM2, &tim_init); @@ -183,7 +181,7 @@ void raw_sampling_worker_start(ProtoViewApp *app) { FURI_LOG_E(TAG, "Timer enabled"); } -void raw_sampling_worker_stop(ProtoViewApp *app) { +void raw_sampling_worker_stop(ProtoViewApp* app) { UNUSED(app); FURI_CRITICAL_ENTER(); LL_TIM_DisableCounter(TIM2); diff --git a/applications/plugins/protoview/crc.c b/applications/plugins/protoview/crc.c index 38a809e10..94d482972 100644 --- a/applications/plugins/protoview/crc.c +++ b/applications/plugins/protoview/crc.c @@ -3,14 +3,13 @@ /* CRC8 with the specified initialization value 'init' and * polynomial 'poly'. */ -uint8_t crc8(const uint8_t *data, size_t len, uint8_t init, uint8_t poly) -{ +uint8_t crc8(const uint8_t* data, size_t len, uint8_t init, uint8_t poly) { uint8_t crc = init; size_t i, j; - for (i = 0; i < len; i++) { + for(i = 0; i < len; i++) { crc ^= data[i]; - for (j = 0; j < 8; j++) { - if ((crc & 0x80) != 0) + for(j = 0; j < 8; j++) { + if((crc & 0x80) != 0) crc = (uint8_t)((crc << 1) ^ poly); else crc <<= 1; diff --git a/applications/plugins/protoview/custom_presets.h b/applications/plugins/protoview/custom_presets.h index cb9a421c6..00aa49945 100644 --- a/applications/plugins/protoview/custom_presets.h +++ b/applications/plugins/protoview/custom_presets.h @@ -76,7 +76,8 @@ static uint8_t protoview_subghz_tpms1_fsk_async_regs[][2] = { // // Modem Configuration {CC1101_MDMCFG0, 0x00}, {CC1101_MDMCFG1, 0x02}, - {CC1101_MDMCFG2, 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized). Other code reading TPMS uses GFSK, but should be the same when in RX mode. + {CC1101_MDMCFG2, + 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized). Other code reading TPMS uses GFSK, but should be the same when in RX mode. {CC1101_MDMCFG3, 0x93}, // Data rate is 20kBaud {CC1101_MDMCFG4, 0x59}, // Rx bandwidth filter is 325 kHz {CC1101_DEVIATN, 0x41}, // Deviation 28.56 kHz @@ -106,8 +107,10 @@ static uint8_t protoview_subghz_tpms1_fsk_async_regs[][2] = { {0, 0}, /* CC1101 2FSK PATABLE. */ - {0xC0, 0}, {0,0}, {0,0}, {0,0} -}; + {0xC0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}; /* This is like the default Flipper OOK 640Khz bandwidth preset, but * the bandwidth is changed to 10kBaud to accomodate TPMS frequency. */ @@ -156,8 +159,10 @@ static const uint8_t protoview_subghz_tpms2_ook_async_regs[][2] = { {0, 0}, /* CC1101 OOK PATABLE. */ - {0, 0xC0}, {0,0}, {0,0}, {0,0} -}; + {0, 0xC0}, + {0, 0}, + {0, 0}, + {0, 0}}; /* 40 KBaud, 2FSK, 28 kHz deviation, 270 Khz bandwidth filter. */ static uint8_t protoview_subghz_tpms3_fsk_async_regs[][2] = { @@ -174,7 +179,8 @@ static uint8_t protoview_subghz_tpms3_fsk_async_regs[][2] = { // // Modem Configuration {CC1101_MDMCFG0, 0x00}, {CC1101_MDMCFG1, 0x02}, - {CC1101_MDMCFG2, 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized). Other code reading TPMS uses GFSK, but should be the same when in RX mode. + {CC1101_MDMCFG2, + 0x04}, // Format 2-FSK/FM, No preamble/sync, Disable (current optimized). Other code reading TPMS uses GFSK, but should be the same when in RX mode. {CC1101_MDMCFG3, 0x93}, // Data rate is 40kBaud {CC1101_MDMCFG4, 0x6A}, // 6 = BW filter 270kHz, A = Data rate exp {CC1101_DEVIATN, 0x41}, // Deviation 28kHz @@ -204,8 +210,10 @@ static uint8_t protoview_subghz_tpms3_fsk_async_regs[][2] = { {0, 0}, /* CC1101 2FSK PATABLE. */ - {0xC0, 0}, {0,0}, {0,0}, {0,0} -}; + {0xC0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}; /* FSK 19k dev, 325 Khz filter, 20kBaud. Works well with Toyota. */ static uint8_t protoview_subghz_tpms4_fsk_async_regs[][2] = { @@ -250,6 +258,7 @@ static uint8_t protoview_subghz_tpms4_fsk_async_regs[][2] = { {0, 0}, /* CC1101 2FSK PATABLE. */ - {0xC0, 0}, {0,0}, {0,0}, {0,0} -}; - + {0xC0, 0}, + {0, 0}, + {0, 0}, + {0, 0}}; diff --git a/applications/plugins/protoview/data_feed.c b/applications/plugins/protoview/data_feed.c index a3bed238e..81d1a8020 100644 --- a/applications/plugins/protoview/data_feed.c +++ b/applications/plugins/protoview/data_feed.c @@ -14,7 +14,7 @@ const SubGhzProtocol subghz_protocol_protoview; /* The feed() method puts data in the RawSamples global (protected by * a mutex). */ -extern RawSamplesBuffer *RawSamples; +extern RawSamplesBuffer* RawSamples; /* This is totally dummy: we just define the decoder base for the async * system to work but we don't really use it if not to collect raw @@ -26,8 +26,7 @@ typedef struct SubGhzProtocolDecoderprotoview { void* subghz_protocol_decoder_protoview_alloc(SubGhzEnvironment* environment) { UNUSED(environment); - SubGhzProtocolDecoderprotoview* instance = - malloc(sizeof(SubGhzProtocolDecoderprotoview)); + SubGhzProtocolDecoderprotoview* instance = malloc(sizeof(SubGhzProtocolDecoderprotoview)); instance->base.protocol = &subghz_protocol_protoview; return instance; } @@ -66,8 +65,7 @@ uint8_t subghz_protocol_decoder_protoview_get_hash_data(void* context) { bool subghz_protocol_decoder_protoview_serialize( void* context, FlipperFormat* flipper_format, - SubGhzRadioPreset* preset) -{ + SubGhzRadioPreset* preset) { UNUSED(context); UNUSED(flipper_format); UNUSED(preset); @@ -75,15 +73,13 @@ bool subghz_protocol_decoder_protoview_serialize( } /* Not used. */ -bool subghz_protocol_decoder_protoview_deserialize(void* context, FlipperFormat* flipper_format) -{ +bool subghz_protocol_decoder_protoview_deserialize(void* context, FlipperFormat* flipper_format) { UNUSED(context); UNUSED(flipper_format); return false; } -void subhz_protocol_decoder_protoview_get_string(void* context, FuriString* output) -{ +void subhz_protocol_decoder_protoview_get_string(void* context, FuriString* output) { furi_assert(context); furi_string_cat_printf(output, "Protoview"); } @@ -116,5 +112,4 @@ const SubGhzProtocol* protoview_protocol_registry_items[] = { const SubGhzProtocolRegistry protoview_protocol_registry = { .items = protoview_protocol_registry_items, - .size = COUNT_OF(protoview_protocol_registry_items) -}; + .size = COUNT_OF(protoview_protocol_registry_items)}; diff --git a/applications/plugins/protoview/fields.c b/applications/plugins/protoview/fields.c index bc62cda54..47d573f4f 100644 --- a/applications/plugins/protoview/fields.c +++ b/applications/plugins/protoview/fields.c @@ -7,8 +7,8 @@ /* Create a new field of the specified type. Without populating its * type-specific value. */ -static ProtoViewField *field_new(ProtoViewFieldType type, const char *name) { - ProtoViewField *f = malloc(sizeof(*f)); +static ProtoViewField* field_new(ProtoViewFieldType type, const char* name) { + ProtoViewField* f = malloc(sizeof(*f)); f->type = type; f->name = strdup(name); return f; @@ -16,72 +16,80 @@ static ProtoViewField *field_new(ProtoViewFieldType type, const char *name) { /* Free only the auxiliary data of a field, used to represent the * current type. Name and type are not touched. */ -static void field_free_aux_data(ProtoViewField *f) { +static void field_free_aux_data(ProtoViewField* f) { switch(f->type) { - case FieldTypeStr: free(f->str); break; - case FieldTypeBytes: free(f->bytes); break; - default: break; // Nothing to free for other types. + case FieldTypeStr: + free(f->str); + break; + case FieldTypeBytes: + free(f->bytes); + break; + default: + break; // Nothing to free for other types. } } /* Free a field an associated data. */ -static void field_free(ProtoViewField *f) { +static void field_free(ProtoViewField* f) { field_free_aux_data(f); free(f->name); free(f); } /* Return the type of the field as string. */ -const char *field_get_type_name(ProtoViewField *f) { +const char* field_get_type_name(ProtoViewField* f) { switch(f->type) { - case FieldTypeStr: return "str"; - case FieldTypeSignedInt: return "int"; - case FieldTypeUnsignedInt: return "uint"; - case FieldTypeBinary: return "bin"; - case FieldTypeHex: return "hex"; - case FieldTypeBytes: return "bytes"; - case FieldTypeFloat: return "float"; + case FieldTypeStr: + return "str"; + case FieldTypeSignedInt: + return "int"; + case FieldTypeUnsignedInt: + return "uint"; + case FieldTypeBinary: + return "bin"; + case FieldTypeHex: + return "hex"; + case FieldTypeBytes: + return "bytes"; + case FieldTypeFloat: + return "float"; } return "unknown"; } /* Set a string representation of the specified field in buf. */ -int field_to_string(char *buf, size_t len, ProtoViewField *f) { +int field_to_string(char* buf, size_t len, ProtoViewField* f) { switch(f->type) { case FieldTypeStr: - return snprintf(buf,len,"%s", f->str); + return snprintf(buf, len, "%s", f->str); case FieldTypeSignedInt: - return snprintf(buf,len,"%lld", (long long) f->value); + return snprintf(buf, len, "%lld", (long long)f->value); case FieldTypeUnsignedInt: - return snprintf(buf,len,"%llu", (unsigned long long) f->uvalue); - case FieldTypeBinary: - { - uint64_t test_bit = (1 << (f->len-1)); - uint64_t idx = 0; - while(idx < len-1 && test_bit) { - buf[idx++] = (f->uvalue & test_bit) ? '1' : '0'; - test_bit >>= 1; - } - buf[idx] = 0; - return idx; + return snprintf(buf, len, "%llu", (unsigned long long)f->uvalue); + case FieldTypeBinary: { + uint64_t test_bit = (1 << (f->len - 1)); + uint64_t idx = 0; + while(idx < len - 1 && test_bit) { + buf[idx++] = (f->uvalue & test_bit) ? '1' : '0'; + test_bit >>= 1; } + buf[idx] = 0; + return idx; + } case FieldTypeHex: - return snprintf(buf, len, "%*llX", (int)(f->len+7)/8, f->uvalue); + return snprintf(buf, len, "%*llX", (int)(f->len + 7) / 8, f->uvalue); case FieldTypeFloat: return snprintf(buf, len, "%.*f", (int)f->len, (double)f->fvalue); - case FieldTypeBytes: - { - uint64_t idx = 0; - while(idx < len-1 && idx < f->len) { - const char *charset = "0123456789ABCDEF"; - uint32_t nibble = idx & 1 ? - (f->bytes[idx/2] & 0xf) : - (f->bytes[idx/2] >> 4); - buf[idx++] = charset[nibble]; - } - buf[idx] = 0; - return idx; + case FieldTypeBytes: { + uint64_t idx = 0; + while(idx < len - 1 && idx < f->len) { + const char* charset = "0123456789ABCDEF"; + uint32_t nibble = idx & 1 ? (f->bytes[idx / 2] & 0xf) : (f->bytes[idx / 2] >> 4); + buf[idx++] = charset[nibble]; } + buf[idx] = 0; + return idx; + } } return 0; } @@ -96,7 +104,7 @@ int field_to_string(char *buf, size_t len, ProtoViewField *f) { * The function returns true if the filed was successfully set to the * new value, otherwise if the specified value is invalid for the * field type, false is returned. */ -bool field_set_from_string(ProtoViewField *f, char *buf, size_t len) { +bool field_set_from_string(ProtoViewField* f, char* buf, size_t len) { // Initialize values to zero since the Flipper sscanf() implementation // is fuzzy... may populate only part of the value. long long val = 0; @@ -107,80 +115,78 @@ bool field_set_from_string(ProtoViewField *f, char *buf, size_t len) { case FieldTypeStr: free(f->str); f->len = len; - f->str = malloc(len+1); - memcpy(f->str,buf,len+1); + f->str = malloc(len + 1); + memcpy(f->str, buf, len + 1); break; case FieldTypeSignedInt: - if (!sscanf(buf,"%lld",&val)) return false; + if(!sscanf(buf, "%lld", &val)) return false; f->value = val; break; case FieldTypeUnsignedInt: - if (!sscanf(buf,"%llu",&uval)) return false; + if(!sscanf(buf, "%llu", &uval)) return false; f->uvalue = uval; break; - case FieldTypeBinary: - { - uint64_t bit_to_set = (1 << (len-1)); - uint64_t idx = 0; - uval = 0; - while(buf[idx]) { - if (buf[idx] == '1') uval |= bit_to_set; - else if (buf[idx] != '0') return false; - bit_to_set >>= 1; - idx++; - } - f->uvalue = uval; + case FieldTypeBinary: { + uint64_t bit_to_set = (1 << (len - 1)); + uint64_t idx = 0; + uval = 0; + while(buf[idx]) { + if(buf[idx] == '1') + uval |= bit_to_set; + else if(buf[idx] != '0') + return false; + bit_to_set >>= 1; + idx++; } - break; + f->uvalue = uval; + } break; case FieldTypeHex: - if (!sscanf(buf,"%llx",&uval) && - !sscanf(buf,"%llX",&uval)) return false; + if(!sscanf(buf, "%llx", &uval) && !sscanf(buf, "%llX", &uval)) return false; f->uvalue = uval; break; case FieldTypeFloat: - if (!sscanf(buf,"%f",&fval)) return false; + if(!sscanf(buf, "%f", &fval)) return false; f->fvalue = fval; break; - case FieldTypeBytes: - { - if (len > f->len) return false; - uint64_t idx = 0; - while(buf[idx]) { - uint8_t nibble = 0; - char c = toupper(buf[idx]); - if (c >= '0' && c <= '9') nibble = c-'0'; - else if (c >= 'A' && c <= 'F') nibble = 10+(c-'A'); - else return false; + case FieldTypeBytes: { + if(len > f->len) return false; + uint64_t idx = 0; + while(buf[idx]) { + uint8_t nibble = 0; + char c = toupper(buf[idx]); + if(c >= '0' && c <= '9') + nibble = c - '0'; + else if(c >= 'A' && c <= 'F') + nibble = 10 + (c - 'A'); + else + return false; - if (idx & 1) { - f->bytes[idx/2] = - (f->bytes[idx/2] & 0xF0) | nibble; - } else { - f->bytes[idx/2] = - (f->bytes[idx/2] & 0x0F) | (nibble<<4); - } - idx++; + if(idx & 1) { + f->bytes[idx / 2] = (f->bytes[idx / 2] & 0xF0) | nibble; + } else { + f->bytes[idx / 2] = (f->bytes[idx / 2] & 0x0F) | (nibble << 4); } - buf[idx] = 0; + idx++; } - break; + buf[idx] = 0; + } break; } return true; } /* Set the 'dst' field to contain a copy of the value of the 'src' * field. The field name is not modified. */ -void field_set_from_field(ProtoViewField *dst, ProtoViewField *src) { +void field_set_from_field(ProtoViewField* dst, ProtoViewField* src) { field_free_aux_data(dst); dst->type = src->type; dst->len = src->len; - switch(src->type) { + switch(src->type) { case FieldTypeStr: dst->str = strdup(src->str); break; case FieldTypeBytes: dst->bytes = malloc(src->len); - memcpy(dst->bytes,src->bytes,dst->len); + memcpy(dst->bytes, src->bytes, dst->len); break; case FieldTypeSignedInt: dst->value = src->value; @@ -199,159 +205,159 @@ void field_set_from_field(ProtoViewField *dst, ProtoViewField *src) { /* Increment the specified field value of 'incr'. If the field type * does not support increments false is returned, otherwise the * action is performed. */ -bool field_incr_value(ProtoViewField *f, int incr) { +bool field_incr_value(ProtoViewField* f, int incr) { switch(f->type) { - case FieldTypeStr: return false; - case FieldTypeSignedInt: { - /* Wrap around depending on the number of bits (f->len) + case FieldTypeStr: + return false; + case FieldTypeSignedInt: { + /* Wrap around depending on the number of bits (f->len) * the integer was declared to have. */ - int64_t max = (1ULL << (f->len-1))-1; - int64_t min = -max-1; - int64_t v = (int64_t)f->value + incr; - if (v > max) v = min+(v-max-1); - if (v < min) v = max+(v-min+1); - f->value = v; - break; - } - case FieldTypeBinary: - case FieldTypeHex: - case FieldTypeUnsignedInt: { - /* Wrap around like for the unsigned case, but here + int64_t max = (1ULL << (f->len - 1)) - 1; + int64_t min = -max - 1; + int64_t v = (int64_t)f->value + incr; + if(v > max) v = min + (v - max - 1); + if(v < min) v = max + (v - min + 1); + f->value = v; + break; + } + case FieldTypeBinary: + case FieldTypeHex: + case FieldTypeUnsignedInt: { + /* Wrap around like for the unsigned case, but here * is simpler. */ - uint64_t max = (1ULL << f->len)-1; // Broken for 64 bits. - uint64_t uv = (uint64_t)f->value + incr; - if (uv > max) uv = uv & max; - f->uvalue = uv; - break; - } - case FieldTypeFloat: - f->fvalue += incr; - break; - case FieldTypeBytes: { - // For bytes we only support single unit increments. - if (incr != -1 && incr != 1) return false; - for (int j = f->len-1; j >= 0; j--) { - uint8_t nibble = (j&1) ? (f->bytes[j/2] & 0x0F) : - ((f->bytes[j/2] & 0xF0) >> 4); + uint64_t max = (1ULL << f->len) - 1; // Broken for 64 bits. + uint64_t uv = (uint64_t)f->value + incr; + if(uv > max) uv = uv & max; + f->uvalue = uv; + break; + } + case FieldTypeFloat: + f->fvalue += incr; + break; + case FieldTypeBytes: { + // For bytes we only support single unit increments. + if(incr != -1 && incr != 1) return false; + for(int j = f->len - 1; j >= 0; j--) { + uint8_t nibble = (j & 1) ? (f->bytes[j / 2] & 0x0F) : ((f->bytes[j / 2] & 0xF0) >> 4); - nibble += incr; - nibble &= 0x0F; + nibble += incr; + nibble &= 0x0F; - f->bytes[j/2] = (j&1) ? ((f->bytes[j/2] & 0xF0) | nibble) : - ((f->bytes[j/2] & 0x0F) | (nibble<<4)); + f->bytes[j / 2] = (j & 1) ? ((f->bytes[j / 2] & 0xF0) | nibble) : + ((f->bytes[j / 2] & 0x0F) | (nibble << 4)); - /* Propagate the operation on overflow of this nibble. */ - if ((incr == 1 && nibble == 0) || - (incr == -1 && nibble == 0xf)) - { - continue; - } - break; // Otherwise stop the loop here. + /* Propagate the operation on overflow of this nibble. */ + if((incr == 1 && nibble == 0) || (incr == -1 && nibble == 0xf)) { + continue; } - break; + break; // Otherwise stop the loop here. } + break; + } } return true; } - /* Free a field set and its contained fields. */ -void fieldset_free(ProtoViewFieldSet *fs) { - for (uint32_t j = 0; j < fs->numfields; j++) - field_free(fs->fields[j]); +void fieldset_free(ProtoViewFieldSet* fs) { + for(uint32_t j = 0; j < fs->numfields; j++) field_free(fs->fields[j]); free(fs->fields); free(fs); } /* Allocate and init an empty field set. */ -ProtoViewFieldSet *fieldset_new(void) { - ProtoViewFieldSet *fs = malloc(sizeof(*fs)); +ProtoViewFieldSet* fieldset_new(void) { + ProtoViewFieldSet* fs = malloc(sizeof(*fs)); fs->numfields = 0; fs->fields = NULL; return fs; } /* Append an already allocated field at the end of the specified field set. */ -static void fieldset_add_field(ProtoViewFieldSet *fs, ProtoViewField *field) { +static void fieldset_add_field(ProtoViewFieldSet* fs, ProtoViewField* field) { fs->numfields++; - fs->fields = realloc(fs->fields,sizeof(ProtoViewField*)*fs->numfields); - fs->fields[fs->numfields-1] = field; + fs->fields = realloc(fs->fields, sizeof(ProtoViewField*) * fs->numfields); + fs->fields[fs->numfields - 1] = field; } /* Allocate and append an integer field. */ -void fieldset_add_int(ProtoViewFieldSet *fs, const char *name, int64_t val, uint8_t bits) { - ProtoViewField *f = field_new(FieldTypeSignedInt,name); +void fieldset_add_int(ProtoViewFieldSet* fs, const char* name, int64_t val, uint8_t bits) { + ProtoViewField* f = field_new(FieldTypeSignedInt, name); f->value = val; f->len = bits; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append an unsigned field. */ -void fieldset_add_uint(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits) { - ProtoViewField *f = field_new(FieldTypeUnsignedInt,name); +void fieldset_add_uint(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits) { + ProtoViewField* f = field_new(FieldTypeUnsignedInt, name); f->uvalue = uval; f->len = bits; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append a hex field. This is an unsigned number but * with an hex representation. */ -void fieldset_add_hex(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits) { - ProtoViewField *f = field_new(FieldTypeHex,name); +void fieldset_add_hex(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits) { + ProtoViewField* f = field_new(FieldTypeHex, name); f->uvalue = uval; f->len = bits; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append a bin field. This is an unsigned number but * with a binary representation. */ -void fieldset_add_bin(ProtoViewFieldSet *fs, const char *name, uint64_t uval, uint8_t bits) { - ProtoViewField *f = field_new(FieldTypeBinary,name); +void fieldset_add_bin(ProtoViewFieldSet* fs, const char* name, uint64_t uval, uint8_t bits) { + ProtoViewField* f = field_new(FieldTypeBinary, name); f->uvalue = uval; f->len = bits; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append a string field. */ -void fieldset_add_str(ProtoViewFieldSet *fs, const char *name, const char *s) { - ProtoViewField *f = field_new(FieldTypeStr,name); +void fieldset_add_str(ProtoViewFieldSet* fs, const char* name, const char* s) { + ProtoViewField* f = field_new(FieldTypeStr, name); f->str = strdup(s); f->len = strlen(s); - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append a bytes field. Note that 'count' is specified in * nibbles (bytes*2). */ -void fieldset_add_bytes(ProtoViewFieldSet *fs, const char *name, const uint8_t *bytes, uint32_t count_nibbles) { - uint32_t numbytes = (count_nibbles+count_nibbles%2)/2; - ProtoViewField *f = field_new(FieldTypeBytes,name); +void fieldset_add_bytes( + ProtoViewFieldSet* fs, + const char* name, + const uint8_t* bytes, + uint32_t count_nibbles) { + uint32_t numbytes = (count_nibbles + count_nibbles % 2) / 2; + ProtoViewField* f = field_new(FieldTypeBytes, name); f->bytes = malloc(numbytes); - memcpy(f->bytes,bytes,numbytes); + memcpy(f->bytes, bytes, numbytes); f->len = count_nibbles; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* Allocate and append a float field. */ -void fieldset_add_float(ProtoViewFieldSet *fs, const char *name, float val, uint32_t digits_after_dot) { - ProtoViewField *f = field_new(FieldTypeFloat,name); +void fieldset_add_float( + ProtoViewFieldSet* fs, + const char* name, + float val, + uint32_t digits_after_dot) { + ProtoViewField* f = field_new(FieldTypeFloat, name); f->fvalue = val; f->len = digits_after_dot; - fieldset_add_field(fs,f); + fieldset_add_field(fs, f); } /* For each field of the destination filedset 'dst', look for a matching * field name/type in the source fieldset 'src', and if one is found copy * its value into the 'dst' field. */ -void fieldset_copy_matching_fields(ProtoViewFieldSet *dst, - ProtoViewFieldSet *src) -{ - for (uint32_t j = 0; j < dst->numfields; j++) { - for (uint32_t i = 0; i < src->numfields; i++) { - if (dst->fields[j]->type == src->fields[i]->type && - !strcmp(dst->fields[j]->name,src->fields[i]->name)) - { - field_set_from_field(dst->fields[j], - src->fields[i]); +void fieldset_copy_matching_fields(ProtoViewFieldSet* dst, ProtoViewFieldSet* src) { + for(uint32_t j = 0; j < dst->numfields; j++) { + for(uint32_t i = 0; i < src->numfields; i++) { + if(dst->fields[j]->type == src->fields[i]->type && + !strcmp(dst->fields[j]->name, src->fields[i]->name)) { + field_set_from_field(dst->fields[j], src->fields[i]); } } } diff --git a/applications/plugins/protoview/protocols/b4b1.c b/applications/plugins/protoview/protocols/b4b1.c index 7308d1211..52c59d24b 100644 --- a/applications/plugins/protoview/protocols/b4b1.c +++ b/applications/plugins/protoview/protocols/b4b1.c @@ -9,9 +9,9 @@ #include "../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - if (numbits < 30) return false; - const char *sync_patterns[3] = { +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + if(numbits < 30) return false; + const char* sync_patterns[3] = { "10000000000000000000000000000001", /* 30 zero bits. */ "100000000000000000000000000000001", /* 31 zero bits. */ "1000000000000000000000000000000001", /* 32 zero bits. */ @@ -19,70 +19,67 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView uint32_t off; int j; - for (j = 0; j < 3; j++) { - off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_patterns[j]); - if (off != BITMAP_SEEK_NOT_FOUND) break; + for(j = 0; j < 3; j++) { + off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_patterns[j]); + if(off != BITMAP_SEEK_NOT_FOUND) break; } - if (off == BITMAP_SEEK_NOT_FOUND) return false; - if (DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 preamble at: %lu",off); + if(off == BITMAP_SEEK_NOT_FOUND) return false; + if(DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 preamble at: %lu", off); info->start_off = off; // Seek data setction. Why -1? Last bit is data. - off += strlen(sync_patterns[j])-1; + off += strlen(sync_patterns[j]) - 1; uint8_t d[3]; /* 24 bits of data. */ - uint32_t decoded = - convert_from_line_code(d,sizeof(d),bits,numbytes,off,"1000","1110"); + uint32_t decoded = convert_from_line_code(d, sizeof(d), bits, numbytes, off, "1000", "1110"); - if (DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 decoded: %lu",decoded); - if (decoded < 24) return false; + if(DEBUG_MSG) FURI_LOG_E(TAG, "B4B1 decoded: %lu", decoded); + if(decoded < 24) return false; - off += 24*4; // seek to end symbol offset to calculate the length. + off += 24 * 4; // seek to end symbol offset to calculate the length. off++; // In this protocol there is a final pulse as terminator. info->pulses_count = off - info->start_off; - fieldset_add_bytes(info->fieldset,"id",d,5); - fieldset_add_uint(info->fieldset,"button",d[2]&0xf,4); + fieldset_add_bytes(info->fieldset, "id", d, 5); + fieldset_add_uint(info->fieldset, "button", d[2] & 0xf, 4); return true; } /* Give fields and defaults for the signal creator. */ -static void get_fields(ProtoViewFieldSet *fieldset) { - uint8_t default_id[3]= {0xAB, 0xCD, 0xE0}; - fieldset_add_bytes(fieldset,"id",default_id,5); - fieldset_add_uint(fieldset,"button",1,4); +static void get_fields(ProtoViewFieldSet* fieldset) { + uint8_t default_id[3] = {0xAB, 0xCD, 0xE0}; + fieldset_add_bytes(fieldset, "id", default_id, 5); + fieldset_add_uint(fieldset, "button", 1, 4); } /* Create a signal. */ -static void build_message(RawSamplesBuffer *samples, ProtoViewFieldSet *fs) -{ +static void build_message(RawSamplesBuffer* samples, ProtoViewFieldSet* fs) { uint32_t te = 334; // Short pulse duration in microseconds. // Sync: 1 te pulse, 31 te gap. - raw_samples_add(samples,true,te); - raw_samples_add(samples,false,te*31); + raw_samples_add(samples, true, te); + raw_samples_add(samples, false, te * 31); // ID + button state uint8_t data[3]; - memcpy(data,fs->fields[0]->bytes,3); - data[2] = (data[2]&0xF0) | (fs->fields[1]->uvalue & 0xF); - for (uint32_t j = 0; j < 24; j++) { - if (bitmap_get(data,sizeof(data),j)) { - raw_samples_add(samples,true,te*3); - raw_samples_add(samples,false,te); + memcpy(data, fs->fields[0]->bytes, 3); + data[2] = (data[2] & 0xF0) | (fs->fields[1]->uvalue & 0xF); + for(uint32_t j = 0; j < 24; j++) { + if(bitmap_get(data, sizeof(data), j)) { + raw_samples_add(samples, true, te * 3); + raw_samples_add(samples, false, te); } else { - raw_samples_add(samples,true,te); - raw_samples_add(samples,false,te*3); + raw_samples_add(samples, true, te); + raw_samples_add(samples, false, te * 3); } } // Signal terminator. Just a single short pulse. - raw_samples_add(samples,true,te); + raw_samples_add(samples, true, te); } ProtoViewDecoder B4B1Decoder = { .name = "PT/SC remote", .decode = decode, .get_fields = get_fields, - .build_message = build_message -}; + .build_message = build_message}; diff --git a/applications/plugins/protoview/protocols/keeloq.c b/applications/plugins/protoview/protocols/keeloq.c index 0741eac47..298c690d4 100644 --- a/applications/plugins/protoview/protocols/keeloq.c +++ b/applications/plugins/protoview/protocols/keeloq.c @@ -24,16 +24,16 @@ #include "../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { /* In the sync pattern, we require the 12 high/low pulses and at least * half the gap we expect (5 pulses times, one is the final zero in the * 24 symbols high/low sequence, then other 4). */ - const char *sync_pattern = "101010101010101010101010" "0000"; - uint8_t sync_len = 24+4; - if (numbits-sync_len+sync_len < 3*66) return false; - uint32_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + const char* sync_pattern = "101010101010101010101010" + "0000"; + uint8_t sync_len = 24 + 4; + if(numbits - sync_len + sync_len < 3 * 66) return false; + uint32_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; info->start_off = off; off += sync_len; // Seek start of message. @@ -42,84 +42,77 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView * symbols of gap, to avoid missing the signal for a matter of wrong * timing. */ uint8_t gap_len = 0; - while(gap_len <= 7 && bitmap_get(bits,numbytes,off+gap_len) == 0) - gap_len++; - if (gap_len < 3 || gap_len > 7) return false; + while(gap_len <= 7 && bitmap_get(bits, numbytes, off + gap_len) == 0) gap_len++; + if(gap_len < 3 || gap_len > 7) return false; off += gap_len; FURI_LOG_E(TAG, "Keeloq preamble+sync found"); uint8_t raw[9] = {0}; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "110","100"); /* Pulse width modulation. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "110", "100"); /* Pulse width modulation. */ FURI_LOG_E(TAG, "Keeloq decoded bits: %lu", decoded); - if (decoded < 66) return false; /* Require the full 66 bits. */ + if(decoded < 66) return false; /* Require the full 66 bits. */ - info->pulses_count = (off+66*3) - info->start_off; + info->pulses_count = (off + 66 * 3) - info->start_off; - bitmap_reverse_bytes_bits(raw,sizeof(raw)); /* Keeloq is LSB first. */ + bitmap_reverse_bytes_bits(raw, sizeof(raw)); /* Keeloq is LSB first. */ - int buttons = raw[7]>>4; - int lowbat = (raw[8]&0x1) == 0; // Actual bit meaning: good battery level - int alwaysone = (raw[8]&0x2) != 0; + int buttons = raw[7] >> 4; + int lowbat = (raw[8] & 0x1) == 0; // Actual bit meaning: good battery level + int alwaysone = (raw[8] & 0x2) != 0; - fieldset_add_bytes(info->fieldset,"encr",raw,8); - raw[7] = raw[7]<<4; // Make ID bits contiguous - fieldset_add_bytes(info->fieldset,"id",raw+4,7); // 28 bits, 7 nibbles - fieldset_add_bin(info->fieldset,"s[2,1,0,3]",buttons,4); - fieldset_add_bin(info->fieldset,"low battery",lowbat,1); - fieldset_add_bin(info->fieldset,"always one",alwaysone,1); + fieldset_add_bytes(info->fieldset, "encr", raw, 8); + raw[7] = raw[7] << 4; // Make ID bits contiguous + fieldset_add_bytes(info->fieldset, "id", raw + 4, 7); // 28 bits, 7 nibbles + fieldset_add_bin(info->fieldset, "s[2,1,0,3]", buttons, 4); + fieldset_add_bin(info->fieldset, "low battery", lowbat, 1); + fieldset_add_bin(info->fieldset, "always one", alwaysone, 1); return true; } -static void get_fields(ProtoViewFieldSet *fieldset) { +static void get_fields(ProtoViewFieldSet* fieldset) { uint8_t remote_id[4] = {0xab, 0xcd, 0xef, 0xa0}; uint8_t encr[4] = {0xab, 0xab, 0xab, 0xab}; - fieldset_add_bytes(fieldset,"encr",encr,8); - fieldset_add_bytes(fieldset,"id",remote_id,7); - fieldset_add_bin(fieldset,"s[2,1,0,3]",2,4); - fieldset_add_bin(fieldset,"low battery",0,1); - fieldset_add_bin(fieldset,"always one",1,1); + fieldset_add_bytes(fieldset, "encr", encr, 8); + fieldset_add_bytes(fieldset, "id", remote_id, 7); + fieldset_add_bin(fieldset, "s[2,1,0,3]", 2, 4); + fieldset_add_bin(fieldset, "low battery", 0, 1); + fieldset_add_bin(fieldset, "always one", 1, 1); } -static void build_message(RawSamplesBuffer *samples, ProtoViewFieldSet *fieldset) -{ +static void build_message(RawSamplesBuffer* samples, ProtoViewFieldSet* fieldset) { uint32_t te = 380; // Short pulse duration in microseconds. // Sync: 12 pairs of pulse/gap + 9 times gap - for (int j = 0; j < 12; j++) { - raw_samples_add(samples,true,te); - raw_samples_add(samples,false,te); + for(int j = 0; j < 12; j++) { + raw_samples_add(samples, true, te); + raw_samples_add(samples, false, te); } - raw_samples_add(samples,false,te*9); + raw_samples_add(samples, false, te * 9); // Data, 66 bits. uint8_t data[9] = {0}; - memcpy(data,fieldset->fields[0]->bytes,4); // Encrypted part. - memcpy(data+4,fieldset->fields[1]->bytes,4); // ID. - data[7] = data[7]>>4 | fieldset->fields[2]->uvalue << 4; // s[2,1,0,3] + memcpy(data, fieldset->fields[0]->bytes, 4); // Encrypted part. + memcpy(data + 4, fieldset->fields[1]->bytes, 4); // ID. + data[7] = data[7] >> 4 | fieldset->fields[2]->uvalue << 4; // s[2,1,0,3] int low_battery = fieldset->fields[3] != 0; int always_one = fieldset->fields[4] != 0; low_battery = !low_battery; // Bit real meaning is good battery level. data[8] |= low_battery; data[8] |= (always_one << 1); - bitmap_reverse_bytes_bits(data,sizeof(data)); /* Keeloq is LSB first. */ + bitmap_reverse_bytes_bits(data, sizeof(data)); /* Keeloq is LSB first. */ - for (int j = 0; j < 66; j++) { - if (bitmap_get(data,9,j)) { - raw_samples_add(samples,true,te); - raw_samples_add(samples,false,te*2); + for(int j = 0; j < 66; j++) { + if(bitmap_get(data, 9, j)) { + raw_samples_add(samples, true, te); + raw_samples_add(samples, false, te * 2); } else { - raw_samples_add(samples,true,te*2); - raw_samples_add(samples,false,te); + raw_samples_add(samples, true, te * 2); + raw_samples_add(samples, false, te); } } } -ProtoViewDecoder KeeloqDecoder = { - .name = "Keeloq", - .decode = decode, - .get_fields = get_fields, - .build_message = build_message -}; +ProtoViewDecoder KeeloqDecoder = + {.name = "Keeloq", .decode = decode, .get_fields = get_fields, .build_message = build_message}; diff --git a/applications/plugins/protoview/protocols/oregon2.c b/applications/plugins/protoview/protocols/oregon2.c index 1d909a504..f67e85a2d 100644 --- a/applications/plugins/protoview/protocols/oregon2.c +++ b/applications/plugins/protoview/protocols/oregon2.c @@ -6,11 +6,14 @@ #include "../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - if (numbits < 32) return false; - const char *sync_pattern = "01100110" "01100110" "10010110" "10010110"; - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + if(numbits < 32) return false; + const char* sync_pattern = "01100110" + "01100110" + "10010110" + "10010110"; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Oregon2 preamble+sync found"); info->start_off = off; @@ -18,50 +21,61 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView uint8_t buffer[8], raw[8] = {0}; uint32_t decoded = - convert_from_line_code(buffer,sizeof(buffer),bits,numbytes,off,"1001","0110"); + convert_from_line_code(buffer, sizeof(buffer), bits, numbytes, off, "1001", "0110"); FURI_LOG_E(TAG, "Oregon2 decoded bits: %lu", decoded); - if (decoded < 11*4) return false; /* Minimum len to extract some data. */ - info->pulses_count = (off+11*4*4) - info->start_off; + if(decoded < 11 * 4) return false; /* Minimum len to extract some data. */ + info->pulses_count = (off + 11 * 4 * 4) - info->start_off; char temp[3] = {0}, hum[2] = {0}; uint8_t deviceid[2]; - for (int j = 0; j < 64; j += 4) { + for(int j = 0; j < 64; j += 4) { uint8_t nib[1]; - nib[0] = (bitmap_get(buffer,8,j+0) | - bitmap_get(buffer,8,j+1) << 1 | - bitmap_get(buffer,8,j+2) << 2 | - bitmap_get(buffer,8,j+3) << 3); - if (DEBUG_MSG) FURI_LOG_E(TAG, "Not inverted nibble[%d]: %x", j/4, (unsigned int)nib[0]); - raw[j/8] |= nib[0] << (4-(j%4)); - switch(j/4) { - case 1: deviceid[0] |= nib[0]; break; - case 0: deviceid[0] |= nib[0] << 4; break; - case 3: deviceid[1] |= nib[0]; break; - case 2: deviceid[1] |= nib[0] << 4; break; - case 10: temp[0] = nib[0]; break; + nib[0] = + (bitmap_get(buffer, 8, j + 0) | bitmap_get(buffer, 8, j + 1) << 1 | + bitmap_get(buffer, 8, j + 2) << 2 | bitmap_get(buffer, 8, j + 3) << 3); + if(DEBUG_MSG) FURI_LOG_E(TAG, "Not inverted nibble[%d]: %x", j / 4, (unsigned int)nib[0]); + raw[j / 8] |= nib[0] << (4 - (j % 4)); + switch(j / 4) { + case 1: + deviceid[0] |= nib[0]; + break; + case 0: + deviceid[0] |= nib[0] << 4; + break; + case 3: + deviceid[1] |= nib[0]; + break; + case 2: + deviceid[1] |= nib[0] << 4; + break; + case 10: + temp[0] = nib[0]; + break; /* Fixme: take the temperature sign from nibble 11. */ - case 9: temp[1] = nib[0]; break; - case 8: temp[2] = nib[0]; break; - case 13: hum[0] = nib[0]; break; - case 12: hum[1] = nib[0]; break; + case 9: + temp[1] = nib[0]; + break; + case 8: + temp[2] = nib[0]; + break; + case 13: + hum[0] = nib[0]; + break; + case 12: + hum[1] = nib[0]; + break; } } - float tempval = ((temp[0]-'0')*10) + - (temp[1]-'0') + - ((float)(temp[2]-'0')*0.1); - int humval = (hum[0]-'0')*10 + (hum[1]-'0'); + float tempval = ((temp[0] - '0') * 10) + (temp[1] - '0') + ((float)(temp[2] - '0') * 0.1); + int humval = (hum[0] - '0') * 10 + (hum[1] - '0'); - fieldset_add_bytes(info->fieldset,"Sensor ID",deviceid,4); - fieldset_add_float(info->fieldset,"Temperature",tempval,1); - fieldset_add_uint(info->fieldset,"Humidity",humval,7); + fieldset_add_bytes(info->fieldset, "Sensor ID", deviceid, 4); + fieldset_add_float(info->fieldset, "Temperature", tempval, 1); + fieldset_add_uint(info->fieldset, "Humidity", humval, 7); return true; } -ProtoViewDecoder Oregon2Decoder = { - .name = "Oregon2", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder Oregon2Decoder = + {.name = "Oregon2", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/protocols/tpms/citroen.c b/applications/plugins/protoview/protocols/tpms/citroen.c index d8a1681e4..ecd8fb983 100644 --- a/applications/plugins/protoview/protocols/tpms/citroen.c +++ b/applications/plugins/protoview/protocols/tpms/citroen.c @@ -7,55 +7,49 @@ #include "../../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { /* We consider a preamble of 17 symbols. They are more, but the decoding * is more likely to happen if we don't pretend to receive from the * very start of the message. */ uint32_t sync_len = 17; - const char *sync_pattern = "10101010101010110"; - if (numbits-sync_len < 8*10) return false; /* Expect 10 bytes. */ + const char* sync_pattern = "10101010101010110"; + if(numbits - sync_len < 8 * 10) return false; /* Expect 10 bytes. */ - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Renault TPMS preamble+sync found"); info->start_off = off; off += sync_len; /* Skip preamble + sync. */ uint8_t raw[10]; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "01","10"); /* Manchester. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "01", "10"); /* Manchester. */ FURI_LOG_E(TAG, "Citroen TPMS decoded bits: %lu", decoded); - if (decoded < 8*10) return false; /* Require the full 10 bytes. */ + if(decoded < 8 * 10) return false; /* Require the full 10 bytes. */ /* Check the CRC. It's a simple XOR of bytes 1-9, the first byte * is not included. The meaning of the first byte is unknown and * we don't display it. */ uint8_t crc = 0; - for (int j = 1; j < 10; j++) crc ^= raw[j]; - if (crc != 0) return false; /* Require sane checksum. */ + for(int j = 1; j < 10; j++) crc ^= raw[j]; + if(crc != 0) return false; /* Require sane checksum. */ - info->pulses_count = (off+8*10*2) - info->start_off; + info->pulses_count = (off + 8 * 10 * 2) - info->start_off; int repeat = raw[5] & 0xf; - float kpa = (float)raw[6]*1.364; - int temp = raw[7]-50; + float kpa = (float)raw[6] * 1.364; + int temp = raw[7] - 50; int battery = raw[8]; /* This may be the battery. It's not clear. */ - fieldset_add_bytes(info->fieldset,"Tire ID",raw+1,4*2); - fieldset_add_float(info->fieldset,"Pressure kpa",kpa,2); - fieldset_add_int(info->fieldset,"Temperature C",temp,8); - fieldset_add_uint(info->fieldset,"Repeat",repeat,4); - fieldset_add_uint(info->fieldset,"Battery",battery,8); + fieldset_add_bytes(info->fieldset, "Tire ID", raw + 1, 4 * 2); + fieldset_add_float(info->fieldset, "Pressure kpa", kpa, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp, 8); + fieldset_add_uint(info->fieldset, "Repeat", repeat, 4); + fieldset_add_uint(info->fieldset, "Battery", battery, 8); return true; } -ProtoViewDecoder CitroenTPMSDecoder = { - .name = "Citroen TPMS", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder CitroenTPMSDecoder = + {.name = "Citroen TPMS", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/protocols/tpms/ford.c b/applications/plugins/protoview/protocols/tpms/ford.c index abdb692ee..3816e72f9 100644 --- a/applications/plugins/protoview/protocols/tpms/ford.c +++ b/applications/plugins/protoview/protocols/tpms/ford.c @@ -10,54 +10,49 @@ #include "../../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + const char* sync_pattern = "010101010101" + "0110"; + uint8_t sync_len = 12 + 4; /* We just use 12 preamble symbols + sync. */ + if(numbits - sync_len < 8 * 8) return false; - const char *sync_pattern = "010101010101" "0110"; - uint8_t sync_len = 12+4; /* We just use 12 preamble symbols + sync. */ - if (numbits-sync_len < 8*8) return false; - - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Fort TPMS preamble+sync found"); info->start_off = off; off += sync_len; /* Skip preamble and sync. */ uint8_t raw[8]; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "01","10"); /* Manchester. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "01", "10"); /* Manchester. */ FURI_LOG_E(TAG, "Ford TPMS decoded bits: %lu", decoded); - if (decoded < 8*8) return false; /* Require the full 8 bytes. */ + if(decoded < 8 * 8) return false; /* Require the full 8 bytes. */ /* CRC is just the sum of the first 7 bytes MOD 256. */ uint8_t crc = 0; - for (int j = 0; j < 7; j++) crc += raw[j]; - if (crc != raw[7]) return false; /* Require sane CRC. */ + for(int j = 0; j < 7; j++) crc += raw[j]; + if(crc != raw[7]) return false; /* Require sane CRC. */ - info->pulses_count = (off+8*8*2) - info->start_off; + info->pulses_count = (off + 8 * 8 * 2) - info->start_off; - float psi = 0.25 * (((raw[6]&0x20)<<3)|raw[4]); + float psi = 0.25 * (((raw[6] & 0x20) << 3) | raw[4]); /* Temperature apperas to be valid only if the most significant * bit of the value is not set. Otherwise its meaning is unknown. * Likely useful to alternatively send temperature or other info. */ - int temp = raw[5] & 0x80 ? 0 : raw[5]-56; + int temp = raw[5] & 0x80 ? 0 : raw[5] - 56; int flags = raw[5] & 0x7f; int car_moving = (raw[6] & 0x44) == 0x44; - fieldset_add_bytes(info->fieldset,"Tire ID",raw,4*2); - fieldset_add_float(info->fieldset,"Pressure psi",psi,2); - fieldset_add_int(info->fieldset,"Temperature C",temp,8); - fieldset_add_hex(info->fieldset,"Flags",flags,7); - fieldset_add_uint(info->fieldset,"Moving",car_moving,1); + fieldset_add_bytes(info->fieldset, "Tire ID", raw, 4 * 2); + fieldset_add_float(info->fieldset, "Pressure psi", psi, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp, 8); + fieldset_add_hex(info->fieldset, "Flags", flags, 7); + fieldset_add_uint(info->fieldset, "Moving", car_moving, 1); return true; } -ProtoViewDecoder FordTPMSDecoder = { - .name = "Ford TPMS", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder FordTPMSDecoder = + {.name = "Ford TPMS", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/protocols/tpms/renault.c b/applications/plugins/protoview/protocols/tpms/renault.c index 09de77d17..3d8fc43d5 100644 --- a/applications/plugins/protoview/protocols/tpms/renault.c +++ b/applications/plugins/protoview/protocols/tpms/renault.c @@ -6,85 +6,82 @@ #include "../../app.h" #define USE_TEST_VECTOR 0 -static const char *test_vector = +static const char* test_vector = "...01010101010101010110" // Preamble + sync /* The following is Marshal encoded, so each two characters are * actaully one bit. 01 = 0, 10 = 1. */ "010110010110" // Flags. "10011001101010011001" // Pressure, multiply by 0.75 to obtain kpa. - // 244 kpa here. - "1010010110011010" // Temperature, subtract 30 to obtain celsius. 22C here. + // 244 kpa here. + "1010010110011010" // Temperature, subtract 30 to obtain celsius. 22C here. "1001010101101001" "0101100110010101" - "1001010101100110" // Tire ID. 0x7AD779 here. + "1001010101100110" // Tire ID. 0x7AD779 here. "0101010101010101" - "0101010101010101" // Two FF bytes (usually). Unknown. + "0101010101010101" // Two FF bytes (usually). Unknown. "0110010101010101"; // CRC8 with (poly 7, initialization 0). -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - - if (USE_TEST_VECTOR) { /* Test vector to check that decoding works. */ - bitmap_set_pattern(bits,numbytes,0,test_vector); +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + if(USE_TEST_VECTOR) { /* Test vector to check that decoding works. */ + bitmap_set_pattern(bits, numbytes, 0, test_vector); numbits = strlen(test_vector); } - if (numbits-12 < 9*8) return false; + if(numbits - 12 < 9 * 8) return false; - const char *sync_pattern = "01010101010101010110"; - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + const char* sync_pattern = "01010101010101010110"; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Renault TPMS preamble+sync found"); info->start_off = off; off += 20; /* Skip preamble. */ uint8_t raw[9]; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "01","10"); /* Manchester. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "01", "10"); /* Manchester. */ FURI_LOG_E(TAG, "Renault TPMS decoded bits: %lu", decoded); - if (decoded < 8*9) return false; /* Require the full 9 bytes. */ - if (crc8(raw,8,0,7) != raw[8]) return false; /* Require sane CRC. */ + if(decoded < 8 * 9) return false; /* Require the full 9 bytes. */ + if(crc8(raw, 8, 0, 7) != raw[8]) return false; /* Require sane CRC. */ - info->pulses_count = (off+8*9*2) - info->start_off; + info->pulses_count = (off + 8 * 9 * 2) - info->start_off; - uint8_t flags = raw[0]>>2; - float kpa = 0.75 * ((uint32_t)((raw[0]&3)<<8) | raw[1]); - int temp = raw[2]-30; + uint8_t flags = raw[0] >> 2; + float kpa = 0.75 * ((uint32_t)((raw[0] & 3) << 8) | raw[1]); + int temp = raw[2] - 30; - fieldset_add_bytes(info->fieldset,"Tire ID",raw+3,3*2); - fieldset_add_float(info->fieldset,"Pressure kpa",kpa,2); - fieldset_add_int(info->fieldset,"Temperature C",temp,8); - fieldset_add_hex(info->fieldset,"Flags",flags,6); - fieldset_add_bytes(info->fieldset,"Unknown1",raw+6,2); - fieldset_add_bytes(info->fieldset,"Unknown2",raw+7,2); + fieldset_add_bytes(info->fieldset, "Tire ID", raw + 3, 3 * 2); + fieldset_add_float(info->fieldset, "Pressure kpa", kpa, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp, 8); + fieldset_add_hex(info->fieldset, "Flags", flags, 6); + fieldset_add_bytes(info->fieldset, "Unknown1", raw + 6, 2); + fieldset_add_bytes(info->fieldset, "Unknown2", raw + 7, 2); return true; } /* Give fields and defaults for the signal creator. */ -static void get_fields(ProtoViewFieldSet *fieldset) { - uint8_t default_id[3]= {0xAB, 0xCD, 0xEF}; - fieldset_add_bytes(fieldset,"Tire ID",default_id,3*2); - fieldset_add_float(fieldset,"Pressure kpa",123,2); - fieldset_add_int(fieldset,"Temperature C",20,8); +static void get_fields(ProtoViewFieldSet* fieldset) { + uint8_t default_id[3] = {0xAB, 0xCD, 0xEF}; + fieldset_add_bytes(fieldset, "Tire ID", default_id, 3 * 2); + fieldset_add_float(fieldset, "Pressure kpa", 123, 2); + fieldset_add_int(fieldset, "Temperature C", 20, 8); // We don't know what flags are, but 1B is a common value. - fieldset_add_hex(fieldset,"Flags",0x1b,6); - fieldset_add_bytes(fieldset,"Unknown1",(uint8_t*)"\xff",2); - fieldset_add_bytes(fieldset,"Unknown2",(uint8_t*)"\xff",2); + fieldset_add_hex(fieldset, "Flags", 0x1b, 6); + fieldset_add_bytes(fieldset, "Unknown1", (uint8_t*)"\xff", 2); + fieldset_add_bytes(fieldset, "Unknown2", (uint8_t*)"\xff", 2); } /* Create a Renault TPMS signal, according to the fields provided. */ -static void build_message(RawSamplesBuffer *samples, ProtoViewFieldSet *fieldset) -{ +static void build_message(RawSamplesBuffer* samples, ProtoViewFieldSet* fieldset) { uint32_t te = 50; // Short pulse duration in microseconds. // Preamble + sync - const char *psync = "01010101010101010101010101010110"; - const char *p = psync; + const char* psync = "01010101010101010101010101010110"; + const char* p = psync; while(*p) { - raw_samples_add_or_update(samples,*p == '1',te); + raw_samples_add_or_update(samples, *p == '1', te); p++; } @@ -93,21 +90,21 @@ static void build_message(RawSamplesBuffer *samples, ProtoViewFieldSet *fieldset unsigned int raw_pressure = fieldset->fields[1]->fvalue * 4 / 3; data[0] = fieldset->fields[3]->uvalue << 2; // Flags data[0] |= (raw_pressure >> 8) & 3; // Pressure kpa high 2 bits - data[1] = raw_pressure & 0xff; // Pressure kpa low 8 bits + data[1] = raw_pressure & 0xff; // Pressure kpa low 8 bits data[2] = fieldset->fields[2]->value + 30; // Temperature C - memcpy(data+3,fieldset->fields[0]->bytes,6); // ID, 24 bits. - data[6] = fieldset->fields[4]->bytes[0]; // Unknown 1 - data[7] = fieldset->fields[5]->bytes[0]; // Unknown 2 - data[8] = crc8(data,8,0,7); + memcpy(data + 3, fieldset->fields[0]->bytes, 6); // ID, 24 bits. + data[6] = fieldset->fields[4]->bytes[0]; // Unknown 1 + data[7] = fieldset->fields[5]->bytes[0]; // Unknown 2 + data[8] = crc8(data, 8, 0, 7); // Generate Manchester code for each bit - for (uint32_t j = 0; j < 9*8; j++) { - if (bitmap_get(data,sizeof(data),j)) { - raw_samples_add_or_update(samples,true,te); - raw_samples_add_or_update(samples,false,te); + for(uint32_t j = 0; j < 9 * 8; j++) { + if(bitmap_get(data, sizeof(data), j)) { + raw_samples_add_or_update(samples, true, te); + raw_samples_add_or_update(samples, false, te); } else { - raw_samples_add_or_update(samples,false,te); - raw_samples_add_or_update(samples,true,te); + raw_samples_add_or_update(samples, false, te); + raw_samples_add_or_update(samples, true, te); } } } @@ -116,5 +113,4 @@ ProtoViewDecoder RenaultTPMSDecoder = { .name = "Renault TPMS", .decode = decode, .get_fields = get_fields, - .build_message = build_message -}; + .build_message = build_message}; diff --git a/applications/plugins/protoview/protocols/tpms/schrader.c b/applications/plugins/protoview/protocols/tpms/schrader.c index ae25e39bb..7dc85a2cb 100644 --- a/applications/plugins/protoview/protocols/tpms/schrader.c +++ b/applications/plugins/protoview/protocols/tpms/schrader.c @@ -11,20 +11,21 @@ #include "../../app.h" #define USE_TEST_VECTOR 0 -static const char *test_vector = "000000111101010101011010010110010110101001010110100110011001100101010101011010100110100110011010101010101010101010101010101010101010101010101010"; +static const char* test_vector = + "000000111101010101011010010110010110101001010110100110011001100101010101011010100110100110011010101010101010101010101010101010101010101010101010"; -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - - if (USE_TEST_VECTOR) { /* Test vector to check that decoding works. */ - bitmap_set_pattern(bits,numbytes,0,test_vector); +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + if(USE_TEST_VECTOR) { /* Test vector to check that decoding works. */ + bitmap_set_pattern(bits, numbytes, 0, test_vector); numbits = strlen(test_vector); } - if (numbits < 64) return false; /* Preamble + data. */ + if(numbits < 64) return false; /* Preamble + data. */ - const char *sync_pattern = "1111010101" "01011010"; - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + const char* sync_pattern = "1111010101" + "01011010"; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Schrader TPMS gap+preamble found"); info->start_off = off; @@ -34,38 +35,33 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView uint8_t raw[8]; uint8_t id[4]; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "01","10"); /* Manchester code. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "01", "10"); /* Manchester code. */ FURI_LOG_E(TAG, "Schrader TPMS decoded bits: %lu", decoded); - if (decoded < 64) return false; /* Require the full 8 bytes. */ + if(decoded < 64) return false; /* Require the full 8 bytes. */ raw[0] |= 0xf0; // Fix the preamble nibble for checksum computation. - uint8_t cksum = crc8(raw,sizeof(raw)-1,0xf0,0x7); - if (cksum != raw[7]) { + uint8_t cksum = crc8(raw, sizeof(raw) - 1, 0xf0, 0x7); + if(cksum != raw[7]) { FURI_LOG_E(TAG, "Schrader TPMS checksum mismatch"); return false; } - info->pulses_count = (off+8*8*2) - info->start_off; + info->pulses_count = (off + 8 * 8 * 2) - info->start_off; - float kpa = (float)raw[5]*2.5; - int temp = raw[6]-50; - id[0] = raw[1]&7; + float kpa = (float)raw[5] * 2.5; + int temp = raw[6] - 50; + id[0] = raw[1] & 7; id[1] = raw[2]; id[2] = raw[3]; id[3] = raw[4]; - fieldset_add_bytes(info->fieldset,"Tire ID",id,4*2); - fieldset_add_float(info->fieldset,"Pressure kpa",kpa,2); - fieldset_add_int(info->fieldset,"Temperature C",temp,8); + fieldset_add_bytes(info->fieldset, "Tire ID", id, 4 * 2); + fieldset_add_float(info->fieldset, "Pressure kpa", kpa, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp, 8); return true; } -ProtoViewDecoder SchraderTPMSDecoder = { - .name = "Schrader TPMS", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder SchraderTPMSDecoder = + {.name = "Schrader TPMS", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/protocols/tpms/schrader_eg53ma4.c b/applications/plugins/protoview/protocols/tpms/schrader_eg53ma4.c index 0105010bd..45accf1a1 100644 --- a/applications/plugins/protoview/protocols/tpms/schrader_eg53ma4.c +++ b/applications/plugins/protoview/protocols/tpms/schrader_eg53ma4.c @@ -15,50 +15,45 @@ #include "../../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + const char* sync_pattern = "010101010101" + "01100101"; + uint8_t sync_len = 12 + 8; /* We just use 12 preamble symbols + sync. */ + if(numbits - sync_len + 8 < 8 * 10) return false; - const char *sync_pattern = "010101010101" "01100101"; - uint8_t sync_len = 12+8; /* We just use 12 preamble symbols + sync. */ - if (numbits-sync_len+8 < 8*10) return false; - - uint64_t off = bitmap_seek_bits(bits,numbytes,0,numbits,sync_pattern); - if (off == BITMAP_SEEK_NOT_FOUND) return false; + uint64_t off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync_pattern); + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Schrader EG53MA4 TPMS preamble+sync found"); info->start_off = off; - off += sync_len-8; /* Skip preamble, not sync that is part of the data. */ + off += sync_len - 8; /* Skip preamble, not sync that is part of the data. */ uint8_t raw[10]; - uint32_t decoded = - convert_from_line_code(raw,sizeof(raw),bits,numbytes,off, - "01","10"); /* Manchester code. */ + uint32_t decoded = convert_from_line_code( + raw, sizeof(raw), bits, numbytes, off, "01", "10"); /* Manchester code. */ FURI_LOG_E(TAG, "Schrader EG53MA4 TPMS decoded bits: %lu", decoded); - if (decoded < 10*8) return false; /* Require the full 10 bytes. */ + if(decoded < 10 * 8) return false; /* Require the full 10 bytes. */ /* CRC is just all bytes added mod 256. */ uint8_t crc = 0; - for (int j = 0; j < 9; j++) crc += raw[j]; - if (crc != raw[9]) return false; /* Require sane CRC. */ + for(int j = 0; j < 9; j++) crc += raw[j]; + if(crc != raw[9]) return false; /* Require sane CRC. */ - info->pulses_count = (off+10*8*2) - info->start_off; + info->pulses_count = (off + 10 * 8 * 2) - info->start_off; /* To convert the raw pressure to kPa, RTL433 uses 2.5, but is likely * wrong. Searching on Google for users experimenting with the value * reported, the value appears to be 2.75. */ - float kpa = (float)raw[7]*2.75; + float kpa = (float)raw[7] * 2.75; int temp_f = raw[8]; - int temp_c = (temp_f-32)*5/9; /* Convert Fahrenheit to Celsius. */ + int temp_c = (temp_f - 32) * 5 / 9; /* Convert Fahrenheit to Celsius. */ - fieldset_add_bytes(info->fieldset,"Tire ID",raw+4,3*2); - fieldset_add_float(info->fieldset,"Pressure kpa",kpa,2); - fieldset_add_int(info->fieldset,"Temperature C",temp_c,8); + fieldset_add_bytes(info->fieldset, "Tire ID", raw + 4, 3 * 2); + fieldset_add_float(info->fieldset, "Pressure kpa", kpa, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp_c, 8); return true; } -ProtoViewDecoder SchraderEG53MA4TPMSDecoder = { - .name = "Schrader EG53MA4 TPMS", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder SchraderEG53MA4TPMSDecoder = + {.name = "Schrader EG53MA4 TPMS", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/protocols/tpms/toyota.c b/applications/plugins/protoview/protocols/tpms/toyota.c index b9dd1d959..b80af7647 100644 --- a/applications/plugins/protoview/protocols/tpms/toyota.c +++ b/applications/plugins/protoview/protocols/tpms/toyota.c @@ -24,40 +24,33 @@ #include "../../app.h" -static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo *info) { - - if (numbits-6 < 64*2) return false; /* Ask for 64 bit of data (each bit +static bool decode(uint8_t* bits, uint32_t numbytes, uint32_t numbits, ProtoViewMsgInfo* info) { + if(numbits - 6 < 64 * 2) + return false; /* Ask for 64 bit of data (each bit is two symbols in the bitmap). */ - char *sync[] = { - "00111100", - "001111100", - "00111101", - "001111101", - NULL - }; + char* sync[] = {"00111100", "001111100", "00111101", "001111101", NULL}; int j; uint32_t off = 0; - for (j = 0; sync[j]; j++) { - off = bitmap_seek_bits(bits,numbytes,0,numbits,sync[j]); - if (off != BITMAP_SEEK_NOT_FOUND) { + for(j = 0; sync[j]; j++) { + off = bitmap_seek_bits(bits, numbytes, 0, numbits, sync[j]); + if(off != BITMAP_SEEK_NOT_FOUND) { info->start_off = off; - off += strlen(sync[j])-2; + off += strlen(sync[j]) - 2; break; - } + } } - if (off == BITMAP_SEEK_NOT_FOUND) return false; + if(off == BITMAP_SEEK_NOT_FOUND) return false; FURI_LOG_E(TAG, "Toyota TPMS sync[%s] found", sync[j]); uint8_t raw[9]; - uint32_t decoded = - convert_from_diff_manchester(raw,sizeof(raw),bits,numbytes,off,true); + uint32_t decoded = convert_from_diff_manchester(raw, sizeof(raw), bits, numbytes, off, true); FURI_LOG_E(TAG, "Toyota TPMS decoded bits: %lu", decoded); - if (decoded < 8*9) return false; /* Require the full 8 bytes. */ - if (crc8(raw,8,0x80,7) != raw[8]) return false; /* Require sane CRC. */ + if(decoded < 8 * 9) return false; /* Require the full 8 bytes. */ + if(crc8(raw, 8, 0x80, 7) != raw[8]) return false; /* Require sane CRC. */ /* We detected a valid signal. However now info->start_off is actually * pointing to the sync part, not the preamble of alternating 0 and 1. @@ -65,25 +58,21 @@ static bool decode(uint8_t *bits, uint32_t numbytes, uint32_t numbits, ProtoView * for the decoder itself to fix the signal if neeeded, so that its * logical representation will be more accurate and better to save * and retransmit. */ - if (info->start_off >= 12) { + if(info->start_off >= 12) { info->start_off -= 12; - bitmap_set_pattern(bits,numbytes,info->start_off,"010101010101"); + bitmap_set_pattern(bits, numbytes, info->start_off, "010101010101"); } - info->pulses_count = (off+8*9*2) - info->start_off; + info->pulses_count = (off + 8 * 9 * 2) - info->start_off; - float psi = (float)((raw[4]&0x7f)<<1 | raw[5]>>7) * 0.25 - 7; - int temp = ((raw[5]&0x7f)<<1 | raw[6]>>7) - 40; + float psi = (float)((raw[4] & 0x7f) << 1 | raw[5] >> 7) * 0.25 - 7; + int temp = ((raw[5] & 0x7f) << 1 | raw[6] >> 7) - 40; - fieldset_add_bytes(info->fieldset,"Tire ID",raw,4*2); - fieldset_add_float(info->fieldset,"Pressure psi",psi,2); - fieldset_add_int(info->fieldset,"Temperature C",temp,8); + fieldset_add_bytes(info->fieldset, "Tire ID", raw, 4 * 2); + fieldset_add_float(info->fieldset, "Pressure psi", psi, 2); + fieldset_add_int(info->fieldset, "Temperature C", temp, 8); return true; } -ProtoViewDecoder ToyotaTPMSDecoder = { - .name = "Toyota TPMS", - .decode = decode, - .get_fields = NULL, - .build_message = NULL -}; +ProtoViewDecoder ToyotaTPMSDecoder = + {.name = "Toyota TPMS", .decode = decode, .get_fields = NULL, .build_message = NULL}; diff --git a/applications/plugins/protoview/raw_samples.c b/applications/plugins/protoview/raw_samples.c index f83cca361..54773f43f 100644 --- a/applications/plugins/protoview/raw_samples.c +++ b/applications/plugins/protoview/raw_samples.c @@ -8,15 +8,15 @@ #include "raw_samples.h" /* Allocate and initialize a samples buffer. */ -RawSamplesBuffer *raw_samples_alloc(void) { - RawSamplesBuffer *buf = malloc(sizeof(*buf)); +RawSamplesBuffer* raw_samples_alloc(void) { + RawSamplesBuffer* buf = malloc(sizeof(*buf)); buf->mutex = furi_mutex_alloc(FuriMutexTypeNormal); raw_samples_reset(buf); return buf; } /* Free a sample buffer. Should be called when the mutex is released. */ -void raw_samples_free(RawSamplesBuffer *s) { +void raw_samples_free(RawSamplesBuffer* s) { furi_mutex_free(s->mutex); free(s); } @@ -24,27 +24,27 @@ void raw_samples_free(RawSamplesBuffer *s) { /* This just set all the samples to zero and also resets the internal * index. There is no need to call it after raw_samples_alloc(), but only * when one wants to reset the whole buffer of samples. */ -void raw_samples_reset(RawSamplesBuffer *s) { - furi_mutex_acquire(s->mutex,FuriWaitForever); +void raw_samples_reset(RawSamplesBuffer* s) { + furi_mutex_acquire(s->mutex, FuriWaitForever); s->total = RAW_SAMPLES_NUM; s->idx = 0; s->short_pulse_dur = 0; - memset(s->samples,0,sizeof(s->samples)); + memset(s->samples, 0, sizeof(s->samples)); furi_mutex_release(s->mutex); } /* Set the raw sample internal index so that what is currently at * offset 'offset', will appear to be at 0 index. */ -void raw_samples_center(RawSamplesBuffer *s, uint32_t offset) { - s->idx = (s->idx+offset) % RAW_SAMPLES_NUM; +void raw_samples_center(RawSamplesBuffer* s, uint32_t offset) { + s->idx = (s->idx + offset) % RAW_SAMPLES_NUM; } /* Add the specified sample in the circular buffer. */ -void raw_samples_add(RawSamplesBuffer *s, bool level, uint32_t dur) { - furi_mutex_acquire(s->mutex,FuriWaitForever); +void raw_samples_add(RawSamplesBuffer* s, bool level, uint32_t dur) { + furi_mutex_acquire(s->mutex, FuriWaitForever); s->samples[s->idx].level = level; s->samples[s->idx].dur = dur; - s->idx = (s->idx+1) % RAW_SAMPLES_NUM; + s->idx = (s->idx + 1) % RAW_SAMPLES_NUM; furi_mutex_release(s->mutex); } @@ -56,28 +56,25 @@ void raw_samples_add(RawSamplesBuffer *s, bool level, uint32_t dur) { * * This function is a bit slower so the internal data sampling should * be performed with raw_samples_add(). */ -void raw_samples_add_or_update(RawSamplesBuffer *s, bool level, uint32_t dur) { - furi_mutex_acquire(s->mutex,FuriWaitForever); - uint32_t previdx = (s->idx-1) % RAW_SAMPLES_NUM; - if (s->samples[previdx].level == level && - s->samples[previdx].dur != 0) - { +void raw_samples_add_or_update(RawSamplesBuffer* s, bool level, uint32_t dur) { + furi_mutex_acquire(s->mutex, FuriWaitForever); + uint32_t previdx = (s->idx - 1) % RAW_SAMPLES_NUM; + if(s->samples[previdx].level == level && s->samples[previdx].dur != 0) { /* Update the last sample: it has the same level. */ s->samples[previdx].dur += dur; } else { /* Add a new sample. */ s->samples[s->idx].level = level; s->samples[s->idx].dur = dur; - s->idx = (s->idx+1) % RAW_SAMPLES_NUM; + s->idx = (s->idx + 1) % RAW_SAMPLES_NUM; } furi_mutex_release(s->mutex); } /* Get the sample from the buffer. It is possible to use out of range indexes * as 'idx' because the modulo operation will rewind back from the start. */ -void raw_samples_get(RawSamplesBuffer *s, uint32_t idx, bool *level, uint32_t *dur) -{ - furi_mutex_acquire(s->mutex,FuriWaitForever); +void raw_samples_get(RawSamplesBuffer* s, uint32_t idx, bool* level, uint32_t* dur) { + furi_mutex_acquire(s->mutex, FuriWaitForever); idx = (s->idx + idx) % RAW_SAMPLES_NUM; *level = s->samples[idx].level; *dur = s->samples[idx].dur; @@ -85,12 +82,12 @@ void raw_samples_get(RawSamplesBuffer *s, uint32_t idx, bool *level, uint32_t *d } /* Copy one buffer to the other, including current index. */ -void raw_samples_copy(RawSamplesBuffer *dst, RawSamplesBuffer *src) { - furi_mutex_acquire(src->mutex,FuriWaitForever); - furi_mutex_acquire(dst->mutex,FuriWaitForever); +void raw_samples_copy(RawSamplesBuffer* dst, RawSamplesBuffer* src) { + furi_mutex_acquire(src->mutex, FuriWaitForever); + furi_mutex_acquire(dst->mutex, FuriWaitForever); dst->idx = src->idx; dst->short_pulse_dur = src->short_pulse_dur; - memcpy(dst->samples,src->samples,sizeof(dst->samples)); + memcpy(dst->samples, src->samples, sizeof(dst->samples)); furi_mutex_release(src->mutex); furi_mutex_release(dst->mutex); } diff --git a/applications/plugins/protoview/raw_samples.h b/applications/plugins/protoview/raw_samples.h index 0b0422025..3493f07fd 100644 --- a/applications/plugins/protoview/raw_samples.h +++ b/applications/plugins/protoview/raw_samples.h @@ -4,16 +4,17 @@ /* Our circular buffer of raw samples, used in order to display * the signal. */ -#define RAW_SAMPLES_NUM 2048 /* Use a power of two: we take the modulo +#define RAW_SAMPLES_NUM \ + 2048 /* Use a power of two: we take the modulo of the index quite often to normalize inside the range, and division is slow. */ typedef struct RawSamplesBuffer { - FuriMutex *mutex; + FuriMutex* mutex; struct { - uint16_t level:1; - uint16_t dur:15; + uint16_t level : 1; + uint16_t dur : 15; } samples[RAW_SAMPLES_NUM]; - uint32_t idx; /* Current idx (next to write). */ + uint32_t idx; /* Current idx (next to write). */ uint32_t total; /* Total samples: same as RAW_SAMPLES_NUM, we provide this field for a cleaner interface with the user, but we always use RAW_SAMPLES_NUM when taking the modulo so @@ -22,11 +23,11 @@ typedef struct RawSamplesBuffer { uint32_t short_pulse_dur; /* Duration of the shortest pulse. */ } RawSamplesBuffer; -RawSamplesBuffer *raw_samples_alloc(void); -void raw_samples_reset(RawSamplesBuffer *s); -void raw_samples_center(RawSamplesBuffer *s, uint32_t offset); -void raw_samples_add(RawSamplesBuffer *s, bool level, uint32_t dur); -void raw_samples_add_or_update(RawSamplesBuffer *s, bool level, uint32_t dur); -void raw_samples_get(RawSamplesBuffer *s, uint32_t idx, bool *level, uint32_t *dur); -void raw_samples_copy(RawSamplesBuffer *dst, RawSamplesBuffer *src); -void raw_samples_free(RawSamplesBuffer *s); +RawSamplesBuffer* raw_samples_alloc(void); +void raw_samples_reset(RawSamplesBuffer* s); +void raw_samples_center(RawSamplesBuffer* s, uint32_t offset); +void raw_samples_add(RawSamplesBuffer* s, bool level, uint32_t dur); +void raw_samples_add_or_update(RawSamplesBuffer* s, bool level, uint32_t dur); +void raw_samples_get(RawSamplesBuffer* s, uint32_t idx, bool* level, uint32_t* dur); +void raw_samples_copy(RawSamplesBuffer* dst, RawSamplesBuffer* src); +void raw_samples_free(RawSamplesBuffer* s); diff --git a/applications/plugins/protoview/signal.c b/applications/plugins/protoview/signal.c index f4c5ebedf..a1c4b2b8f 100644 --- a/applications/plugins/protoview/signal.c +++ b/applications/plugins/protoview/signal.c @@ -3,7 +3,7 @@ #include "app.h" -bool decode_signal(RawSamplesBuffer *s, uint64_t len, ProtoViewMsgInfo *info); +bool decode_signal(RawSamplesBuffer* s, uint64_t len, ProtoViewMsgInfo* info); /* ============================================================================= * Raw signal detection @@ -16,7 +16,7 @@ uint32_t duration_delta(uint32_t a, uint32_t b) { } /* Reset the current signal, so that a new one can be detected. */ -void reset_current_signal(ProtoViewApp *app) { +void reset_current_signal(ProtoViewApp* app) { app->signal_bestlen = 0; app->signal_offset = 0; app->signal_decoded = false; @@ -39,47 +39,47 @@ void reset_current_signal(ProtoViewApp *app) { * For instance Oregon2 sensors, in the case of protocol 2.1 will send * pulses of ~400us (RF on) VS ~580us (RF off). */ #define SEARCH_CLASSES 3 -uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) { +uint32_t search_coherent_signal(RawSamplesBuffer* s, uint32_t idx) { struct { - uint32_t dur[2]; /* dur[0] = low, dur[1] = high */ - uint32_t count[2]; /* Associated observed frequency. */ + uint32_t dur[2]; /* dur[0] = low, dur[1] = high */ + uint32_t count[2]; /* Associated observed frequency. */ } classes[SEARCH_CLASSES]; - memset(classes,0,sizeof(classes)); + memset(classes, 0, sizeof(classes)); uint32_t minlen = 30, maxlen = 4000; /* Depends on data rate, here we allow for high and low. */ uint32_t len = 0; /* Observed len of coherent samples. */ s->short_pulse_dur = 0; - for (uint32_t j = idx; j < idx+500; j++) { + for(uint32_t j = idx; j < idx + 500; j++) { bool level; uint32_t dur; raw_samples_get(s, j, &level, &dur); - if (dur < minlen || dur > maxlen) break; /* return. */ + if(dur < minlen || dur > maxlen) break; /* return. */ /* Let's see if it matches a class we already have or if we * can populate a new (yet empty) class. */ uint32_t k; - for (k = 0; k < SEARCH_CLASSES; k++) { - if (classes[k].count[level] == 0) { + for(k = 0; k < SEARCH_CLASSES; k++) { + if(classes[k].count[level] == 0) { classes[k].dur[level] = dur; classes[k].count[level] = 1; break; /* Sample accepted. */ } else { uint32_t classavg = classes[k].dur[level]; uint32_t count = classes[k].count[level]; - uint32_t delta = duration_delta(dur,classavg); + uint32_t delta = duration_delta(dur, classavg); /* Is the difference in duration between this signal and * the class we are inspecting less than a given percentage? * If so, accept this signal. */ - if (delta < classavg/5) { /* 100%/5 = 20%. */ + if(delta < classavg / 5) { /* 100%/5 = 20%. */ /* It is useful to compute the average of the class * we are observing. We know how many samples we got so * far, so we can recompute the average easily. * By always having a better estimate of the pulse len * we can avoid missing next samples in case the first * observed samples are too off. */ - classavg = ((classavg * count) + dur) / (count+1); + classavg = ((classavg * count) + dur) / (count + 1); classes[k].dur[level] = classavg; classes[k].count[level]++; break; /* Sample accepted. */ @@ -87,7 +87,7 @@ uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) { } } - if (k == SEARCH_CLASSES) break; /* No match, return. */ + if(k == SEARCH_CLASSES) break; /* No match, return. */ /* If we are here, we accepted this sample. Try with the next * one. */ @@ -97,14 +97,12 @@ uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) { /* Update the buffer setting the shortest pulse we found * among the three classes. This will be used when scaling * for visualization. */ - uint32_t short_dur[2] = {0,0}; - for (int j = 0; j < SEARCH_CLASSES; j++) { - for (int level = 0; level < 2; level++) { - if (classes[j].dur[level] == 0) continue; - if (classes[j].count[level] < 3) continue; - if (short_dur[level] == 0 || - short_dur[level] > classes[j].dur[level]) - { + uint32_t short_dur[2] = {0, 0}; + for(int j = 0; j < SEARCH_CLASSES; j++) { + for(int level = 0; level < 2; level++) { + if(classes[j].dur[level] == 0) continue; + if(classes[j].count[level] < 3) continue; + if(short_dur[level] == 0 || short_dur[level] > classes[j].dur[level]) { short_dur[level] = classes[j].dur[level]; } } @@ -113,33 +111,28 @@ uint32_t search_coherent_signal(RawSamplesBuffer *s, uint32_t idx) { /* Use the average between high and low short pulses duration. * Often they are a bit different, and using the average is more robust * when we do decoding sampling at short_pulse_dur intervals. */ - if (short_dur[0] == 0) short_dur[0] = short_dur[1]; - if (short_dur[1] == 0) short_dur[1] = short_dur[0]; - s->short_pulse_dur = (short_dur[0]+short_dur[1])/2; + if(short_dur[0] == 0) short_dur[0] = short_dur[1]; + if(short_dur[1] == 0) short_dur[1] = short_dur[0]; + s->short_pulse_dur = (short_dur[0] + short_dur[1]) / 2; return len; } /* Called when we detect a message. Just blinks when the message was * not decoded. Vibrates, too, when the message was correctly decoded. */ -void notify_signal_detected(ProtoViewApp *app, bool decoded) { +void notify_signal_detected(ProtoViewApp* app, bool decoded) { static const NotificationSequence decoded_seq = { &message_vibro_on, &message_green_255, &message_delay_50, &message_green_0, &message_vibro_off, - NULL - }; + NULL}; static const NotificationSequence unknown_seq = { - &message_red_255, - &message_delay_50, - &message_red_0, - NULL - }; + &message_red_255, &message_delay_50, &message_red_0, NULL}; - if (decoded) + if(decoded) notification_message(app->notification, &decoded_seq); else notification_message(app->notification, &unknown_seq); @@ -149,57 +142,59 @@ void notify_signal_detected(ProtoViewApp *app, bool decoded) { * in order to find a coherent signal. If a signal that does not appear to * be just noise is found, it is set in DetectedSamples global signal * buffer, that is what is rendered on the screen. */ -void scan_for_signal(ProtoViewApp *app, RawSamplesBuffer *source) { +void scan_for_signal(ProtoViewApp* app, RawSamplesBuffer* source) { /* We need to work on a copy: the source buffer may be populated * by the background thread receiving data. */ - RawSamplesBuffer *copy = raw_samples_alloc(); - raw_samples_copy(copy,source); + RawSamplesBuffer* copy = raw_samples_alloc(); + raw_samples_copy(copy, source); /* Try to seek on data that looks to have a regular high low high low * pattern. */ - uint32_t minlen = 18; /* Min run of coherent samples. With less + uint32_t minlen = 18; /* Min run of coherent samples. With less than a few samples it's very easy to mistake noise for signal. */ uint32_t i = 0; - while (i < copy->total-1) { - uint32_t thislen = search_coherent_signal(copy,i); + while(i < copy->total - 1) { + uint32_t thislen = search_coherent_signal(copy, i); /* For messages that are long enough, attempt decoding. */ - if (thislen > minlen) { + if(thislen > minlen) { /* Allocate the message information that some decoder may * fill, in case it is able to decode a message. */ - ProtoViewMsgInfo *info = malloc(sizeof(ProtoViewMsgInfo)); - init_msg_info(info,app); + ProtoViewMsgInfo* info = malloc(sizeof(ProtoViewMsgInfo)); + init_msg_info(info, app); info->short_pulse_dur = copy->short_pulse_dur; uint32_t saved_idx = copy->idx; /* Save index, see later. */ /* decode_signal() expects the detected signal to start * from index zero .*/ - raw_samples_center(copy,i); - bool decoded = decode_signal(copy,thislen,info); + raw_samples_center(copy, i); + bool decoded = decode_signal(copy, thislen, info); copy->idx = saved_idx; /* Restore the index as we are scanning the signal in the loop. */ /* Accept this signal as the new signal if either it's longer * than the previous undecoded one, or the previous one was * unknown and this is decoded. */ - if ((thislen > app->signal_bestlen && app->signal_decoded == false) - || (app->signal_decoded == false && decoded)) - { + if((thislen > app->signal_bestlen && app->signal_decoded == false) || + (app->signal_decoded == false && decoded)) { free_msg_info(app->msg_info); app->msg_info = info; app->signal_bestlen = thislen; app->signal_decoded = decoded; - raw_samples_copy(DetectedSamples,copy); - raw_samples_center(DetectedSamples,i); - FURI_LOG_E(TAG, "===> Displayed sample updated (%d samples %lu us)", - (int)thislen, DetectedSamples->short_pulse_dur); + raw_samples_copy(DetectedSamples, copy); + raw_samples_center(DetectedSamples, i); + FURI_LOG_E( + TAG, + "===> Displayed sample updated (%d samples %lu us)", + (int)thislen, + DetectedSamples->short_pulse_dur); - adjust_raw_view_scale(app,DetectedSamples->short_pulse_dur); - notify_signal_detected(app,decoded); + adjust_raw_view_scale(app, DetectedSamples->short_pulse_dur); + notify_signal_detected(app, decoded); } else { /* If the structure was not filled, discard it. Otherwise * now the owner is app->msg_info. */ @@ -227,38 +222,42 @@ void scan_for_signal(ProtoViewApp *app, RawSamplesBuffer *source) { /* Set the 'bitpos' bit to value 'val', in the specified bitmap * 'b' of len 'blen'. * Out of range bits will silently be discarded. */ -void bitmap_set(uint8_t *b, uint32_t blen, uint32_t bitpos, bool val) { - uint32_t byte = bitpos/8; - uint32_t bit = 7-(bitpos&7); - if (byte >= blen) return; - if (val) - b[byte] |= 1<= blen) return; + if(val) + b[byte] |= 1 << bit; else - b[byte] &= ~(1<= blen) return 0; - return (b[byte] & (1<= blen) return 0; + return (b[byte] & (1 << bit)) != 0; } /* Copy 'count' bits from the bitmap 's' of 'slen' total bytes, to the * bitmap 'd' of 'dlen' total bytes. The bits are copied starting from * offset 'soff' of the source bitmap to the offset 'doff' of the * destination bitmap. */ -void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, - uint8_t *s, uint32_t slen, uint32_t soff, - uint32_t count) -{ +void bitmap_copy( + uint8_t* d, + uint32_t dlen, + uint32_t doff, + uint8_t* s, + uint32_t slen, + uint32_t soff, + uint32_t count) { /* If we are byte-aligned in both source and destination, use a fast * path for the number of bytes we can consume this way. */ - if ((doff & 7) == 0 && (soff & 7) == 0) { - uint32_t didx = doff/8; - uint32_t sidx = soff/8; + if((doff & 7) == 0 && (soff & 7) == 0) { + uint32_t didx = doff / 8; + uint32_t sidx = soff / 8; while(count > 8 && didx < dlen && sidx < slen) { d[didx++] = s[sidx++]; count -= 8; @@ -271,9 +270,9 @@ void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, /* Copy the bits needed to reach an offset where we can copy * two half bytes of src to a full byte of destination. */ - while(count > 8 && (doff&7) != 0) { - bool bit = bitmap_get(s,slen,soff++); - bitmap_set(d,dlen,doff++,bit); + while(count > 8 && (doff & 7) != 0) { + bool bit = bitmap_get(s, slen, soff++); + bitmap_set(d, dlen, doff++, bit); count--; } @@ -316,13 +315,12 @@ void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, * src[2] << 5, that is "WORLDS!!" >> 5 = ".....WOR" * That is "HELLOWOR" */ - if (count > 8) { + if(count > 8) { uint8_t skew = soff % 8; /* Don't worry, compiler will optimize. */ - uint32_t didx = doff/8; - uint32_t sidx = soff/8; + uint32_t didx = doff / 8; + uint32_t sidx = soff / 8; while(count > 8 && didx < dlen && sidx < slen) { - d[didx] = ((s[sidx] << skew) | - (s[sidx+1] >> (8-skew))); + d[didx] = ((s[sidx] << skew) | (s[sidx + 1] >> (8 - skew))); sidx++; didx++; soff += 8; @@ -334,8 +332,8 @@ void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, /* Here count is guaranteed to be < 8. * Copy the final bits bit by bit. */ while(count) { - bool bit = bitmap_get(s,slen,soff++); - bitmap_set(d,dlen,doff++,bit); + bool bit = bitmap_get(s, slen, soff++); + bitmap_set(d, dlen, doff++, bit); count--; } } @@ -343,15 +341,15 @@ void bitmap_copy(uint8_t *d, uint32_t dlen, uint32_t doff, /* We decode bits assuming the first bit we receive is the MSB * (see bitmap_set/get functions). Certain devices send data * encoded in the reverse way. */ -void bitmap_reverse_bytes_bits(uint8_t *p, uint32_t len) { - for (uint32_t j = 0; j < len; j++) { +void bitmap_reverse_bytes_bits(uint8_t* p, uint32_t len) { + for(uint32_t j = 0; j < len; j++) { uint32_t b = p[j]; /* Step 1: swap the two nibbles: 12345678 -> 56781234 */ - b = (b&0xf0)>>4 | (b&0x0f)<<4; + b = (b & 0xf0) >> 4 | (b & 0x0f) << 4; /* Step 2: swap adjacent pairs : 56781234 -> 78563412 */ - b = (b&0xcc)>>2 | (b&0x33)<<2; + b = (b & 0xcc) >> 2 | (b & 0x33) << 2; /* Step 3: swap adjacent bits : 78563412 -> 87654321 */ - b = (b&0xaa)>>1 | (b&0x55)<<1; + b = (b & 0xaa) >> 1 | (b & 0x55) << 1; p[j] = b; } } @@ -359,10 +357,10 @@ void bitmap_reverse_bytes_bits(uint8_t *p, uint32_t len) { /* Return true if the specified sequence of bits, provided as a string in the * form "11010110..." is found in the 'b' bitmap of 'blen' bits at 'bitpos' * position. */ -bool bitmap_match_bits(uint8_t *b, uint32_t blen, uint32_t bitpos, const char *bits) { - for (size_t j = 0; bits[j]; j++) { +bool bitmap_match_bits(uint8_t* b, uint32_t blen, uint32_t bitpos, const char* bits) { + for(size_t j = 0; bits[j]; j++) { bool expected = (bits[j] == '1') ? true : false; - if (bitmap_get(b,blen,bitpos+j) != expected) return false; + if(bitmap_get(b, blen, bitpos + j) != expected) return false; } return true; } @@ -375,12 +373,17 @@ bool bitmap_match_bits(uint8_t *b, uint32_t blen, uint32_t bitpos, const char *b * Note: there are better algorithms, such as Boyer-Moore. Here we hope that * for the kind of patterns we search we'll have a lot of early stops so * we use a vanilla approach. */ -uint32_t bitmap_seek_bits(uint8_t *b, uint32_t blen, uint32_t startpos, uint32_t maxbits, const char *bits) { - uint32_t endpos = startpos+blen*8; - uint32_t end2 = startpos+maxbits; - if (end2 < endpos) endpos = end2; - for (uint32_t j = startpos; j < endpos; j++) - if (bitmap_match_bits(b,blen,j,bits)) return j; +uint32_t bitmap_seek_bits( + uint8_t* b, + uint32_t blen, + uint32_t startpos, + uint32_t maxbits, + const char* bits) { + uint32_t endpos = startpos + blen * 8; + uint32_t end2 = startpos + maxbits; + if(end2 < endpos) endpos = end2; + for(uint32_t j = startpos; j < endpos; j++) + if(bitmap_match_bits(b, blen, j, bits)) return j; return BITMAP_SEEK_NOT_FOUND; } @@ -391,10 +394,10 @@ uint32_t bitmap_seek_bits(uint8_t *b, uint32_t blen, uint32_t startpos, uint32_t * This function is useful in order to set the test vectors in the protocol * decoders, to see if the decoding works regardless of the fact we are able * to actually receive a given signal. */ -void bitmap_set_pattern(uint8_t *b, uint32_t blen, uint32_t off, const char *pat) { +void bitmap_set_pattern(uint8_t* b, uint32_t blen, uint32_t off, const char* pat) { uint32_t i = 0; while(pat[i]) { - bitmap_set(b,blen,i+off,pat[i] == '1'); + bitmap_set(b, blen, i + off, pat[i] == '1'); i++; } } @@ -426,31 +429,36 @@ void bitmap_set_pattern(uint8_t *b, uint32_t blen, uint32_t off, const char *pat * bits set into the buffer 'b'. The 'rate' argument, in microseconds, is * the detected short-pulse duration. We expect the line code to be * meaningful when interpreted at multiples of 'rate'. */ -uint32_t convert_signal_to_bits(uint8_t *b, uint32_t blen, RawSamplesBuffer *s, uint32_t idx, uint32_t count, uint32_t rate) { - if (rate == 0) return 0; /* We can't perform the conversion. */ +uint32_t convert_signal_to_bits( + uint8_t* b, + uint32_t blen, + RawSamplesBuffer* s, + uint32_t idx, + uint32_t count, + uint32_t rate) { + if(rate == 0) return 0; /* We can't perform the conversion. */ uint32_t bitpos = 0; - for (uint32_t j = 0; j < count; j++) { + for(uint32_t j = 0; j < count; j++) { uint32_t dur; bool level; - raw_samples_get(s, j+idx, &level, &dur); + raw_samples_get(s, j + idx, &level, &dur); uint32_t numbits = dur / rate; /* full bits that surely fit. */ - uint32_t rest = dur % rate; /* How much we are left with. */ - if (rest > rate/2) numbits++; /* There is another one. */ + uint32_t rest = dur % rate; /* How much we are left with. */ + if(rest > rate / 2) numbits++; /* There is another one. */ /* Limit how much a single sample can spawn. There are likely no * protocols doing such long pulses when the rate is low. */ - if (numbits > 1024) numbits = 1024; + if(numbits > 1024) numbits = 1024; - if (0) /* Super verbose, so not under the DEBUG_MSG define. */ - FURI_LOG_E(TAG, "%lu converted into %lu (%d) bits", - dur,numbits,(int)level); + if(0) /* Super verbose, so not under the DEBUG_MSG define. */ + FURI_LOG_E(TAG, "%lu converted into %lu (%d) bits", dur, numbits, (int)level); /* If the signal is too short, let's claim it an interference * and ignore it completely. */ - if (numbits == 0) continue; + if(numbits == 0) continue; - while(numbits--) bitmap_set(b,blen,bitpos++,level); + while(numbits--) bitmap_set(b, blen, bitpos++, level); } return bitpos; } @@ -467,23 +475,29 @@ uint32_t convert_signal_to_bits(uint8_t *b, uint32_t blen, RawSamplesBuffer *s, * specified in bytes by the caller, via the 'len' parameters). * * The decoding starts at the specified offset (in bits) 'off'. */ -uint32_t convert_from_line_code(uint8_t *buf, uint64_t buflen, uint8_t *bits, uint32_t len, uint32_t off, const char *zero_pattern, const char *one_pattern) -{ +uint32_t convert_from_line_code( + uint8_t* buf, + uint64_t buflen, + uint8_t* bits, + uint32_t len, + uint32_t off, + const char* zero_pattern, + const char* one_pattern) { uint32_t decoded = 0; /* Number of bits extracted. */ len *= 8; /* Convert bytes to bits. */ while(off < len) { bool bitval; - if (bitmap_match_bits(bits,len,off,zero_pattern)) { + if(bitmap_match_bits(bits, len, off, zero_pattern)) { bitval = false; off += strlen(zero_pattern); - } else if (bitmap_match_bits(bits,len,off,one_pattern)) { + } else if(bitmap_match_bits(bits, len, off, one_pattern)) { bitval = true; off += strlen(one_pattern); } else { break; } - bitmap_set(buf,buflen,decoded++,bitval); - if (decoded/8 == buflen) break; /* No space left on target buffer. */ + bitmap_set(buf, buflen, decoded++, bitval); + if(decoded / 8 == buflen) break; /* No space left on target buffer. */ } return decoded; } @@ -494,17 +508,22 @@ uint32_t convert_from_line_code(uint8_t *buf, uint64_t buflen, uint8_t *bits, ui * in differential codings the next bits depend on the previous one. * * Parameters and return values are like convert_from_line_code(). */ -uint32_t convert_from_diff_manchester(uint8_t *buf, uint64_t buflen, uint8_t *bits, uint32_t len, uint32_t off, bool previous) -{ +uint32_t convert_from_diff_manchester( + uint8_t* buf, + uint64_t buflen, + uint8_t* bits, + uint32_t len, + uint32_t off, + bool previous) { uint32_t decoded = 0; len *= 8; /* Conver to bits. */ - for (uint32_t j = off; j < len; j += 2) { - bool b0 = bitmap_get(bits,len,j); - bool b1 = bitmap_get(bits,len,j+1); - if (b0 == previous) break; /* Each new bit must switch value. */ - bitmap_set(buf,buflen,decoded++,b0 == b1); + for(uint32_t j = off; j < len; j += 2) { + bool b0 = bitmap_get(bits, len, j); + bool b1 = bitmap_get(bits, len, j + 1); + if(b0 == previous) break; /* Each new bit must switch value. */ + bitmap_set(buf, buflen, decoded++, b0 == b1); previous = b1; - if (decoded/8 == buflen) break; /* No space left on target buffer. */ + if(decoded / 8 == buflen) break; /* No space left on target buffer. */ } return decoded; } @@ -522,22 +541,21 @@ extern ProtoViewDecoder CitroenTPMSDecoder; extern ProtoViewDecoder FordTPMSDecoder; extern ProtoViewDecoder KeeloqDecoder; -ProtoViewDecoder *Decoders[] = { - &Oregon2Decoder, /* Oregon sensors v2.1 protocol. */ - &B4B1Decoder, /* PT, SC, ... 24 bits remotes. */ - &RenaultTPMSDecoder, /* Renault TPMS. */ - &ToyotaTPMSDecoder, /* Toyota TPMS. */ - &SchraderTPMSDecoder, /* Schrader TPMS. */ - &SchraderEG53MA4TPMSDecoder, /* Schrader EG53MA4 TPMS. */ - &CitroenTPMSDecoder, /* Citroen TPMS. */ - &FordTPMSDecoder, /* Ford TPMS. */ - &KeeloqDecoder, /* Keeloq remote. */ - NULL -}; +ProtoViewDecoder* Decoders[] = { + &Oregon2Decoder, /* Oregon sensors v2.1 protocol. */ + &B4B1Decoder, /* PT, SC, ... 24 bits remotes. */ + &RenaultTPMSDecoder, /* Renault TPMS. */ + &ToyotaTPMSDecoder, /* Toyota TPMS. */ + &SchraderTPMSDecoder, /* Schrader TPMS. */ + &SchraderEG53MA4TPMSDecoder, /* Schrader EG53MA4 TPMS. */ + &CitroenTPMSDecoder, /* Citroen TPMS. */ + &FordTPMSDecoder, /* Ford TPMS. */ + &KeeloqDecoder, /* Keeloq remote. */ + NULL}; /* Free the message info and allocated data. */ -void free_msg_info(ProtoViewMsgInfo *i) { - if (i == NULL) return; +void free_msg_info(ProtoViewMsgInfo* i) { + if(i == NULL) return; fieldset_free(i->fieldset); free(i->bits); free(i); @@ -545,9 +563,9 @@ void free_msg_info(ProtoViewMsgInfo *i) { /* Reset the message info structure before passing it to the decoding * functions. */ -void init_msg_info(ProtoViewMsgInfo *i, ProtoViewApp *app) { +void init_msg_info(ProtoViewMsgInfo* i, ProtoViewApp* app) { UNUSED(app); - memset(i,0,sizeof(ProtoViewMsgInfo)); + memset(i, 0, sizeof(ProtoViewMsgInfo)); i->bits = NULL; i->fieldset = fieldset_new(); } @@ -556,23 +574,29 @@ void init_msg_info(ProtoViewMsgInfo *i, ProtoViewApp *app) { * to a bitstream, and the calls the protocol specific functions for * decoding. If the signal was decoded correctly by some protocol, true * is returned. Otherwise false is returned. */ -bool decode_signal(RawSamplesBuffer *s, uint64_t len, ProtoViewMsgInfo *info) { - uint32_t bitmap_bits_size = 4096*8; - uint32_t bitmap_size = bitmap_bits_size/8; +bool decode_signal(RawSamplesBuffer* s, uint64_t len, ProtoViewMsgInfo* info) { + uint32_t bitmap_bits_size = 4096 * 8; + uint32_t bitmap_size = bitmap_bits_size / 8; /* We call the decoders with an offset a few samples before the actual * signal detected and for a len of a few bits after its end. */ uint32_t before_samples = 32; uint32_t after_samples = 100; - uint8_t *bitmap = malloc(bitmap_size); - uint32_t bits = convert_signal_to_bits(bitmap,bitmap_size,s,-before_samples,len+before_samples+after_samples,s->short_pulse_dur); + uint8_t* bitmap = malloc(bitmap_size); + uint32_t bits = convert_signal_to_bits( + bitmap, + bitmap_size, + s, + -before_samples, + len + before_samples + after_samples, + s->short_pulse_dur); - if (DEBUG_MSG) { /* Useful for debugging purposes. Don't remove. */ - char *str = malloc(1024); + if(DEBUG_MSG) { /* Useful for debugging purposes. Don't remove. */ + char* str = malloc(1024); uint32_t j; - for (j = 0; j < bits && j < 1023; j++) { - str[j] = bitmap_get(bitmap,bitmap_size,j) ? '1' : '0'; + for(j = 0; j < bits && j < 1023; j++) { + str[j] = bitmap_get(bitmap, bitmap_size, j) ? '1' : '0'; } str[j] = 0; FURI_LOG_E(TAG, "%lu bits sampled: %s", bits, str); @@ -585,18 +609,17 @@ bool decode_signal(RawSamplesBuffer *s, uint64_t len, ProtoViewMsgInfo *info) { bool decoded = false; while(Decoders[j]) { uint32_t start_time = furi_get_tick(); - decoded = Decoders[j]->decode(bitmap,bitmap_size,bits,info); + decoded = Decoders[j]->decode(bitmap, bitmap_size, bits, info); uint32_t delta = furi_get_tick() - start_time; - FURI_LOG_E(TAG, "Decoder %s took %lu ms", - Decoders[j]->name, (unsigned long)delta); - if (decoded) { + FURI_LOG_E(TAG, "Decoder %s took %lu ms", Decoders[j]->name, (unsigned long)delta); + if(decoded) { info->decoder = Decoders[j]; break; } j++; } - if (!decoded) { + if(!decoded) { FURI_LOG_E(TAG, "No decoding possible"); } else { FURI_LOG_E(TAG, "+++ Decoded %s", info->decoder->name); @@ -604,12 +627,17 @@ bool decode_signal(RawSamplesBuffer *s, uint64_t len, ProtoViewMsgInfo *info) { * with the decoded signal. The decoder may not implement offset/len * filling of the structure. In such case we have no info and * pulses_count will be set to zero. */ - if (info->pulses_count) { - info->bits_bytes = (info->pulses_count+7)/8; // Round to full byte. + if(info->pulses_count) { + info->bits_bytes = (info->pulses_count + 7) / 8; // Round to full byte. info->bits = malloc(info->bits_bytes); - bitmap_copy(info->bits,info->bits_bytes,0, - bitmap,bitmap_size,info->start_off, - info->pulses_count); + bitmap_copy( + info->bits, + info->bits_bytes, + 0, + bitmap, + bitmap_size, + info->start_off, + info->pulses_count); } } free(bitmap); diff --git a/applications/plugins/protoview/signal_file.c b/applications/plugins/protoview/signal_file.c index 31c8726fb..c60a6a181 100644 --- a/applications/plugins/protoview/signal_file.c +++ b/applications/plugins/protoview/signal_file.c @@ -13,57 +13,56 @@ * but it's logical representation stored in the app->msg_info bitmap, where * each 1 or 0 means a puls or gap for the specified short pulse duration time * (te). */ -bool save_signal(ProtoViewApp *app, const char *filename) { +bool save_signal(ProtoViewApp* app, const char* filename) { /* We have a message at all? */ - if (app->msg_info == NULL || app->msg_info->pulses_count == 0) return false; - - Storage *storage = furi_record_open(RECORD_STORAGE); - FlipperFormat *file = flipper_format_file_alloc(storage); - Stream *stream = flipper_format_get_raw_stream(file); - FuriString *file_content = NULL; + if(app->msg_info == NULL || app->msg_info->pulses_count == 0) return false; + + Storage* storage = furi_record_open(RECORD_STORAGE); + FlipperFormat* file = flipper_format_file_alloc(storage); + Stream* stream = flipper_format_get_raw_stream(file); + FuriString* file_content = NULL; bool success = true; - if (flipper_format_file_open_always(file, filename)) { + if(flipper_format_file_open_always(file, filename)) { /* Write the file header. */ - FuriString *file_content = furi_string_alloc(); - const char *preset_id = ProtoViewModulations[app->modulation].id; + FuriString* file_content = furi_string_alloc(); + const char* preset_id = ProtoViewModulations[app->modulation].id; - furi_string_printf(file_content, - "Filetype: Flipper SubGhz RAW File\n" - "Version: 1\n" - "Frequency: %ld\n" - "Preset: %s\n", - app->frequency, - preset_id ? preset_id : "FuriHalSubGhzPresetCustom"); + furi_string_printf( + file_content, + "Filetype: Flipper SubGhz RAW File\n" + "Version: 1\n" + "Frequency: %ld\n" + "Preset: %s\n", + app->frequency, + preset_id ? preset_id : "FuriHalSubGhzPresetCustom"); /* For custom modulations, we need to emit a set of registers. */ - if (preset_id == NULL) { - FuriString *custom = furi_string_alloc(); - uint8_t *regs = ProtoViewModulations[app->modulation].custom; - furi_string_printf(custom, + if(preset_id == NULL) { + FuriString* custom = furi_string_alloc(); + uint8_t* regs = ProtoViewModulations[app->modulation].custom; + furi_string_printf( + custom, "Custom_preset_module: CC1101\n" - "Custom_preset_data: "); - for (int j = 0; regs[j]; j += 2) { - furi_string_cat_printf(custom, "%02X %02X ", - (int)regs[j], (int)regs[j+1]); + "Custom_preset_data: "); + for(int j = 0; regs[j]; j += 2) { + furi_string_cat_printf(custom, "%02X %02X ", (int)regs[j], (int)regs[j + 1]); } size_t len = furi_string_size(file_content); - furi_string_set_char(custom,len-1,'\n'); - furi_string_cat(file_content,custom); + furi_string_set_char(custom, len - 1, '\n'); + furi_string_cat(file_content, custom); furi_string_free(custom); } /* We always save raw files. */ - furi_string_cat_printf(file_content, - "Protocol: RAW\n" - "RAW_Data: -10000\n"); // Start with 10 ms of gap + furi_string_cat_printf( + file_content, + "Protocol: RAW\n" + "RAW_Data: -10000\n"); // Start with 10 ms of gap /* Write header. */ size_t len = furi_string_size(file_content); - if (stream_write(stream, - (uint8_t*) furi_string_get_cstr(file_content), len) - != len) - { + if(stream_write(stream, (uint8_t*)furi_string_get_cstr(file_content), len) != len) { FURI_LOG_W(TAG, "Short write to file"); success = false; goto write_err; @@ -76,15 +75,13 @@ bool save_signal(ProtoViewApp *app, const char *filename) { uint32_t this_line_samples = 0; uint32_t max_line_samples = 100; uint32_t idx = 0; // Iindex in the signal bitmap. - ProtoViewMsgInfo *i = app->msg_info; + ProtoViewMsgInfo* i = app->msg_info; while(idx < i->pulses_count) { - bool level = bitmap_get(i->bits,i->bits_bytes,idx); + bool level = bitmap_get(i->bits, i->bits_bytes, idx); uint32_t te_times = 1; idx++; /* Count the duration of the current pulse/gap. */ - while(idx < i->pulses_count && - bitmap_get(i->bits,i->bits_bytes,idx) == level) - { + while(idx < i->pulses_count && bitmap_get(i->bits, i->bits_bytes, idx) == level) { te_times++; idx++; } @@ -92,32 +89,29 @@ bool save_signal(ProtoViewApp *app, const char *filename) { // next gap or pulse. int32_t dur = (int32_t)i->short_pulse_dur * te_times; - if (level == 0) dur = -dur; /* Negative is gap in raw files. */ + if(level == 0) dur = -dur; /* Negative is gap in raw files. */ /* Emit the sample. If this is the first sample of the line, * also emit the RAW_Data: field. */ - if (this_line_samples == 0) - furi_string_cat_printf(file_content,"RAW_Data: "); - furi_string_cat_printf(file_content,"%d ",(int)dur); + if(this_line_samples == 0) furi_string_cat_printf(file_content, "RAW_Data: "); + furi_string_cat_printf(file_content, "%d ", (int)dur); this_line_samples++; /* Store the current set of samples on disk, when we reach a * given number or the end of the signal. */ bool end_reached = (idx == i->pulses_count); - if (this_line_samples == max_line_samples || end_reached) { + if(this_line_samples == max_line_samples || end_reached) { /* If that's the end, terminate the signal with a long * gap. */ - if (end_reached) furi_string_cat_printf(file_content,"-10000 "); + if(end_reached) furi_string_cat_printf(file_content, "-10000 "); /* We always have a trailing space in the last sample. Make it * a newline. */ size_t len = furi_string_size(file_content); - furi_string_set_char(file_content,len-1,'\n'); + furi_string_set_char(file_content, len - 1, '\n'); - if (stream_write(stream, - (uint8_t*) furi_string_get_cstr(file_content), - len) != len) - { + if(stream_write(stream, (uint8_t*)furi_string_get_cstr(file_content), len) != + len) { FURI_LOG_W(TAG, "Short write to file"); success = false; goto write_err; @@ -136,6 +130,6 @@ bool save_signal(ProtoViewApp *app, const char *filename) { write_err: furi_record_close(RECORD_STORAGE); flipper_format_free(file); - if (file_content != NULL) furi_string_free(file_content); + if(file_content != NULL) furi_string_free(file_content); return success; } diff --git a/applications/plugins/protoview/ui.c b/applications/plugins/protoview/ui.c index 8badab5bf..b0251f09f 100644 --- a/applications/plugins/protoview/ui.c +++ b/applications/plugins/protoview/ui.c @@ -10,36 +10,31 @@ /* Return the ID of the currently selected subview, of the current * view. */ -int ui_get_current_subview(ProtoViewApp *app) { +int ui_get_current_subview(ProtoViewApp* app) { return app->current_subview[app->current_view]; } /* Called by view rendering callback that has subviews, to show small triangles * facing down/up if there are other subviews the user can access with up * and down. */ -void ui_show_available_subviews(Canvas *canvas, ProtoViewApp *app, - int last_subview) -{ +void ui_show_available_subviews(Canvas* canvas, ProtoViewApp* app, int last_subview) { int subview = ui_get_current_subview(app); - if (subview != 0) - canvas_draw_triangle(canvas,120,5,8,5,CanvasDirectionBottomToTop); - if (subview != last_subview-1) - canvas_draw_triangle(canvas,120,59,8,5,CanvasDirectionTopToBottom); + if(subview != 0) canvas_draw_triangle(canvas, 120, 5, 8, 5, CanvasDirectionBottomToTop); + if(subview != last_subview - 1) + canvas_draw_triangle(canvas, 120, 59, 8, 5, CanvasDirectionTopToBottom); } /* Handle up/down keys when we are in a subview. If the function catched * such keypress, it returns true, so that the actual view input callback * knows it can just return ASAP without doing anything. */ -bool ui_process_subview_updown(ProtoViewApp *app, InputEvent input, int last_subview) { +bool ui_process_subview_updown(ProtoViewApp* app, InputEvent input, int last_subview) { int subview = ui_get_current_subview(app); - if (input.type == InputTypePress) { - if (input.key == InputKeyUp) { - if (subview != 0) - app->current_subview[app->current_view]--; + if(input.type == InputTypePress) { + if(input.key == InputKeyUp) { + if(subview != 0) app->current_subview[app->current_view]--; return true; - } else if (input.key == InputKeyDown) { - if (subview != last_subview-1) - app->current_subview[app->current_view]++; + } else if(input.key == InputKeyDown) { + if(subview != last_subview - 1) app->current_subview[app->current_view]++; return true; } } @@ -62,16 +57,18 @@ bool ui_process_subview_updown(ProtoViewApp *app, InputEvent input, int last_sub * * Note: if the buffer is not a null-termined zero string, what it contains will * be used as initial input for the user. */ -void ui_show_keyboard(ProtoViewApp *app, char *buffer, uint32_t buflen, - void (*done_callback)(void*)) -{ +void ui_show_keyboard( + ProtoViewApp* app, + char* buffer, + uint32_t buflen, + void (*done_callback)(void*)) { app->show_text_input = true; app->text_input_buffer = buffer; app->text_input_buffer_len = buflen; app->text_input_done_callback = done_callback; } -void ui_dismiss_keyboard(ProtoViewApp *app) { +void ui_dismiss_keyboard(ProtoViewApp* app) { view_dispatcher_stop(app->view_dispatcher); } @@ -79,24 +76,24 @@ void ui_dismiss_keyboard(ProtoViewApp *app) { /* Set an alert message to be shown over any currently active view, for * the specified amount of time of 'ttl' milliseconds. */ -void ui_show_alert(ProtoViewApp *app, const char *text, uint32_t ttl) { +void ui_show_alert(ProtoViewApp* app, const char* text, uint32_t ttl) { app->alert_dismiss_time = furi_get_tick() + furi_ms_to_ticks(ttl); - snprintf(app->alert_text,ALERT_MAX_LEN,"%s",text); + snprintf(app->alert_text, ALERT_MAX_LEN, "%s", text); } /* Cancel the alert before its time has elapsed. */ -void ui_dismiss_alert(ProtoViewApp *app) { +void ui_dismiss_alert(ProtoViewApp* app) { app->alert_dismiss_time = 0; } /* Show the alert if an alert is set. This is called after the currently * active view displayed its stuff, so we overwrite the screen with the * alert message. */ -void ui_draw_alert_if_needed(Canvas *canvas, ProtoViewApp *app) { - if (app->alert_dismiss_time == 0) { +void ui_draw_alert_if_needed(Canvas* canvas, ProtoViewApp* app) { + if(app->alert_dismiss_time == 0) { /* No active alert. */ return; - } else if (app->alert_dismiss_time < furi_get_tick()) { + } else if(app->alert_dismiss_time < furi_get_tick()) { /* Alert just expired. */ ui_dismiss_alert(app); return; @@ -106,41 +103,43 @@ void ui_draw_alert_if_needed(Canvas *canvas, ProtoViewApp *app) { canvas_set_font(canvas, FontPrimary); uint8_t w = canvas_string_width(canvas, app->alert_text); uint8_t h = 8; // Font height. - uint8_t text_x = 64-(w/2); - uint8_t text_y = 32+4; + uint8_t text_x = 64 - (w / 2); + uint8_t text_y = 32 + 4; uint8_t padding = 3; - canvas_set_color(canvas,ColorBlack); - canvas_draw_box(canvas,text_x-padding,text_y-padding-h,w+padding*2,h+padding*2); - canvas_set_color(canvas,ColorWhite); - canvas_draw_box(canvas,text_x-padding+1,text_y-padding-h+1,w+padding*2-2,h+padding*2-2); - canvas_set_color(canvas,ColorBlack); - canvas_draw_str(canvas,text_x,text_y,app->alert_text); + canvas_set_color(canvas, ColorBlack); + canvas_draw_box( + canvas, text_x - padding, text_y - padding - h, w + padding * 2, h + padding * 2); + canvas_set_color(canvas, ColorWhite); + canvas_draw_box( + canvas, + text_x - padding + 1, + text_y - padding - h + 1, + w + padding * 2 - 2, + h + padding * 2 - 2); + canvas_set_color(canvas, ColorBlack); + canvas_draw_str(canvas, text_x, text_y, app->alert_text); } /* =========================== Canvas extensions ============================ */ -void canvas_draw_str_with_border(Canvas* canvas, uint8_t x, uint8_t y, const char* str, Color text_color, Color border_color) -{ +void canvas_draw_str_with_border( + Canvas* canvas, + uint8_t x, + uint8_t y, + const char* str, + Color text_color, + Color border_color) { struct { - uint8_t x; uint8_t y; - } dir[8] = { - {-1,-1}, - {0,-1}, - {1,-1}, - {1,0}, - {1,1}, - {0,1}, - {-1,1}, - {-1,0} - }; + uint8_t x; + uint8_t y; + } dir[8] = {{-1, -1}, {0, -1}, {1, -1}, {1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}}; /* Rotate in all the directions writing the same string to create a * border, then write the actual string in the other color in the * middle. */ canvas_set_color(canvas, border_color); - for (int j = 0; j < 8; j++) - canvas_draw_str(canvas,x+dir[j].x,y+dir[j].y,str); + for(int j = 0; j < 8; j++) canvas_draw_str(canvas, x + dir[j].x, y + dir[j].y, str); canvas_set_color(canvas, text_color); - canvas_draw_str(canvas,x,y,str); + canvas_draw_str(canvas, x, y, str); canvas_set_color(canvas, ColorBlack); } diff --git a/applications/plugins/protoview/view_build.c b/applications/plugins/protoview/view_build.c index fd276b61d..955855902 100644 --- a/applications/plugins/protoview/view_build.c +++ b/applications/plugins/protoview/view_build.c @@ -3,39 +3,38 @@ #include "app.h" -extern ProtoViewDecoder *Decoders[]; // Defined in signal.c. +extern ProtoViewDecoder* Decoders[]; // Defined in signal.c. /* Our view private data. */ #define USER_VALUE_LEN 64 typedef struct { - ProtoViewDecoder *decoder; /* Decoder we are using to create a + ProtoViewDecoder* decoder; /* Decoder we are using to create a message. */ - uint32_t cur_decoder; /* Decoder index when we are yet selecting + uint32_t cur_decoder; /* Decoder index when we are yet selecting a decoder. Used when decoder is NULL. */ - ProtoViewFieldSet *fieldset; /* The fields to populate. */ - uint32_t cur_field; /* Field we are editing right now. This + ProtoViewFieldSet* fieldset; /* The fields to populate. */ + uint32_t cur_field; /* Field we are editing right now. This is the index inside the 'fieldset' fields. */ - char *user_value; /* Keyboard input to replace the current + char* user_value; /* Keyboard input to replace the current field value goes here. */ } BuildViewPrivData; /* Not all the decoders support message bulding, so we can't just * increment / decrement the cur_decoder index here. */ -static void select_next_decoder(ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; - do { +static void select_next_decoder(ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; + do { privdata->cur_decoder++; - if (Decoders[privdata->cur_decoder] == NULL) - privdata->cur_decoder = 0; + if(Decoders[privdata->cur_decoder] == NULL) privdata->cur_decoder = 0; } while(Decoders[privdata->cur_decoder]->get_fields == NULL); } /* Like select_next_decoder() but goes backward. */ -static void select_prev_decoder(ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; +static void select_prev_decoder(ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; do { - if (privdata->cur_decoder == 0) { + if(privdata->cur_decoder == 0) { /* Go one after the last one to wrap around. */ while(Decoders[privdata->cur_decoder]) privdata->cur_decoder++; } @@ -45,69 +44,73 @@ static void select_prev_decoder(ProtoViewApp *app) { /* Render the view to select the decoder, among the ones that * support message building. */ -static void render_view_select_decoder(Canvas *const canvas, ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; +static void render_view_select_decoder(Canvas* const canvas, ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; canvas_set_font(canvas, FontPrimary); canvas_draw_str(canvas, 0, 9, "Signal creator"); canvas_set_font(canvas, FontSecondary); canvas_draw_str(canvas, 0, 19, "up/down: select, ok: choose"); canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas,64,38,AlignCenter,AlignCenter, - Decoders[privdata->cur_decoder]->name); + canvas_draw_str_aligned( + canvas, 64, 38, AlignCenter, AlignCenter, Decoders[privdata->cur_decoder]->name); } /* Render the view that allows the user to populate the fields needed * for the selected decoder to build a message. */ -static void render_view_set_fields(Canvas *const canvas, ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; +static void render_view_set_fields(Canvas* const canvas, ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; char buf[32]; - snprintf(buf,sizeof(buf), "%s field %d/%d", - privdata->decoder->name, (int)privdata->cur_field+1, + snprintf( + buf, + sizeof(buf), + "%s field %d/%d", + privdata->decoder->name, + (int)privdata->cur_field + 1, (int)privdata->fieldset->numfields); - canvas_set_color(canvas,ColorBlack); - canvas_draw_box(canvas,0,0,128,21); - canvas_set_color(canvas,ColorWhite); + canvas_set_color(canvas, ColorBlack); + canvas_draw_box(canvas, 0, 0, 128, 21); + canvas_set_color(canvas, ColorWhite); canvas_set_font(canvas, FontPrimary); canvas_draw_str(canvas, 1, 9, buf); canvas_set_font(canvas, FontSecondary); canvas_draw_str(canvas, 1, 19, "up/down: next field, ok: edit"); /* Write the field name, type, current content. */ - canvas_set_color(canvas,ColorBlack); - ProtoViewField *field = privdata->fieldset->fields[privdata->cur_field]; - snprintf(buf,sizeof(buf), "%s %s:%d", field->name, - field_get_type_name(field), (int)field->len); + canvas_set_color(canvas, ColorBlack); + ProtoViewField* field = privdata->fieldset->fields[privdata->cur_field]; + snprintf( + buf, sizeof(buf), "%s %s:%d", field->name, field_get_type_name(field), (int)field->len); buf[0] = toupper(buf[0]); canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas,64,30,AlignCenter,AlignCenter,buf); + canvas_draw_str_aligned(canvas, 64, 30, AlignCenter, AlignCenter, buf); canvas_set_font(canvas, FontSecondary); /* Render the current value between "" */ - unsigned int written = (unsigned int) field_to_string(buf+1,sizeof(buf)-1,field); + unsigned int written = (unsigned int)field_to_string(buf + 1, sizeof(buf) - 1, field); buf[0] = '"'; - if (written+3 < sizeof(buf)) memcpy(buf+written+1,"\"\x00",2); - canvas_draw_str_aligned(canvas,63,45,AlignCenter,AlignCenter,buf); + if(written + 3 < sizeof(buf)) memcpy(buf + written + 1, "\"\x00", 2); + canvas_draw_str_aligned(canvas, 63, 45, AlignCenter, AlignCenter, buf); /* Footer instructions. */ canvas_draw_str(canvas, 0, 62, "Long ok: create, < > incr/decr"); } /* Render the build message view. */ -void render_view_build_message(Canvas *const canvas, ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; +void render_view_build_message(Canvas* const canvas, ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; - if (privdata->decoder) - render_view_set_fields(canvas,app); + if(privdata->decoder) + render_view_set_fields(canvas, app); else - render_view_select_decoder(canvas,app); + render_view_select_decoder(canvas, app); } /* Handle input for the decoder selection. */ -static void process_input_select_decoder(ProtoViewApp *app, InputEvent input) { - BuildViewPrivData *privdata = app->view_privdata; - if (input.type == InputTypeShort) { - if (input.key == InputKeyOk) { +static void process_input_select_decoder(ProtoViewApp* app, InputEvent input) { + BuildViewPrivData* privdata = app->view_privdata; + if(input.type == InputTypeShort) { + if(input.key == InputKeyOk) { privdata->decoder = Decoders[privdata->cur_decoder]; privdata->fieldset = fieldset_new(); privdata->decoder->get_fields(privdata->fieldset); @@ -116,11 +119,8 @@ static void process_input_select_decoder(ProtoViewApp *app, InputEvent input) { * same decoder the user selected, let's populate the * defaults with the current values. So the user will * actaully edit the current message. */ - if (app->signal_decoded && - app->msg_info->decoder == privdata->decoder) - { - fieldset_copy_matching_fields(privdata->fieldset, - app->msg_info->fieldset); + if(app->signal_decoded && app->msg_info->decoder == privdata->decoder) { + fieldset_copy_matching_fields(privdata->fieldset, app->msg_info->fieldset); } /* Now we use the subview system in order to protect the @@ -128,10 +128,10 @@ static void process_input_select_decoder(ProtoViewApp *app, InputEvent input) { Since we are technically into a subview now, we'll have control of < and >. */ InputEvent ii = {.type = InputTypePress, .key = InputKeyDown}; - ui_process_subview_updown(app,ii,2); - } else if (input.key == InputKeyDown) { + ui_process_subview_updown(app, ii, 2); + } else if(input.key == InputKeyDown) { select_next_decoder(app); - } else if (input.key == InputKeyUp) { + } else if(input.key == InputKeyUp) { select_prev_decoder(app); } } @@ -140,12 +140,13 @@ static void process_input_select_decoder(ProtoViewApp *app, InputEvent input) { /* Called after the user typed the new field value in the keyboard. * Let's save it and remove the keyboard view. */ static void text_input_done_callback(void* context) { - ProtoViewApp *app = context; - BuildViewPrivData *privdata = app->view_privdata; + ProtoViewApp* app = context; + BuildViewPrivData* privdata = app->view_privdata; - if (field_set_from_string(privdata->fieldset->fields[privdata->cur_field], - privdata->user_value, strlen(privdata->user_value)) == false) - { + if(field_set_from_string( + privdata->fieldset->fields[privdata->cur_field], + privdata->user_value, + strlen(privdata->user_value)) == false) { ui_show_alert(app, "Invalid value", 1500); } @@ -160,94 +161,88 @@ static void text_input_done_callback(void* context) { * decrement the current field in a much simpler way. * * The current filed is changed by 'incr' amount. */ -static bool increment_current_field(ProtoViewApp *app, int incr) { - BuildViewPrivData *privdata = app->view_privdata; - ProtoViewFieldSet *fs = privdata->fieldset; - ProtoViewField *f = fs->fields[privdata->cur_field]; - return field_incr_value(f,incr); +static bool increment_current_field(ProtoViewApp* app, int incr) { + BuildViewPrivData* privdata = app->view_privdata; + ProtoViewFieldSet* fs = privdata->fieldset; + ProtoViewField* f = fs->fields[privdata->cur_field]; + return field_incr_value(f, incr); } /* Handle input for fields editing mode. */ -static void process_input_set_fields(ProtoViewApp *app, InputEvent input) { - BuildViewPrivData *privdata = app->view_privdata; - ProtoViewFieldSet *fs = privdata->fieldset; +static void process_input_set_fields(ProtoViewApp* app, InputEvent input) { + BuildViewPrivData* privdata = app->view_privdata; + ProtoViewFieldSet* fs = privdata->fieldset; - if (input.type == InputTypeShort && input.key == InputKeyOk) { + if(input.type == InputTypeShort && input.key == InputKeyOk) { /* Show the keyboard to let the user type the new * value. */ - if (privdata->user_value == NULL) - privdata->user_value = malloc(USER_VALUE_LEN); - field_to_string(privdata->user_value, USER_VALUE_LEN, - fs->fields[privdata->cur_field]); - ui_show_keyboard(app, privdata->user_value, USER_VALUE_LEN, - text_input_done_callback); - } else if (input.type == InputTypeShort && input.key == InputKeyDown) { - privdata->cur_field = (privdata->cur_field+1) % fs->numfields; - } else if (input.type == InputTypeShort && input.key == InputKeyUp) { - if (privdata->cur_field == 0) - privdata->cur_field = fs->numfields-1; + if(privdata->user_value == NULL) privdata->user_value = malloc(USER_VALUE_LEN); + field_to_string(privdata->user_value, USER_VALUE_LEN, fs->fields[privdata->cur_field]); + ui_show_keyboard(app, privdata->user_value, USER_VALUE_LEN, text_input_done_callback); + } else if(input.type == InputTypeShort && input.key == InputKeyDown) { + privdata->cur_field = (privdata->cur_field + 1) % fs->numfields; + } else if(input.type == InputTypeShort && input.key == InputKeyUp) { + if(privdata->cur_field == 0) + privdata->cur_field = fs->numfields - 1; else privdata->cur_field--; - } else if (input.type == InputTypeShort && input.key == InputKeyRight) { - increment_current_field(app,1); - } else if (input.type == InputTypeShort && input.key == InputKeyLeft) { - increment_current_field(app,-1); - } else if (input.type == InputTypeRepeat && input.key == InputKeyRight) { + } else if(input.type == InputTypeShort && input.key == InputKeyRight) { + increment_current_field(app, 1); + } else if(input.type == InputTypeShort && input.key == InputKeyLeft) { + increment_current_field(app, -1); + } else if(input.type == InputTypeRepeat && input.key == InputKeyRight) { // The reason why we don't use a large increment directly // is that certain field types only support +1 -1 increments. int times = 10; - while(times--) increment_current_field(app,1); - } else if (input.type == InputTypeRepeat && input.key == InputKeyLeft) { + while(times--) increment_current_field(app, 1); + } else if(input.type == InputTypeRepeat && input.key == InputKeyLeft) { int times = 10; - while(times--) increment_current_field(app,-1); - } else if (input.type == InputTypeLong && input.key == InputKeyOk) { + while(times--) increment_current_field(app, -1); + } else if(input.type == InputTypeLong && input.key == InputKeyOk) { // Build the message in a fresh raw buffer. - if (privdata->decoder->build_message) { - RawSamplesBuffer *rs = raw_samples_alloc(); - privdata->decoder->build_message(rs,privdata->fieldset); + if(privdata->decoder->build_message) { + RawSamplesBuffer* rs = raw_samples_alloc(); + privdata->decoder->build_message(rs, privdata->fieldset); app->signal_decoded = false; // So that the new signal will be - // accepted as the current signal. - scan_for_signal(app,rs); + // accepted as the current signal. + scan_for_signal(app, rs); raw_samples_free(rs); - ui_show_alert(app,"Done: press back key",3000); + ui_show_alert(app, "Done: press back key", 3000); } } } /* Handle input for the build message view. */ -void process_input_build_message(ProtoViewApp *app, InputEvent input) { - BuildViewPrivData *privdata = app->view_privdata; - if (privdata->decoder) - process_input_set_fields(app,input); +void process_input_build_message(ProtoViewApp* app, InputEvent input) { + BuildViewPrivData* privdata = app->view_privdata; + if(privdata->decoder) + process_input_set_fields(app, input); else - process_input_select_decoder(app,input); + process_input_select_decoder(app, input); } /* Enter view callback. */ -void view_enter_build_message(ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; +void view_enter_build_message(ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; // When we enter the view, the current decoder is just set to zero. // Seek the next valid if needed. - if (Decoders[privdata->cur_decoder]->get_fields == NULL) { + if(Decoders[privdata->cur_decoder]->get_fields == NULL) { select_next_decoder(app); } // However if there is currently a decoded message, and the // decoder of such message supports message building, let's // select it. - if (app->signal_decoded && - app->msg_info->decoder->get_fields && - app->msg_info->decoder->build_message) - { - while(Decoders[privdata->cur_decoder] != app->msg_info->decoder) - select_next_decoder(app); + if(app->signal_decoded && app->msg_info->decoder->get_fields && + app->msg_info->decoder->build_message) { + while(Decoders[privdata->cur_decoder] != app->msg_info->decoder) select_next_decoder(app); } } /* Called on exit for cleanup. */ -void view_exit_build_message(ProtoViewApp *app) { - BuildViewPrivData *privdata = app->view_privdata; - if (privdata->fieldset) fieldset_free(privdata->fieldset); - if (privdata->user_value) free(privdata->user_value); +void view_exit_build_message(ProtoViewApp* app) { + BuildViewPrivData* privdata = app->view_privdata; + if(privdata->fieldset) fieldset_free(privdata->fieldset); + if(privdata->user_value) free(privdata->user_value); } diff --git a/applications/plugins/protoview/view_direct_sampling.c b/applications/plugins/protoview/view_direct_sampling.c index 251a289b8..1ab90f096 100644 --- a/applications/plugins/protoview/view_direct_sampling.c +++ b/applications/plugins/protoview/view_direct_sampling.c @@ -7,47 +7,46 @@ /* Read directly from the G0 CC1101 pin, and draw a black or white * dot depending on the level. */ -void render_view_direct_sampling(Canvas *const canvas, ProtoViewApp *app) { - if (!app->direct_sampling_enabled) { +void render_view_direct_sampling(Canvas* const canvas, ProtoViewApp* app) { + if(!app->direct_sampling_enabled) { canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas,2,9,"Direct sampling is a special"); - canvas_draw_str(canvas,2,18,"mode that displays the signal"); - canvas_draw_str(canvas,2,27,"captured in real time. Like in"); - canvas_draw_str(canvas,2,36,"a old CRT TV. It's very slow."); - canvas_draw_str(canvas,2,45,"Can crash your Flipper."); + canvas_draw_str(canvas, 2, 9, "Direct sampling is a special"); + canvas_draw_str(canvas, 2, 18, "mode that displays the signal"); + canvas_draw_str(canvas, 2, 27, "captured in real time. Like in"); + canvas_draw_str(canvas, 2, 36, "a old CRT TV. It's very slow."); + canvas_draw_str(canvas, 2, 45, "Can crash your Flipper."); canvas_set_font(canvas, FontPrimary); - canvas_draw_str(canvas,14,60,"To enable press OK"); + canvas_draw_str(canvas, 14, 60, "To enable press OK"); return; } - for (int y = 0; y < 64; y++) { - for (int x = 0; x < 128; x++) { + for(int y = 0; y < 64; y++) { + for(int x = 0; x < 128; x++) { bool level = furi_hal_gpio_read(&gpio_cc1101_g0); - if (level) canvas_draw_dot(canvas,x,y); + if(level) canvas_draw_dot(canvas, x, y); /* Busy loop: this is a terrible approach as it blocks * everything else, but for now it's the best we can do * to obtain direct data with some spacing. */ - uint32_t x = 250; while(x--); + uint32_t x = 250; + while(x--) + ; } } canvas_set_font(canvas, FontSecondary); - canvas_draw_str_with_border(canvas,36,60,"Direct sampling", - ColorWhite,ColorBlack); + canvas_draw_str_with_border(canvas, 36, 60, "Direct sampling", ColorWhite, ColorBlack); } /* Handle input */ -void process_input_direct_sampling(ProtoViewApp *app, InputEvent input) { - if (input.type == InputTypePress && input.key == InputKeyOk) { +void process_input_direct_sampling(ProtoViewApp* app, InputEvent input) { + if(input.type == InputTypePress && input.key == InputKeyOk) { app->direct_sampling_enabled = !app->direct_sampling_enabled; } } /* Enter view. Stop the subghz thread to prevent access as we read * the CC1101 data directly. */ -void view_enter_direct_sampling(ProtoViewApp *app) { - if (app->txrx->txrx_state == TxRxStateRx && - !app->txrx->debug_timer_sampling) - { +void view_enter_direct_sampling(ProtoViewApp* app) { + if(app->txrx->txrx_state == TxRxStateRx && !app->txrx->debug_timer_sampling) { subghz_worker_stop(app->txrx->worker); } else { raw_sampling_worker_stop(app); @@ -55,10 +54,8 @@ void view_enter_direct_sampling(ProtoViewApp *app) { } /* Exit view. Restore the subghz thread. */ -void view_exit_direct_sampling(ProtoViewApp *app) { - if (app->txrx->txrx_state == TxRxStateRx && - !app->txrx->debug_timer_sampling) - { +void view_exit_direct_sampling(ProtoViewApp* app) { + if(app->txrx->txrx_state == TxRxStateRx && !app->txrx->debug_timer_sampling) { subghz_worker_start(app->txrx->worker); } else { raw_sampling_worker_start(app); diff --git a/applications/plugins/protoview/view_info.c b/applications/plugins/protoview/view_info.c index 6aa69739c..75fc58411 100644 --- a/applications/plugins/protoview/view_info.c +++ b/applications/plugins/protoview/view_info.c @@ -20,31 +20,29 @@ typedef struct { * so that the user can see what they are saving. With left/right * you can move to next rows. Here we store where we are. */ uint32_t signal_display_start_row; - char *filename; + char* filename; uint8_t cur_info_page; // Info page to display. Useful when there are - // too many fields populated by the decoder that - // a single page is not enough. + // too many fields populated by the decoder that + // a single page is not enough. } InfoViewPrivData; /* Draw the text label and value of the specified info field at x,y. */ -static void render_info_field(Canvas *const canvas, - ProtoViewField *f, uint8_t x, uint8_t y) -{ +static void render_info_field(Canvas* const canvas, ProtoViewField* f, uint8_t x, uint8_t y) { char buf[64]; char strval[32]; - field_to_string(strval,sizeof(strval),f); - snprintf(buf,sizeof(buf),"%s: %s", f->name, strval); + field_to_string(strval, sizeof(strval), f); + snprintf(buf, sizeof(buf), "%s: %s", f->name, strval); canvas_set_font(canvas, FontSecondary); canvas_draw_str(canvas, x, y, buf); } /* Render the view with the detected message information. */ #define INFO_LINES_PER_PAGE 5 -static void render_subview_main(Canvas *const canvas, ProtoViewApp *app) { - InfoViewPrivData *privdata = app->view_privdata; - uint8_t pages = (app->msg_info->fieldset->numfields - +(INFO_LINES_PER_PAGE-1)) / INFO_LINES_PER_PAGE; +static void render_subview_main(Canvas* const canvas, ProtoViewApp* app) { + InfoViewPrivData* privdata = app->view_privdata; + uint8_t pages = + (app->msg_info->fieldset->numfields + (INFO_LINES_PER_PAGE - 1)) / INFO_LINES_PER_PAGE; privdata->cur_info_page %= pages; uint8_t current_page = privdata->cur_info_page; char buf[32]; @@ -53,9 +51,9 @@ static void render_subview_main(Canvas *const canvas, ProtoViewApp *app) { canvas_set_font(canvas, FontPrimary); uint8_t y = 8, lineheight = 10; - if (pages > 1) { - snprintf(buf,sizeof(buf),"%s %u/%u", app->msg_info->decoder->name, - current_page+1, pages); + if(pages > 1) { + snprintf( + buf, sizeof(buf), "%s %u/%u", app->msg_info->decoder->name, current_page + 1, pages); canvas_draw_str(canvas, 0, y, buf); } else { canvas_draw_str(canvas, 0, y, app->msg_info->decoder->name); @@ -64,26 +62,30 @@ static void render_subview_main(Canvas *const canvas, ProtoViewApp *app) { /* Draw the info fields. */ uint8_t max_lines = INFO_LINES_PER_PAGE; - uint32_t j = current_page*max_lines; - while (j < app->msg_info->fieldset->numfields) { - render_info_field(canvas,app->msg_info->fieldset->fields[j++],0,y); + uint32_t j = current_page * max_lines; + while(j < app->msg_info->fieldset->numfields) { + render_info_field(canvas, app->msg_info->fieldset->fields[j++], 0, y); y += lineheight; - if (--max_lines == 0) break; + if(--max_lines == 0) break; } /* Draw a vertical "save" label. Temporary solution, to switch to * something better ASAP. */ y = 37; lineheight = 7; - canvas_draw_str(canvas, 119, y, "s"); y += lineheight; - canvas_draw_str(canvas, 119, y, "a"); y += lineheight; - canvas_draw_str(canvas, 119, y, "v"); y += lineheight; - canvas_draw_str(canvas, 119, y, "e"); y += lineheight; + canvas_draw_str(canvas, 119, y, "s"); + y += lineheight; + canvas_draw_str(canvas, 119, y, "a"); + y += lineheight; + canvas_draw_str(canvas, 119, y, "v"); + y += lineheight; + canvas_draw_str(canvas, 119, y, "e"); + y += lineheight; } /* Render view with save option. */ -static void render_subview_save(Canvas *const canvas, ProtoViewApp *app) { - InfoViewPrivData *privdata = app->view_privdata; +static void render_subview_save(Canvas* const canvas, ProtoViewApp* app) { + InfoViewPrivData* privdata = app->view_privdata; /* Display our signal in digital form: here we don't show the * signal with the exact timing of the received samples, but as it @@ -92,21 +94,20 @@ static void render_subview_save(Canvas *const canvas, ProtoViewApp *app) { uint8_t rowheight = 11; uint8_t bitwidth = 4; uint8_t bitheight = 5; - uint32_t idx = privdata->signal_display_start_row * (128/4); + uint32_t idx = privdata->signal_display_start_row * (128 / 4); bool prevbit = false; - for (uint8_t y = bitheight+12; y <= rows*rowheight; y += rowheight) { - for (uint8_t x = 0; x < 128; x += 4) { - bool bit = bitmap_get(app->msg_info->bits, - app->msg_info->bits_bytes,idx); - uint8_t prevy = y + prevbit*(bitheight*-1) - 1; - uint8_t thisy = y + bit*(bitheight*-1) - 1; - canvas_draw_line(canvas,x,prevy,x,thisy); - canvas_draw_line(canvas,x,thisy,x+bitwidth-1,thisy); + for(uint8_t y = bitheight + 12; y <= rows * rowheight; y += rowheight) { + for(uint8_t x = 0; x < 128; x += 4) { + bool bit = bitmap_get(app->msg_info->bits, app->msg_info->bits_bytes, idx); + uint8_t prevy = y + prevbit * (bitheight * -1) - 1; + uint8_t thisy = y + bit * (bitheight * -1) - 1; + canvas_draw_line(canvas, x, prevy, x, thisy); + canvas_draw_line(canvas, x, thisy, x + bitwidth - 1, thisy); prevbit = bit; - if (idx >= app->msg_info->pulses_count) { + if(idx >= app->msg_info->pulses_count) { canvas_set_color(canvas, ColorWhite); - canvas_draw_dot(canvas, x+1,thisy); - canvas_draw_dot(canvas, x+3,thisy); + canvas_draw_dot(canvas, x + 1, thisy); + canvas_draw_dot(canvas, x + 3, thisy); canvas_set_color(canvas, ColorBlack); } idx++; // Draw next bit @@ -118,28 +119,32 @@ static void render_subview_save(Canvas *const canvas, ProtoViewApp *app) { } /* Render the selected subview of this view. */ -void render_view_info(Canvas *const canvas, ProtoViewApp *app) { - if (app->signal_decoded == false) { +void render_view_info(Canvas* const canvas, ProtoViewApp* app) { + if(app->signal_decoded == false) { canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 30,36,"No signal decoded"); + canvas_draw_str(canvas, 30, 36, "No signal decoded"); return; } - ui_show_available_subviews(canvas,app,SubViewInfoLast); + ui_show_available_subviews(canvas, app, SubViewInfoLast); switch(app->current_subview[app->current_view]) { - case SubViewInfoMain: render_subview_main(canvas,app); break; - case SubViewInfoSave: render_subview_save(canvas,app); break; + case SubViewInfoMain: + render_subview_main(canvas, app); + break; + case SubViewInfoSave: + render_subview_save(canvas, app); + break; } } /* The user typed the file name. Let's save it and remove the keyboard * view. */ static void text_input_done_callback(void* context) { - ProtoViewApp *app = context; - InfoViewPrivData *privdata = app->view_privdata; + ProtoViewApp* app = context; + InfoViewPrivData* privdata = app->view_privdata; - FuriString *save_path = furi_string_alloc_printf( - "%s/%s.sub", EXT_PATH("subghz"), privdata->filename); + FuriString* save_path = + furi_string_alloc_printf("%s/%s.sub", EXT_PATH("subghz"), privdata->filename); save_signal(app, furi_string_get_cstr(save_path)); furi_string_free(save_path); @@ -151,22 +156,22 @@ static void text_input_done_callback(void* context) { /* Replace all the occurrences of character c1 with c2 in the specified * string. */ -void str_replace(char *buf, char c1, char c2) { - char *p = buf; +void str_replace(char* buf, char c1, char c2) { + char* p = buf; while(*p) { - if (*p == c1) *p = c2; + if(*p == c1) *p = c2; p++; } } /* Set a random filename the user can edit. */ -void set_signal_random_filename(ProtoViewApp *app, char *buf, size_t buflen) { +void set_signal_random_filename(ProtoViewApp* app, char* buf, size_t buflen) { char suffix[6]; - set_random_name(suffix,sizeof(suffix)); - snprintf(buf,buflen,"%.10s-%s-%d",app->msg_info->decoder->name,suffix,rand()%1000); - str_replace(buf,' ','_'); - str_replace(buf,'-','_'); - str_replace(buf,'/','_'); + set_random_name(suffix, sizeof(suffix)); + snprintf(buf, buflen, "%.10s-%s-%d", app->msg_info->decoder->name, suffix, rand() % 1000); + str_replace(buf, ' ', '_'); + str_replace(buf, '-', '_'); + str_replace(buf, '/', '_'); } /* ========================== Signal transmission =========================== */ @@ -180,20 +185,20 @@ typedef enum { SendSignalEndTransmission } SendSignalState; -#define PROTOVIEW_SENDSIGNAL_START_GAP 10000 /* microseconds. */ -#define PROTOVIEW_SENDSIGNAL_END_GAP 10000 /* microseconds. */ +#define PROTOVIEW_SENDSIGNAL_START_GAP 10000 /* microseconds. */ +#define PROTOVIEW_SENDSIGNAL_END_GAP 10000 /* microseconds. */ typedef struct { - SendSignalState state; // Current state. - uint32_t curpos; // Current bit position of data to send. - ProtoViewApp *app; // App reference. + SendSignalState state; // Current state. + uint32_t curpos; // Current bit position of data to send. + ProtoViewApp* app; // App reference. uint32_t start_gap_dur; // Gap to send at the start. - uint32_t end_gap_dur; // Gap to send at the end. + uint32_t end_gap_dur; // Gap to send at the end. } SendSignalCtx; /* Setup the state context for the callback responsible to feed data * to the subghz async tx system. */ -static void send_signal_init(SendSignalCtx *ss, ProtoViewApp *app) { +static void send_signal_init(SendSignalCtx* ss, ProtoViewApp* app) { ss->state = SendSignalSendStartGap; ss->curpos = 0; ss->app = app; @@ -214,27 +219,26 @@ static void send_signal_init(SendSignalCtx *ss, ProtoViewApp *app) { * message we are, in ss->curoff. We also send a start and end gap in order * to make sure the transmission is clear. */ -LevelDuration radio_tx_feed_data(void *ctx) { - SendSignalCtx *ss = ctx; +LevelDuration radio_tx_feed_data(void* ctx) { + SendSignalCtx* ss = ctx; /* Send start gap. */ - if (ss->state == SendSignalSendStartGap) { + if(ss->state == SendSignalSendStartGap) { ss->state = SendSignalSendBits; - return level_duration_make(0,ss->start_gap_dur); + return level_duration_make(0, ss->start_gap_dur); } /* Send data. */ - if (ss->state == SendSignalSendBits) { + if(ss->state == SendSignalSendBits) { uint32_t dur = 0, j; uint32_t level = 0; /* Let's see how many consecutive bits we have with the same * level. */ - for (j = 0; ss->curpos+j < ss->app->msg_info->pulses_count; j++) { - uint32_t l = bitmap_get(ss->app->msg_info->bits, - ss->app->msg_info->bits_bytes, - ss->curpos+j); - if (j == 0) { + for(j = 0; ss->curpos + j < ss->app->msg_info->pulses_count; j++) { + uint32_t l = + bitmap_get(ss->app->msg_info->bits, ss->app->msg_info->bits_bytes, ss->curpos + j); + if(j == 0) { /* At the first bit of this sequence, we store the * level of the sequence. */ level = l; @@ -244,22 +248,21 @@ LevelDuration radio_tx_feed_data(void *ctx) { /* As long as the level is the same, we update the duration. * Otherwise stop the loop and return this sample. */ - if (l != level) break; + if(l != level) break; dur += ss->app->msg_info->short_pulse_dur; } ss->curpos += j; /* If this was the last set of bits, change the state to * send the final gap. */ - if (ss->curpos >= ss->app->msg_info->pulses_count) - ss->state = SendSignalSendEndGap; + if(ss->curpos >= ss->app->msg_info->pulses_count) ss->state = SendSignalSendEndGap; return level_duration_make(level, dur); } /* Send end gap. */ - if (ss->state == SendSignalSendEndGap) { + if(ss->state == SendSignalSendEndGap) { ss->state = SendSignalEndTransmission; - return level_duration_make(0,ss->end_gap_dur); + return level_duration_make(0, ss->end_gap_dur); } /* End transmission. Here state is guaranteed @@ -268,7 +271,7 @@ LevelDuration radio_tx_feed_data(void *ctx) { } /* Vibrate and produce a click sound when a signal is sent. */ -void notify_signal_sent(ProtoViewApp *app) { +void notify_signal_sent(ProtoViewApp* app) { static const NotificationSequence sent_seq = { &message_blue_255, &message_vibro_on, @@ -277,59 +280,53 @@ void notify_signal_sent(ProtoViewApp *app) { &message_sound_off, &message_vibro_off, &message_blue_0, - NULL - }; + NULL}; notification_message(app->notification, &sent_seq); } /* Handle input for the info view. */ -void process_input_info(ProtoViewApp *app, InputEvent input) { +void process_input_info(ProtoViewApp* app, InputEvent input) { /* If we don't have a decoded signal, we don't allow to go up/down * in the subviews: they are only useful when a loaded signal. */ - if (app->signal_decoded && - ui_process_subview_updown(app,input,SubViewInfoLast)) return; + if(app->signal_decoded && ui_process_subview_updown(app, input, SubViewInfoLast)) return; - InfoViewPrivData *privdata = app->view_privdata; + InfoViewPrivData* privdata = app->view_privdata; int subview = ui_get_current_subview(app); /* Main subview. */ - if (subview == SubViewInfoMain) { - if (input.type == InputTypeLong && input.key == InputKeyOk) { + if(subview == SubViewInfoMain) { + if(input.type == InputTypeLong && input.key == InputKeyOk) { /* Reset the current sample to capture the next. */ reset_current_signal(app); - } else if (input.type == InputTypeShort && input.key == InputKeyOk) { + } else if(input.type == InputTypeShort && input.key == InputKeyOk) { /* Show next info page. */ privdata->cur_info_page++; } - } else if (subview == SubViewInfoSave) { - /* Save subview. */ - if (input.type == InputTypePress && input.key == InputKeyRight) { + } else if(subview == SubViewInfoSave) { + /* Save subview. */ + if(input.type == InputTypePress && input.key == InputKeyRight) { privdata->signal_display_start_row++; - } else if (input.type == InputTypePress && input.key == InputKeyLeft) { - if (privdata->signal_display_start_row != 0) - privdata->signal_display_start_row--; - } else if (input.type == InputTypeLong && input.key == InputKeyOk) - { + } else if(input.type == InputTypePress && input.key == InputKeyLeft) { + if(privdata->signal_display_start_row != 0) privdata->signal_display_start_row--; + } else if(input.type == InputTypeLong && input.key == InputKeyOk) { // We have have the buffer already allocated, in case the // user aborted with BACK a previous saving. - if (privdata->filename == NULL) - privdata->filename = malloc(SAVE_FILENAME_LEN); - set_signal_random_filename(app,privdata->filename,SAVE_FILENAME_LEN); - ui_show_keyboard(app, privdata->filename, SAVE_FILENAME_LEN, - text_input_done_callback); - } else if (input.type == InputTypeShort && input.key == InputKeyOk) { + if(privdata->filename == NULL) privdata->filename = malloc(SAVE_FILENAME_LEN); + set_signal_random_filename(app, privdata->filename, SAVE_FILENAME_LEN); + ui_show_keyboard(app, privdata->filename, SAVE_FILENAME_LEN, text_input_done_callback); + } else if(input.type == InputTypeShort && input.key == InputKeyOk) { SendSignalCtx send_state; - send_signal_init(&send_state,app); - radio_tx_signal(app,radio_tx_feed_data,&send_state); + send_signal_init(&send_state, app); + radio_tx_signal(app, radio_tx_feed_data, &send_state); notify_signal_sent(app); } } } /* Called on view exit. */ -void view_exit_info(ProtoViewApp *app) { - InfoViewPrivData *privdata = app->view_privdata; +void view_exit_info(ProtoViewApp* app) { + InfoViewPrivData* privdata = app->view_privdata; // When the user aborts the keyboard input, we are left with the // filename buffer allocated. - if (privdata->filename) free(privdata->filename); + if(privdata->filename) free(privdata->filename); } diff --git a/applications/plugins/protoview/view_raw_signal.c b/applications/plugins/protoview/view_raw_signal.c index 023e986f9..38354bef9 100644 --- a/applications/plugins/protoview/view_raw_signal.c +++ b/applications/plugins/protoview/view_raw_signal.c @@ -12,7 +12,7 @@ * * The 'idx' argument is the first sample to render in the circular * buffer. */ -void render_signal(ProtoViewApp *app, Canvas *const canvas, RawSamplesBuffer *buf, uint32_t idx) { +void render_signal(ProtoViewApp* app, Canvas* const canvas, RawSamplesBuffer* buf, uint32_t idx) { canvas_set_color(canvas, ColorBlack); int rows = 8; @@ -20,31 +20,29 @@ void render_signal(ProtoViewApp *app, Canvas *const canvas, RawSamplesBuffer *bu uint32_t start_idx = idx; bool level = 0; uint32_t dur = 0, sample_num = 0; - for (int row = 0; row < rows ; row++) { - for (int x = 0; x < 128; x++) { - int y = 3 + row*8; - if (dur < time_per_pixel/2) { + for(int row = 0; row < rows; row++) { + for(int x = 0; x < 128; x++) { + int y = 3 + row * 8; + if(dur < time_per_pixel / 2) { /* Get more data. */ raw_samples_get(buf, idx++, &level, &dur); sample_num++; } - canvas_draw_line(canvas, x,y,x,y-(level*3)); + canvas_draw_line(canvas, x, y, x, y - (level * 3)); /* Write a small triangle under the last sample detected. */ - if (app->signal_bestlen != 0 && - sample_num+start_idx == app->signal_bestlen+1) - { - canvas_draw_dot(canvas,x,y+2); - canvas_draw_dot(canvas,x-1,y+3); - canvas_draw_dot(canvas,x,y+3); - canvas_draw_dot(canvas,x+1,y+3); + if(app->signal_bestlen != 0 && sample_num + start_idx == app->signal_bestlen + 1) { + canvas_draw_dot(canvas, x, y + 2); + canvas_draw_dot(canvas, x - 1, y + 3); + canvas_draw_dot(canvas, x, y + 3); + canvas_draw_dot(canvas, x + 1, y + 3); sample_num++; /* Make sure we don't mark the next, too. */ } /* Remove from the current level duration the time we * just plot. */ - if (dur > time_per_pixel) + if(dur > time_per_pixel) dur -= time_per_pixel; else dur = 0; @@ -53,61 +51,63 @@ void render_signal(ProtoViewApp *app, Canvas *const canvas, RawSamplesBuffer *bu } /* Raw pulses rendering. This is our default view. */ -void render_view_raw_pulses(Canvas *const canvas, ProtoViewApp *app) { +void render_view_raw_pulses(Canvas* const canvas, ProtoViewApp* app) { /* Show signal. */ render_signal(app, canvas, DetectedSamples, app->signal_offset); /* Show signal information. */ char buf[64]; - snprintf(buf,sizeof(buf),"%luus", - (unsigned long)DetectedSamples->short_pulse_dur); + snprintf(buf, sizeof(buf), "%luus", (unsigned long)DetectedSamples->short_pulse_dur); canvas_set_font(canvas, FontSecondary); canvas_draw_str_with_border(canvas, 97, 63, buf, ColorWhite, ColorBlack); - if (app->signal_decoded) { + if(app->signal_decoded) { canvas_set_font(canvas, FontPrimary); - canvas_draw_str_with_border(canvas, 1, 61, app->msg_info->decoder->name, ColorWhite, ColorBlack); + canvas_draw_str_with_border( + canvas, 1, 61, app->msg_info->decoder->name, ColorWhite, ColorBlack); } } /* Handle input for the raw pulses view. */ -void process_input_raw_pulses(ProtoViewApp *app, InputEvent input) { - if (input.type == InputTypeRepeat) { +void process_input_raw_pulses(ProtoViewApp* app, InputEvent input) { + if(input.type == InputTypeRepeat) { /* Handle panning of the signal window. Long pressing * right will show successive samples, long pressing left * previous samples. */ - if (input.key == InputKeyRight) app->signal_offset++; - else if (input.key == InputKeyLeft) app->signal_offset--; - } else if (input.type == InputTypeLong) { - if (input.key == InputKeyOk) { + if(input.key == InputKeyRight) + app->signal_offset++; + else if(input.key == InputKeyLeft) + app->signal_offset--; + } else if(input.type == InputTypeLong) { + if(input.key == InputKeyOk) { /* Reset the current sample to capture the next. */ reset_current_signal(app); } - } else if (input.type == InputTypeShort) { - if (input.key == InputKeyOk) { + } else if(input.type == InputTypeShort) { + if(input.key == InputKeyOk) { app->signal_offset = 0; - adjust_raw_view_scale(app,DetectedSamples->short_pulse_dur); - } else if (input.key == InputKeyDown) { + adjust_raw_view_scale(app, DetectedSamples->short_pulse_dur); + } else if(input.key == InputKeyDown) { /* Rescaling. The set becomes finer under 50us per pixel. */ uint32_t scale_step = app->us_scale >= 50 ? 50 : 10; - if (app->us_scale < 500) app->us_scale += scale_step; - } else if (input.key == InputKeyUp) { + if(app->us_scale < 500) app->us_scale += scale_step; + } else if(input.key == InputKeyUp) { uint32_t scale_step = app->us_scale > 50 ? 50 : 10; - if (app->us_scale > 10) app->us_scale -= scale_step; + if(app->us_scale > 10) app->us_scale -= scale_step; } } } /* Adjust raw view scale depending on short pulse duration. */ -void adjust_raw_view_scale(ProtoViewApp *app, uint32_t short_pulse_dur) { - if (short_pulse_dur == 0) +void adjust_raw_view_scale(ProtoViewApp* app, uint32_t short_pulse_dur) { + if(short_pulse_dur == 0) app->us_scale = PROTOVIEW_RAW_VIEW_DEFAULT_SCALE; - else if (short_pulse_dur < 75) + else if(short_pulse_dur < 75) app->us_scale = 10; - else if (short_pulse_dur < 145) + else if(short_pulse_dur < 145) app->us_scale = 30; - else if (short_pulse_dur < 400) + else if(short_pulse_dur < 400) app->us_scale = 100; - else if (short_pulse_dur < 1000) + else if(short_pulse_dur < 1000) app->us_scale = 200; else app->us_scale = PROTOVIEW_RAW_VIEW_DEFAULT_SCALE; diff --git a/applications/plugins/protoview/view_settings.c b/applications/plugins/protoview/view_settings.c index 1e2dce226..09abf5a2a 100644 --- a/applications/plugins/protoview/view_settings.c +++ b/applications/plugins/protoview/view_settings.c @@ -6,30 +6,30 @@ /* Renders a single view with frequency and modulation setting. However * this are logically two different views, and only one of the settings * will be highlighted. */ -void render_view_settings(Canvas *const canvas, ProtoViewApp *app) { +void render_view_settings(Canvas* const canvas, ProtoViewApp* app) { canvas_set_font(canvas, FontPrimary); - if (app->current_view == ViewFrequencySettings) - canvas_draw_str_with_border(canvas,1,10,"Frequency",ColorWhite,ColorBlack); + if(app->current_view == ViewFrequencySettings) + canvas_draw_str_with_border(canvas, 1, 10, "Frequency", ColorWhite, ColorBlack); else - canvas_draw_str(canvas,1,10,"Frequency"); + canvas_draw_str(canvas, 1, 10, "Frequency"); - if (app->current_view == ViewModulationSettings) - canvas_draw_str_with_border(canvas,70,10,"Modulation",ColorWhite,ColorBlack); + if(app->current_view == ViewModulationSettings) + canvas_draw_str_with_border(canvas, 70, 10, "Modulation", ColorWhite, ColorBlack); else - canvas_draw_str(canvas,70,10,"Modulation"); + canvas_draw_str(canvas, 70, 10, "Modulation"); canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas,10,61,"Use up and down to modify"); + canvas_draw_str(canvas, 10, 61, "Use up and down to modify"); - if (app->txrx->debug_timer_sampling) - canvas_draw_str(canvas,3,52,"(DEBUG timer sampling is ON)"); + if(app->txrx->debug_timer_sampling) + canvas_draw_str(canvas, 3, 52, "(DEBUG timer sampling is ON)"); /* Show frequency. We can use big numbers font since it's just a number. */ - if (app->current_view == ViewFrequencySettings) { + if(app->current_view == ViewFrequencySettings) { char buf[16]; - snprintf(buf,sizeof(buf),"%.2f",(double)app->frequency/1000000); + snprintf(buf, sizeof(buf), "%.2f", (double)app->frequency / 1000000); canvas_set_font(canvas, FontBigNumbers); canvas_draw_str(canvas, 30, 40, buf); - } else if (app->current_view == ViewModulationSettings) { + } else if(app->current_view == ViewModulationSettings) { int current = app->modulation; canvas_set_font(canvas, FontPrimary); canvas_draw_str(canvas, 33, 39, ProtoViewModulations[current].name); @@ -37,13 +37,13 @@ void render_view_settings(Canvas *const canvas, ProtoViewApp *app) { } /* Handle input for the settings view. */ -void process_input_settings(ProtoViewApp *app, InputEvent input) { - if (input.type == InputTypeLong && input.key == InputKeyOk) { +void process_input_settings(ProtoViewApp* app, InputEvent input) { + if(input.type == InputTypeLong && input.key == InputKeyOk) { /* Long pressing to OK sets the default frequency and * modulation. */ app->frequency = subghz_setting_get_default_frequency(app->setting); app->modulation = 0; - } else if (0 && input.type == InputTypeLong && input.key == InputKeyDown) { + } else if(0 && input.type == InputTypeLong && input.key == InputKeyDown) { /* Long pressing to down switches between normal and debug * timer sampling mode. NOTE: this feature is disabled for users, * only useful for devs (if useful at all). */ @@ -55,42 +55,40 @@ void process_input_settings(ProtoViewApp *app, InputEvent input) { app->txrx->debug_timer_sampling = !app->txrx->debug_timer_sampling; radio_begin(app); radio_rx(app); - } else if (input.type == InputTypePress && - (input.key != InputKeyDown || input.key != InputKeyUp)) - { + } else if(input.type == InputTypePress && (input.key != InputKeyDown || input.key != InputKeyUp)) { /* Handle up and down to change frequency or modulation. */ - if (app->current_view == ViewFrequencySettings) { + if(app->current_view == ViewFrequencySettings) { size_t curidx = 0, i; size_t count = subghz_setting_get_frequency_count(app->setting); /* Scan the list of frequencies to check for the index of the * currently set frequency. */ for(i = 0; i < count; i++) { - uint32_t freq = subghz_setting_get_frequency(app->setting,i); - if (freq == app->frequency) { + uint32_t freq = subghz_setting_get_frequency(app->setting, i); + if(freq == app->frequency) { curidx = i; break; } } - if (i == count) return; /* Should never happen. */ + if(i == count) return; /* Should never happen. */ - if (input.key == InputKeyUp) { - curidx = curidx == 0 ? count-1 : curidx-1; - } else if (input.key == InputKeyDown) { - curidx = (curidx+1) % count; + if(input.key == InputKeyUp) { + curidx = curidx == 0 ? count - 1 : curidx - 1; + } else if(input.key == InputKeyDown) { + curidx = (curidx + 1) % count; } else { return; } - app->frequency = subghz_setting_get_frequency(app->setting,curidx); - } else if (app->current_view == ViewModulationSettings) { + app->frequency = subghz_setting_get_frequency(app->setting, curidx); + } else if(app->current_view == ViewModulationSettings) { uint32_t count = 0; uint32_t modid = app->modulation; while(ProtoViewModulations[count].name != NULL) count++; - if (input.key == InputKeyUp) { - modid = modid == 0 ? count-1 : modid-1; - } else if (input.key == InputKeyDown) { - modid = (modid+1) % count; + if(input.key == InputKeyUp) { + modid = modid == 0 ? count - 1 : modid - 1; + } else if(input.key == InputKeyDown) { + modid = (modid + 1) % count; } else { return; } @@ -106,9 +104,13 @@ void process_input_settings(ProtoViewApp *app, InputEvent input) { /* When the user switches to some other view, if they changed the parameters * we need to restart the radio with the right frequency and modulation. */ -void view_exit_settings(ProtoViewApp *app) { - if (app->txrx->freq_mod_changed) { - FURI_LOG_E(TAG, "Setting view, setting frequency/modulation to %lu %s", app->frequency, ProtoViewModulations[app->modulation].name); +void view_exit_settings(ProtoViewApp* app) { + if(app->txrx->freq_mod_changed) { + FURI_LOG_E( + TAG, + "Setting view, setting frequency/modulation to %lu %s", + app->frequency, + ProtoViewModulations[app->modulation].name); radio_rx_end(app); radio_begin(app); radio_rx(app); diff --git a/applications/plugins/tama_p1/hal.c b/applications/plugins/tama_p1/hal.c index 211457803..585cd88c4 100644 --- a/applications/plugins/tama_p1/hal.c +++ b/applications/plugins/tama_p1/hal.c @@ -40,7 +40,7 @@ static void tama_p1_hal_log(log_level_t level, char* buff, ...) { va_list args; va_start(args, buff); furi_string_cat_vprintf(string, buff, args); - va_end(args); + va_end(args); switch(level) { case LOG_ERROR: diff --git a/applications/plugins/tama_p1/tama.h b/applications/plugins/tama_p1/tama.h index e2a267443..e8eecc945 100644 --- a/applications/plugins/tama_p1/tama.h +++ b/applications/plugins/tama_p1/tama.h @@ -13,7 +13,6 @@ #define STATE_FILE_VERSION 2 #define TAMA_SAVE_PATH EXT_PATH("tama_p1/save.bin") - typedef struct { FuriThread* thread; hal_t hal; diff --git a/applications/plugins/tama_p1/tama_p1.c b/applications/plugins/tama_p1/tama_p1.c index 7184638d7..0e7686a06 100644 --- a/applications/plugins/tama_p1/tama_p1.c +++ b/applications/plugins/tama_p1/tama_p1.c @@ -52,7 +52,6 @@ static void tama_p1_draw_callback(Canvas* const canvas, void* cb_ctx) { uint16_t lcd_icon_lower_left = lcd_matrix_left; uint16_t lcd_icon_spacing_horiz = (lcd_matrix_scaled_width - (4 * TAMA_LCD_ICON_SIZE)) / 3 + TAMA_LCD_ICON_SIZE; - uint16_t y = lcd_matrix_top; for(uint8_t row = 0; row < 16; ++row) { @@ -71,7 +70,7 @@ static void tama_p1_draw_callback(Canvas* const canvas, void* cb_ctx) { // Start drawing icons uint8_t lcd_icons = g_ctx->icons; - + // Draw top icons y = lcd_icon_upper_top; // y = 64 - TAMA_LCD_ICON_SIZE; @@ -114,135 +113,134 @@ static void tama_p1_update_timer_callback(FuriMessageQueue* event_queue) { TamaEvent event = {.type = EventTypeTick}; furi_message_queue_put(event_queue, &event, 0); } - -static void tama_p1_load_state() { - state_t *state; + +static void tama_p1_load_state() { + state_t* state; uint8_t buf[4]; - bool error = false; + bool error = false; state = tamalib_get_state(); - Storage* storage = furi_record_open(RECORD_STORAGE); - File* file = storage_file_alloc(storage); - if(storage_file_open(file, TAMA_SAVE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { - - storage_file_read(file, &buf, 4); - if (buf[0] != (uint8_t) STATE_FILE_MAGIC[0] || buf[1] != (uint8_t) STATE_FILE_MAGIC[1] || - buf[2] != (uint8_t) STATE_FILE_MAGIC[2] || buf[3] != (uint8_t) STATE_FILE_MAGIC[3]) { + Storage* storage = furi_record_open(RECORD_STORAGE); + File* file = storage_file_alloc(storage); + if(storage_file_open(file, TAMA_SAVE_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { + storage_file_read(file, &buf, 4); + if(buf[0] != (uint8_t)STATE_FILE_MAGIC[0] || buf[1] != (uint8_t)STATE_FILE_MAGIC[1] || + buf[2] != (uint8_t)STATE_FILE_MAGIC[2] || buf[3] != (uint8_t)STATE_FILE_MAGIC[3]) { FURI_LOG_E(TAG, "FATAL: Wrong state file magic in \"%s\" !\n", TAMA_SAVE_PATH); error = true; } - storage_file_read(file, &buf, 1); - if (buf[0] != STATE_FILE_VERSION) { + storage_file_read(file, &buf, 1); + if(buf[0] != STATE_FILE_VERSION) { FURI_LOG_E(TAG, "FATAL: Unsupported version"); error = true; } - if (!error) { + if(!error) { FURI_LOG_D(TAG, "Reading save.bin"); - storage_file_read(file, &buf, 2); - *(state->pc) = buf[0] | ((buf[1] & 0x1F) << 8); - - storage_file_read(file, &buf, 2); - *(state->x) = buf[0] | ((buf[1] & 0xF) << 8); + storage_file_read(file, &buf, 2); + *(state->pc) = buf[0] | ((buf[1] & 0x1F) << 8); - storage_file_read(file, &buf, 2); - *(state->y) = buf[0] | ((buf[1] & 0xF) << 8); + storage_file_read(file, &buf, 2); + *(state->x) = buf[0] | ((buf[1] & 0xF) << 8); - storage_file_read(file, &buf, 1); - *(state->a) = buf[0] & 0xF; + storage_file_read(file, &buf, 2); + *(state->y) = buf[0] | ((buf[1] & 0xF) << 8); - storage_file_read(file, &buf, 1); - *(state->b) = buf[0] & 0xF; + storage_file_read(file, &buf, 1); + *(state->a) = buf[0] & 0xF; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); + *(state->b) = buf[0] & 0xF; + + storage_file_read(file, &buf, 1); *(state->np) = buf[0] & 0x1F; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); *(state->sp) = buf[0]; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); *(state->flags) = buf[0] & 0xF; - storage_file_read(file, &buf, 4); + storage_file_read(file, &buf, 4); *(state->tick_counter) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); - storage_file_read(file, &buf, 4); - *(state->clk_timer_timestamp) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); + storage_file_read(file, &buf, 4); + *(state->clk_timer_timestamp) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | + (buf[3] << 24); - storage_file_read(file, &buf, 4); - *(state->prog_timer_timestamp) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); + storage_file_read(file, &buf, 4); + *(state->prog_timer_timestamp) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | + (buf[3] << 24); - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); *(state->prog_timer_enabled) = buf[0] & 0x1; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); *(state->prog_timer_data) = buf[0]; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); *(state->prog_timer_rld) = buf[0]; - storage_file_read(file, &buf, 4); + storage_file_read(file, &buf, 4); *(state->call_depth) = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); FURI_LOG_D(TAG, "Restoring Interupts"); - for (uint32_t i = 0; i < INT_SLOT_NUM; i++) { - storage_file_read(file, &buf, 1); + for(uint32_t i = 0; i < INT_SLOT_NUM; i++) { + storage_file_read(file, &buf, 1); state->interrupts[i].factor_flag_reg = buf[0] & 0xF; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); state->interrupts[i].mask_reg = buf[0] & 0xF; - storage_file_read(file, &buf, 1); + storage_file_read(file, &buf, 1); state->interrupts[i].triggered = buf[0] & 0x1; } /* First 640 half bytes correspond to the RAM */ FURI_LOG_D(TAG, "Restoring RAM"); - for (uint32_t i = 0; i < MEM_RAM_SIZE; i++) { - storage_file_read(file, &buf, 1); + for(uint32_t i = 0; i < MEM_RAM_SIZE; i++) { + storage_file_read(file, &buf, 1); SET_RAM_MEMORY(state->memory, i + MEM_RAM_ADDR, buf[0] & 0xF); } /* I/Os are from 0xF00 to 0xF7F */ FURI_LOG_D(TAG, "Restoring I/O"); - for (uint32_t i = 0; i < MEM_IO_SIZE; i++) { - storage_file_read(file, &buf, 1); + for(uint32_t i = 0; i < MEM_IO_SIZE; i++) { + storage_file_read(file, &buf, 1); SET_IO_MEMORY(state->memory, i + MEM_IO_ADDR, buf[0] & 0xF); - } - FURI_LOG_D(TAG, "Refreshing Hardware"); - tamalib_refresh_hw(); - } + } + FURI_LOG_D(TAG, "Refreshing Hardware"); + tamalib_refresh_hw(); + } } - + storage_file_close(file); storage_file_free(file); - furi_record_close(RECORD_STORAGE); + furi_record_close(RECORD_STORAGE); } - static void tama_p1_save_state() { - // Saving state FURI_LOG_D(TAG, "Saving Gamestate"); uint8_t buf[4]; - state_t *state; + state_t* state; uint32_t offset = 0; state = tamalib_get_state(); - - Storage* storage = furi_record_open(RECORD_STORAGE); - File* file = storage_file_alloc(storage); + + Storage* storage = furi_record_open(RECORD_STORAGE); + File* file = storage_file_alloc(storage); if(storage_file_open(file, TAMA_SAVE_PATH, FSAM_WRITE, FSOM_CREATE_ALWAYS)) { - buf[0] = (uint8_t) STATE_FILE_MAGIC[0]; - buf[1] = (uint8_t) STATE_FILE_MAGIC[1]; - buf[2] = (uint8_t) STATE_FILE_MAGIC[2]; - buf[3] = (uint8_t) STATE_FILE_MAGIC[3]; + buf[0] = (uint8_t)STATE_FILE_MAGIC[0]; + buf[1] = (uint8_t)STATE_FILE_MAGIC[1]; + buf[2] = (uint8_t)STATE_FILE_MAGIC[2]; + buf[3] = (uint8_t)STATE_FILE_MAGIC[3]; offset += storage_file_write(file, &buf, sizeof(buf)); - + buf[0] = STATE_FILE_VERSION & 0xFF; offset += storage_file_write(file, &buf, 1); - + buf[0] = *(state->pc) & 0xFF; buf[1] = (*(state->pc) >> 8) & 0x1F; offset += storage_file_write(file, &buf, 2); @@ -303,7 +301,7 @@ static void tama_p1_save_state() { buf[3] = (*(state->call_depth) >> 24) & 0xFF; offset += storage_file_write(file, &buf, sizeof(buf)); - for (uint32_t i = 0; i < INT_SLOT_NUM; i++) { + for(uint32_t i = 0; i < INT_SLOT_NUM; i++) { buf[0] = state->interrupts[i].factor_flag_reg & 0xF; offset += storage_file_write(file, &buf, 1); @@ -315,17 +313,17 @@ static void tama_p1_save_state() { } /* First 640 half bytes correspond to the RAM */ - for (uint32_t i = 0; i < MEM_RAM_SIZE; i++) { + for(uint32_t i = 0; i < MEM_RAM_SIZE; i++) { buf[0] = GET_RAM_MEMORY(state->memory, i + MEM_RAM_ADDR) & 0xF; offset += storage_file_write(file, &buf, 1); } /* I/Os are from 0xF00 to 0xF7F */ - for (uint32_t i = 0; i < MEM_IO_SIZE; i++) { + for(uint32_t i = 0; i < MEM_IO_SIZE; i++) { buf[0] = GET_IO_MEMORY(state->memory, i + MEM_IO_ADDR) & 0xF; offset += storage_file_write(file, &buf, 1); } - } + } storage_file_close(file); storage_file_free(file); furi_record_close(RECORD_STORAGE); @@ -333,7 +331,6 @@ static void tama_p1_save_state() { FURI_LOG_D(TAG, "Finished Writing %lu", offset); } - static int32_t tama_p1_worker(void* context) { bool running = true; FuriMutex* mutex = context; @@ -357,8 +354,6 @@ static int32_t tama_p1_worker(void* context) { furi_mutex_release(mutex); return 0; } - - static void tama_p1_init(TamaApp* const ctx) { g_ctx = ctx; @@ -485,9 +480,9 @@ int32_t tama_p1_app(void* p) { tamalib_set_button(BTN_MIDDLE, tama_btn_state); } else if(event.input.key == InputKeyRight) { tamalib_set_button(BTN_RIGHT, tama_btn_state); - } else if(event.input.key == InputKeyDown && event.input.type == InputTypeShort) { + } else if(event.input.key == InputKeyDown && event.input.type == InputTypeShort) { // TODO: pause or fast-forward tamagotchi - tama_p1_save_state(); + tama_p1_save_state(); } else if(event.input.key == InputKeyUp) { // mute tamagotchi tamalib_set_button(BTN_LEFT, tama_btn_state); tamalib_set_button(BTN_RIGHT, tama_btn_state); @@ -500,7 +495,7 @@ int32_t tama_p1_app(void* p) { furi_timer_stop(timer); running = false; - tama_p1_save_state(); + tama_p1_save_state(); } } diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index a993b6cae..ad3ae71c9 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -370,8 +370,8 @@ static void bt_close_connection(Bt* bt) { furi_event_flag_set(bt->api_event, BT_API_UNLOCK_EVENT); } -static void bt_restart(Bt *bt) { - if (bt->profile == BtProfileHidKeyboard) { +static void bt_restart(Bt* bt) { + if(bt->profile == BtProfileHidKeyboard) { furi_hal_bt_change_app(FuriHalBtProfileHidKeyboard, bt_on_gap_event_callback, bt); } else { furi_hal_bt_change_app(FuriHalBtProfileSerial, bt_on_gap_event_callback, bt); @@ -379,7 +379,7 @@ static void bt_restart(Bt *bt) { furi_hal_bt_start_advertising(); } -void bt_set_profile_adv_name(Bt *bt, const char* fmt, ...) { +void bt_set_profile_adv_name(Bt* bt, const char* fmt, ...) { furi_assert(bt); furi_assert(fmt); @@ -388,7 +388,7 @@ void bt_set_profile_adv_name(Bt *bt, const char* fmt, ...) { va_start(args, fmt); vsnprintf(name, sizeof(name), fmt, args); va_end(args); - if (bt->profile == BtProfileHidKeyboard) { + if(bt->profile == BtProfileHidKeyboard) { furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, name); } else { furi_hal_bt_set_profile_adv_name(FuriHalBtProfileSerial, name); @@ -397,46 +397,45 @@ void bt_set_profile_adv_name(Bt *bt, const char* fmt, ...) { bt_restart(bt); } -const char *bt_get_profile_adv_name(Bt *bt) { +const char* bt_get_profile_adv_name(Bt* bt) { furi_assert(bt); - if (bt->profile == BtProfileHidKeyboard) { + if(bt->profile == BtProfileHidKeyboard) { return furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard); } else { return furi_hal_bt_get_profile_adv_name(FuriHalBtProfileSerial); } } -void bt_set_profile_mac_address(Bt *bt, const uint8_t mac[6]) { +void bt_set_profile_mac_address(Bt* bt, const uint8_t mac[6]) { furi_assert(bt); furi_assert(mac); - if (bt->profile == BtProfileHidKeyboard) { + if(bt->profile == BtProfileHidKeyboard) { furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, mac); } else { furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileSerial, mac); } - + bt_restart(bt); } -const uint8_t *bt_get_profile_mac_address(Bt *bt) { +const uint8_t* bt_get_profile_mac_address(Bt* bt) { furi_assert(bt); - if (bt->profile == BtProfileHidKeyboard) { + if(bt->profile == BtProfileHidKeyboard) { return furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard); } else { return furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileSerial); } } -bool bt_remote_rssi(Bt *bt, BtRssi *rssi) { +bool bt_remote_rssi(Bt* bt, BtRssi* rssi) { furi_assert(bt); UNUSED(rssi); uint8_t rssi_val; uint32_t since = furi_hal_bt_get_conn_rssi(&rssi_val); - if (since == 0) - return false; + if(since == 0) return false; rssi->rssi = rssi_val; rssi->since = since; diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index 2e6bbf1bb..60420a7f7 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -28,7 +28,6 @@ typedef struct { uint32_t since; } BtRssi; - typedef void (*BtStatusChangedCallback)(BtStatus status, void* context); /** Change BLE Profile @@ -41,15 +40,13 @@ typedef void (*BtStatusChangedCallback)(BtStatus status, void* context); */ bool bt_set_profile(Bt* bt, BtProfile profile); +void bt_set_profile_adv_name(Bt* bt, const char* fmt, ...); +const char* bt_get_profile_adv_name(Bt* bt); -void bt_set_profile_adv_name(Bt *bt, const char* fmt, ...); -const char *bt_get_profile_adv_name(Bt *bt); - -void bt_set_profile_mac_address(Bt *bt, const uint8_t mac[6]); -const uint8_t *bt_get_profile_mac_address(Bt *bt); - -bool bt_remote_rssi(Bt *bt, BtRssi *rssi); +void bt_set_profile_mac_address(Bt* bt, const uint8_t mac[6]); +const uint8_t* bt_get_profile_mac_address(Bt* bt); +bool bt_remote_rssi(Bt* bt, BtRssi* rssi); /** Disconnect from Central * diff --git a/applications/services/desktop/animations/animation_manager.c b/applications/services/desktop/animations/animation_manager.c index c1eb50d59..5239d72d5 100644 --- a/applications/services/desktop/animations/animation_manager.c +++ b/applications/services/desktop/animations/animation_manager.c @@ -145,7 +145,8 @@ void animation_manager_check_blocking_process(AnimationManager* animation_manage const StorageAnimationManifestInfo* manifest_info = animation_storage_get_meta(animation_manager->current_animation); - bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, XTREME_SETTINGS()->unlock_anims); + bool valid = animation_manager_is_valid_idle_animation( + manifest_info, &stats, XTREME_SETTINGS()->unlock_anims); if(!valid) { animation_manager_start_new_idle(animation_manager); @@ -201,8 +202,10 @@ static void animation_manager_start_new_idle(AnimationManager* animation_manager animation_storage_get_bubble_animation(animation_manager->current_animation); animation_manager->state = AnimationManagerStateIdle; XtremeSettings* xtreme_settings = XTREME_SETTINGS(); - int32_t duration = (xtreme_settings->cycle_anims == 0) ? (bubble_animation->duration) : (xtreme_settings->cycle_anims); - furi_timer_start(animation_manager->idle_animation_timer, (duration > 0) ? (duration * 1000) : 0); + int32_t duration = (xtreme_settings->cycle_anims == 0) ? (bubble_animation->duration) : + (xtreme_settings->cycle_anims); + furi_timer_start( + animation_manager->idle_animation_timer, (duration > 0) ? (duration * 1000) : 0); } static bool animation_manager_check_blocking(AnimationManager* animation_manager) { @@ -355,7 +358,7 @@ static bool animation_manager_is_valid_idle_animation( result = (sd_status == FSE_NOT_READY); } - if (!unlock) { + if(!unlock) { if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) { result = false; } @@ -370,8 +373,9 @@ static bool animation_manager_is_valid_idle_animation( static StorageAnimation* animation_manager_select_idle_animation(AnimationManager* animation_manager) { const char* old_animation_name = NULL; - if (animation_manager->current_animation) { - old_animation_name = animation_storage_get_meta(animation_manager->current_animation)->name; + if(animation_manager->current_animation) { + old_animation_name = + animation_storage_get_meta(animation_manager->current_animation)->name; } StorageAnimationList_t animation_list; @@ -391,8 +395,8 @@ static StorageAnimation* animation_storage_get_meta(storage_animation); bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock); - if (old_animation_name != NULL) { - if (strcmp(manifest_info->name, old_animation_name) == 0) { + if(old_animation_name != NULL) { + if(strcmp(manifest_info->name, old_animation_name) == 0) { valid = false; } } @@ -512,7 +516,8 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m furi_record_close(RECORD_DOLPHIN); const StorageAnimationManifestInfo* manifest_info = animation_storage_get_meta(restore_animation); - bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, XTREME_SETTINGS()->unlock_anims); + bool valid = animation_manager_is_valid_idle_animation( + manifest_info, &stats, XTREME_SETTINGS()->unlock_anims); if(valid) { animation_manager_replace_current_animation( animation_manager, restore_animation); @@ -523,12 +528,16 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m animation_manager->idle_animation_timer, animation_manager->freezed_animation_time_left); } else { - const BubbleAnimation* bubble_animation = animation_storage_get_bubble_animation( - animation_manager->current_animation); + const BubbleAnimation* bubble_animation = + animation_storage_get_bubble_animation( + animation_manager->current_animation); XtremeSettings* xtreme_settings = XTREME_SETTINGS(); - int32_t duration = (xtreme_settings->cycle_anims == 0) ? (bubble_animation->duration) : (xtreme_settings->cycle_anims); + int32_t duration = (xtreme_settings->cycle_anims == 0) ? + (bubble_animation->duration) : + (xtreme_settings->cycle_anims); furi_timer_start( - animation_manager->idle_animation_timer, (duration > 0) ? (duration * 1000) : 0); + animation_manager->idle_animation_timer, + (duration > 0) ? (duration * 1000) : 0); } } } else { diff --git a/applications/services/desktop/animations/animation_storage.c b/applications/services/desktop/animations/animation_storage.c index 28cdfe810..c717b0c36 100644 --- a/applications/services/desktop/animations/animation_storage.c +++ b/applications/services/desktop/animations/animation_storage.c @@ -35,18 +35,18 @@ void animation_handler_select_manifest() { FuriString* anim_dir = furi_string_alloc(); FuriString* manifest = furi_string_alloc(); bool use_asset_pack = xtreme_settings->asset_pack[0] != '\0'; - if (use_asset_pack) { + if(use_asset_pack) { furi_string_printf(anim_dir, "%s/%s/Anims", PACKS_DIR, xtreme_settings->asset_pack); furi_string_printf(manifest, "%s/manifest.txt", furi_string_get_cstr(anim_dir)); Storage* storage = furi_record_open(RECORD_STORAGE); - if (storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) { + if(storage_common_stat(storage, furi_string_get_cstr(manifest), NULL) == FSE_OK) { FURI_LOG_I(TAG, "Custom Manifest selected"); } else { use_asset_pack = false; } furi_record_close(RECORD_STORAGE); } - if (!use_asset_pack) { + if(!use_asset_pack) { furi_string_set(anim_dir, BASE_ANIMATION_DIR); if(xtreme_settings->nsfw_mode) { furi_string_cat_str(anim_dir, "/nsfw"); @@ -58,7 +58,8 @@ void animation_handler_select_manifest() { furi_string_printf(manifest, "%s/manifest.txt", furi_string_get_cstr(anim_dir)); } strlcpy(ANIMATION_DIR, furi_string_get_cstr(anim_dir), sizeof(ANIMATION_DIR)); - strlcpy(ANIMATION_MANIFEST_FILE, furi_string_get_cstr(manifest), sizeof(ANIMATION_MANIFEST_FILE)); + strlcpy( + ANIMATION_MANIFEST_FILE, furi_string_get_cstr(manifest), sizeof(ANIMATION_MANIFEST_FILE)); furi_string_free(manifest); furi_string_free(anim_dir); } diff --git a/applications/services/desktop/views/desktop_view_lock_menu.c b/applications/services/desktop/views/desktop_view_lock_menu.c index 4cdfa54da..594676c28 100644 --- a/applications/services/desktop/views/desktop_view_lock_menu.c +++ b/applications/services/desktop/views/desktop_view_lock_menu.c @@ -68,7 +68,7 @@ void desktop_lock_menu_draw_callback(Canvas* canvas, void* model) { str = "Set PIN + Off"; } } else if(i == DesktopLockMenuIndexXtremeSettings) { - str = "Xtreme Settings"; + str = "Xtreme Settings"; } if(str) //-V547 diff --git a/applications/services/dolphin/helpers/dolphin_state.c b/applications/services/dolphin/helpers/dolphin_state.c index 72fa75ac0..419245a7c 100644 --- a/applications/services/dolphin/helpers/dolphin_state.c +++ b/applications/services/dolphin/helpers/dolphin_state.c @@ -15,9 +15,10 @@ #define DOLPHIN_STATE_HEADER_MAGIC 0xD0 #define DOLPHIN_STATE_HEADER_VERSION 0x01 -const int DOLPHIN_LEVELS[DOLPHIN_LEVEL_COUNT] = {100, 200, 300, 450, 600, 750, 950, 1150, 1350, 1600, - 1850, 2100, 2400, 2700, 3000, 3350, 3700, 4050, 4450, 4850, - 5250, 5700, 6150, 6600, 7100, 7600, 8100, 8650, 9200}; +const int DOLPHIN_LEVELS[DOLPHIN_LEVEL_COUNT] = {100, 200, 300, 450, 600, 750, 950, 1150, + 1350, 1600, 1850, 2100, 2400, 2700, 3000, 3350, + 3700, 4050, 4450, 4850, 5250, 5700, 6150, 6600, + 7100, 7600, 8100, 8650, 9200}; #define BUTTHURT_MAX 14 #define BUTTHURT_MIN 0 diff --git a/applications/services/power/power_service/power.c b/applications/services/power/power_service/power.c index f0f7735fb..e52cb4e10 100644 --- a/applications/services/power/power_service/power.c +++ b/applications/services/power/power_service/power.c @@ -26,7 +26,7 @@ void power_draw_battery_callback(Canvas* canvas, void* context) { snprintf(batteryPercentile, sizeof(batteryPercentile), "%d", power->info.charge); if((battery_style == BatteryStylePercent) && - (power->state != + (power->state != PowerStateCharging)) { //if display battery percentage, black background white text canvas_set_font(canvas, FontBatteryPercent); canvas_set_color(canvas, ColorBlack); @@ -36,7 +36,7 @@ void power_draw_battery_callback(Canvas* canvas, void* context) { } else if( (battery_style == BatteryStyleInvertedPercent) && (power->state != - PowerStateCharging)) { //if display inverted percentage, white background black text + PowerStateCharging)) { //if display inverted percentage, white background black text canvas_set_font(canvas, FontBatteryPercent); canvas_set_color(canvas, ColorBlack); canvas_draw_str_aligned(canvas, 11, 4, AlignCenter, AlignCenter, batteryPercentile); @@ -74,7 +74,7 @@ void power_draw_battery_callback(Canvas* canvas, void* context) { (battery_style == BatteryStyleBarPercent) && (power->state != PowerStateCharging) && // Default bar display with percentage (power->info.voltage_battery_charging >= - 4.2)) { // not looking nice with low voltage indicator + 4.2)) { // not looking nice with low voltage indicator canvas_set_font(canvas, FontBatteryPercent); // align charge dispaly value with digits to draw @@ -145,8 +145,7 @@ void power_draw_battery_callback(Canvas* canvas, void* context) { if(power->state == PowerStateCharging) { canvas_set_bitmap_mode(canvas, 1); // TODO: replace -1 magic for uint8_t with re-framing - if(battery_style == BatteryStylePercent || - battery_style == BatteryStyleBarPercent) { + if(battery_style == BatteryStylePercent || battery_style == BatteryStyleBarPercent) { canvas_set_color(canvas, ColorBlack); canvas_draw_box(canvas, 1, 1, 22, 6); canvas_draw_icon(canvas, 2, -1, &I_Charging_lightning_9x10); diff --git a/applications/settings/about/about.c b/applications/settings/about/about.c index 42712bc9c..918083265 100644 --- a/applications/settings/about/about.c +++ b/applications/settings/about/about.c @@ -222,9 +222,9 @@ static void draw_battery(Canvas* canvas, PowerInfo* info, int x, int y) { snprintf(header, sizeof(header), "Charged!"); } - if (!strcmp(value, "")) { + if(!strcmp(value, "")) { canvas_draw_str_aligned(canvas, x + 92, y + 14, AlignCenter, AlignCenter, header); - } else if (!strcmp(header, "")) { + } else if(!strcmp(header, "")) { canvas_draw_str_aligned(canvas, x + 92, y + 14, AlignCenter, AlignCenter, value); } else { canvas_draw_str_aligned(canvas, x + 92, y + 9, AlignCenter, AlignCenter, header); @@ -298,7 +298,6 @@ const AboutDialogScreen about_screens[] = { const int about_screens_count = sizeof(about_screens) / sizeof(AboutDialogScreen); - int32_t about_settings_app(void* p) { bool battery_info = false; if(p && strlen(p) && !strcmp(p, "batt")) { @@ -324,24 +323,19 @@ int32_t about_settings_app(void* p) { DialogMessageButton screen_result; // draw empty screen to prevent menu flickering - view_dispatcher_add_view( - view_dispatcher, battery_info_index, battery_view); + view_dispatcher_add_view(view_dispatcher, battery_info_index, battery_view); view_dispatcher_add_view( view_dispatcher, empty_screen_index, empty_screen_get_view(empty_screen)); view_dispatcher_attach_to_gui(view_dispatcher, gui, ViewDispatcherTypeFullscreen); screen_index = -1 + !battery_info; while(screen_index > -2) { - - if (screen_index == -1) { - if (!battery_info) { + if(screen_index == -1) { + if(!battery_info) { break; } with_view_model( - battery_view, - PowerInfo * model, - { power_get_info(power, model); }, - true); + battery_view, PowerInfo * model, { power_get_info(power, model); }, true); view_dispatcher_switch_to_view(view_dispatcher, battery_info_index); furi_semaphore_acquire(semaphore, 2000); } else { @@ -360,7 +354,6 @@ int32_t about_settings_app(void* p) { screen_index = -2; } } - } dialog_message_free(message); diff --git a/applications/settings/dolphin_passport/passport.c b/applications/settings/dolphin_passport/passport.c index 3bea705ac..f0430de5d 100644 --- a/applications/settings/dolphin_passport/passport.c +++ b/applications/settings/dolphin_passport/passport.c @@ -67,7 +67,7 @@ static void render_callback(Canvas* canvas, void* _ctx) { uint32_t xp_need = dolphin_state_xp_to_levelup(stats->icounter); uint32_t xp_above_last_levelup = dolphin_state_xp_above_last_levelup(stats->icounter); uint32_t xp_levelup = 0; - if (ctx->progress_total) { + if(ctx->progress_total) { xp_levelup = xp_need + stats->icounter; } else { xp_levelup = xp_need + xp_above_last_levelup; diff --git a/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c b/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c index 90bdde83f..53d679efb 100644 --- a/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c +++ b/applications/settings/xtreme_settings/scenes/xtreme_settings_scene_start.c @@ -15,8 +15,12 @@ static void xtreme_settings_scene_start_base_graphics_changed(VariableItem* item static void xtreme_settings_scene_start_asset_pack_changed(VariableItem* item) { XtremeSettingsApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, index == 0 ? "OFF" : *asset_packs_get(app->asset_packs, index - 1)); - strlcpy(XTREME_SETTINGS()->asset_pack, index == 0 ? "" : *asset_packs_get(app->asset_packs, index - 1), MAX_PACK_NAME_LEN); + variable_item_set_current_value_text( + item, index == 0 ? "OFF" : *asset_packs_get(app->asset_packs, index - 1)); + strlcpy( + XTREME_SETTINGS()->asset_pack, + index == 0 ? "" : *asset_packs_get(app->asset_packs, index - 1), + MAX_PACK_NAME_LEN); app->settings_changed = true; app->assets_changed = true; } @@ -33,8 +37,20 @@ static void xtreme_settings_scene_start_anim_speed_changed(VariableItem* item) { app->settings_changed = true; } -const char* const cycle_anims_names[] = - {"OFF", "Meta.txt", "30 S", "1 M", "5 M", "10 M", "15 M", "30 M", "1 H", "2 H", "6 H", "12 H", "24 H"}; +const char* const cycle_anims_names[] = { + "OFF", + "Meta.txt", + "30 S", + "1 M", + "5 M", + "10 M", + "15 M", + "30 M", + "1 H", + "2 H", + "6 H", + "12 H", + "24 H"}; const int32_t cycle_anims_values[COUNT_OF(cycle_anims_names)] = {-1, 0, 30, 60, 300, 600, 900, 1800, 3600, 7200, 21600, 43200, 86400}; static void xtreme_settings_scene_start_cycle_anims_changed(VariableItem* item) { @@ -62,8 +78,7 @@ const int32_t battery_style_values[COUNT_OF(battery_style_names)] = { BatteryStyleInvertedPercent, BatteryStyleRetro3, BatteryStyleRetro5, - BatteryStyleBarPercent -}; + BatteryStyleBarPercent}; static void xtreme_settings_scene_start_battery_style_changed(VariableItem* item) { XtremeSettingsApp* app = variable_item_get_context(item); uint8_t index = variable_item_get_current_value_index(item); @@ -112,7 +127,8 @@ void xtreme_settings_scene_start_on_enter(void* context) { app->subghz_extend = false; app->subghz_bypass = false; if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) { - flipper_format_read_bool(subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1); + flipper_format_read_bool( + subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1); flipper_format_read_bool(subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1); } flipper_format_free(subghz_range); @@ -123,14 +139,15 @@ void xtreme_settings_scene_start_on_enter(void* context) { FileInfo info; char* name = malloc(MAX_PACK_NAME_LEN); do { - if (!storage_dir_open(folder, PACKS_DIR)) break; + if(!storage_dir_open(folder, PACKS_DIR)) break; while(true) { - if (!storage_dir_read(folder, &info, name, MAX_PACK_NAME_LEN)) break; + if(!storage_dir_read(folder, &info, name, MAX_PACK_NAME_LEN)) break; if(info.flags & FSF_DIRECTORY) { char* copy = malloc(MAX_PACK_NAME_LEN); strlcpy(copy, name, MAX_PACK_NAME_LEN); asset_packs_push_back(app->asset_packs, copy); - if (strcmp(name, xtreme_settings->asset_pack) == 0) current_pack = asset_packs_size(app->asset_packs); + if(strcmp(name, xtreme_settings->asset_pack) == 0) + current_pack = asset_packs_size(app->asset_packs); } } } while(false); @@ -139,11 +156,7 @@ void xtreme_settings_scene_start_on_enter(void* context) { furi_record_close(RECORD_STORAGE); item = variable_item_list_add( - var_item_list, - "Base Graphics", - 2, - xtreme_settings_scene_start_base_graphics_changed, - app); + var_item_list, "Base Graphics", 2, xtreme_settings_scene_start_base_graphics_changed, app); variable_item_set_current_value_index(item, xtreme_settings->nsfw_mode); variable_item_set_current_value_text(item, xtreme_settings->nsfw_mode ? "NSFW" : "SFW"); @@ -154,7 +167,8 @@ void xtreme_settings_scene_start_on_enter(void* context) { xtreme_settings_scene_start_asset_pack_changed, app); variable_item_set_current_value_index(item, current_pack); - variable_item_set_current_value_text(item, current_pack == 0 ? "OFF" : *asset_packs_get(app->asset_packs, current_pack - 1)); + variable_item_set_current_value_text( + item, current_pack == 0 ? "OFF" : *asset_packs_get(app->asset_packs, current_pack - 1)); item = variable_item_list_add( var_item_list, @@ -179,11 +193,7 @@ void xtreme_settings_scene_start_on_enter(void* context) { variable_item_set_current_value_text(item, cycle_anims_names[value_index]); item = variable_item_list_add( - var_item_list, - "Unlock Anims", - 2, - xtreme_settings_scene_start_unlock_anims_changed, - app); + var_item_list, "Unlock Anims", 2, xtreme_settings_scene_start_unlock_anims_changed, app); variable_item_set_current_value_index(item, xtreme_settings->unlock_anims); variable_item_set_current_value_text(item, xtreme_settings->unlock_anims ? "ON" : "OFF"); @@ -210,30 +220,18 @@ void xtreme_settings_scene_start_on_enter(void* context) { variable_item_set_current_value_text(item, level_str); item = variable_item_list_add( - var_item_list, - "SubGHz Extend", - 2, - xtreme_settings_scene_start_subghz_extend_changed, - app); + var_item_list, "SubGHz Extend", 2, xtreme_settings_scene_start_subghz_extend_changed, app); variable_item_set_current_value_index(item, app->subghz_extend); variable_item_set_current_value_text(item, app->subghz_extend ? "ON" : "OFF"); item = variable_item_list_add( - var_item_list, - "SubGHz Bypass", - 2, - xtreme_settings_scene_start_subghz_bypass_changed, - app); + var_item_list, "SubGHz Bypass", 2, xtreme_settings_scene_start_subghz_bypass_changed, app); variable_item_set_current_value_index(item, app->subghz_bypass); variable_item_set_current_value_text(item, app->subghz_bypass ? "ON" : "OFF"); - FuriString* version_tag = furi_string_alloc_printf("%s %s", version_get_gitbranchnum(NULL), version_get_builddate(NULL)); - item = variable_item_list_add( - var_item_list, - furi_string_get_cstr(version_tag), - 0, - NULL, - app); + FuriString* version_tag = furi_string_alloc_printf( + "%s %s", version_get_gitbranchnum(NULL), version_get_builddate(NULL)); + item = variable_item_list_add(var_item_list, furi_string_get_cstr(version_tag), 0, NULL, app); view_dispatcher_switch_to_view(app->view_dispatcher, XtremeSettingsAppViewVarItemList); } @@ -248,7 +246,7 @@ bool xtreme_settings_scene_start_on_event(void* context, SceneManagerEvent event void xtreme_settings_scene_start_on_exit(void* context) { XtremeSettingsApp* app = context; asset_packs_it_t it; - for (asset_packs_it(it, app->asset_packs); !asset_packs_end_p(it); asset_packs_next(it)) { + for(asset_packs_it(it, app->asset_packs); !asset_packs_end_p(it); asset_packs_next(it)) { free(*asset_packs_cref(it)); } asset_packs_clear(app->asset_packs); diff --git a/applications/settings/xtreme_settings/xtreme_assets.c b/applications/settings/xtreme_settings/xtreme_assets.c index 444b50951..0f6ab998d 100644 --- a/applications/settings/xtreme_settings/xtreme_assets.c +++ b/applications/settings/xtreme_settings/xtreme_assets.c @@ -5,94 +5,158 @@ XtremeAssets* xtreme_assets = NULL; XtremeAssets* XTREME_ASSETS() { - if (xtreme_assets == NULL) { + if(xtreme_assets == NULL) { XTREME_ASSETS_LOAD(); } return xtreme_assets; } void XTREME_ASSETS_LOAD() { - if (xtreme_assets != NULL) return; + if(xtreme_assets != NULL) return; xtreme_assets = malloc(sizeof(XtremeAssets)); XtremeSettings* xtreme_settings = XTREME_SETTINGS(); - if (xtreme_settings->nsfw_mode) { - xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64; - xtreme_assets->I_DolphinCommon_56x48 = &I_DolphinCommon_56x48; - xtreme_assets->I_DolphinMafia_115x62 = &I_DolphinMafia_115x62; - xtreme_assets->I_DolphinNice_96x59 = &I_DolphinNice_96x59; - xtreme_assets->I_DolphinWait_61x59 = &I_DolphinWait_61x59; + if(xtreme_settings->nsfw_mode) { + xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64; + xtreme_assets->I_DolphinCommon_56x48 = &I_DolphinCommon_56x48; + xtreme_assets->I_DolphinMafia_115x62 = &I_DolphinMafia_115x62; + xtreme_assets->I_DolphinNice_96x59 = &I_DolphinNice_96x59; + xtreme_assets->I_DolphinWait_61x59 = &I_DolphinWait_61x59; xtreme_assets->I_iButtonDolphinVerySuccess_108x52 = &I_iButtonDolphinVerySuccess_108x52; - xtreme_assets->I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63; - xtreme_assets->I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61; - xtreme_assets->I_passport_bad_46x49 = &I_flipper; - xtreme_assets->I_passport_DB = &I_passport_DB; - xtreme_assets->I_passport_happy_46x49 = &I_flipper; - xtreme_assets->I_passport_okay_46x49 = &I_flipper; - xtreme_assets->I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61; - xtreme_assets->I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61; - xtreme_assets->I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57; - xtreme_assets->I_Cry_dolph_55x52 = &I_Cry_dolph_55x52; - xtreme_assets->I_Scanning_123x52 = &I_Scanning_123x52; - xtreme_assets->I_Auth_62x31 = &I_Auth_62x31; - xtreme_assets->I_Connect_me_62x31 = &I_Connect_me_62x31; - xtreme_assets->I_Connected_62x31 = &I_Connected_62x31; - xtreme_assets->I_Error_62x31 = &I_Error_62x31; + xtreme_assets->I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63; + xtreme_assets->I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61; + xtreme_assets->I_passport_bad_46x49 = &I_flipper; + xtreme_assets->I_passport_DB = &I_passport_DB; + xtreme_assets->I_passport_happy_46x49 = &I_flipper; + xtreme_assets->I_passport_okay_46x49 = &I_flipper; + xtreme_assets->I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61; + xtreme_assets->I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61; + xtreme_assets->I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57; + xtreme_assets->I_Cry_dolph_55x52 = &I_Cry_dolph_55x52; + xtreme_assets->I_Scanning_123x52 = &I_Scanning_123x52; + xtreme_assets->I_Auth_62x31 = &I_Auth_62x31; + xtreme_assets->I_Connect_me_62x31 = &I_Connect_me_62x31; + xtreme_assets->I_Connected_62x31 = &I_Connected_62x31; + xtreme_assets->I_Error_62x31 = &I_Error_62x31; } else { - xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64_sfw; - xtreme_assets->I_DolphinCommon_56x48 = &I_DolphinCommon_56x48_sfw; - xtreme_assets->I_DolphinMafia_115x62 = &I_DolphinMafia_115x62_sfw; - xtreme_assets->I_DolphinNice_96x59 = &I_DolphinNice_96x59_sfw; - xtreme_assets->I_DolphinWait_61x59 = &I_DolphinWait_61x59_sfw; - xtreme_assets->I_iButtonDolphinVerySuccess_108x52 = &I_iButtonDolphinVerySuccess_108x52_sfw; - xtreme_assets->I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63_sfw; - xtreme_assets->I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61_sfw; - xtreme_assets->I_passport_bad_46x49 = &I_passport_bad1_46x49_sfw; - xtreme_assets->I_passport_DB = &I_passport_DB_sfw; - xtreme_assets->I_passport_happy_46x49 = &I_passport_happy1_46x49_sfw; - xtreme_assets->I_passport_okay_46x49 = &I_passport_okay1_46x49_sfw; - xtreme_assets->I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61_sfw; - xtreme_assets->I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61_sfw; - xtreme_assets->I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57_sfw; - xtreme_assets->I_Cry_dolph_55x52 = &I_Cry_dolph_55x52_sfw; - xtreme_assets->I_Scanning_123x52 = &I_Scanning_123x52_sfw; - xtreme_assets->I_Auth_62x31 = &I_Auth_62x31_sfw; - xtreme_assets->I_Connect_me_62x31 = &I_Connect_me_62x31_sfw; - xtreme_assets->I_Connected_62x31 = &I_Connected_62x31_sfw; - xtreme_assets->I_Error_62x31 = &I_Error_62x31_sfw; + xtreme_assets->I_BLE_Pairing_128x64 = &I_BLE_Pairing_128x64_sfw; + xtreme_assets->I_DolphinCommon_56x48 = &I_DolphinCommon_56x48_sfw; + xtreme_assets->I_DolphinMafia_115x62 = &I_DolphinMafia_115x62_sfw; + xtreme_assets->I_DolphinNice_96x59 = &I_DolphinNice_96x59_sfw; + xtreme_assets->I_DolphinWait_61x59 = &I_DolphinWait_61x59_sfw; + xtreme_assets->I_iButtonDolphinVerySuccess_108x52 = + &I_iButtonDolphinVerySuccess_108x52_sfw; + xtreme_assets->I_DolphinReadingSuccess_59x63 = &I_DolphinReadingSuccess_59x63_sfw; + xtreme_assets->I_NFC_dolphin_emulation_47x61 = &I_NFC_dolphin_emulation_47x61_sfw; + xtreme_assets->I_passport_bad_46x49 = &I_passport_bad1_46x49_sfw; + xtreme_assets->I_passport_DB = &I_passport_DB_sfw; + xtreme_assets->I_passport_happy_46x49 = &I_passport_happy1_46x49_sfw; + xtreme_assets->I_passport_okay_46x49 = &I_passport_okay1_46x49_sfw; + xtreme_assets->I_RFIDDolphinReceive_97x61 = &I_RFIDDolphinReceive_97x61_sfw; + xtreme_assets->I_RFIDDolphinSend_97x61 = &I_RFIDDolphinSend_97x61_sfw; + xtreme_assets->I_RFIDDolphinSuccess_108x57 = &I_RFIDDolphinSuccess_108x57_sfw; + xtreme_assets->I_Cry_dolph_55x52 = &I_Cry_dolph_55x52_sfw; + xtreme_assets->I_Scanning_123x52 = &I_Scanning_123x52_sfw; + xtreme_assets->I_Auth_62x31 = &I_Auth_62x31_sfw; + xtreme_assets->I_Connect_me_62x31 = &I_Connect_me_62x31_sfw; + xtreme_assets->I_Connected_62x31 = &I_Connected_62x31_sfw; + xtreme_assets->I_Error_62x31 = &I_Error_62x31_sfw; } - if (xtreme_settings->asset_pack[0] == '\0') return; + if(xtreme_settings->asset_pack[0] == '\0') return; FileInfo info; FuriString* path = furi_string_alloc(); const char* pack = xtreme_settings->asset_pack; furi_string_printf(path, PACKS_DIR "/%s", pack); Storage* storage = furi_record_open(RECORD_STORAGE); - if (storage_common_stat(storage, furi_string_get_cstr(path), &info) == FSE_OK && info.flags & FSF_DIRECTORY) { + if(storage_common_stat(storage, furi_string_get_cstr(path), &info) == FSE_OK && + info.flags & FSF_DIRECTORY) { File* file = storage_file_alloc(storage); - swap_bmx_icon(&xtreme_assets->I_BLE_Pairing_128x64, pack, "BLE/BLE_Pairing_128x64.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_DolphinCommon_56x48, pack, "Dolphin/DolphinCommon_56x48.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_DolphinMafia_115x62, pack, "iButton/DolphinMafia_115x62.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_DolphinNice_96x59, pack, "iButton/DolphinNice_96x59.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_DolphinWait_61x59, pack, "iButton/DolphinWait_61x59.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_iButtonDolphinVerySuccess_108x52, pack, "iButton/iButtonDolphinVerySuccess_108x52.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_DolphinReadingSuccess_59x63, pack, "Infrared/DolphinReadingSuccess_59x63.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_NFC_dolphin_emulation_47x61, pack, "NFC/NFC_dolphin_emulation_47x61.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_passport_bad_46x49, pack, "Passport/passport_bad_46x49.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_passport_DB, pack, "Passport/passport_DB.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_passport_happy_46x49, pack, "Passport/passport_happy_46x49.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_passport_okay_46x49, pack, "Passport/passport_okay_46x49.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_RFIDDolphinReceive_97x61, pack, "RFID/RFIDDolphinReceive_97x61.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_RFIDDolphinSend_97x61, pack, "RFID/RFIDDolphinSend_97x61.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_RFIDDolphinSuccess_108x57, pack, "RFID/RFIDDolphinSuccess_108x57.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Cry_dolph_55x52, pack, "Settings/Cry_dolph_55x52.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Scanning_123x52, pack, "SubGhz/Scanning_123x52.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Auth_62x31, pack, "U2F/Auth_62x31.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Connect_me_62x31, pack, "U2F/Connect_me_62x31.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Connected_62x31, pack, "U2F/Connected_62x31.bmx", path, file); - swap_bmx_icon(&xtreme_assets->I_Error_62x31, pack, "U2F/Error_62x31.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_BLE_Pairing_128x64, pack, "BLE/BLE_Pairing_128x64.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_DolphinCommon_56x48, + pack, + "Dolphin/DolphinCommon_56x48.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_DolphinMafia_115x62, + pack, + "iButton/DolphinMafia_115x62.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_DolphinNice_96x59, pack, "iButton/DolphinNice_96x59.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_DolphinWait_61x59, pack, "iButton/DolphinWait_61x59.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_iButtonDolphinVerySuccess_108x52, + pack, + "iButton/iButtonDolphinVerySuccess_108x52.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_DolphinReadingSuccess_59x63, + pack, + "Infrared/DolphinReadingSuccess_59x63.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_NFC_dolphin_emulation_47x61, + pack, + "NFC/NFC_dolphin_emulation_47x61.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_passport_bad_46x49, + pack, + "Passport/passport_bad_46x49.bmx", + path, + file); + swap_bmx_icon(&xtreme_assets->I_passport_DB, pack, "Passport/passport_DB.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_passport_happy_46x49, + pack, + "Passport/passport_happy_46x49.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_passport_okay_46x49, + pack, + "Passport/passport_okay_46x49.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_RFIDDolphinReceive_97x61, + pack, + "RFID/RFIDDolphinReceive_97x61.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_RFIDDolphinSend_97x61, + pack, + "RFID/RFIDDolphinSend_97x61.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_RFIDDolphinSuccess_108x57, + pack, + "RFID/RFIDDolphinSuccess_108x57.bmx", + path, + file); + swap_bmx_icon( + &xtreme_assets->I_Cry_dolph_55x52, pack, "Settings/Cry_dolph_55x52.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_Scanning_123x52, pack, "SubGhz/Scanning_123x52.bmx", path, file); + swap_bmx_icon(&xtreme_assets->I_Auth_62x31, pack, "U2F/Auth_62x31.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_Connect_me_62x31, pack, "U2F/Connect_me_62x31.bmx", path, file); + swap_bmx_icon( + &xtreme_assets->I_Connected_62x31, pack, "U2F/Connected_62x31.bmx", path, file); + swap_bmx_icon(&xtreme_assets->I_Error_62x31, pack, "U2F/Error_62x31.bmx", path, file); storage_file_free(file); } @@ -100,9 +164,14 @@ void XTREME_ASSETS_LOAD() { furi_string_free(path); } -void swap_bmx_icon(const Icon** replace, const char* pack, const char* name, FuriString* path, File* file) { +void swap_bmx_icon( + const Icon** replace, + const char* pack, + const char* name, + FuriString* path, + File* file) { furi_string_printf(path, PACKS_DIR "/%s/Icons/%s", pack, name); - if (storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { + if(storage_file_open(file, furi_string_get_cstr(path), FSAM_READ, FSOM_OPEN_EXISTING)) { uint64_t size = storage_file_size(file) - 8; int32_t width, height; storage_file_read(file, &width, 4); diff --git a/applications/settings/xtreme_settings/xtreme_assets.h b/applications/settings/xtreme_settings/xtreme_assets.h index df618c47d..c49f5b590 100644 --- a/applications/settings/xtreme_settings/xtreme_assets.h +++ b/applications/settings/xtreme_settings/xtreme_assets.h @@ -34,6 +34,11 @@ XtremeAssets* XTREME_ASSETS(); void XTREME_ASSETS_LOAD(); -void swap_bmx_icon(const Icon** replace, const char* base, const char* name, FuriString* path, File* file); +void swap_bmx_icon( + const Icon** replace, + const char* base, + const char* name, + FuriString* path, + File* file); void free_bmx_icon(Icon* icon); diff --git a/applications/settings/xtreme_settings/xtreme_settings.c b/applications/settings/xtreme_settings/xtreme_settings.c index 84018bcf0..3db0a4c1c 100644 --- a/applications/settings/xtreme_settings/xtreme_settings.c +++ b/applications/settings/xtreme_settings/xtreme_settings.c @@ -3,17 +3,21 @@ XtremeSettings* xtreme_settings = NULL; XtremeSettings* XTREME_SETTINGS() { - if (xtreme_settings == NULL) { + if(xtreme_settings == NULL) { XTREME_SETTINGS_LOAD(); } return xtreme_settings; } bool XTREME_SETTINGS_LOAD() { - if (xtreme_settings == NULL) { + if(xtreme_settings == NULL) { xtreme_settings = malloc(sizeof(XtremeSettings)); bool loaded = saved_struct_load( - XTREME_SETTINGS_PATH, xtreme_settings, sizeof(XtremeSettings), XTREME_SETTINGS_MAGIC, XTREME_SETTINGS_VERSION); + XTREME_SETTINGS_PATH, + xtreme_settings, + sizeof(XtremeSettings), + XTREME_SETTINGS_MAGIC, + XTREME_SETTINGS_VERSION); if(!loaded) { memset(xtreme_settings, 0, sizeof(XtremeSettings)); loaded = XTREME_SETTINGS_SAVE(); @@ -24,9 +28,13 @@ bool XTREME_SETTINGS_LOAD() { } bool XTREME_SETTINGS_SAVE() { - if (xtreme_settings == NULL) { + if(xtreme_settings == NULL) { XTREME_SETTINGS_LOAD(); } return saved_struct_save( - XTREME_SETTINGS_PATH, xtreme_settings, sizeof(XtremeSettings), XTREME_SETTINGS_MAGIC, XTREME_SETTINGS_VERSION); + XTREME_SETTINGS_PATH, + xtreme_settings, + sizeof(XtremeSettings), + XTREME_SETTINGS_MAGIC, + XTREME_SETTINGS_VERSION); } diff --git a/applications/settings/xtreme_settings/xtreme_settings_app.c b/applications/settings/xtreme_settings/xtreme_settings_app.c index 780e76730..6b0a12f1c 100644 --- a/applications/settings/xtreme_settings/xtreme_settings_app.c +++ b/applications/settings/xtreme_settings/xtreme_settings_app.c @@ -15,10 +15,10 @@ static bool xtreme_settings_back_event_callback(void* context) { furi_assert(context); XtremeSettingsApp* app = context; - if (app->level_changed) { + if(app->level_changed) { Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN); DolphinStats stats = dolphin_stats(dolphin); - if (app->dolphin_level != stats.level) { + if(app->dolphin_level != stats.level) { int xp = app->dolphin_level > 1 ? dolphin_get_levels()[app->dolphin_level - 2] : 0; dolphin->state->data.icounter = xp + 1; dolphin->state->dirty = true; @@ -27,20 +27,22 @@ static bool xtreme_settings_back_event_callback(void* context) { furi_record_close(RECORD_DOLPHIN); } - if (app->subghz_changed) { + if(app->subghz_changed) { Storage* storage = furi_record_open(RECORD_STORAGE); FlipperFormat* subghz_range = flipper_format_file_alloc(storage); if(flipper_format_file_open_existing(subghz_range, "/ext/subghz/assets/extend_range.txt")) { - flipper_format_insert_or_update_bool(subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1); - flipper_format_insert_or_update_bool(subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1); + flipper_format_insert_or_update_bool( + subghz_range, "use_ext_range_at_own_risk", &app->subghz_extend, 1); + flipper_format_insert_or_update_bool( + subghz_range, "ignore_default_tx_region", &app->subghz_bypass, 1); } flipper_format_free(subghz_range); furi_record_close(RECORD_STORAGE); } - if (app->settings_changed) { + if(app->settings_changed) { XTREME_SETTINGS_SAVE(); - if (app->assets_changed) { + if(app->assets_changed) { popup_set_header(app->popup, "Rebooting...", 64, 26, AlignCenter, AlignCenter); popup_set_text(app->popup, "Swapping assets...", 64, 40, AlignCenter, AlignCenter); popup_set_callback(app->popup, xtreme_settings_reboot); @@ -81,9 +83,7 @@ XtremeSettingsApp* xtreme_settings_app_alloc() { app->popup = popup_alloc(); view_dispatcher_add_view( - app->view_dispatcher, - XtremeSettingsAppViewPopup, - popup_get_view(app->popup)); + app->view_dispatcher, XtremeSettingsAppViewPopup, popup_get_view(app->popup)); // Set first scene scene_manager_next_scene(app->scene_manager, XtremeSettingsAppSceneStart); diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 8023b8915..725a69dfb 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -56,8 +56,8 @@ static Gap* gap = NULL; static inline void fetch_rssi() { uint8_t ret_rssi = 127; - if (hci_read_rssi(gap->service.connection_handle, &ret_rssi) == BLE_STATUS_SUCCESS) { - gap->conn_rssi = (int8_t) ret_rssi; + if(hci_read_rssi(gap->service.connection_handle, &ret_rssi) == BLE_STATUS_SUCCESS) { + gap->conn_rssi = (int8_t)ret_rssi; gap->time_rssi_sample = furi_get_tick(); return; } @@ -166,7 +166,6 @@ SVCCTL_UserEvtFlowStatus_t SVCCTL_App_Notification(void* pckt) { gap->connection_params.slave_latency = event->Conn_Latency; gap->connection_params.supervisor_timeout = event->Supervision_Timeout; - // Stop advertising as connection completed furi_timer_stop(gap->advertise_timer); @@ -383,7 +382,7 @@ static void gap_init_svc(Gap* gap) { keypress_supported, CFG_ENCRYPTION_KEY_SIZE_MIN, CFG_ENCRYPTION_KEY_SIZE_MAX, - CFG_USED_FIXED_PIN, // 0x0 for no pin + CFG_USED_FIXED_PIN, // 0x0 for no pin 0, PUBLIC_ADDR); // Configure whitelist @@ -504,9 +503,15 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { // Initialization of GATT & GAP layer gap->service.adv_name = config->adv_name; FURI_LOG_I(TAG, "Advertising name: %s", &(gap->service.adv_name[1])); - FURI_LOG_I(TAG, "MAC @ : %02X:%02X:%02X:%02X:%02X:%02X", - config->mac_address[0], config->mac_address[1], config->mac_address[2], - config->mac_address[3], config->mac_address[4], config->mac_address[5]); + FURI_LOG_I( + TAG, + "MAC @ : %02X:%02X:%02X:%02X:%02X:%02X", + config->mac_address[0], + config->mac_address[1], + config->mac_address[2], + config->mac_address[3], + config->mac_address[4], + config->mac_address[5]); gap_init_svc(gap); // Initialization of the BLE Services SVCCTL_Init(); @@ -538,15 +543,12 @@ bool gap_init(GapConfig* config, GapEventCallback on_event_cb, void* context) { return true; } -uint32_t gap_get_remote_conn_rssi(int8_t *rssi) { - if (gap && gap->state == GapStateConnected) { +uint32_t gap_get_remote_conn_rssi(int8_t* rssi) { + if(gap && gap->state == GapStateConnected) { fetch_rssi(); *rssi = gap->conn_rssi; - FURI_LOG_D(TAG, "RSSI: %d", *rssi); - - if (gap->time_rssi_sample) - return furi_get_tick() - gap->time_rssi_sample; + if(gap->time_rssi_sample) return furi_get_tick() - gap->time_rssi_sample; } return 0; } diff --git a/firmware/targets/f7/ble_glue/gap.h b/firmware/targets/f7/ble_glue/gap.h index 3b9ca5b28..7b317e06c 100644 --- a/firmware/targets/f7/ble_glue/gap.h +++ b/firmware/targets/f7/ble_glue/gap.h @@ -81,7 +81,7 @@ GapState gap_get_state(); void gap_thread_stop(); -uint32_t gap_get_remote_conn_rssi(int8_t *rssi); +uint32_t gap_get_remote_conn_rssi(int8_t* rssi); #ifdef __cplusplus } diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index f01b66d14..1e7b80040 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -429,15 +429,13 @@ float furi_hal_bt_get_rssi() { * the beginning of the connection * */ -uint32_t furi_hal_bt_get_conn_rssi(uint8_t *rssi) { - +uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi) { int8_t ret_rssi = 0; uint32_t since = gap_get_remote_conn_rssi(&ret_rssi); - if (ret_rssi == 127 || since == 0) - return 0; + if(ret_rssi == 127 || since == 0) return 0; - *rssi = (uint8_t) abs(ret_rssi); + *rssi = (uint8_t)abs(ret_rssi); return since; } @@ -469,12 +467,14 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode) { void furi_hal_bt_set_profile_adv_name( FuriHalBtProfile profile, - const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1]) { + const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1]) { furi_assert(profile < FuriHalBtProfileNumber); furi_assert(name); memcpy( - &(profile_config[profile].config.adv_name[1]), name, FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1); + &(profile_config[profile].config.adv_name[1]), + name, + FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1); } const char* furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile) { diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c index 501704420..424999fc0 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c @@ -199,8 +199,7 @@ bool furi_hal_bt_hid_kb_press(uint16_t button) { bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots) { furi_assert(kb_report); for(uint8_t i = 0; n_empty_slots > 0 && i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { - if(kb_report->key[i] == 0) - n_empty_slots--; + if(kb_report->key[i] == 0) n_empty_slots--; } return (n_empty_slots == 0); } diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index 45d2a4261..fb17436f4 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -228,19 +228,23 @@ bool furi_hal_bt_ensure_c2_mode(BleGlueC2Mode mode); * @param[in] profile profile type * @param[in] name new adv name */ -void furi_hal_bt_set_profile_adv_name(FuriHalBtProfile profile, const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH-1]); +void furi_hal_bt_set_profile_adv_name( + FuriHalBtProfile profile, + const char name[FURI_HAL_VERSION_DEVICE_NAME_LENGTH - 1]); -const char *furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile); +const char* furi_hal_bt_get_profile_adv_name(FuriHalBtProfile profile); /** Modify profile mac address and restart bluetooth * @param[in] profile profile type * @param[in] mac new mac address */ -void furi_hal_bt_set_profile_mac_addr(FuriHalBtProfile profile, const uint8_t mac_addr[GAP_MAC_ADDR_SIZE]); +void furi_hal_bt_set_profile_mac_addr( + FuriHalBtProfile profile, + const uint8_t mac_addr[GAP_MAC_ADDR_SIZE]); -const uint8_t *furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile); +const uint8_t* furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile); -uint32_t furi_hal_bt_get_conn_rssi(uint8_t *rssi); +uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi); #ifdef __cplusplus } diff --git a/flipper.log b/flipper.log deleted file mode 100644 index f267750c0..000000000 --- a/flipper.log +++ /dev/null @@ -1,3146 +0,0 @@ - - _.-------.._ -, - .-"```"--..,,_/ /`-, -, \ - .:" /:/ /'\ \ ,_..., `. | | - / ,----/:/ /`\ _\~`_-"` _; - ' / /`"""'\ \ \.~`_-' ,-"'/ - | | | 0 | | .-' ,/` / - | ,..\ \ ,.-"` ,/` / - ; : `/`""\` ,/--==,/-----, - | `-...| -.___-Z:_______J...---; - : ` _-' - _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ -| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| -| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | -|_| |____||___||_| |_| |___||_|_\ \___||____||___| - -Welcome to Flipper Zero Command Line Interface! -Read Manual https://docs.flipperzero.one - -Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) - ->: log -Press CTRL+C to stop... -218220 [D][BrowserWorker] End -218233 [I][BtGap] Stop advertising -218237 [D][BtGap] set_non_discoverable success -218252 [I][SavedStruct] Loading "/int/.desktop.settings" -218390 [I][SavedStruct] Loading "/int/.desktop.settings" -218442 [I][FuriHalBt] Disconnect and stop advertising -218444 [I][FuriHalBt] Stop current profile services -218453 [I][FuriHalBt] Stop BLE related RTOS threads -218479 [I][FuriHalBt] Reset SHCI -218590 [I][SavedStruct] Loading "/int/.desktop.settings" -218594 [I][FuriHalBt] Start BT initialization -218601 [I][Core2] Core2 started -218604 [I][Core2] C2 boot completed, mode: Stack -218608 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -218612 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -218619 [I][Core2] Radio stack started -218623 [I][Core2] Flash activity control switched to SEM7 -218626 [I][BtGap] Advertising name: Keyboard -218629 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -218646 [D][BtBatterySvc] Updating power state characteristic -218651 [I][BtGap] Start advertising -218654 [I][SavedStruct] Loading "/int/.bt.settings" -218671 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -218681 [I][FuriHalBt] Disconnect and stop advertising -218683 [I][BtGap] Stop advertising -218686 [D][BtGap] set_non_discoverable success -218689 [I][FuriHalBt] Stop current profile services -218698 [I][FuriHalBt] Stop BLE related RTOS threads -218723 [I][FuriHalBt] Reset SHCI -218748 [I][SavedStruct] Loading "/int/.desktop.settings" -218790 [I][SavedStruct] Loading "/int/.desktop.settings" -218837 [I][FuriHalBt] Start BT initialization -218842 [I][Core2] Core2 started -218844 [I][Core2] C2 boot completed, mode: Stack -218847 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -218849 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -218854 [I][Core2] Radio stack started -218856 [I][Core2] Flash activity control switched to SEM7 -218859 [I][BtGap] Advertising name: Rumik1 -218861 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -218879 [D][BtBatterySvc] Updating power state characteristic -218889 [I][BtSrv] Bt App started -218891 [I][BtGap] Start advertising -218894 [I][BadBleWorker] Init -218896 [I][SavedStruct] Loading "/int/.desktop.settings" -218923 [I][BadBleWorker] BLE Key timeout : 16 -218990 [I][SavedStruct] Loading "/int/.desktop.settings" -219190 [I][SavedStruct] Loading "/int/.desktop.settings" -219248 [I][SavedStruct] Loading "/int/.desktop.settings" -219285 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -219287 [I][BtGap] Rssi: 295 -219390 [D][BtGap] Slave security initiated -219392 [I][SavedStruct] Loading "/int/.desktop.settings" -219508 [I][BtGap] Pairing complete -219511 [D][BtBatterySvc] Updating battery level characteristic -219515 [I][BadBleWorker] BLE Key timeout : 16 -219590 [I][SavedStruct] Loading "/int/.desktop.settings" -219687 [I][BtGap] Rx MTU size: 414 -219748 [I][SavedStruct] Loading "/int/.desktop.settings" -219790 [I][SavedStruct] Loading "/int/.desktop.settings" -219990 [I][SavedStruct] Loading "/int/.desktop.settings" -220190 [I][SavedStruct] Loading "/int/.desktop.settings" -220248 [I][SavedStruct] Loading "/int/.desktop.settings" -220282 [I][BtGap] Connection parameters event complete -220284 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -220287 [W][BtGap] Unsupported connection interval. Request connection parameters update -220290 [I][BtGap] Rssi: 298 -220335 [D][BtGap] Connection parameters accepted -220390 [I][SavedStruct] Loading "/int/.desktop.settings" -220498 [I][BtGap] Connection parameters event complete -220500 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -220506 [I][BtGap] Rssi: 293 -220590 [I][SavedStruct] Loading "/int/.desktop.settings" -220748 [I][SavedStruct] Loading "/int/.desktop.settings" -220790 [I][SavedStruct] Loading "/int/.desktop.settings" -220990 [I][SavedStruct] Loading "/int/.desktop.settings" -221190 [I][SavedStruct] Loading "/int/.desktop.settings" -221248 [I][SavedStruct] Loading "/int/.desktop.settings" -221390 [I][SavedStruct] Loading "/int/.desktop.settings" -221590 [I][SavedStruct] Loading "/int/.desktop.settings" -221748 [I][SavedStruct] Loading "/int/.desktop.settings" -221790 [I][SavedStruct] Loading "/int/.desktop.settings" -221990 [I][SavedStruct] Loading "/int/.desktop.settings" -222190 [I][SavedStruct] Loading "/int/.desktop.settings" -222248 [I][SavedStruct] Loading "/int/.desktop.settings" -222390 [I][SavedStruct] Loading "/int/.desktop.settings" -222590 [I][SavedStruct] Loading "/int/.desktop.settings" -222748 [I][SavedStruct] Loading "/int/.desktop.settings" -222790 [I][SavedStruct] Loading "/int/.desktop.settings" -222990 [I][SavedStruct] Loading "/int/.desktop.settings" -223190 [I][SavedStruct] Loading "/int/.desktop.settings" -223248 [I][SavedStruct] Loading "/int/.desktop.settings" -223390 [I][SavedStruct] Loading "/int/.desktop.settings" -223590 [I][SavedStruct] Loading "/int/.desktop.settings" -223748 [I][SavedStruct] Loading "/int/.desktop.settings" -223790 [I][SavedStruct] Loading "/int/.desktop.settings" -223990 [I][SavedStruct] Loading "/int/.desktop.settings" -224190 [I][SavedStruct] Loading "/int/.desktop.settings" -224248 [I][SavedStruct] Loading "/int/.desktop.settings" -224390 [I][SavedStruct] Loading "/int/.desktop.settings" -224590 [I][SavedStruct] Loading "/int/.desktop.settings" -224748 [I][SavedStruct] Loading "/int/.desktop.settings" -224790 [I][SavedStruct] Loading "/int/.desktop.settings" -224990 [I][SavedStruct] Loading "/int/.desktop.settings" -225190 [I][SavedStruct] Loading "/int/.desktop.settings" -225248 [I][SavedStruct] Loading "/int/.desktop.settings" -225390 [I][SavedStruct] Loading "/int/.desktop.settings" -225590 [I][SavedStruct] Loading "/int/.desktop.settings" -225748 [I][SavedStruct] Loading "/int/.desktop.settings" -225790 [I][SavedStruct] Loading "/int/.desktop.settings" -225990 [I][SavedStruct] Loading "/int/.desktop.settings" -226190 [I][SavedStruct] Loading "/int/.desktop.settings" -226248 [I][SavedStruct] Loading "/int/.desktop.settings" -226390 [I][SavedStruct] Loading "/int/.desktop.settings" -226596 [I][SavedStruct] Loading "/int/.desktop.settings" -226748 [I][SavedStruct] Loading "/int/.desktop.settings" -226790 [I][SavedStruct] Loading "/int/.desktop.settings" -226990 [I][SavedStruct] Loading "/int/.desktop.settings" -227190 [I][SavedStruct] Loading "/int/.desktop.settings" -227248 [I][SavedStruct] Loading "/int/.desktop.settings" -227390 [I][SavedStruct] Loading "/int/.desktop.settings" -227590 [I][SavedStruct] Loading "/int/.desktop.settings" -227748 [I][SavedStruct] Loading "/int/.desktop.settings" -227790 [I][SavedStruct] Loading "/int/.desktop.settings" -227990 [I][SavedStruct] Loading "/int/.desktop.settings" -228190 [I][SavedStruct] Loading "/int/.desktop.settings" -228248 [I][SavedStruct] Loading "/int/.desktop.settings" -228390 [I][SavedStruct] Loading "/int/.desktop.settings" -228590 [I][SavedStruct] Loading "/int/.desktop.settings" -228748 [I][SavedStruct] Loading "/int/.desktop.settings" -228790 [I][SavedStruct] Loading "/int/.desktop.settings" -234485 [I][FuriHalBt] Disconnect and stop advertising -234489 [I][BtGap] Stop advertising -234493 [D][BtGap] terminate success -234497 [E][BtGap] set_non_discoverable failed 12 -234502 [I][FuriHalBt] Stop current profile services -234507 [I][BadBleWorker] BLE Key timeout : 16 -234526 [I][FuriHalBt] Stop BLE related RTOS threads -234551 [I][FuriHalBt] Reset SHCI -234665 [I][FuriHalBt] Start BT initialization -234670 [I][Core2] Core2 started -234672 [I][Core2] C2 boot completed, mode: Stack -234675 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -234677 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -234681 [I][Core2] Radio stack started -234683 [I][Core2] Flash activity control switched to SEM7 -234685 [I][BtGap] Advertising name: Mmm_ -234687 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -234711 [D][BtBatterySvc] Updating power state characteristic -234721 [I][BtGap] Start advertising -235977 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -235982 [I][BtGap] Rssi: 308 -236066 [D][BtGap] Slave security initiated -236187 [I][BtGap] Pairing complete -236190 [D][BtBatterySvc] Updating battery level characteristic -236195 [I][BadBleWorker] BLE Key timeout : 16 -236366 [I][BtGap] Rx MTU size: 414 -236935 [I][BtGap] Connection parameters event complete -236938 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -236941 [W][BtGap] Unsupported connection interval. Request connection parameters update -236944 [I][BtGap] Rssi: 314 -236975 [D][BtGap] Connection parameters accepted -237139 [I][BtGap] Connection parameters event complete -237141 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -237144 [I][BtGap] Rssi: 326 -240985 [I][FuriHalBt] Disconnect and stop advertising -240989 [I][BtGap] Stop advertising -240993 [D][BtGap] terminate success -240997 [E][BtGap] set_non_discoverable failed 12 -241002 [I][FuriHalBt] Stop current profile services -241007 [I][BadBleWorker] BLE Key timeout : 16 -241028 [I][FuriHalBt] Stop BLE related RTOS threads -241054 [I][FuriHalBt] Reset SHCI -241168 [I][FuriHalBt] Start BT initialization -241173 [I][Core2] Core2 started -241175 [I][Core2] C2 boot completed, mode: Stack -241178 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -241180 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -241184 [I][Core2] Radio stack started -241186 [I][Core2] Flash activity control switched to SEM7 -241188 [I][BtGap] Advertising name: Mmm_ -241190 [I][BtGap] MAC @ : 35:F2:47:26:81:88 -241212 [D][BtBatterySvc] Updating power state characteristic -241222 [I][BtGap] Start advertising -242157 [D][ViewDispatcher] View changed while key press 20010600 -> 20010708. Sending key: Back, type: Release, sequence: 0000002C to previous view port -242161 [I][SavedStruct] Loading "/int/.desktop.settings" -242190 [I][SavedStruct] Loading "/int/.desktop.settings" -242390 [I][SavedStruct] Loading "/int/.desktop.settings" -242590 [I][SavedStruct] Loading "/int/.desktop.settings" -242662 [I][SavedStruct] Loading "/int/.desktop.settings" -242790 [I][SavedStruct] Loading "/int/.desktop.settings" -242836 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -242839 [I][BtGap] Rssi: 305 -242929 [D][BtGap] Slave security initiated -242990 [I][SavedStruct] Loading "/int/.desktop.settings" -243018 [I][BtGap] Rx MTU size: 414 -243162 [I][SavedStruct] Loading "/int/.desktop.settings" -243190 [I][SavedStruct] Loading "/int/.desktop.settings" -243390 [I][SavedStruct] Loading "/int/.desktop.settings" -243524 [D][BtGap] Bond lost event. Start rebonding -243590 [I][SavedStruct] Loading "/int/.desktop.settings" -243662 [I][SavedStruct] Loading "/int/.desktop.settings" -243702 [I][BtGap] Verify numeric comparison: 382889 -243829 [I][SavedStruct] Loading "/int/.desktop.settings" -245253 [I][SavedStruct] Loading "/int/.desktop.settings" -245274 [I][SavedStruct] Loading "/int/.desktop.settings" -245390 [I][SavedStruct] Loading "/int/.desktop.settings" -245590 [I][SavedStruct] Loading "/int/.desktop.settings" -245662 [I][SavedStruct] Loading "/int/.desktop.settings" -245679 [I][BtGap] Pairing complete -245683 [D][BtBatterySvc] Updating battery level characteristic -245687 [I][BadBleWorker] BLE Key timeout : 16 -245790 [I][SavedStruct] Loading "/int/.desktop.settings" -245990 [I][SavedStruct] Loading "/int/.desktop.settings" -246162 [I][SavedStruct] Loading "/int/.desktop.settings" -246190 [I][SavedStruct] Loading "/int/.desktop.settings" -246390 [I][SavedStruct] Loading "/int/.desktop.settings" -246590 [I][SavedStruct] Loading "/int/.desktop.settings" -246660 [I][BtGap] Connection parameters event complete -246663 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -246667 [W][BtGap] Unsupported connection interval. Request connection parameters update -246670 [I][SavedStruct] Loading "/int/.desktop.settings" -246673 [I][BtGap] Rssi: 304 -246699 [D][BtGap] Connection parameters accepted -246790 [I][SavedStruct] Loading "/int/.desktop.settings" -246862 [I][BtGap] Connection parameters event complete -246866 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -246871 [I][BtGap] Rssi: 303 -246990 [I][SavedStruct] Loading "/int/.desktop.settings" -247162 [I][SavedStruct] Loading "/int/.desktop.settings" -247190 [I][SavedStruct] Loading "/int/.desktop.settings" -247390 [I][SavedStruct] Loading "/int/.desktop.settings" -247590 [I][SavedStruct] Loading "/int/.desktop.settings" -247662 [I][SavedStruct] Loading "/int/.desktop.settings" -247790 [I][SavedStruct] Loading "/int/.desktop.settings" -247990 [I][SavedStruct] Loading "/int/.desktop.settings" -248162 [I][SavedStruct] Loading "/int/.desktop.settings" -248190 [I][SavedStruct] Loading "/int/.desktop.settings" -248390 [I][SavedStruct] Loading "/int/.desktop.settings" -248590 [I][SavedStruct] Loading "/int/.desktop.settings" -248747 [D][DolphinState] icounter 1325, butthurt 0 -248750 [I][BadBleWorker] BLE Key timeout : 16 -248754 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -248757 [I][BadBleWorker] BLE Key timeout : 16 -248759 [D][BadBleWorker] line:DELAY 1000 -248763 [I][BadBleWorker] BLE Key timeout : 16 -248790 [I][SavedStruct] Loading "/int/.desktop.settings" -248990 [I][SavedStruct] Loading "/int/.desktop.settings" -249190 [I][SavedStruct] Loading "/int/.desktop.settings" -249248 [I][SavedStruct] Loading "/int/.desktop.settings" -249390 [I][SavedStruct] Loading "/int/.desktop.settings" -249590 [I][SavedStruct] Loading "/int/.desktop.settings" -249748 [I][SavedStruct] Loading "/int/.desktop.settings" -249766 [D][BadBleWorker] line:GUI SPACE -249768 [I][BadBleWorker] Special key pressed 82c - -249773 [I][BadBleWorker] BT RSSI: 0.000000 -249790 [I][SavedStruct] Loading "/int/.desktop.settings" -249794 [I][BadBleWorker] BLE Key timeout : 16 -249800 [D][BadBleWorker] line:DELAY 500 -249804 [I][BadBleWorker] BLE Key timeout : 16 -249990 [I][SavedStruct] Loading "/int/.desktop.settings" -250190 [I][SavedStruct] Loading "/int/.desktop.settings" -250248 [I][SavedStruct] Loading "/int/.desktop.settings" -250308 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -250312 [I][BadBleWorker] BT RSSI: 0.000000 -250332 [I][BadBleWorker] BT RSSI: 0.000000 -250351 [I][BadBleWorker] BT RSSI: 0.000000 -250371 [I][BadBleWorker] BT RSSI: 0.000000 -250390 [I][SavedStruct] Loading "/int/.desktop.settings" -250392 [I][BadBleWorker] BT RSSI: 0.000000 -250414 [I][BadBleWorker] BT RSSI: 0.000000 -250434 [I][BadBleWorker] BT RSSI: 0.000000 -250454 [I][BadBleWorker] BT RSSI: 0.000000 -250474 [I][BadBleWorker] BT RSSI: 0.000000 -250494 [I][BadBleWorker] BT RSSI: 0.000000 -250514 [I][BadBleWorker] BT RSSI: 0.000000 -250534 [I][BadBleWorker] BT RSSI: 0.000000 -250554 [I][BadBleWorker] BT RSSI: 0.000000 -250574 [I][BadBleWorker] BT RSSI: 0.000000 -250590 [I][SavedStruct] Loading "/int/.desktop.settings" -250596 [I][BadBleWorker] BT RSSI: 0.000000 -250618 [I][BadBleWorker] BT RSSI: 0.000000 -250638 [I][BadBleWorker] BT RSSI: 0.000000 -250658 [I][BadBleWorker] BT RSSI: 0.000000 -250678 [I][BadBleWorker] BT RSSI: 0.000000 -250698 [I][BadBleWorker] BT RSSI: 0.000000 -250718 [I][BadBleWorker] BT RSSI: 0.000000 -250737 [I][BadBleWorker] BT RSSI: 0.000000 -250748 [I][SavedStruct] Loading "/int/.desktop.settings" -250760 [I][BadBleWorker] BT RSSI: 0.000000 -250781 [I][BadBleWorker] BT RSSI: 0.000000 -250790 [I][SavedStruct] Loading "/int/.desktop.settings" -250803 [I][BadBleWorker] BT RSSI: 0.000000 -250824 [I][BadBleWorker] BT RSSI: 0.000000 -250844 [I][BadBleWorker] BT RSSI: 0.000000 -250864 [I][BadBleWorker] BT RSSI: 0.000000 -250884 [I][BadBleWorker] BT RSSI: 0.000000 -250904 [I][BadBleWorker] BT RSSI: 0.000000 -250926 [I][BadBleWorker] BT RSSI: 0.000000 -250947 [I][BadBleWorker] BT RSSI: 0.000000 -250967 [I][BadBleWorker] BT RSSI: 0.000000 -250987 [I][BadBleWorker] BT RSSI: 0.000000 -250990 [I][SavedStruct] Loading "/int/.desktop.settings" -251008 [I][BadBleWorker] BT RSSI: 0.000000 -251028 [I][BadBleWorker] BT RSSI: 0.000000 -251048 [I][BadBleWorker] BT RSSI: 0.000000 -251068 [I][BadBleWorker] BT RSSI: 0.000000 -251088 [I][BadBleWorker] BT RSSI: 0.000000 -251108 [I][BadBleWorker] BT RSSI: 0.000000 -251128 [I][BadBleWorker] BT RSSI: 0.000000 -251147 [I][BadBleWorker] BLE Key timeout : 16 -251150 [D][BadBleWorker] line:DELAY 200 -251152 [I][BadBleWorker] BLE Key timeout : 16 -251190 [I][SavedStruct] Loading "/int/.desktop.settings" -251248 [I][SavedStruct] Loading "/int/.desktop.settings" -251355 [D][BadBleWorker] line:ENTER -251357 [I][BadBleWorker] Special key pressed 28 - -251360 [I][BadBleWorker] BT RSSI: 0.000000 -251379 [I][BadBleWorker] BLE Key timeout : 16 -251382 [D][BadBleWorker] line:GUI SPACE -251384 [I][BadBleWorker] Special key pressed 82c - -251387 [I][BadBleWorker] BT RSSI: 0.000000 -251391 [I][SavedStruct] Loading "/int/.desktop.settings" -251408 [I][BadBleWorker] BLE Key timeout : 16 -251411 [D][BadBleWorker] line:DELAY 500 -251413 [I][BadBleWorker] BLE Key timeout : 16 -251590 [I][SavedStruct] Loading "/int/.desktop.settings" -251748 [I][SavedStruct] Loading "/int/.desktop.settings" -251790 [I][SavedStruct] Loading "/int/.desktop.settings" -251915 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -251919 [I][BadBleWorker] BT RSSI: 0.000000 -251941 [I][BadBleWorker] BT RSSI: 0.000000 -251962 [I][BadBleWorker] BT RSSI: 0.000000 -251982 [I][BadBleWorker] BT RSSI: 0.000000 -251990 [I][SavedStruct] Loading "/int/.desktop.settings" -252004 [I][BadBleWorker] BT RSSI: 0.000000 -252026 [I][BadBleWorker] BT RSSI: 0.000000 -252046 [I][BadBleWorker] BT RSSI: 0.000000 -252066 [I][BadBleWorker] BT RSSI: 0.000000 -252086 [I][BadBleWorker] BT RSSI: 0.000000 -252106 [I][BadBleWorker] BT RSSI: 0.000000 -252126 [I][BadBleWorker] BT RSSI: 0.000000 -252146 [I][BadBleWorker] BT RSSI: 0.000000 -252166 [I][BadBleWorker] BT RSSI: 0.000000 -252186 [I][BadBleWorker] BT RSSI: 0.000000 -252190 [I][SavedStruct] Loading "/int/.desktop.settings" -252207 [I][BadBleWorker] BT RSSI: 0.000000 -252227 [I][BadBleWorker] BT RSSI: 0.000000 -252248 [I][BadBleWorker] BT RSSI: 0.000000 -252251 [I][SavedStruct] Loading "/int/.desktop.settings" -252269 [I][BadBleWorker] BT RSSI: 0.000000 -252289 [I][BadBleWorker] BT RSSI: 0.000000 -252309 [I][BadBleWorker] BT RSSI: 0.000000 -252329 [I][BadBleWorker] BT RSSI: 0.000000 -252348 [I][BadBleWorker] BT RSSI: 0.000000 -252368 [I][BadBleWorker] BT RSSI: 0.000000 -252388 [I][BadBleWorker] BT RSSI: 0.000000 -252391 [I][SavedStruct] Loading "/int/.desktop.settings" -252409 [I][BadBleWorker] BT RSSI: 0.000000 -252429 [I][BadBleWorker] BT RSSI: 0.000000 -252449 [I][BadBleWorker] BT RSSI: 0.000000 -252469 [I][BadBleWorker] BT RSSI: 0.000000 -252489 [I][BadBleWorker] BT RSSI: 0.000000 -252509 [I][BadBleWorker] BT RSSI: 0.000000 -252529 [I][BadBleWorker] BT RSSI: 0.000000 -252549 [I][BadBleWorker] BT RSSI: 0.000000 -252569 [I][BadBleWorker] BT RSSI: 0.000000 -252590 [I][SavedStruct] Loading "/int/.desktop.settings" -252592 [I][BadBleWorker] BT RSSI: 0.000000 -252614 [I][BadBleWorker] BT RSSI: 0.000000 -252634 [I][BadBleWorker] BT RSSI: 0.000000 -252654 [I][BadBleWorker] BT RSSI: 0.000000 -252674 [I][BadBleWorker] BT RSSI: 0.000000 -252694 [I][BadBleWorker] BT RSSI: 0.000000 -252714 [I][BadBleWorker] BT RSSI: 0.000000 -252733 [I][BadBleWorker] BT RSSI: 0.000000 -252748 [I][SavedStruct] Loading "/int/.desktop.settings" -252754 [I][BadBleWorker] BLE Key timeout : 16 -252758 [D][BadBleWorker] line:DELAY 200 -252763 [I][BadBleWorker] BLE Key timeout : 16 -252790 [I][SavedStruct] Loading "/int/.desktop.settings" -252967 [D][BadBleWorker] line:ENTER -252969 [I][BadBleWorker] Special key pressed 28 - -252972 [I][BadBleWorker] BT RSSI: 0.000000 -252990 [I][SavedStruct] Loading "/int/.desktop.settings" -252993 [I][BadBleWorker] BLE Key timeout : 16 -253000 [D][BadBleWorker] line:GUI SPACE -253002 [I][BadBleWorker] Special key pressed 82c - -253007 [I][BadBleWorker] BT RSSI: 0.000000 -253028 [I][BadBleWorker] BLE Key timeout : 16 -253031 [D][BadBleWorker] line:DELAY 500 -253033 [I][BadBleWorker] BLE Key timeout : 16 -253190 [I][SavedStruct] Loading "/int/.desktop.settings" -253248 [I][SavedStruct] Loading "/int/.desktop.settings" -253390 [I][SavedStruct] Loading "/int/.desktop.settings" -253536 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -253540 [I][BadBleWorker] BT RSSI: 0.000000 -253560 [I][BadBleWorker] BT RSSI: 0.000000 -253580 [I][BadBleWorker] BT RSSI: 0.000000 -253590 [I][SavedStruct] Loading "/int/.desktop.settings" -253602 [I][BadBleWorker] BT RSSI: 0.000000 -253624 [I][BadBleWorker] BT RSSI: 0.000000 -253644 [I][BadBleWorker] BT RSSI: 0.000000 -253664 [I][BadBleWorker] BT RSSI: 0.000000 -253684 [I][BadBleWorker] BT RSSI: 0.000000 -253704 [I][BadBleWorker] BT RSSI: 0.000000 -253724 [I][BadBleWorker] BT RSSI: 0.000000 -253743 [I][BadBleWorker] BT RSSI: 0.000000 -253748 [I][SavedStruct] Loading "/int/.desktop.settings" -253765 [I][BadBleWorker] BT RSSI: 0.000000 -253785 [I][BadBleWorker] BT RSSI: 0.000000 -253790 [I][SavedStruct] Loading "/int/.desktop.settings" -253807 [I][BadBleWorker] BT RSSI: 0.000000 -253827 [I][BadBleWorker] BT RSSI: 0.000000 -253847 [I][BadBleWorker] BT RSSI: 0.000000 -253867 [I][BadBleWorker] BT RSSI: 0.000000 -253887 [I][BadBleWorker] BT RSSI: 0.000000 -253907 [I][BadBleWorker] BT RSSI: 0.000000 -253927 [I][BadBleWorker] BT RSSI: 0.000000 -253947 [I][BadBleWorker] BT RSSI: 0.000000 -253969 [I][BadBleWorker] BT RSSI: 0.000000 -253990 [I][SavedStruct] Loading "/int/.desktop.settings" -253993 [I][BadBleWorker] BT RSSI: 0.000000 -254015 [I][BadBleWorker] BT RSSI: 0.000000 -254035 [I][BadBleWorker] BT RSSI: 0.000000 -254055 [I][BadBleWorker] BT RSSI: 0.000000 -254075 [I][BadBleWorker] BT RSSI: 0.000000 -254095 [I][BadBleWorker] BT RSSI: 0.000000 -254115 [I][BadBleWorker] BT RSSI: 0.000000 -254135 [I][BadBleWorker] BT RSSI: 0.000000 -254155 [I][BadBleWorker] BT RSSI: 0.000000 -254174 [I][BadBleWorker] BT RSSI: 0.000000 -254190 [I][SavedStruct] Loading "/int/.desktop.settings" -254196 [I][BadBleWorker] BT RSSI: 0.000000 -254217 [I][BadBleWorker] BT RSSI: 0.000000 -254237 [I][BadBleWorker] BT RSSI: 0.000000 -254248 [I][SavedStruct] Loading "/int/.desktop.settings" -254259 [I][BadBleWorker] BT RSSI: 0.000000 -254281 [I][BadBleWorker] BT RSSI: 0.000000 -254300 [I][BadBleWorker] BT RSSI: 0.000000 -254320 [I][BadBleWorker] BT RSSI: 0.000000 -254340 [I][BadBleWorker] BT RSSI: 0.000000 -254360 [I][BadBleWorker] BT RSSI: 0.000000 -254379 [I][BadBleWorker] BLE Key timeout : 16 -254383 [D][BadBleWorker] line:DELAY 200 -254386 [I][BadBleWorker] BLE Key timeout : 16 -254390 [I][SavedStruct] Loading "/int/.desktop.settings" -254588 [D][BadBleWorker] line:ENTER -254590 [I][BadBleWorker] Special key pressed 28 - -254593 [I][SavedStruct] Loading "/int/.desktop.settings" -254596 [I][BadBleWorker] BT RSSI: 0.000000 -254617 [I][BadBleWorker] BLE Key timeout : 16 -254621 [D][BadBleWorker] line:GUI SPACE -254623 [I][BadBleWorker] Special key pressed 82c - -254627 [I][BadBleWorker] BT RSSI: 0.000000 -254646 [I][BadBleWorker] BLE Key timeout : 16 -254650 [D][BadBleWorker] line:DELAY 500 -254653 [I][BadBleWorker] BLE Key timeout : 16 -254748 [I][SavedStruct] Loading "/int/.desktop.settings" -254790 [I][SavedStruct] Loading "/int/.desktop.settings" -254990 [I][SavedStruct] Loading "/int/.desktop.settings" -255155 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -255159 [I][BadBleWorker] BT RSSI: 0.000000 -255179 [I][BadBleWorker] BT RSSI: 0.000000 -255190 [I][SavedStruct] Loading "/int/.desktop.settings" -255201 [I][BadBleWorker] BT RSSI: 0.000000 -255223 [I][BadBleWorker] BT RSSI: 0.000000 -255243 [I][BadBleWorker] BT RSSI: 0.000000 -255248 [I][SavedStruct] Loading "/int/.desktop.settings" -255265 [I][BadBleWorker] BT RSSI: 0.000000 -255286 [I][BadBleWorker] BT RSSI: 0.000000 -255306 [I][BadBleWorker] BT RSSI: 0.000000 -255326 [I][BadBleWorker] BT RSSI: 0.000000 -255346 [I][BadBleWorker] BT RSSI: 0.000000 -255366 [I][BadBleWorker] BT RSSI: 0.000000 -255386 [I][BadBleWorker] BT RSSI: 0.000000 -255390 [I][SavedStruct] Loading "/int/.desktop.settings" -255407 [I][BadBleWorker] BT RSSI: 0.000000 -255427 [I][BadBleWorker] BT RSSI: 0.000000 -255446 [I][BadBleWorker] BT RSSI: 0.000000 -255466 [I][BadBleWorker] BT RSSI: 0.000000 -255485 [I][BadBleWorker] BT RSSI: 0.000000 -255505 [I][BadBleWorker] BT RSSI: 0.000000 -255525 [I][BadBleWorker] BT RSSI: 0.000000 -255545 [I][BadBleWorker] BT RSSI: 0.000000 -255565 [I][BadBleWorker] BT RSSI: 0.000000 -255585 [I][BadBleWorker] BT RSSI: 0.000000 -255590 [I][SavedStruct] Loading "/int/.desktop.settings" -255607 [I][BadBleWorker] BT RSSI: 0.000000 -255628 [I][BadBleWorker] BT RSSI: 0.000000 -255648 [I][BadBleWorker] BT RSSI: 0.000000 -255668 [I][BadBleWorker] BT RSSI: 0.000000 -255688 [I][BadBleWorker] BT RSSI: 0.000000 -255708 [I][BadBleWorker] BT RSSI: 0.000000 -255728 [I][BadBleWorker] BT RSSI: 0.000000 -255748 [I][SavedStruct] Loading "/int/.desktop.settings" -255750 [I][BadBleWorker] BT RSSI: 0.000000 -255772 [I][BadBleWorker] BT RSSI: 0.000000 -255790 [I][SavedStruct] Loading "/int/.desktop.settings" -255794 [I][BadBleWorker] BT RSSI: 0.000000 -255816 [I][BadBleWorker] BT RSSI: 0.000000 -255836 [I][BadBleWorker] BT RSSI: 0.000000 -255856 [I][BadBleWorker] BT RSSI: 0.000000 -255876 [I][BadBleWorker] BT RSSI: 0.000000 -255896 [I][BadBleWorker] BT RSSI: 0.000000 -255915 [I][BadBleWorker] BT RSSI: 0.000000 -255935 [I][BadBleWorker] BT RSSI: 0.000000 -255955 [I][BadBleWorker] BT RSSI: 0.000000 -255975 [I][BadBleWorker] BT RSSI: 0.000000 -255996 [I][BadBleWorker] BLE Key timeout : 16 -256000 [D][BadBleWorker] line:DELAY 200 -256003 [I][BadBleWorker] BLE Key timeout : 16 -256006 [I][SavedStruct] Loading "/int/.desktop.settings" -256190 [I][SavedStruct] Loading "/int/.desktop.settings" -256207 [D][BadBleWorker] line:ENTER -256209 [I][BadBleWorker] Special key pressed 28 - -256213 [I][BadBleWorker] BT RSSI: 0.000000 -256232 [I][BadBleWorker] BLE Key timeout : 16 -256236 [I][BadBleWorker] BLE Key timeout : 16 -256248 [I][SavedStruct] Loading "/int/.desktop.settings" -256390 [I][SavedStruct] Loading "/int/.desktop.settings" -256590 [I][SavedStruct] Loading "/int/.desktop.settings" -256748 [I][SavedStruct] Loading "/int/.desktop.settings" -256790 [I][SavedStruct] Loading "/int/.desktop.settings" -256990 [I][SavedStruct] Loading "/int/.desktop.settings" -257190 [I][SavedStruct] Loading "/int/.desktop.settings" -257248 [I][SavedStruct] Loading "/int/.desktop.settings" -257390 [I][SavedStruct] Loading "/int/.desktop.settings" -257436 [I][BtGap] Stop advertising -257439 [D][BtGap] terminate success -257442 [E][BtGap] set_non_discoverable failed 12 -257446 [I][SavedStruct] Loading "/int/.desktop.settings" -257590 [I][SavedStruct] Loading "/int/.desktop.settings" -257646 [I][SavedStruct] Loading "/int/.bt.settings" -257659 [I][SavedStruct] Loading "/int/.bt.keys" -257669 [I][FuriHalBt] Disconnect and stop advertising -257671 [I][FuriHalBt] Stop current profile services -257683 [I][FuriHalBt] Stop BLE related RTOS threads -257707 [I][FuriHalBt] Reset SHCI -257790 [I][SavedStruct] Loading "/int/.desktop.settings" -257821 [I][FuriHalBt] Start BT initialization -257826 [I][Core2] Core2 started -257828 [I][Core2] C2 boot completed, mode: Stack -257831 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -257833 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -257837 [I][Core2] Radio stack started -257839 [I][Core2] Flash activity control switched to SEM7 -257841 [I][BtGap] Advertising name: Keyboard -257843 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -257860 [D][BtBatterySvc] Updating power state characteristic -257866 [I][BtSrv] Bt App started -257868 [I][BtGap] Start advertising -257871 [I][BadBleWorker] End -257873 [I][SavedStruct] Loading "/int/.desktop.settings" -257893 [D][BrowserWorker] Start -257909 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -257911 [D][BrowserWorker] Load offset: 0 cnt: 50 -257983 [D][GuiSrv] ViewPort changed while key press 2000D718 -> 20010BD0. Discarding key: Back, type: Short, sequence: 00000031 -257987 [D][GuiSrv] ViewPort changed while key press 2000D718 -> 20010BD0. Sending key: Back, type: Release, sequence: 00000031 to previous view port -258434 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 -258438 [D][BrowserWorker] Load offset: 0 cnt: 50 -278749 [I][Dolphin] Flush stats -278751 [I][SavedStruct] Saving "/int/.dolphin.state" -278762 [D][StorageInt] Device erase: page 2, translated page: cf -278771 [D][StorageInt] Device sync: skipping -278774 [I][DolphinState] State saved -317982 [D][BtGap] set_non_discoverable success -377984 [D][BtGap] set_non_discoverable success - - _.-------.._ -, - .-"```"--..,,_/ /`-, -, \ - .:" /:/ /'\ \ ,_..., `. | | - / ,----/:/ /`\ _\~`_-"` _; - ' / /`"""'\ \ \.~`_-' ,-"'/ - | | | 0 | | .-' ,/` / - | ,..\ \ ,.-"` ,/` / - ; : `/`""\` ,/--==,/-----, - | `-...| -.___-Z:_______J...---; - : ` _-' - _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ -| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| -| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | -|_| |____||___||_| |_| |___||_|_\ \___||____||___| - -Welcome to Flipper Zero Command Line Interface! -Read Manual https://docs.flipperzero.one - -Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) - ->: log -Press CTRL+C to stop... -48839 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 -48842 [D][BrowserWorker] Load offset: 0 cnt: 50 -51685 [D][BrowserWorker] End -51698 [I][BtGap] Stop advertising -51702 [D][BtGap] set_non_discoverable success -51716 [I][SavedStruct] Loading "/int/.desktop.settings" -51843 [I][SavedStruct] Loading "/int/.desktop.settings" -51908 [I][FuriHalBt] Disconnect and stop advertising -51910 [I][FuriHalBt] Stop current profile services -51919 [I][FuriHalBt] Stop BLE related RTOS threads -51943 [I][FuriHalBt] Reset SHCI -52043 [I][SavedStruct] Loading "/int/.desktop.settings" -52057 [I][FuriHalBt] Start BT initialization -52063 [I][Core2] Core2 started -52065 [I][Core2] C2 boot completed, mode: Stack -52068 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -52070 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -52074 [I][Core2] Radio stack started -52077 [I][Core2] Flash activity control switched to SEM7 -52079 [I][BtGap] Advertising name: Keyboard -52082 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -52098 [D][BtBatterySvc] Updating power state characteristic -52104 [I][BtGap] Start advertising -52106 [I][SavedStruct] Loading "/int/.bt.settings" -52124 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -52134 [I][FuriHalBt] Disconnect and stop advertising -52136 [I][BtGap] Stop advertising -52139 [D][BtGap] set_non_discoverable success -52142 [I][FuriHalBt] Stop current profile services -52152 [I][FuriHalBt] Stop BLE related RTOS threads -52177 [I][FuriHalBt] Reset SHCI -52212 [I][SavedStruct] Loading "/int/.desktop.settings" -52243 [I][SavedStruct] Loading "/int/.desktop.settings" -52291 [I][FuriHalBt] Start BT initialization -52296 [I][Core2] Core2 started -52298 [I][Core2] C2 boot completed, mode: Stack -52301 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -52303 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -52308 [I][Core2] Radio stack started -52310 [I][Core2] Flash activity control switched to SEM7 -52314 [I][BtGap] Advertising name: Rumik1 -52316 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -52333 [D][BtBatterySvc] Updating power state characteristic -52342 [I][BtSrv] Bt App started -52343 [I][BtGap] Start advertising -52347 [I][BadBleWorker] Init -52351 [I][SavedStruct] Loading "/int/.desktop.settings" -52378 [I][BadBleWorker] BLE Key timeout : 16 -52443 [I][SavedStruct] Loading "/int/.desktop.settings" -52643 [I][SavedStruct] Loading "/int/.desktop.settings" -52712 [I][SavedStruct] Loading "/int/.desktop.settings" -52843 [I][SavedStruct] Loading "/int/.desktop.settings" -53043 [I][SavedStruct] Loading "/int/.desktop.settings" -53243 [I][SavedStruct] Loading "/int/.desktop.settings" -53861 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -53865 [I][BtGap] Rssi: 302 -53954 [D][BtGap] Slave security initiated -54073 [I][BtGap] Pairing complete -54076 [D][BtBatterySvc] Updating battery level characteristic -54079 [I][BadBleWorker] BLE Key timeout : 16 -54252 [I][BtGap] Rx MTU size: 414 -54822 [I][BtGap] Connection parameters event complete -54824 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -54826 [W][BtGap] Unsupported connection interval. Request connection parameters update -54829 [I][BtGap] Rssi: 290 -54859 [D][BtGap] Connection parameters accepted -55022 [I][BtGap] Connection parameters event complete -55025 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -55027 [I][BtGap] Rssi: 293 -59176 [I][FuriHalBt] Disconnect and stop advertising -59180 [I][BtGap] Stop advertising -59184 [D][BtGap] terminate success -59188 [E][BtGap] set_non_discoverable failed 12 -59193 [I][FuriHalBt] Stop current profile services -59198 [I][BadBleWorker] BLE Key timeout : 16 -59216 [I][FuriHalBt] Stop BLE related RTOS threads -59240 [I][FuriHalBt] Reset SHCI -59354 [I][FuriHalBt] Start BT initialization -59360 [I][Core2] Core2 started -59363 [I][Core2] C2 boot completed, mode: Stack -59366 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -59368 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -59372 [I][Core2] Radio stack started -59375 [I][Core2] Flash activity control switched to SEM7 -59377 [I][BtGap] Advertising name: Kkk -59380 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -59397 [D][BtBatterySvc] Updating power state characteristic -59407 [I][BtGap] Start advertising -60280 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -60282 [I][BtGap] Rssi: 302 -60374 [D][BtGap] Slave security initiated -60495 [I][BtGap] Pairing complete -60498 [D][BtBatterySvc] Updating battery level characteristic -60500 [I][BadBleWorker] BLE Key timeout : 16 -60673 [I][BtGap] Rx MTU size: 414 -61244 [I][BtGap] Connection parameters event complete -61248 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -61252 [W][BtGap] Unsupported connection interval. Request connection parameters update -61258 [I][BtGap] Rssi: 297 -61284 [D][BtGap] Connection parameters accepted -61448 [I][BtGap] Connection parameters event complete -61452 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -61456 [I][BtGap] Rssi: 298 -66066 [I][BtGap] Disconnect from client. Reason: 13 -66069 [I][BadBleWorker] BLE Key timeout : 16 -69485 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -69489 [I][BtGap] Rssi: 297 -69600 [D][BtGap] Slave security initiated -69720 [I][BtGap] Pairing complete -69723 [D][BtBatterySvc] Updating battery level characteristic -69727 [I][BadBleWorker] BLE Key timeout : 16 -69900 [I][BtGap] Rx MTU size: 414 -71400 [I][BtGap] Connection parameters event complete -71402 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -71405 [W][BtGap] Unsupported connection interval. Request connection parameters update -71408 [I][BtGap] Rssi: 296 -71438 [D][BtGap] Connection parameters accepted -71603 [I][BtGap] Connection parameters event complete -71605 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -71609 [I][BtGap] Rssi: 299 -73790 [I][BtGap] Disconnect from client. Reason: 13 -73792 [I][BadBleWorker] BLE Key timeout : 16 -80587 [I][FuriHalBt] Disconnect and stop advertising -80591 [I][BtGap] Stop advertising -80595 [D][BtGap] set_non_discoverable success -80600 [I][FuriHalBt] Stop current profile services -80621 [I][FuriHalBt] Stop BLE related RTOS threads -80647 [I][FuriHalBt] Reset SHCI -80762 [I][FuriHalBt] Start BT initialization -80767 [I][Core2] Core2 started -80769 [I][Core2] C2 boot completed, mode: Stack -80772 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -80774 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -80778 [I][Core2] Radio stack started -80781 [I][Core2] Flash activity control switched to SEM7 -80783 [I][BtGap] Advertising name: Kkk -80786 [I][BtGap] MAC @ : 35:F2:47:26:11:11 -80803 [D][BtBatterySvc] Updating power state characteristic -80813 [I][BtGap] Start advertising -81988 [D][ViewDispatcher] View changed while key press 200101B0 -> 200102B8. Sending key: Back, type: Release, sequence: 00000028 to previous view port -81992 [I][SavedStruct] Loading "/int/.desktop.settings" -82043 [I][SavedStruct] Loading "/int/.desktop.settings" -82243 [I][SavedStruct] Loading "/int/.desktop.settings" -82443 [I][SavedStruct] Loading "/int/.desktop.settings" -82493 [I][SavedStruct] Loading "/int/.desktop.settings" -82643 [I][SavedStruct] Loading "/int/.desktop.settings" -82843 [I][SavedStruct] Loading "/int/.desktop.settings" -82993 [I][SavedStruct] Loading "/int/.desktop.settings" -83043 [I][SavedStruct] Loading "/int/.desktop.settings" -83243 [I][SavedStruct] Loading "/int/.desktop.settings" -83443 [I][SavedStruct] Loading "/int/.desktop.settings" -83493 [I][SavedStruct] Loading "/int/.desktop.settings" -83643 [I][SavedStruct] Loading "/int/.desktop.settings" -83843 [I][SavedStruct] Loading "/int/.desktop.settings" -83993 [I][SavedStruct] Loading "/int/.desktop.settings" -84043 [I][SavedStruct] Loading "/int/.desktop.settings" -84243 [I][SavedStruct] Loading "/int/.desktop.settings" -84443 [I][SavedStruct] Loading "/int/.desktop.settings" -84493 [I][SavedStruct] Loading "/int/.desktop.settings" -84643 [I][SavedStruct] Loading "/int/.desktop.settings" -84843 [I][SavedStruct] Loading "/int/.desktop.settings" -84993 [I][SavedStruct] Loading "/int/.desktop.settings" -85043 [I][SavedStruct] Loading "/int/.desktop.settings" -85243 [I][SavedStruct] Loading "/int/.desktop.settings" -85443 [I][SavedStruct] Loading "/int/.desktop.settings" -85493 [I][SavedStruct] Loading "/int/.desktop.settings" -85643 [I][SavedStruct] Loading "/int/.desktop.settings" -85843 [I][SavedStruct] Loading "/int/.desktop.settings" -85993 [I][SavedStruct] Loading "/int/.desktop.settings" -86043 [I][SavedStruct] Loading "/int/.desktop.settings" -86243 [I][SavedStruct] Loading "/int/.desktop.settings" -86443 [I][SavedStruct] Loading "/int/.desktop.settings" -86493 [I][SavedStruct] Loading "/int/.desktop.settings" -86643 [I][SavedStruct] Loading "/int/.desktop.settings" -86843 [I][SavedStruct] Loading "/int/.desktop.settings" -86993 [I][SavedStruct] Loading "/int/.desktop.settings" -87043 [I][SavedStruct] Loading "/int/.desktop.settings" -87243 [I][SavedStruct] Loading "/int/.desktop.settings" -87443 [I][SavedStruct] Loading "/int/.desktop.settings" -87493 [I][SavedStruct] Loading "/int/.desktop.settings" -87643 [I][SavedStruct] Loading "/int/.desktop.settings" -87843 [I][SavedStruct] Loading "/int/.desktop.settings" -87993 [I][SavedStruct] Loading "/int/.desktop.settings" -88043 [I][SavedStruct] Loading "/int/.desktop.settings" -88243 [I][SavedStruct] Loading "/int/.desktop.settings" -88443 [I][SavedStruct] Loading "/int/.desktop.settings" -88493 [I][SavedStruct] Loading "/int/.desktop.settings" -88643 [I][SavedStruct] Loading "/int/.desktop.settings" -88843 [I][SavedStruct] Loading "/int/.desktop.settings" -88993 [I][SavedStruct] Loading "/int/.desktop.settings" -89043 [I][SavedStruct] Loading "/int/.desktop.settings" -89243 [I][SavedStruct] Loading "/int/.desktop.settings" -89443 [I][SavedStruct] Loading "/int/.desktop.settings" -89493 [I][SavedStruct] Loading "/int/.desktop.settings" -89643 [I][SavedStruct] Loading "/int/.desktop.settings" -89843 [I][SavedStruct] Loading "/int/.desktop.settings" -89993 [I][SavedStruct] Loading "/int/.desktop.settings" -90043 [I][SavedStruct] Loading "/int/.desktop.settings" -90243 [I][SavedStruct] Loading "/int/.desktop.settings" -90443 [I][SavedStruct] Loading "/int/.desktop.settings" -90493 [I][SavedStruct] Loading "/int/.desktop.settings" -90643 [I][SavedStruct] Loading "/int/.desktop.settings" -90843 [I][SavedStruct] Loading "/int/.desktop.settings" -90993 [I][SavedStruct] Loading "/int/.desktop.settings" -91043 [I][SavedStruct] Loading "/int/.desktop.settings" -91243 [I][SavedStruct] Loading "/int/.desktop.settings" -91443 [I][SavedStruct] Loading "/int/.desktop.settings" -91493 [I][SavedStruct] Loading "/int/.desktop.settings" -91643 [I][SavedStruct] Loading "/int/.desktop.settings" -91843 [I][SavedStruct] Loading "/int/.desktop.settings" -91993 [I][SavedStruct] Loading "/int/.desktop.settings" -92043 [I][SavedStruct] Loading "/int/.desktop.settings" -92243 [I][SavedStruct] Loading "/int/.desktop.settings" -92443 [I][SavedStruct] Loading "/int/.desktop.settings" -92493 [I][SavedStruct] Loading "/int/.desktop.settings" -92643 [I][SavedStruct] Loading "/int/.desktop.settings" -92843 [I][SavedStruct] Loading "/int/.desktop.settings" -92993 [I][SavedStruct] Loading "/int/.desktop.settings" -93043 [I][SavedStruct] Loading "/int/.desktop.settings" -93243 [I][SavedStruct] Loading "/int/.desktop.settings" -93443 [I][SavedStruct] Loading "/int/.desktop.settings" -93493 [I][SavedStruct] Loading "/int/.desktop.settings" -93643 [I][SavedStruct] Loading "/int/.desktop.settings" -93843 [I][SavedStruct] Loading "/int/.desktop.settings" -93993 [I][SavedStruct] Loading "/int/.desktop.settings" -94043 [I][SavedStruct] Loading "/int/.desktop.settings" -94243 [I][SavedStruct] Loading "/int/.desktop.settings" -94443 [I][SavedStruct] Loading "/int/.desktop.settings" -94493 [I][SavedStruct] Loading "/int/.desktop.settings" -94643 [I][SavedStruct] Loading "/int/.desktop.settings" -94843 [I][SavedStruct] Loading "/int/.desktop.settings" -94993 [I][SavedStruct] Loading "/int/.desktop.settings" -95043 [I][SavedStruct] Loading "/int/.desktop.settings" -95243 [I][SavedStruct] Loading "/int/.desktop.settings" -95443 [I][SavedStruct] Loading "/int/.desktop.settings" -95493 [I][SavedStruct] Loading "/int/.desktop.settings" -95643 [I][SavedStruct] Loading "/int/.desktop.settings" -95843 [I][SavedStruct] Loading "/int/.desktop.settings" -95993 [I][SavedStruct] Loading "/int/.desktop.settings" -96043 [I][SavedStruct] Loading "/int/.desktop.settings" -96243 [I][SavedStruct] Loading "/int/.desktop.settings" -96443 [I][SavedStruct] Loading "/int/.desktop.settings" -96493 [I][SavedStruct] Loading "/int/.desktop.settings" -96643 [I][SavedStruct] Loading "/int/.desktop.settings" -96846 [I][SavedStruct] Loading "/int/.desktop.settings" -96913 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -96916 [I][BtGap] Rssi: 324 -96993 [I][SavedStruct] Loading "/int/.desktop.settings" -97006 [D][BtGap] Slave security initiated -97043 [I][SavedStruct] Loading "/int/.desktop.settings" -97094 [I][BtGap] Rx MTU size: 414 -97243 [I][SavedStruct] Loading "/int/.desktop.settings" -97443 [I][SavedStruct] Loading "/int/.desktop.settings" -97493 [I][SavedStruct] Loading "/int/.desktop.settings" -97601 [D][BtGap] Bond lost event. Start rebonding -97643 [I][SavedStruct] Loading "/int/.desktop.settings" -97780 [I][BtGap] Verify numeric comparison: 898056 -100222 [I][SavedStruct] Loading "/int/.desktop.settings" -100243 [I][SavedStruct] Loading "/int/.desktop.settings" -100264 [I][SavedStruct] Loading "/int/.desktop.settings" -100443 [I][SavedStruct] Loading "/int/.desktop.settings" -100493 [I][SavedStruct] Loading "/int/.desktop.settings" -100643 [I][SavedStruct] Loading "/int/.desktop.settings" -100657 [I][BtGap] Pairing complete -100661 [D][BtBatterySvc] Updating battery level characteristic -100666 [I][BadBleWorker] BLE Key timeout : 16 -100843 [I][SavedStruct] Loading "/int/.desktop.settings" -100993 [I][SavedStruct] Loading "/int/.desktop.settings" -101043 [I][SavedStruct] Loading "/int/.desktop.settings" -101243 [I][SavedStruct] Loading "/int/.desktop.settings" -101443 [I][SavedStruct] Loading "/int/.desktop.settings" -101493 [I][SavedStruct] Loading "/int/.desktop.settings" -101643 [I][SavedStruct] Loading "/int/.desktop.settings" -101668 [I][BtGap] Connection parameters event complete -101670 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -101673 [W][BtGap] Unsupported connection interval. Request connection parameters update -101677 [I][BtGap] Rssi: 345 -101707 [D][BtGap] Connection parameters accepted -101843 [I][SavedStruct] Loading "/int/.desktop.settings" -101870 [I][BtGap] Connection parameters event complete -101873 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -101875 [I][BtGap] Rssi: 337 -101993 [I][SavedStruct] Loading "/int/.desktop.settings" -102043 [I][SavedStruct] Loading "/int/.desktop.settings" -102243 [I][SavedStruct] Loading "/int/.desktop.settings" -102443 [I][SavedStruct] Loading "/int/.desktop.settings" -102493 [I][SavedStruct] Loading "/int/.desktop.settings" -102643 [I][SavedStruct] Loading "/int/.desktop.settings" -102843 [I][SavedStruct] Loading "/int/.desktop.settings" -102993 [I][SavedStruct] Loading "/int/.desktop.settings" -103043 [I][SavedStruct] Loading "/int/.desktop.settings" -103243 [I][SavedStruct] Loading "/int/.desktop.settings" -103443 [I][SavedStruct] Loading "/int/.desktop.settings" -103493 [I][SavedStruct] Loading "/int/.desktop.settings" -103643 [I][SavedStruct] Loading "/int/.desktop.settings" -103843 [I][SavedStruct] Loading "/int/.desktop.settings" -103993 [I][SavedStruct] Loading "/int/.desktop.settings" -104043 [I][SavedStruct] Loading "/int/.desktop.settings" -104243 [I][SavedStruct] Loading "/int/.desktop.settings" -104443 [I][SavedStruct] Loading "/int/.desktop.settings" -104493 [I][SavedStruct] Loading "/int/.desktop.settings" -104643 [I][SavedStruct] Loading "/int/.desktop.settings" -104843 [I][SavedStruct] Loading "/int/.desktop.settings" -104993 [I][SavedStruct] Loading "/int/.desktop.settings" -105043 [I][SavedStruct] Loading "/int/.desktop.settings" -105243 [I][SavedStruct] Loading "/int/.desktop.settings" -105443 [I][SavedStruct] Loading "/int/.desktop.settings" -105493 [I][SavedStruct] Loading "/int/.desktop.settings" -105643 [I][SavedStruct] Loading "/int/.desktop.settings" -105843 [I][SavedStruct] Loading "/int/.desktop.settings" -105993 [I][SavedStruct] Loading "/int/.desktop.settings" -106043 [I][SavedStruct] Loading "/int/.desktop.settings" -106243 [I][SavedStruct] Loading "/int/.desktop.settings" -106443 [I][SavedStruct] Loading "/int/.desktop.settings" -106493 [I][SavedStruct] Loading "/int/.desktop.settings" -106643 [I][SavedStruct] Loading "/int/.desktop.settings" -106843 [I][SavedStruct] Loading "/int/.desktop.settings" -106993 [I][SavedStruct] Loading "/int/.desktop.settings" -107043 [I][SavedStruct] Loading "/int/.desktop.settings" -107243 [I][SavedStruct] Loading "/int/.desktop.settings" -107443 [I][SavedStruct] Loading "/int/.desktop.settings" -107493 [I][SavedStruct] Loading "/int/.desktop.settings" -107643 [I][SavedStruct] Loading "/int/.desktop.settings" -107843 [I][SavedStruct] Loading "/int/.desktop.settings" -107995 [I][SavedStruct] Loading "/int/.desktop.settings" -108043 [I][SavedStruct] Loading "/int/.desktop.settings" -108243 [I][SavedStruct] Loading "/int/.desktop.settings" -108443 [I][SavedStruct] Loading "/int/.desktop.settings" -108493 [I][SavedStruct] Loading "/int/.desktop.settings" -108643 [I][SavedStruct] Loading "/int/.desktop.settings" -108843 [I][SavedStruct] Loading "/int/.desktop.settings" -108993 [I][SavedStruct] Loading "/int/.desktop.settings" -109043 [I][SavedStruct] Loading "/int/.desktop.settings" -109243 [I][SavedStruct] Loading "/int/.desktop.settings" -109443 [I][SavedStruct] Loading "/int/.desktop.settings" -109536 [D][DolphinState] icounter 1325, butthurt 0 -109539 [I][BadBleWorker] BLE Key timeout : 16 -109543 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -109546 [I][BadBleWorker] BLE Key timeout : 16 -109549 [D][BadBleWorker] line:DELAY 1000 -109552 [I][BadBleWorker] BLE Key timeout : 16 -109643 [I][SavedStruct] Loading "/int/.desktop.settings" -109843 [I][SavedStruct] Loading "/int/.desktop.settings" -110037 [I][SavedStruct] Loading "/int/.desktop.settings" -110055 [I][SavedStruct] Loading "/int/.desktop.settings" -110243 [I][SavedStruct] Loading "/int/.desktop.settings" -110443 [I][SavedStruct] Loading "/int/.desktop.settings" -110537 [I][SavedStruct] Loading "/int/.desktop.settings" -110555 [D][BadBleWorker] line:GUI SPACE -110557 [I][BadBleWorker] Special key pressed 82c - -110578 [I][BadBleWorker] BLE Key timeout : 16 -110582 [D][BadBleWorker] line:DELAY 500 -110585 [I][BadBleWorker] BLE Key timeout : 16 -110643 [I][SavedStruct] Loading "/int/.desktop.settings" -110843 [I][SavedStruct] Loading "/int/.desktop.settings" -111039 [I][SavedStruct] Loading "/int/.desktop.settings" -111066 [I][SavedStruct] Loading "/int/.desktop.settings" -111088 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -111243 [I][SavedStruct] Loading "/int/.desktop.settings" -111443 [I][SavedStruct] Loading "/int/.desktop.settings" -111537 [I][SavedStruct] Loading "/int/.desktop.settings" -111643 [I][SavedStruct] Loading "/int/.desktop.settings" -111792 [E][BtHid] Failed updating report characteristic: 100 -111811 [E][BtHid] Failed updating report characteristic: 100 -111814 [E][BtHid] Failed updating report characteristic: 100 -111833 [E][BtHid] Failed updating report characteristic: 100 -111836 [I][BadBleWorker] BLE Key timeout : 16 -111838 [D][BadBleWorker] line:DELAY 200 -111840 [I][BadBleWorker] BLE Key timeout : 16 -111843 [I][SavedStruct] Loading "/int/.desktop.settings" -112037 [I][SavedStruct] Loading "/int/.desktop.settings" -112044 [D][BadBleWorker] line:ENTER -112046 [I][BadBleWorker] Special key pressed 28 - -112069 [I][BadBleWorker] BLE Key timeout : 16 -112072 [D][BadBleWorker] line:GUI SPACE -112074 [I][BadBleWorker] Special key pressed 82c - -112077 [I][SavedStruct] Loading "/int/.desktop.settings" -112095 [I][BadBleWorker] BLE Key timeout : 16 -112099 [D][BadBleWorker] line:DELAY 500 -112102 [I][BadBleWorker] BLE Key timeout : 16 -112243 [I][SavedStruct] Loading "/int/.desktop.settings" -112443 [I][SavedStruct] Loading "/int/.desktop.settings" -112537 [I][SavedStruct] Loading "/int/.desktop.settings" -112605 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -112643 [I][SavedStruct] Loading "/int/.desktop.settings" -112843 [I][SavedStruct] Loading "/int/.desktop.settings" -113037 [I][SavedStruct] Loading "/int/.desktop.settings" -113055 [I][SavedStruct] Loading "/int/.desktop.settings" -113243 [I][SavedStruct] Loading "/int/.desktop.settings" -113347 [I][BadBleWorker] BLE Key timeout : 16 -113351 [D][BadBleWorker] line:DELAY 200 -113354 [I][BadBleWorker] BLE Key timeout : 16 -113443 [I][SavedStruct] Loading "/int/.desktop.settings" -113537 [I][SavedStruct] Loading "/int/.desktop.settings" -113557 [D][BadBleWorker] line:ENTER -113559 [I][BadBleWorker] Special key pressed 28 - -113579 [I][BadBleWorker] BLE Key timeout : 16 -113583 [D][BadBleWorker] line:GUI SPACE -113585 [I][BadBleWorker] Special key pressed 82c - -113605 [I][BadBleWorker] BLE Key timeout : 16 -113608 [D][BadBleWorker] line:DELAY 500 -113610 [I][BadBleWorker] BLE Key timeout : 16 -113643 [I][SavedStruct] Loading "/int/.desktop.settings" -113843 [I][SavedStruct] Loading "/int/.desktop.settings" -114037 [I][SavedStruct] Loading "/int/.desktop.settings" -114055 [I][SavedStruct] Loading "/int/.desktop.settings" -114113 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -114243 [I][SavedStruct] Loading "/int/.desktop.settings" -114443 [I][SavedStruct] Loading "/int/.desktop.settings" -114537 [I][SavedStruct] Loading "/int/.desktop.settings" -114643 [I][SavedStruct] Loading "/int/.desktop.settings" -114843 [I][SavedStruct] Loading "/int/.desktop.settings" -114853 [I][BadBleWorker] BLE Key timeout : 16 -114861 [D][BadBleWorker] line:DELAY 200 -114865 [I][BadBleWorker] BLE Key timeout : 16 -115037 [I][SavedStruct] Loading "/int/.desktop.settings" -115055 [I][SavedStruct] Loading "/int/.desktop.settings" -115069 [D][BadBleWorker] line:ENTER -115071 [I][BadBleWorker] Special key pressed 28 - -115093 [I][BadBleWorker] BLE Key timeout : 16 -115097 [D][BadBleWorker] line:GUI SPACE -115100 [I][BadBleWorker] Special key pressed 82c - -115122 [I][BadBleWorker] BLE Key timeout : 16 -115126 [D][BadBleWorker] line:DELAY 500 -115129 [I][BadBleWorker] BLE Key timeout : 16 -115243 [I][SavedStruct] Loading "/int/.desktop.settings" -115443 [I][SavedStruct] Loading "/int/.desktop.settings" -115537 [I][SavedStruct] Loading "/int/.desktop.settings" -115632 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -115643 [I][SavedStruct] Loading "/int/.desktop.settings" -115843 [I][SavedStruct] Loading "/int/.desktop.settings" -116037 [I][SavedStruct] Loading "/int/.desktop.settings" -116055 [I][SavedStruct] Loading "/int/.desktop.settings" -116243 [I][SavedStruct] Loading "/int/.desktop.settings" -116369 [I][BadBleWorker] BLE Key timeout : 16 -116372 [D][BadBleWorker] line:DELAY 200 -116374 [I][BadBleWorker] BLE Key timeout : 16 -116443 [I][SavedStruct] Loading "/int/.desktop.settings" -116537 [I][SavedStruct] Loading "/int/.desktop.settings" -116577 [D][BadBleWorker] line:ENTER -116579 [I][BadBleWorker] Special key pressed 28 - -116599 [I][BadBleWorker] BLE Key timeout : 16 -116603 [I][BadBleWorker] BLE Key timeout : 16 -116643 [I][SavedStruct] Loading "/int/.desktop.settings" -116843 [I][SavedStruct] Loading "/int/.desktop.settings" -117037 [I][SavedStruct] Loading "/int/.desktop.settings" -117056 [I][SavedStruct] Loading "/int/.desktop.settings" -117243 [I][SavedStruct] Loading "/int/.desktop.settings" -117443 [I][SavedStruct] Loading "/int/.desktop.settings" -117537 [I][SavedStruct] Loading "/int/.desktop.settings" -117643 [I][SavedStruct] Loading "/int/.desktop.settings" -117843 [I][SavedStruct] Loading "/int/.desktop.settings" -118037 [I][SavedStruct] Loading "/int/.desktop.settings" -118056 [I][SavedStruct] Loading "/int/.desktop.settings" -118243 [I][SavedStruct] Loading "/int/.desktop.settings" -118443 [I][SavedStruct] Loading "/int/.desktop.settings" -118537 [I][SavedStruct] Loading "/int/.desktop.settings" -118643 [I][SavedStruct] Loading "/int/.desktop.settings" -118843 [I][SavedStruct] Loading "/int/.desktop.settings" -119037 [I][SavedStruct] Loading "/int/.desktop.settings" -119056 [I][SavedStruct] Loading "/int/.desktop.settings" -119243 [I][SavedStruct] Loading "/int/.desktop.settings" -119443 [I][SavedStruct] Loading "/int/.desktop.settings" -119537 [I][SavedStruct] Loading "/int/.desktop.settings" -119643 [I][SavedStruct] Loading "/int/.desktop.settings" -119843 [I][SavedStruct] Loading "/int/.desktop.settings" -120037 [I][SavedStruct] Loading "/int/.desktop.settings" -120056 [I][SavedStruct] Loading "/int/.desktop.settings" -120243 [I][SavedStruct] Loading "/int/.desktop.settings" -120443 [I][SavedStruct] Loading "/int/.desktop.settings" -120537 [I][SavedStruct] Loading "/int/.desktop.settings" -120643 [I][SavedStruct] Loading "/int/.desktop.settings" -120843 [I][SavedStruct] Loading "/int/.desktop.settings" -121037 [I][SavedStruct] Loading "/int/.desktop.settings" -121056 [I][SavedStruct] Loading "/int/.desktop.settings" -121243 [I][SavedStruct] Loading "/int/.desktop.settings" -121443 [I][SavedStruct] Loading "/int/.desktop.settings" -121537 [I][SavedStruct] Loading "/int/.desktop.settings" -121643 [I][SavedStruct] Loading "/int/.desktop.settings" -121843 [I][SavedStruct] Loading "/int/.desktop.settings" -122037 [I][SavedStruct] Loading "/int/.desktop.settings" -122056 [I][SavedStruct] Loading "/int/.desktop.settings" -122243 [I][SavedStruct] Loading "/int/.desktop.settings" -122443 [I][SavedStruct] Loading "/int/.desktop.settings" -122537 [I][SavedStruct] Loading "/int/.desktop.settings" -122643 [I][SavedStruct] Loading "/int/.desktop.settings" -122843 [I][SavedStruct] Loading "/int/.desktop.settings" -123037 [I][SavedStruct] Loading "/int/.desktop.settings" -123056 [I][SavedStruct] Loading "/int/.desktop.settings" -123243 [I][SavedStruct] Loading "/int/.desktop.settings" -123443 [I][SavedStruct] Loading "/int/.desktop.settings" -123537 [I][SavedStruct] Loading "/int/.desktop.settings" -123643 [I][SavedStruct] Loading "/int/.desktop.settings" -123843 [I][SavedStruct] Loading "/int/.desktop.settings" -124037 [I][SavedStruct] Loading "/int/.desktop.settings" -124056 [I][SavedStruct] Loading "/int/.desktop.settings" -124243 [I][SavedStruct] Loading "/int/.desktop.settings" -124335 [I][BtGap] Stop advertising -124338 [D][BtGap] terminate success -124341 [E][BtGap] set_non_discoverable failed 12 -124345 [I][SavedStruct] Loading "/int/.desktop.settings" -124443 [I][SavedStruct] Loading "/int/.desktop.settings" -124483 [I][BtGap] Disconnect from client. Reason: 16 -124545 [I][SavedStruct] Loading "/int/.bt.settings" -124558 [I][SavedStruct] Loading "/int/.bt.keys" -124567 [I][FuriHalBt] Disconnect and stop advertising -124571 [I][FuriHalBt] Stop current profile services -124582 [I][FuriHalBt] Stop BLE related RTOS threads -124606 [I][FuriHalBt] Reset SHCI -124643 [I][SavedStruct] Loading "/int/.desktop.settings" -124720 [I][FuriHalBt] Start BT initialization -124725 [I][Core2] Core2 started -124727 [I][Core2] C2 boot completed, mode: Stack -124730 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -124732 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -124736 [I][Core2] Radio stack started -124738 [I][Core2] Flash activity control switched to SEM7 -124740 [I][BtGap] Advertising name: Keyboard -124742 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -124753 [E][BtGap] Message queue get error: -4 -124762 [D][BtBatterySvc] Updating power state characteristic -124768 [I][BtSrv] Bt App started -124770 [I][BtGap] Start advertising -124772 [I][BadBleWorker] End -124774 [I][SavedStruct] Loading "/int/.desktop.settings" -124785 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -124790 [I][BtGap] Rssi: 328 -124801 [D][BrowserWorker] Start -124803 [I][SavedStruct] Loading "/int/.desktop.settings" -124834 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -124836 [D][BrowserWorker] Load offset: 0 cnt: 50 -124880 [D][BtGap] Slave security initiated -124999 [I][BtGap] Pairing complete -125003 [I][BtSrv] Open RPC connection -125006 [D][RpcSrv] Session started -125008 [D][BtBatterySvc] Updating battery level characteristic -125025 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 -125028 [D][BrowserWorker] Load offset: 0 cnt: 50 -125146 [I][BtGap] Rx MTU size: 414 -125268 [D][BrowserWorker] End -125270 [I][SavedStruct] Loading "/int/.desktop.settings" -125315 [I][fap_loader_app] FAP app returned: 0 -125347 [I][LoaderSrv] Application stopped. Free heap: 118720 -125376 [I][AnimationStorage] Custom Manifest selected -126074 [I][AnimationManager] Select 'SPIRAL' animation -126078 [I][AnimationManager] Load animation 'SPIRAL' -126102 [I][SavedStruct] Loading "/int/.desktop.settings" -127063 [D][BtSerialSvc] Received 57 bytes -127066 [D][BtSerialSvc] Available buff size: 967 -127069 [D][RpcStorage] Read -127123 [D][RpcStorage] Stat -127183 [D][RpcStorage] Info -127243 [D][BtSerialSvc] Received 12 bytes -127245 [D][BtSerialSvc] Available buff size: 1012 -127247 [D][RpcStorage] Info -127301 [D][BtSerialSvc] Received 23 bytes -127303 [D][BtSerialSvc] Available buff size: 1001 -127306 [D][RpcSystem] SetDatetime -127359 [D][BtSerialSvc] Received 29 bytes -127361 [D][BtSerialSvc] Available buff size: 995 -127364 [D][RpcStorage] Stat -127446 [D][BtSerialSvc] Received 11 bytes -127448 [D][BtSerialSvc] Available buff size: 1013 -127451 [D][RpcStorage] List -127745 [D][BtSerialSvc] Received 18 bytes -127747 [D][BtSerialSvc] Available buff size: 1006 -127749 [D][RpcStorage] List -127983 [D][BtSerialSvc] Received 18 bytes -127985 [D][BtSerialSvc] Available buff size: 1006 -127988 [D][RpcStorage] List -128041 [D][BtSerialSvc] Received 15 bytes -128043 [D][BtSerialSvc] Available buff size: 1009 -128046 [D][RpcStorage] List -128219 [D][BtSerialSvc] Received 15 bytes -128222 [D][BtSerialSvc] Available buff size: 1009 -128225 [D][RpcStorage] List -128399 [D][BtSerialSvc] Received 20 bytes -128403 [D][BtSerialSvc] Available buff size: 1004 -128408 [D][RpcStorage] List -128576 [D][BtSerialSvc] Received 19 bytes -128578 [D][BtSerialSvc] Available buff size: 1005 -128580 [D][RpcStorage] List -128633 [D][BtSerialSvc] Received 27 bytes -128635 [D][BtSerialSvc] Available buff size: 997 -128639 [D][RpcStorage] Md5sum -129503 [D][BtSerialSvc] Received 37 bytes -129505 [D][BtSerialSvc] Available buff size: 987 -129512 [D][RpcStorage] Md5sum -129591 [D][BtSerialSvc] Received 38 bytes -129593 [D][BtSerialSvc] Available buff size: 986 -129600 [D][RpcStorage] Md5sum -129678 [D][BtSerialSvc] Received 37 bytes -129680 [D][BtSerialSvc] Available buff size: 987 -129683 [D][RpcStorage] Md5sum -129736 [D][BtSerialSvc] Received 38 bytes -129738 [D][BtSerialSvc] Available buff size: 986 -129741 [D][RpcStorage] Md5sum -129794 [D][BtSerialSvc] Received 36 bytes -129796 [D][BtSerialSvc] Available buff size: 988 -129799 [D][RpcStorage] Md5sum -130032 [D][BtSerialSvc] Received 36 bytes -130034 [D][BtSerialSvc] Available buff size: 988 -130037 [D][RpcStorage] Md5sum -130120 [D][BtSerialSvc] Received 36 bytes -130122 [D][BtSerialSvc] Available buff size: 988 -130125 [D][RpcStorage] Md5sum - ->: - _.-------.._ -, - .-"```"--..,,_/ /`-, -, \ - .:" /:/ /'\ \ ,_..., `. | | - / ,----/:/ /`\ _\~`_-"` _; - ' / /`"""'\ \ \.~`_-' ,-"'/ - | | | 0 | | .-' ,/` / - | ,..\ \ ,.-"` ,/` / - ; : `/`""\` ,/--==,/-----, - | `-...| -.___-Z:_______J...---; - : ` _-' - _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ -| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| -| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | -|_| |____||___||_| |_| |___||_|_\ \___||____||___| - -Welcome to Flipper Zero Command Line Interface! -Read Manual https://docs.flipperzero.one - -Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) - ->: log -Press CTRL+C to stop... -25524 [D][BrowserWorker] End -25537 [I][BtGap] Stop advertising -25541 [D][BtGap] set_non_discoverable success -25555 [I][SavedStruct] Loading "/int/.desktop.settings" -25706 [I][SavedStruct] Loading "/int/.desktop.settings" -25747 [I][FuriHalBt] Disconnect and stop advertising -25749 [I][FuriHalBt] Stop current profile services -25758 [I][FuriHalBt] Stop BLE related RTOS threads -25782 [I][FuriHalBt] Reset SHCI -25896 [I][FuriHalBt] Start BT initialization -25901 [I][Core2] Core2 started -25903 [I][Core2] C2 boot completed, mode: Stack -25906 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -25908 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -25912 [I][SavedStruct] Loading "/int/.desktop.settings" -25915 [I][Core2] Radio stack started -25921 [I][Core2] Flash activity control switched to SEM7 -25925 [I][BtGap] Advertising name: Keyboard -25928 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -25950 [D][BtBatterySvc] Updating power state characteristic -25956 [I][BtGap] Start advertising -25958 [I][SavedStruct] Loading "/int/.bt.settings" -25975 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -25984 [I][FuriHalBt] Disconnect and stop advertising -25986 [I][BtGap] Stop advertising -25989 [D][BtGap] set_non_discoverable success -25992 [I][FuriHalBt] Stop current profile services -26001 [I][FuriHalBt] Stop BLE related RTOS threads -26026 [I][FuriHalBt] Reset SHCI -26051 [I][SavedStruct] Loading "/int/.desktop.settings" -26106 [I][SavedStruct] Loading "/int/.desktop.settings" -26140 [I][FuriHalBt] Start BT initialization -26145 [I][Core2] Core2 started -26147 [I][Core2] C2 boot completed, mode: Stack -26150 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -26152 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -26156 [I][Core2] Radio stack started -26159 [I][Core2] Flash activity control switched to SEM7 -26161 [I][BtGap] Advertising name: Rumik1 -26164 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -26181 [D][BtBatterySvc] Updating power state characteristic -26190 [I][BtSrv] Bt App started -26192 [I][BtGap] Start advertising -26195 [I][BadBleWorker] Init -26197 [I][SavedStruct] Loading "/int/.desktop.settings" -26224 [I][BadBleWorker] BLE Key timeout : 16 -26306 [I][SavedStruct] Loading "/int/.desktop.settings" -26506 [I][SavedStruct] Loading "/int/.desktop.settings" -26551 [I][SavedStruct] Loading "/int/.desktop.settings" -26706 [I][SavedStruct] Loading "/int/.desktop.settings" -26909 [I][SavedStruct] Loading "/int/.desktop.settings" -27051 [I][SavedStruct] Loading "/int/.desktop.settings" -27106 [I][SavedStruct] Loading "/int/.desktop.settings" -27306 [I][SavedStruct] Loading "/int/.desktop.settings" -27506 [I][SavedStruct] Loading "/int/.desktop.settings" -27551 [I][SavedStruct] Loading "/int/.desktop.settings" -27706 [I][SavedStruct] Loading "/int/.desktop.settings" -27906 [I][SavedStruct] Loading "/int/.desktop.settings" -28051 [I][SavedStruct] Loading "/int/.desktop.settings" -28106 [I][SavedStruct] Loading "/int/.desktop.settings" -28306 [I][SavedStruct] Loading "/int/.desktop.settings" -28506 [I][SavedStruct] Loading "/int/.desktop.settings" -28551 [I][SavedStruct] Loading "/int/.desktop.settings" -28706 [I][SavedStruct] Loading "/int/.desktop.settings" -28906 [I][SavedStruct] Loading "/int/.desktop.settings" -29051 [I][SavedStruct] Loading "/int/.desktop.settings" -29106 [I][SavedStruct] Loading "/int/.desktop.settings" -29306 [I][SavedStruct] Loading "/int/.desktop.settings" -29506 [I][SavedStruct] Loading "/int/.desktop.settings" -29551 [I][SavedStruct] Loading "/int/.desktop.settings" -29706 [I][SavedStruct] Loading "/int/.desktop.settings" -29906 [I][SavedStruct] Loading "/int/.desktop.settings" -30051 [I][SavedStruct] Loading "/int/.desktop.settings" -30106 [I][SavedStruct] Loading "/int/.desktop.settings" -30306 [I][SavedStruct] Loading "/int/.desktop.settings" -30506 [I][SavedStruct] Loading "/int/.desktop.settings" -30551 [I][SavedStruct] Loading "/int/.desktop.settings" -30706 [I][SavedStruct] Loading "/int/.desktop.settings" -30906 [I][SavedStruct] Loading "/int/.desktop.settings" -31051 [I][SavedStruct] Loading "/int/.desktop.settings" -31106 [I][SavedStruct] Loading "/int/.desktop.settings" -31306 [I][SavedStruct] Loading "/int/.desktop.settings" -31506 [I][SavedStruct] Loading "/int/.desktop.settings" -31551 [I][SavedStruct] Loading "/int/.desktop.settings" -31706 [I][SavedStruct] Loading "/int/.desktop.settings" -31906 [I][SavedStruct] Loading "/int/.desktop.settings" -32051 [I][SavedStruct] Loading "/int/.desktop.settings" -32106 [I][SavedStruct] Loading "/int/.desktop.settings" -32306 [I][SavedStruct] Loading "/int/.desktop.settings" -32506 [I][SavedStruct] Loading "/int/.desktop.settings" -32551 [I][SavedStruct] Loading "/int/.desktop.settings" -32706 [I][SavedStruct] Loading "/int/.desktop.settings" -32906 [I][SavedStruct] Loading "/int/.desktop.settings" -33051 [I][SavedStruct] Loading "/int/.desktop.settings" -33106 [I][SavedStruct] Loading "/int/.desktop.settings" -33306 [I][SavedStruct] Loading "/int/.desktop.settings" -33506 [I][SavedStruct] Loading "/int/.desktop.settings" -33551 [I][SavedStruct] Loading "/int/.desktop.settings" -33706 [I][SavedStruct] Loading "/int/.desktop.settings" -33906 [I][SavedStruct] Loading "/int/.desktop.settings" -34051 [I][SavedStruct] Loading "/int/.desktop.settings" -34106 [I][SavedStruct] Loading "/int/.desktop.settings" -34306 [I][SavedStruct] Loading "/int/.desktop.settings" -34506 [I][SavedStruct] Loading "/int/.desktop.settings" -34551 [I][SavedStruct] Loading "/int/.desktop.settings" -34706 [I][SavedStruct] Loading "/int/.desktop.settings" -34906 [I][SavedStruct] Loading "/int/.desktop.settings" -35051 [I][SavedStruct] Loading "/int/.desktop.settings" -35106 [I][SavedStruct] Loading "/int/.desktop.settings" -35306 [I][SavedStruct] Loading "/int/.desktop.settings" -35506 [I][SavedStruct] Loading "/int/.desktop.settings" -35551 [I][SavedStruct] Loading "/int/.desktop.settings" -35706 [I][SavedStruct] Loading "/int/.desktop.settings" -35906 [I][SavedStruct] Loading "/int/.desktop.settings" -36051 [I][SavedStruct] Loading "/int/.desktop.settings" -36106 [I][SavedStruct] Loading "/int/.desktop.settings" -36306 [I][SavedStruct] Loading "/int/.desktop.settings" -36506 [I][SavedStruct] Loading "/int/.desktop.settings" -36551 [I][SavedStruct] Loading "/int/.desktop.settings" -36706 [I][SavedStruct] Loading "/int/.desktop.settings" -36906 [I][SavedStruct] Loading "/int/.desktop.settings" -37051 [I][SavedStruct] Loading "/int/.desktop.settings" -37106 [I][SavedStruct] Loading "/int/.desktop.settings" -37306 [I][SavedStruct] Loading "/int/.desktop.settings" -37506 [I][SavedStruct] Loading "/int/.desktop.settings" -37551 [I][SavedStruct] Loading "/int/.desktop.settings" -37706 [I][SavedStruct] Loading "/int/.desktop.settings" -37906 [I][SavedStruct] Loading "/int/.desktop.settings" -38053 [I][SavedStruct] Loading "/int/.desktop.settings" -38106 [I][SavedStruct] Loading "/int/.desktop.settings" -38306 [I][SavedStruct] Loading "/int/.desktop.settings" -38506 [I][SavedStruct] Loading "/int/.desktop.settings" -38551 [I][SavedStruct] Loading "/int/.desktop.settings" -38706 [I][SavedStruct] Loading "/int/.desktop.settings" -38906 [I][SavedStruct] Loading "/int/.desktop.settings" -39051 [I][SavedStruct] Loading "/int/.desktop.settings" -39106 [I][SavedStruct] Loading "/int/.desktop.settings" -39256 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -39258 [I][BtGap] Rssi: 334 -39306 [I][SavedStruct] Loading "/int/.desktop.settings" -39344 [D][BtGap] Slave security initiated -39435 [I][BtGap] Rx MTU size: 414 -39506 [I][SavedStruct] Loading "/int/.desktop.settings" -39551 [I][SavedStruct] Loading "/int/.desktop.settings" -39706 [I][SavedStruct] Loading "/int/.desktop.settings" -39906 [I][SavedStruct] Loading "/int/.desktop.settings" -39941 [D][BtGap] Bond lost event. Start rebonding -40051 [I][SavedStruct] Loading "/int/.desktop.settings" -40106 [I][SavedStruct] Loading "/int/.desktop.settings" -40119 [I][BtGap] Verify numeric comparison: 448118 -41993 [I][SavedStruct] Loading "/int/.desktop.settings" -42014 [I][SavedStruct] Loading "/int/.desktop.settings" -42051 [I][SavedStruct] Loading "/int/.desktop.settings" -42106 [I][SavedStruct] Loading "/int/.desktop.settings" -42306 [I][SavedStruct] Loading "/int/.desktop.settings" -42453 [I][BtKeyStorage] Base address: 200301E0. Start update address: 20030938. Size changed: 4 -42456 [I][SavedStruct] Saving "/ext/apps/Tools/.bt_hid.keys" -42458 [I][BtGap] Pairing complete -42506 [I][BtKeyStorage] Base address: 200301E0. Start update address: 20030938. Size changed: 88 -42508 [I][SavedStruct] Saving "/ext/apps/Tools/.bt_hid.keys" -42540 [D][BtGap] RSSI: -81 -42542 [D][BtBatterySvc] Updating battery level characteristic -42544 [I][SavedStruct] Loading "/int/.desktop.settings" -42547 [D][BtGap] RSSI: -81 -42551 [I][BadBleWorker] BLE Key timeout : 33 -42569 [I][SavedStruct] Loading "/int/.desktop.settings" -42706 [I][SavedStruct] Loading "/int/.desktop.settings" -42906 [I][SavedStruct] Loading "/int/.desktop.settings" -43068 [I][SavedStruct] Loading "/int/.desktop.settings" -43106 [I][SavedStruct] Loading "/int/.desktop.settings" -43306 [I][SavedStruct] Loading "/int/.desktop.settings" -43506 [I][SavedStruct] Loading "/int/.desktop.settings" -43514 [I][BtGap] Connection parameters event complete -43518 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -43522 [W][BtGap] Unsupported connection interval. Request connection parameters update -43528 [I][BtGap] Rssi: 358 -43568 [I][SavedStruct] Loading "/int/.desktop.settings" -43570 [D][BtGap] Connection parameters accepted -43706 [I][SavedStruct] Loading "/int/.desktop.settings" -43731 [I][BtGap] Connection parameters event complete -43735 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -43737 [I][BtGap] Rssi: 337 -43906 [I][SavedStruct] Loading "/int/.desktop.settings" -44068 [I][SavedStruct] Loading "/int/.desktop.settings" -44106 [I][SavedStruct] Loading "/int/.desktop.settings" -44306 [I][SavedStruct] Loading "/int/.desktop.settings" -44506 [I][SavedStruct] Loading "/int/.desktop.settings" -44568 [I][SavedStruct] Loading "/int/.desktop.settings" -44706 [I][SavedStruct] Loading "/int/.desktop.settings" -44906 [I][SavedStruct] Loading "/int/.desktop.settings" -45068 [I][SavedStruct] Loading "/int/.desktop.settings" -45106 [I][SavedStruct] Loading "/int/.desktop.settings" -45306 [I][SavedStruct] Loading "/int/.desktop.settings" -45337 [D][DolphinState] icounter 1325, butthurt 0 -45340 [D][BtGap] RSSI: -92 -45341 [I][BadBleWorker] BLE Key timeout : 16 -45346 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -45348 [D][BtGap] RSSI: -92 -45350 [I][BadBleWorker] BLE Key timeout : 16 -45352 [D][BadBleWorker] line:DELAY 1000 -45354 [D][BtGap] RSSI: -92 -45355 [I][BadBleWorker] BLE Key timeout : 16 -45506 [I][SavedStruct] Loading "/int/.desktop.settings" -45706 [I][SavedStruct] Loading "/int/.desktop.settings" -45838 [I][SavedStruct] Loading "/int/.desktop.settings" -45906 [I][SavedStruct] Loading "/int/.desktop.settings" -46106 [I][SavedStruct] Loading "/int/.desktop.settings" -46306 [I][SavedStruct] Loading "/int/.desktop.settings" -46338 [I][SavedStruct] Loading "/int/.desktop.settings" -46357 [D][BadBleWorker] line:GUI SPACE -46359 [I][BadBleWorker] Special key pressed 82c - -46380 [D][BtGap] RSSI: -96 -46382 [I][BadBleWorker] BLE Key timeout : 16 -46385 [D][BadBleWorker] line:DELAY 500 -46388 [D][BtGap] RSSI: -96 -46390 [I][BadBleWorker] BLE Key timeout : 16 -46506 [I][SavedStruct] Loading "/int/.desktop.settings" -46706 [I][SavedStruct] Loading "/int/.desktop.settings" -46838 [I][SavedStruct] Loading "/int/.desktop.settings" -46892 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -46906 [I][SavedStruct] Loading "/int/.desktop.settings" -47106 [I][SavedStruct] Loading "/int/.desktop.settings" -47306 [I][SavedStruct] Loading "/int/.desktop.settings" -47308 [E][BtHid] Failed updating report characteristic: 100 -47313 [E][BtHid] Failed updating report characteristic: 100 -47334 [E][BtHid] Failed updating report characteristic: 100 -47338 [I][SavedStruct] Loading "/int/.desktop.settings" -47340 [E][BtHid] Failed updating report characteristic: 100 -47469 [E][BtHid] Failed updating report characteristic: 100 -47472 [E][BtHid] Failed updating report characteristic: 100 -47491 [E][BtHid] Failed updating report characteristic: 100 -47494 [E][BtHid] Failed updating report characteristic: 100 -47506 [I][SavedStruct] Loading "/int/.desktop.settings" -47513 [E][BtHid] Failed updating report characteristic: 100 -47516 [E][BtHid] Failed updating report characteristic: 100 -47537 [E][BtHid] Failed updating report characteristic: 100 -47540 [E][BtHid] Failed updating report characteristic: 100 -47559 [E][BtHid] Failed updating report characteristic: 100 -47562 [E][BtHid] Failed updating report characteristic: 100 -47581 [E][BtHid] Failed updating report characteristic: 100 -47584 [E][BtHid] Failed updating report characteristic: 100 -47603 [E][BtHid] Failed updating report characteristic: 100 -47606 [E][BtHid] Failed updating report characteristic: 100 -47625 [E][BtHid] Failed updating report characteristic: 100 -47628 [E][BtHid] Failed updating report characteristic: 100 -47682 [D][BtGap] RSSI: -97 -47684 [I][BadBleWorker] BLE Key timeout : 16 -47686 [D][BadBleWorker] line:DELAY 200 -47688 [D][BtGap] RSSI: -97 -47690 [I][BadBleWorker] BLE Key timeout : 16 -47706 [I][SavedStruct] Loading "/int/.desktop.settings" -47838 [I][SavedStruct] Loading "/int/.desktop.settings" -47892 [D][BadBleWorker] line:ENTER -47894 [I][BadBleWorker] Special key pressed 28 - -47906 [I][SavedStruct] Loading "/int/.desktop.settings" -47916 [D][BtGap] RSSI: -91 -47918 [I][BadBleWorker] BLE Key timeout : 16 -47922 [D][BadBleWorker] line:GUI SPACE -47924 [I][BadBleWorker] Special key pressed 82c - -47948 [D][BtGap] RSSI: -91 -47950 [I][BadBleWorker] BLE Key timeout : 16 -47953 [D][BadBleWorker] line:DELAY 500 -47956 [D][BtGap] RSSI: -91 -47958 [I][BadBleWorker] BLE Key timeout : 16 -48106 [I][SavedStruct] Loading "/int/.desktop.settings" -48306 [I][SavedStruct] Loading "/int/.desktop.settings" -48338 [I][SavedStruct] Loading "/int/.desktop.settings" -48460 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -48506 [I][SavedStruct] Loading "/int/.desktop.settings" -48706 [I][SavedStruct] Loading "/int/.desktop.settings" -48787 [E][BtHid] Failed updating report characteristic: 100 -48790 [E][BtHid] Failed updating report characteristic: 100 -48809 [E][BtHid] Failed updating report characteristic: 100 -48812 [E][BtHid] Failed updating report characteristic: 100 -48831 [E][BtHid] Failed updating report characteristic: 100 -48834 [E][BtHid] Failed updating report characteristic: 100 -48838 [I][SavedStruct] Loading "/int/.desktop.settings" -48854 [E][BtHid] Failed updating report characteristic: 100 -48859 [E][BtHid] Failed updating report characteristic: 100 -48878 [E][BtHid] Failed updating report characteristic: 100 -48881 [E][BtHid] Failed updating report characteristic: 100 -48900 [E][BtHid] Failed updating report characteristic: 100 -48903 [E][BtHid] Failed updating report characteristic: 100 -48907 [I][SavedStruct] Loading "/int/.desktop.settings" -48923 [E][BtHid] Failed updating report characteristic: 100 -48928 [E][BtHid] Failed updating report characteristic: 100 -48947 [E][BtHid] Failed updating report characteristic: 100 -48950 [E][BtHid] Failed updating report characteristic: 100 -48969 [E][BtHid] Failed updating report characteristic: 100 -48972 [E][BtHid] Failed updating report characteristic: 100 -48991 [E][BtHid] Failed updating report characteristic: 100 -48994 [E][BtHid] Failed updating report characteristic: 100 -49103 [E][BtHid] Failed updating report characteristic: 100 -49106 [I][SavedStruct] Loading "/int/.desktop.settings" -49123 [E][BtHid] Failed updating report characteristic: 100 -49127 [E][BtHid] Failed updating report characteristic: 100 -49146 [E][BtHid] Failed updating report characteristic: 100 -49149 [E][BtHid] Failed updating report characteristic: 100 -49168 [E][BtHid] Failed updating report characteristic: 100 -49171 [E][BtHid] Failed updating report characteristic: 100 -49190 [E][BtHid] Failed updating report characteristic: 100 -49193 [E][BtHid] Failed updating report characteristic: 100 -49213 [E][BtHid] Failed updating report characteristic: 100 -49218 [E][BtHid] Failed updating report characteristic: 100 -49238 [E][BtHid] Failed updating report characteristic: 100 -49241 [E][BtHid] Failed updating report characteristic: 100 -49260 [E][BtHid] Failed updating report characteristic: 100 -49280 [D][BtGap] RSSI: -90 -49282 [I][BadBleWorker] BLE Key timeout : 16 -49285 [D][BadBleWorker] line:DELAY 200 -49288 [D][BtGap] RSSI: -90 -49290 [I][BadBleWorker] BLE Key timeout : 16 -49306 [I][SavedStruct] Loading "/int/.desktop.settings" -49338 [I][SavedStruct] Loading "/int/.desktop.settings" -49492 [D][BadBleWorker] line:ENTER -49494 [I][BadBleWorker] Special key pressed 28 - -49506 [I][SavedStruct] Loading "/int/.desktop.settings" -49516 [D][BtGap] RSSI: -96 -49518 [I][BadBleWorker] BLE Key timeout : 16 -49527 [D][BadBleWorker] line:GUI SPACE -49529 [I][BadBleWorker] Special key pressed 82c - -49550 [D][BtGap] RSSI: -97 -49552 [I][BadBleWorker] BLE Key timeout : 16 -49555 [D][BadBleWorker] line:DELAY 500 -49557 [D][BtGap] RSSI: -97 -49558 [I][BadBleWorker] BLE Key timeout : 16 -49706 [I][SavedStruct] Loading "/int/.desktop.settings" -49838 [I][SavedStruct] Loading "/int/.desktop.settings" -49906 [I][SavedStruct] Loading "/int/.desktop.settings" -50060 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -50106 [I][SavedStruct] Loading "/int/.desktop.settings" -50306 [I][SavedStruct] Loading "/int/.desktop.settings" -50338 [I][SavedStruct] Loading "/int/.desktop.settings" -50506 [I][SavedStruct] Loading "/int/.desktop.settings" -50706 [I][SavedStruct] Loading "/int/.desktop.settings" -50796 [D][BtGap] RSSI: -91 -50798 [I][BadBleWorker] BLE Key timeout : 16 -50801 [D][BadBleWorker] line:DELAY 200 -50804 [D][BtGap] RSSI: -91 -50806 [I][BadBleWorker] BLE Key timeout : 16 -50838 [I][SavedStruct] Loading "/int/.desktop.settings" -50906 [I][SavedStruct] Loading "/int/.desktop.settings" -51008 [D][BadBleWorker] line:ENTER -51010 [I][BadBleWorker] Special key pressed 28 - -51029 [D][BtGap] RSSI: -95 -51031 [I][BadBleWorker] BLE Key timeout : 16 -51034 [D][BadBleWorker] line:GUI SPACE -51036 [I][BadBleWorker] Special key pressed 82c - -51056 [D][BtGap] RSSI: -85 -51058 [I][BadBleWorker] BLE Key timeout : 33 -51061 [D][BadBleWorker] line:DELAY 500 -51064 [D][BtGap] RSSI: -85 -51066 [I][BadBleWorker] BLE Key timeout : 33 -51106 [I][SavedStruct] Loading "/int/.desktop.settings" -51306 [I][SavedStruct] Loading "/int/.desktop.settings" -51338 [I][SavedStruct] Loading "/int/.desktop.settings" -51506 [I][SavedStruct] Loading "/int/.desktop.settings" -51568 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -51706 [I][SavedStruct] Loading "/int/.desktop.settings" -51838 [I][SavedStruct] Loading "/int/.desktop.settings" -51906 [I][SavedStruct] Loading "/int/.desktop.settings" -52106 [I][SavedStruct] Loading "/int/.desktop.settings" -52306 [I][SavedStruct] Loading "/int/.desktop.settings" -52338 [I][SavedStruct] Loading "/int/.desktop.settings" -52506 [I][SavedStruct] Loading "/int/.desktop.settings" -52706 [I][SavedStruct] Loading "/int/.desktop.settings" -52838 [I][SavedStruct] Loading "/int/.desktop.settings" -52906 [I][SavedStruct] Loading "/int/.desktop.settings" -53007 [D][BtGap] RSSI: -79 -53009 [I][BadBleWorker] BLE Key timeout : 33 -53012 [D][BadBleWorker] line:DELAY 200 -53014 [D][BtGap] RSSI: -79 -53016 [I][BadBleWorker] BLE Key timeout : 33 -53106 [I][SavedStruct] Loading "/int/.desktop.settings" -53218 [D][BadBleWorker] line:ENTER -53220 [I][BadBleWorker] Special key pressed 28 - -53257 [D][BtGap] RSSI: -80 -53259 [I][BadBleWorker] BLE Key timeout : 33 -53263 [D][BtGap] RSSI: -80 -53265 [I][BadBleWorker] BLE Key timeout : 33 -53306 [I][SavedStruct] Loading "/int/.desktop.settings" -53338 [I][SavedStruct] Loading "/int/.desktop.settings" -53506 [I][SavedStruct] Loading "/int/.desktop.settings" -53706 [I][SavedStruct] Loading "/int/.desktop.settings" -53838 [I][SavedStruct] Loading "/int/.desktop.settings" -53906 [I][SavedStruct] Loading "/int/.desktop.settings" -54106 [I][SavedStruct] Loading "/int/.desktop.settings" -54306 [I][SavedStruct] Loading "/int/.desktop.settings" -54338 [I][SavedStruct] Loading "/int/.desktop.settings" -54506 [I][SavedStruct] Loading "/int/.desktop.settings" -54706 [I][SavedStruct] Loading "/int/.desktop.settings" -54838 [I][SavedStruct] Loading "/int/.desktop.settings" -54906 [I][SavedStruct] Loading "/int/.desktop.settings" -55106 [I][SavedStruct] Loading "/int/.desktop.settings" -55306 [I][SavedStruct] Loading "/int/.desktop.settings" -55338 [I][SavedStruct] Loading "/int/.desktop.settings" -55506 [I][SavedStruct] Loading "/int/.desktop.settings" -55706 [I][SavedStruct] Loading "/int/.desktop.settings" -55838 [I][SavedStruct] Loading "/int/.desktop.settings" -55906 [I][SavedStruct] Loading "/int/.desktop.settings" -56106 [I][SavedStruct] Loading "/int/.desktop.settings" -56316 [I][SavedStruct] Loading "/int/.desktop.settings" -56338 [I][SavedStruct] Loading "/int/.desktop.settings" -56506 [I][SavedStruct] Loading "/int/.desktop.settings" -56706 [I][SavedStruct] Loading "/int/.desktop.settings" -56838 [I][SavedStruct] Loading "/int/.desktop.settings" -56906 [I][SavedStruct] Loading "/int/.desktop.settings" -57106 [I][SavedStruct] Loading "/int/.desktop.settings" -57306 [I][SavedStruct] Loading "/int/.desktop.settings" -57338 [I][SavedStruct] Loading "/int/.desktop.settings" -57506 [I][SavedStruct] Loading "/int/.desktop.settings" -57706 [I][SavedStruct] Loading "/int/.desktop.settings" -57838 [I][SavedStruct] Loading "/int/.desktop.settings" -57906 [I][SavedStruct] Loading "/int/.desktop.settings" -58083 [I][BtGap] Stop advertising -58086 [D][BtGap] terminate success -58089 [E][BtGap] set_non_discoverable failed 12 -58093 [I][SavedStruct] Loading "/int/.desktop.settings" -58112 [I][SavedStruct] Loading "/int/.desktop.settings" -58131 [I][BtGap] Disconnect from client. Reason: 16 -58293 [I][SavedStruct] Loading "/int/.bt.settings" -58307 [I][SavedStruct] Loading "/int/.bt.keys" -58317 [I][FuriHalBt] Disconnect and stop advertising -58320 [I][FuriHalBt] Stop current profile services -58324 [I][SavedStruct] Loading "/int/.desktop.settings" -58346 [I][FuriHalBt] Stop BLE related RTOS threads -58374 [I][FuriHalBt] Reset SHCI -58488 [I][FuriHalBt] Start BT initialization -58493 [I][Core2] Core2 started -58495 [I][Core2] C2 boot completed, mode: Stack -58498 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -58500 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -58504 [I][Core2] Radio stack started -58507 [I][Core2] Flash activity control switched to SEM7 -58511 [I][BtGap] Advertising name: Keyboard -58514 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -58518 [I][SavedStruct] Loading "/int/.desktop.settings" -58541 [D][BtBatterySvc] Updating power state characteristic -58547 [I][BtSrv] Bt App started -58548 [I][BtGap] Start advertising -58550 [I][BadBleWorker] End -58552 [I][SavedStruct] Loading "/int/.desktop.settings" -58573 [I][SavedStruct] Loading "/int/.desktop.settings" -58575 [D][BrowserWorker] Start -58608 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -58610 [D][BrowserWorker] Load offset: 0 cnt: 50 -58724 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 -58727 [D][BrowserWorker] Load offset: 0 cnt: 50 -59009 [D][BrowserWorker] End -59011 [I][SavedStruct] Loading "/int/.desktop.settings" -59055 [I][fap_loader_app] FAP app returned: 0 -59091 [I][LoaderSrv] Application stopped. Free heap: 127088 -59120 [I][AnimationStorage] Custom Manifest selected -59411 [I][AnimationManager] Select 'HANDS' animation -59415 [I][AnimationManager] Load animation 'HANDS' -59443 [I][SavedStruct] Loading "/int/.desktop.settings" -75339 [I][Dolphin] Flush stats -75341 [I][SavedStruct] Saving "/int/.dolphin.state" -75351 [D][StorageInt] Device erase: page 9, translated page: d6 -75439 [D][StorageInt] Device sync: skipping -75441 [I][DolphinState] State saved -77873 [I][AnimationStorage] Custom Manifest selected -78353 [I][AnimationManager] Select 'DEDSEC_AD' animation -108394 [I][AnimationStorage] Custom Manifest selected -108758 [I][AnimationManager] Select 'DEDSEC_ASCII' animation -118697 [D][BtGap] set_non_discoverable success -138798 [I][AnimationStorage] Custom Manifest selected -139612 [I][AnimationManager] Select 'MARCUS' animation -169649 [I][AnimationStorage] Custom Manifest selected -170049 [I][AnimationManager] Select 'HANDS' animation -178699 [D][BtGap] set_non_discoverable success -200094 [I][AnimationStorage] Custom Manifest selected -200963 [I][AnimationManager] Select 'SKULL' animation -231003 [I][AnimationStorage] Custom Manifest selected -231753 [I][AnimationManager] Select 'GUNS_CAR' animation -238701 [D][BtGap] set_non_discoverable success -261795 [I][AnimationStorage] Custom Manifest selected -262627 [I][AnimationManager] Select 'DEDSEC_LOGO' animation -292669 [I][AnimationStorage] Custom Manifest selected -293615 [I][AnimationManager] Select 'LOGO_WD2' animation -298703 [D][BtGap] set_non_discoverable success -323656 [I][AnimationStorage] Custom Manifest selected -324243 [I][AnimationManager] Select 'DEDSEC_OLD' animation -354285 [I][AnimationStorage] Custom Manifest selected -355074 [I][AnimationManager] Select 'SPIRAL' animation -358705 [D][BtGap] set_non_discoverable success -385114 [I][AnimationStorage] Custom Manifest selected -385501 [I][AnimationManager] Select 'HANDS' animation -415546 [I][AnimationStorage] Custom Manifest selected -416332 [I][AnimationManager] Select 'SPIRAL' animation -418707 [D][BtGap] set_non_discoverable success -446371 [I][AnimationStorage] Custom Manifest selected -446861 [I][AnimationManager] Select 'DEDSEC_AD' animation -476903 [I][AnimationStorage] Custom Manifest selected -477735 [I][AnimationManager] Select 'DEDSEC_LOGO' animation -478709 [D][BtGap] set_non_discoverable success -507777 [I][AnimationStorage] Custom Manifest selected -508256 [I][AnimationManager] Select 'DEDSEC_AD' animation -538299 [I][AnimationStorage] Custom Manifest selected -539085 [I][AnimationManager] Select 'SPIRAL' animation -539117 [D][BtGap] set_non_discoverable success -569126 [I][AnimationStorage] Custom Manifest selected -569876 [I][AnimationManager] Select 'GUNS_CAR' animation -599120 [D][BtGap] set_non_discoverable success -599918 [I][AnimationStorage] Custom Manifest selected -600830 [I][AnimationManager] Select 'REAPER_ALT' animation -630871 [I][AnimationStorage] Custom Manifest selected -631392 [I][AnimationManager] Select 'DEDSEC_TALK' animation -659122 [D][BtGap] set_non_discoverable success -661435 [I][AnimationStorage] Custom Manifest selected -662238 [I][AnimationManager] Select 'MARCUS' animation -690919 [I][LoaderSrv] Starting: Applications -690925 [I][AnimationManager] Unload animation 'MARCUS' -690948 [D][BrowserWorker] Start -690965 [D][BrowserWorker] Enter folder: /ext/apps items: 6 idx: -1 -690967 [D][BrowserWorker] Load offset: 0 cnt: 50 -717407 [D][BrowserWorker] Enter folder: /ext/apps/Tools items: 23 idx: -1 -717410 [D][BrowserWorker] Load offset: 0 cnt: 50 -718007 [D][BrowserWorker] Exit to: /ext/apps items: 6 idx: 5 -718011 [D][BrowserWorker] Load offset: 0 cnt: 50 -719124 [D][BtGap] set_non_discoverable success -719398 [D][BrowserWorker] Enter folder: /ext/apps/Main items: 8 idx: -1 -719400 [D][BrowserWorker] Load offset: 0 cnt: 50 -720667 [D][BrowserWorker] End -720679 [I][fap_loader_app] FAP Loader is loading /ext/apps/Main/bad_ble.fap -720722 [I][fap_loader_app] FAP Loader is mapping -721451 [I][elf] Total size of loaded sections: 10460 -721453 [I][fap_loader_app] Loaded in 774ms -721455 [I][fap_loader_app] FAP Loader is starting app -721483 [D][BrowserWorker] Start -721498 [D][BrowserWorker] Enter folder: /any/BadUsb items: 10 idx: -1 -721502 [D][BrowserWorker] Load offset: 0 cnt: 50 -724277 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 -724280 [D][BrowserWorker] Load offset: 0 cnt: 50 -737153 [D][BrowserWorker] End -737166 [I][BtGap] Stop advertising -737170 [D][BtGap] set_non_discoverable success -737185 [I][SavedStruct] Loading "/int/.desktop.settings" -737308 [I][SavedStruct] Loading "/int/.desktop.settings" -737327 [I][SavedStruct] Loading "/int/.desktop.settings" -737376 [I][FuriHalBt] Disconnect and stop advertising -737380 [I][FuriHalBt] Stop current profile services -737395 [I][FuriHalBt] Stop BLE related RTOS threads -737419 [I][FuriHalBt] Reset SHCI -737527 [I][SavedStruct] Loading "/int/.desktop.settings" -737533 [I][FuriHalBt] Start BT initialization -737540 [I][Core2] Core2 started -737542 [I][Core2] C2 boot completed, mode: Stack -737546 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -737550 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -737557 [I][Core2] Radio stack started -737559 [I][Core2] Flash activity control switched to SEM7 -737562 [I][BtGap] Advertising name: Keyboard -737565 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -737582 [D][BtBatterySvc] Updating power state characteristic -737587 [I][BtGap] Start advertising -737590 [I][SavedStruct] Loading "/int/.bt.settings" -737607 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -737616 [I][FuriHalBt] Disconnect and stop advertising -737618 [I][BtGap] Stop advertising -737621 [D][BtGap] set_non_discoverable success -737623 [I][FuriHalBt] Stop current profile services -737633 [I][FuriHalBt] Stop BLE related RTOS threads -737641 [I][SavedStruct] Loading "/int/.desktop.settings" -737658 [I][FuriHalBt] Reset SHCI -737683 [I][SavedStruct] Loading "/int/.desktop.settings" -737727 [I][SavedStruct] Loading "/int/.desktop.settings" -737772 [I][FuriHalBt] Start BT initialization -737777 [I][Core2] Core2 started -737779 [I][Core2] C2 boot completed, mode: Stack -737782 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -737784 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -737788 [I][Core2] Radio stack started -737790 [I][Core2] Flash activity control switched to SEM7 -737792 [I][BtGap] Advertising name: Rumik1 -737794 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -737810 [D][BtBatterySvc] Updating power state characteristic -737820 [I][BtSrv] Bt App started -737822 [I][BtGap] Start advertising -737824 [I][BadBleWorker] Init -737828 [I][SavedStruct] Loading "/int/.desktop.settings" -737834 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -737839 [I][BtGap] Rssi: 296 -737863 [D][BtGap] RSSI: -43 -737865 [I][BadBleWorker] BLE Key timeout : 41 -737921 [D][BtGap] Slave security initiated -737927 [I][SavedStruct] Loading "/int/.desktop.settings" -737974 [I][SavedStruct] Loading "/int/.desktop.settings" -738039 [I][BtGap] Pairing complete -738042 [D][BtGap] RSSI: -47 -738044 [D][BtBatterySvc] Updating battery level characteristic -738048 [D][BtGap] RSSI: -47 -738050 [I][BadBleWorker] BLE Key timeout : 41 -738127 [I][SavedStruct] Loading "/int/.desktop.settings" -738183 [I][SavedStruct] Loading "/int/.desktop.settings" -738216 [I][BtGap] Rx MTU size: 414 -738307 [I][SavedStruct] Loading "/int/.desktop.settings" -738327 [I][SavedStruct] Loading "/int/.desktop.settings" -738527 [I][SavedStruct] Loading "/int/.desktop.settings" -738640 [I][SavedStruct] Loading "/int/.desktop.settings" -738683 [I][SavedStruct] Loading "/int/.desktop.settings" -738727 [I][SavedStruct] Loading "/int/.desktop.settings" -738810 [I][BtGap] Connection parameters event complete -738813 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -738815 [W][BtGap] Unsupported connection interval. Request connection parameters update -738819 [I][BtGap] Rssi: 311 -738849 [D][BtGap] Connection parameters accepted -738927 [I][SavedStruct] Loading "/int/.desktop.settings" -738973 [I][SavedStruct] Loading "/int/.desktop.settings" -739010 [I][BtGap] Connection parameters event complete -739012 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -739015 [I][BtGap] Rssi: 328 -739127 [I][SavedStruct] Loading "/int/.desktop.settings" -739183 [I][SavedStruct] Loading "/int/.desktop.settings" -739306 [I][SavedStruct] Loading "/int/.desktop.settings" -739327 [I][SavedStruct] Loading "/int/.desktop.settings" -739527 [I][SavedStruct] Loading "/int/.desktop.settings" -739639 [I][SavedStruct] Loading "/int/.desktop.settings" -739683 [I][SavedStruct] Loading "/int/.desktop.settings" -739727 [I][SavedStruct] Loading "/int/.desktop.settings" -739927 [I][SavedStruct] Loading "/int/.desktop.settings" -739972 [I][SavedStruct] Loading "/int/.desktop.settings" -740127 [I][SavedStruct] Loading "/int/.desktop.settings" -740183 [I][SavedStruct] Loading "/int/.desktop.settings" -740305 [I][SavedStruct] Loading "/int/.desktop.settings" -740327 [I][SavedStruct] Loading "/int/.desktop.settings" -740527 [I][SavedStruct] Loading "/int/.desktop.settings" -740638 [I][SavedStruct] Loading "/int/.desktop.settings" -740683 [I][SavedStruct] Loading "/int/.desktop.settings" -740727 [I][SavedStruct] Loading "/int/.desktop.settings" -740927 [I][SavedStruct] Loading "/int/.desktop.settings" -740971 [I][SavedStruct] Loading "/int/.desktop.settings" -741127 [I][SavedStruct] Loading "/int/.desktop.settings" -741183 [I][SavedStruct] Loading "/int/.desktop.settings" -741304 [I][SavedStruct] Loading "/int/.desktop.settings" -741327 [I][SavedStruct] Loading "/int/.desktop.settings" -741527 [I][SavedStruct] Loading "/int/.desktop.settings" -741637 [I][SavedStruct] Loading "/int/.desktop.settings" -741683 [I][SavedStruct] Loading "/int/.desktop.settings" -741727 [I][SavedStruct] Loading "/int/.desktop.settings" -741927 [I][SavedStruct] Loading "/int/.desktop.settings" -741970 [I][SavedStruct] Loading "/int/.desktop.settings" -742127 [I][SavedStruct] Loading "/int/.desktop.settings" -742183 [I][SavedStruct] Loading "/int/.desktop.settings" -742303 [I][SavedStruct] Loading "/int/.desktop.settings" -742327 [I][SavedStruct] Loading "/int/.desktop.settings" -742527 [I][SavedStruct] Loading "/int/.desktop.settings" -742636 [I][SavedStruct] Loading "/int/.desktop.settings" -742727 [I][SavedStruct] Loading "/int/.desktop.settings" -742927 [I][SavedStruct] Loading "/int/.desktop.settings" -742969 [I][SavedStruct] Loading "/int/.desktop.settings" -743127 [I][SavedStruct] Loading "/int/.desktop.settings" -743302 [I][SavedStruct] Loading "/int/.desktop.settings" -743327 [I][SavedStruct] Loading "/int/.desktop.settings" -743382 [I][SavedStruct] Loading "/int/.desktop.settings" -743527 [I][SavedStruct] Loading "/int/.desktop.settings" -743635 [I][SavedStruct] Loading "/int/.desktop.settings" -743727 [I][SavedStruct] Loading "/int/.desktop.settings" -743882 [I][SavedStruct] Loading "/int/.desktop.settings" -743927 [I][SavedStruct] Loading "/int/.desktop.settings" -743968 [I][SavedStruct] Loading "/int/.desktop.settings" -744127 [I][SavedStruct] Loading "/int/.desktop.settings" -744301 [I][SavedStruct] Loading "/int/.desktop.settings" -744327 [I][SavedStruct] Loading "/int/.desktop.settings" -744382 [I][SavedStruct] Loading "/int/.desktop.settings" -744527 [I][SavedStruct] Loading "/int/.desktop.settings" -744634 [I][SavedStruct] Loading "/int/.desktop.settings" -744727 [I][SavedStruct] Loading "/int/.desktop.settings" -744882 [I][SavedStruct] Loading "/int/.desktop.settings" -744927 [I][SavedStruct] Loading "/int/.desktop.settings" -744967 [I][SavedStruct] Loading "/int/.desktop.settings" -745127 [I][SavedStruct] Loading "/int/.desktop.settings" -745300 [I][SavedStruct] Loading "/int/.desktop.settings" -745327 [I][SavedStruct] Loading "/int/.desktop.settings" -745382 [I][SavedStruct] Loading "/int/.desktop.settings" -745527 [I][SavedStruct] Loading "/int/.desktop.settings" -745633 [I][SavedStruct] Loading "/int/.desktop.settings" -745727 [I][SavedStruct] Loading "/int/.desktop.settings" -745882 [I][SavedStruct] Loading "/int/.desktop.settings" -745927 [I][SavedStruct] Loading "/int/.desktop.settings" -745966 [I][SavedStruct] Loading "/int/.desktop.settings" -746127 [I][SavedStruct] Loading "/int/.desktop.settings" -746299 [I][SavedStruct] Loading "/int/.desktop.settings" -746327 [I][SavedStruct] Loading "/int/.desktop.settings" -746382 [I][SavedStruct] Loading "/int/.desktop.settings" -746527 [I][SavedStruct] Loading "/int/.desktop.settings" -746632 [I][SavedStruct] Loading "/int/.desktop.settings" -746727 [I][SavedStruct] Loading "/int/.desktop.settings" -746882 [I][SavedStruct] Loading "/int/.desktop.settings" -746927 [I][SavedStruct] Loading "/int/.desktop.settings" -746965 [I][SavedStruct] Loading "/int/.desktop.settings" -747127 [I][SavedStruct] Loading "/int/.desktop.settings" -747298 [I][SavedStruct] Loading "/int/.desktop.settings" -747327 [I][SavedStruct] Loading "/int/.desktop.settings" -747453 [D][DolphinState] icounter 1325, butthurt 0 -747456 [D][BtGap] RSSI: -65 -747458 [I][BadBleWorker] BLE Key timeout : 37 -747462 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -747465 [D][BtGap] RSSI: -65 -747467 [I][BadBleWorker] BLE Key timeout : 37 -747470 [D][BadBleWorker] line:DELAY 1000 -747473 [D][BtGap] RSSI: -65 -747475 [I][BadBleWorker] BLE Key timeout : 37 -747527 [I][SavedStruct] Loading "/int/.desktop.settings" -747631 [I][SavedStruct] Loading "/int/.desktop.settings" -747727 [I][SavedStruct] Loading "/int/.desktop.settings" -747927 [I][SavedStruct] Loading "/int/.desktop.settings" -747954 [I][SavedStruct] Loading "/int/.desktop.settings" -747972 [I][SavedStruct] Loading "/int/.desktop.settings" -748127 [I][SavedStruct] Loading "/int/.desktop.settings" -748297 [I][SavedStruct] Loading "/int/.desktop.settings" -748327 [I][SavedStruct] Loading "/int/.desktop.settings" -748454 [I][SavedStruct] Loading "/int/.desktop.settings" -748477 [D][BadBleWorker] line:GUI SPACE -748479 [I][BadBleWorker] Special key pressed 82c - -748520 [D][BtGap] RSSI: -77 -748523 [I][BadBleWorker] BLE Key timeout : 33 -748531 [D][BadBleWorker] line:DELAY 500 -748535 [D][BtGap] RSSI: -77 -748537 [I][BadBleWorker] BLE Key timeout : 33 -748543 [I][SavedStruct] Loading "/int/.desktop.settings" -748630 [I][SavedStruct] Loading "/int/.desktop.settings" -748727 [I][SavedStruct] Loading "/int/.desktop.settings" -748927 [I][SavedStruct] Loading "/int/.desktop.settings" -748954 [I][SavedStruct] Loading "/int/.desktop.settings" -748972 [I][SavedStruct] Loading "/int/.desktop.settings" -749041 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -749127 [I][SavedStruct] Loading "/int/.desktop.settings" -749296 [I][SavedStruct] Loading "/int/.desktop.settings" -749327 [I][SavedStruct] Loading "/int/.desktop.settings" -749454 [I][SavedStruct] Loading "/int/.desktop.settings" -749527 [I][SavedStruct] Loading "/int/.desktop.settings" -749629 [I][SavedStruct] Loading "/int/.desktop.settings" -749727 [I][SavedStruct] Loading "/int/.desktop.settings" -749927 [I][SavedStruct] Loading "/int/.desktop.settings" -749954 [I][SavedStruct] Loading "/int/.desktop.settings" -749972 [I][SavedStruct] Loading "/int/.desktop.settings" -750127 [I][SavedStruct] Loading "/int/.desktop.settings" -750295 [I][SavedStruct] Loading "/int/.desktop.settings" -750327 [I][SavedStruct] Loading "/int/.desktop.settings" -750454 [I][SavedStruct] Loading "/int/.desktop.settings" -750479 [D][BtGap] RSSI: -76 -750481 [I][BadBleWorker] BLE Key timeout : 33 -750484 [D][BadBleWorker] line:DELAY 200 -750487 [D][BtGap] RSSI: -76 -750489 [I][BadBleWorker] BLE Key timeout : 33 -750527 [I][SavedStruct] Loading "/int/.desktop.settings" -750628 [I][SavedStruct] Loading "/int/.desktop.settings" -750692 [D][BadBleWorker] line:ENTER -750694 [I][BadBleWorker] Special key pressed 28 - -750727 [I][SavedStruct] Loading "/int/.desktop.settings" -750733 [D][BtGap] RSSI: -63 -750735 [I][BadBleWorker] BLE Key timeout : 37 -750738 [D][BadBleWorker] line:GUI SPACE -750740 [I][BadBleWorker] Special key pressed 82c - -750782 [D][BtGap] RSSI: -62 -750784 [I][BadBleWorker] BLE Key timeout : 37 -750788 [D][BadBleWorker] line:DELAY 500 -750791 [D][BtGap] RSSI: -62 -750793 [I][BadBleWorker] BLE Key timeout : 37 -750927 [I][SavedStruct] Loading "/int/.desktop.settings" -750954 [I][SavedStruct] Loading "/int/.desktop.settings" -750972 [I][SavedStruct] Loading "/int/.desktop.settings" -751127 [I][SavedStruct] Loading "/int/.desktop.settings" -751294 [I][SavedStruct] Loading "/int/.desktop.settings" -751304 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -751327 [I][SavedStruct] Loading "/int/.desktop.settings" -751454 [I][SavedStruct] Loading "/int/.desktop.settings" -751527 [I][SavedStruct] Loading "/int/.desktop.settings" -751627 [I][SavedStruct] Loading "/int/.desktop.settings" -751727 [I][SavedStruct] Loading "/int/.desktop.settings" -751927 [I][SavedStruct] Loading "/int/.desktop.settings" -751954 [I][SavedStruct] Loading "/int/.desktop.settings" -751972 [I][SavedStruct] Loading "/int/.desktop.settings" -752127 [I][SavedStruct] Loading "/int/.desktop.settings" -752293 [I][SavedStruct] Loading "/int/.desktop.settings" -752327 [I][SavedStruct] Loading "/int/.desktop.settings" -752454 [I][SavedStruct] Loading "/int/.desktop.settings" -752527 [I][SavedStruct] Loading "/int/.desktop.settings" -752626 [I][SavedStruct] Loading "/int/.desktop.settings" -752727 [I][SavedStruct] Loading "/int/.desktop.settings" -752908 [D][BtGap] RSSI: -54 -752910 [I][BadBleWorker] BLE Key timeout : 37 -752914 [D][BadBleWorker] line:DELAY 200 -752917 [D][BtGap] RSSI: -54 -752919 [I][BadBleWorker] BLE Key timeout : 37 -752927 [I][SavedStruct] Loading "/int/.desktop.settings" -752954 [I][SavedStruct] Loading "/int/.desktop.settings" -752972 [I][SavedStruct] Loading "/int/.desktop.settings" -753122 [D][BadBleWorker] line:ENTER -753124 [I][BadBleWorker] Special key pressed 28 - -753127 [I][SavedStruct] Loading "/int/.desktop.settings" -753166 [D][BtGap] RSSI: -54 -753168 [I][BadBleWorker] BLE Key timeout : 37 -753172 [D][BadBleWorker] line:GUI SPACE -753174 [I][BadBleWorker] Special key pressed 82c - -753215 [D][BtGap] RSSI: -55 -753217 [I][BadBleWorker] BLE Key timeout : 37 -753220 [D][BadBleWorker] line:DELAY 500 -753224 [D][BtGap] RSSI: -55 -753226 [I][BadBleWorker] BLE Key timeout : 37 -753292 [I][SavedStruct] Loading "/int/.desktop.settings" -753327 [I][SavedStruct] Loading "/int/.desktop.settings" -753527 [I][SavedStruct] Loading "/int/.desktop.settings" -753625 [I][SavedStruct] Loading "/int/.desktop.settings" -753727 [I][SavedStruct] Loading "/int/.desktop.settings" -753927 [I][SavedStruct] Loading "/int/.desktop.settings" -753958 [I][SavedStruct] Loading "/int/.desktop.settings" -753998 [I][SavedStruct] Loading "/int/.desktop.settings" -754127 [I][SavedStruct] Loading "/int/.desktop.settings" -754146 [I][BtGap] Stop advertising -754149 [D][BtGap] terminate success -754152 [E][BtGap] set_non_discoverable failed 12 -754156 [I][SavedStruct] Loading "/int/.desktop.settings" -754275 [I][BtGap] Disconnect from client. Reason: 16 -754291 [I][SavedStruct] Loading "/int/.desktop.settings" -754327 [I][SavedStruct] Loading "/int/.desktop.settings" -754356 [I][SavedStruct] Loading "/int/.bt.settings" -754370 [I][SavedStruct] Loading "/int/.bt.keys" -754380 [I][FuriHalBt] Disconnect and stop advertising -754382 [I][FuriHalBt] Stop current profile services -754393 [I][FuriHalBt] Stop BLE related RTOS threads -754417 [I][FuriHalBt] Reset SHCI -754527 [I][SavedStruct] Loading "/int/.desktop.settings" -754531 [I][FuriHalBt] Start BT initialization -754538 [I][Core2] Core2 started -754541 [I][Core2] C2 boot completed, mode: Stack -754544 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -754547 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -754554 [I][Core2] Radio stack started -754559 [I][Core2] Flash activity control switched to SEM7 -754563 [I][BtGap] Advertising name: Keyboard -754567 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -754585 [D][BtBatterySvc] Updating power state characteristic -754591 [I][BtSrv] Bt App started -754592 [I][BtGap] Start advertising -754596 [I][BadBleWorker] End -754599 [I][SavedStruct] Loading "/int/.desktop.settings" -754630 [I][SavedStruct] Loading "/int/.desktop.settings" -754634 [D][BrowserWorker] Start -754661 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -754664 [D][BrowserWorker] Load offset: 0 cnt: 50 - - _.-------.._ -, - .-"```"--..,,_/ /`-, -, \ - .:" /:/ /'\ \ ,_..., `. | | - / ,----/:/ /`\ _\~`_-"` _; - ' / /`"""'\ \ \.~`_-' ,-"'/ - | | | 0 | | .-' ,/` / - | ,..\ \ ,.-"` ,/` / - ; : `/`""\` ,/--==,/-----, - | `-...| -.___-Z:_______J...---; - : ` _-' - _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ -| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| -| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | -|_| |____||___||_| |_| |___||_|_\ \___||____||___| - -Welcome to Flipper Zero Command Line Interface! -Read Manual https://docs.flipperzero.one - -Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) - ->: log -Press CTRL+C to stop... -988327 [I][SavedStruct] Loading "/int/.desktop.settings" -988390 [I][SavedStruct] Loading "/int/.desktop.settings" -988527 [I][SavedStruct] Loading "/int/.desktop.settings" -988555 [I][SavedStruct] Loading "/int/.desktop.settings" -988723 [I][SavedStruct] Loading "/int/.desktop.settings" -988742 [I][SavedStruct] Loading "/int/.desktop.settings" -988927 [I][SavedStruct] Loading "/int/.desktop.settings" -989055 [I][SavedStruct] Loading "/int/.desktop.settings" -989074 [I][SavedStruct] Loading "/int/.desktop.settings" -989127 [I][SavedStruct] Loading "/int/.desktop.settings" -989327 [I][SavedStruct] Loading "/int/.desktop.settings" -989389 [I][SavedStruct] Loading "/int/.desktop.settings" -989527 [I][SavedStruct] Loading "/int/.desktop.settings" -989555 [I][SavedStruct] Loading "/int/.desktop.settings" -989722 [I][SavedStruct] Loading "/int/.desktop.settings" -989741 [I][SavedStruct] Loading "/int/.desktop.settings" -989927 [I][SavedStruct] Loading "/int/.desktop.settings" -990055 [I][SavedStruct] Loading "/int/.desktop.settings" -990074 [I][SavedStruct] Loading "/int/.desktop.settings" -990127 [I][SavedStruct] Loading "/int/.desktop.settings" -990327 [I][SavedStruct] Loading "/int/.desktop.settings" -990388 [I][SavedStruct] Loading "/int/.desktop.settings" -990527 [I][SavedStruct] Loading "/int/.desktop.settings" -990558 [I][BtGap] Stop advertising -990561 [D][BtGap] terminate success -990564 [E][BtGap] set_non_discoverable failed 12 -990568 [I][SavedStruct] Loading "/int/.desktop.settings" -990720 [I][BtGap] Disconnect from client. Reason: 16 -990723 [I][SavedStruct] Loading "/int/.desktop.settings" -990743 [I][SavedStruct] Loading "/int/.desktop.settings" -990768 [I][SavedStruct] Loading "/int/.bt.settings" -990782 [I][SavedStruct] Loading "/int/.bt.keys" -990792 [I][FuriHalBt] Disconnect and stop advertising -990794 [I][FuriHalBt] Stop current profile services -990805 [I][FuriHalBt] Stop BLE related RTOS threads -990829 [I][FuriHalBt] Reset SHCI -990927 [I][SavedStruct] Loading "/int/.desktop.settings" -990943 [I][FuriHalBt] Start BT initialization -990949 [I][Core2] Core2 started -990951 [I][Core2] C2 boot completed, mode: Stack -990954 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -990956 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -990960 [I][Core2] Radio stack started -990962 [I][Core2] Flash activity control switched to SEM7 -990964 [I][BtGap] Advertising name: Keyboard -990966 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -990983 [D][BtBatterySvc] Updating power state characteristic -990989 [I][BtSrv] Bt App started -990991 [I][BtGap] Start advertising -990993 [I][BadBleWorker] End -990995 [I][SavedStruct] Loading "/int/.desktop.settings" -991016 [I][SavedStruct] Loading "/int/.desktop.settings" -991020 [D][BrowserWorker] Start -991046 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -991048 [D][BrowserWorker] Load offset: 0 cnt: 50 -995286 [D][BrowserWorker] End -995288 [I][SavedStruct] Loading "/int/.desktop.settings" -995311 [I][BtGap] Stop advertising -995315 [D][BtGap] set_non_discoverable success -995321 [I][SavedStruct] Loading "/int/.desktop.settings" -995342 [I][SavedStruct] Loading "/int/.desktop.settings" -995360 [I][SavedStruct] Loading "/int/.desktop.settings" -995383 [I][SavedStruct] Loading "/int/.desktop.settings" -995520 [I][FuriHalBt] Disconnect and stop advertising -995522 [I][FuriHalBt] Stop current profile services -995527 [I][SavedStruct] Loading "/int/.desktop.settings" -995539 [I][FuriHalBt] Stop BLE related RTOS threads -995565 [I][FuriHalBt] Reset SHCI -995679 [I][FuriHalBt] Start BT initialization -995684 [I][Core2] Core2 started -995686 [I][Core2] C2 boot completed, mode: Stack -995689 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -995691 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -995695 [I][Core2] Radio stack started -995697 [I][Core2] Flash activity control switched to SEM7 -995699 [I][BtGap] Advertising name: Keyboard -995701 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -995712 [E][BtGap] Message queue get error: -4 -995716 [I][SavedStruct] Loading "/int/.desktop.settings" -995728 [D][BtBatterySvc] Updating power state characteristic -995738 [I][BtGap] Start advertising -995741 [I][SavedStruct] Loading "/int/.bt.settings" -995745 [I][SavedStruct] Loading "/int/.desktop.settings" -995773 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -995786 [I][FuriHalBt] Disconnect and stop advertising -995789 [I][BtGap] Stop advertising -995791 [D][BtGap] set_non_discoverable success -995794 [I][FuriHalBt] Stop current profile services -995805 [I][FuriHalBt] Stop BLE related RTOS threads -995830 [I][FuriHalBt] Reset SHCI -995927 [I][SavedStruct] Loading "/int/.desktop.settings" -995944 [I][FuriHalBt] Start BT initialization -995949 [I][Core2] Core2 started -995951 [I][Core2] C2 boot completed, mode: Stack -995954 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -995956 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -995960 [I][Core2] Radio stack started -995962 [I][Core2] Flash activity control switched to SEM7 -995964 [I][BtGap] Advertising name: Rumik1 -995966 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -995984 [D][BtBatterySvc] Updating power state characteristic -995993 [I][BtSrv] Bt App started -995994 [I][BtGap] Start advertising -995998 [I][BadBleWorker] Init -996000 [I][SavedStruct] Loading "/int/.desktop.settings" -996023 [I][BadBleWorker] BLE Key timeout : 16 -996027 [I][BtGap] Stop advertising -996030 [D][BtGap] set_non_discoverable success -996034 [I][SavedStruct] Loading "/int/.desktop.settings" -996052 [I][SavedStruct] Loading "/int/.desktop.settings" -996127 [I][SavedStruct] Loading "/int/.desktop.settings" -996234 [I][SavedStruct] Loading "/int/.bt.settings" -996248 [I][SavedStruct] Loading "/int/.bt.keys" -996258 [I][FuriHalBt] Disconnect and stop advertising -996260 [I][FuriHalBt] Stop current profile services -996271 [I][FuriHalBt] Stop BLE related RTOS threads -996296 [I][FuriHalBt] Reset SHCI -996327 [I][SavedStruct] Loading "/int/.desktop.settings" -996382 [I][SavedStruct] Loading "/int/.desktop.settings" -996410 [I][FuriHalBt] Start BT initialization -996415 [I][Core2] Core2 started -996417 [I][Core2] C2 boot completed, mode: Stack -996420 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -996422 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -996426 [I][Core2] Radio stack started -996428 [I][Core2] Flash activity control switched to SEM7 -996430 [I][BtGap] Advertising name: Keyboard -996432 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -996449 [D][BtBatterySvc] Updating power state characteristic -996456 [I][BtSrv] Bt App started -996458 [I][BtGap] Start advertising -996461 [I][BadBleWorker] End -996464 [I][SavedStruct] Loading "/int/.desktop.settings" -996482 [I][SavedStruct] Loading "/int/.desktop.settings" -996485 [D][BrowserWorker] Start -996510 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 6 -996512 [D][BrowserWorker] Load offset: 0 cnt: 50 -996800 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 -996803 [D][BrowserWorker] Load offset: 0 cnt: 50 -999551 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 -999553 [D][BrowserWorker] Load offset: 0 cnt: 50 -1001657 [D][BrowserWorker] End -1001660 [I][SavedStruct] Loading "/int/.desktop.settings" -1001680 [I][BtGap] Stop advertising -1001685 [D][BtGap] set_non_discoverable success -1001692 [I][SavedStruct] Loading "/int/.desktop.settings" -1001710 [I][SavedStruct] Loading "/int/.desktop.settings" -1001726 [I][SavedStruct] Loading "/int/.desktop.settings" -1001744 [I][SavedStruct] Loading "/int/.desktop.settings" -1001890 [I][FuriHalBt] Disconnect and stop advertising -1001892 [I][FuriHalBt] Stop current profile services -1001902 [I][FuriHalBt] Stop BLE related RTOS threads -1001926 [I][FuriHalBt] Reset SHCI -1001929 [I][SavedStruct] Loading "/int/.desktop.settings" -1002040 [I][FuriHalBt] Start BT initialization -1002044 [I][SavedStruct] Loading "/int/.desktop.settings" -1002046 [I][Core2] Core2 started -1002049 [I][Core2] C2 boot completed, mode: Stack -1002053 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -1002057 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -1002063 [I][Core2] Radio stack started -1002066 [I][Core2] Flash activity control switched to SEM7 -1002070 [I][BtGap] Advertising name: Keyboard -1002074 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -1002095 [D][BtBatterySvc] Updating power state characteristic -1002102 [I][BtGap] Start advertising -1002104 [I][SavedStruct] Loading "/int/.bt.settings" -1002121 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -1002130 [I][FuriHalBt] Disconnect and stop advertising -1002132 [I][BtGap] Stop advertising -1002136 [D][BtGap] set_non_discoverable success -1002139 [I][SavedStruct] Loading "/int/.desktop.settings" -1002141 [I][FuriHalBt] Stop current profile services -1002158 [I][FuriHalBt] Stop BLE related RTOS threads -1002183 [I][FuriHalBt] Reset SHCI -1002209 [I][SavedStruct] Loading "/int/.desktop.settings" -1002297 [I][FuriHalBt] Start BT initialization -1002302 [I][Core2] Core2 started -1002305 [I][Core2] C2 boot completed, mode: Stack -1002308 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -1002310 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -1002314 [I][Core2] Radio stack started -1002316 [I][Core2] Flash activity control switched to SEM7 -1002318 [I][BtGap] Advertising name: Rumik1 -1002321 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -1002327 [I][SavedStruct] Loading "/int/.desktop.settings" -1002348 [D][BtBatterySvc] Updating power state characteristic -1002357 [I][BtSrv] Bt App started -1002359 [I][BtGap] Start advertising -1002362 [I][BadBleWorker] Init -1002364 [I][SavedStruct] Loading "/int/.desktop.settings" -1002393 [I][BadBleWorker] BLE Key timeout : 16 -1002396 [I][SavedStruct] Loading "/int/.desktop.settings" -1002527 [I][SavedStruct] Loading "/int/.desktop.settings" -1002709 [I][SavedStruct] Loading "/int/.desktop.settings" -1002729 [I][SavedStruct] Loading "/int/.desktop.settings" -1002750 [I][SavedStruct] Loading "/int/.desktop.settings" -1002927 [I][SavedStruct] Loading "/int/.desktop.settings" -1002929 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -1002934 [I][BtGap] Rssi: 315 -1003036 [D][BtGap] Slave security initiated -1003042 [I][SavedStruct] Loading "/int/.desktop.settings" -1003127 [I][SavedStruct] Loading "/int/.desktop.settings" -1003155 [I][BtGap] Pairing complete -1003158 [D][BtGap] RSSI: -55 -1003160 [D][BtBatterySvc] Updating battery level characteristic -1003163 [D][BtGap] RSSI: -55 -1003165 [I][BadBleWorker] BLE Key timeout : 37 -1003209 [I][SavedStruct] Loading "/int/.desktop.settings" -1003327 [I][SavedStruct] Loading "/int/.desktop.settings" -1003331 [I][BtGap] Rx MTU size: 414 -1003375 [I][SavedStruct] Loading "/int/.desktop.settings" -1003527 [I][SavedStruct] Loading "/int/.desktop.settings" -1003708 [I][SavedStruct] Loading "/int/.desktop.settings" -1003727 [I][SavedStruct] Loading "/int/.desktop.settings" -1003746 [I][SavedStruct] Loading "/int/.desktop.settings" -1003894 [I][BtGap] Connection parameters event complete -1003896 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -1003899 [W][BtGap] Unsupported connection interval. Request connection parameters update -1003903 [I][BtGap] Rssi: 314 -1003927 [I][SavedStruct] Loading "/int/.desktop.settings" -1003933 [D][BtGap] Connection parameters accepted -1004041 [I][SavedStruct] Loading "/int/.desktop.settings" -1004095 [I][BtGap] Connection parameters event complete -1004097 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -1004100 [I][BtGap] Rssi: 317 -1004127 [I][SavedStruct] Loading "/int/.desktop.settings" -1004225 [I][SavedStruct] Loading "/int/.desktop.settings" -1004327 [I][SavedStruct] Loading "/int/.desktop.settings" -1004374 [I][SavedStruct] Loading "/int/.desktop.settings" -1004527 [I][SavedStruct] Loading "/int/.desktop.settings" -1004707 [I][SavedStruct] Loading "/int/.desktop.settings" -1004726 [I][SavedStruct] Loading "/int/.desktop.settings" -1004745 [I][SavedStruct] Loading "/int/.desktop.settings" -1004927 [I][SavedStruct] Loading "/int/.desktop.settings" -1005040 [I][SavedStruct] Loading "/int/.desktop.settings" -1005127 [I][SavedStruct] Loading "/int/.desktop.settings" -1005225 [I][SavedStruct] Loading "/int/.desktop.settings" -1005327 [I][SavedStruct] Loading "/int/.desktop.settings" -1005373 [I][SavedStruct] Loading "/int/.desktop.settings" -1005527 [I][SavedStruct] Loading "/int/.desktop.settings" -1005706 [I][SavedStruct] Loading "/int/.desktop.settings" -1005727 [I][SavedStruct] Loading "/int/.desktop.settings" -1005800 [D][DolphinState] icounter 1325, butthurt 0 -1005803 [D][BtGap] RSSI: -57 -1005805 [I][BadBleWorker] BLE Key timeout : 37 -1005809 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -1005812 [D][BtGap] RSSI: -57 -1005814 [I][BadBleWorker] BLE Key timeout : 37 -1005817 [D][BadBleWorker] line:DELAY 1000 -1005820 [D][BtGap] RSSI: -57 -1005822 [I][BadBleWorker] BLE Key timeout : 37 -1005927 [I][SavedStruct] Loading "/int/.desktop.settings" -1006039 [I][SavedStruct] Loading "/int/.desktop.settings" -1006127 [I][SavedStruct] Loading "/int/.desktop.settings" -1006301 [I][SavedStruct] Loading "/int/.desktop.settings" -1006327 [I][SavedStruct] Loading "/int/.desktop.settings" -1006372 [I][SavedStruct] Loading "/int/.desktop.settings" -1006527 [I][SavedStruct] Loading "/int/.desktop.settings" -1006705 [I][SavedStruct] Loading "/int/.desktop.settings" -1006727 [I][SavedStruct] Loading "/int/.desktop.settings" -1006801 [I][SavedStruct] Loading "/int/.desktop.settings" -1006824 [D][BadBleWorker] line:GUI SPACE -1006826 [I][BadBleWorker] Special key pressed 82c - -1006867 [D][BtGap] RSSI: -62 -1006869 [I][BadBleWorker] BLE Key timeout : 37 -1006873 [D][BadBleWorker] line:DELAY 500 -1006875 [D][BtGap] RSSI: -62 -1006877 [I][BadBleWorker] BLE Key timeout : 37 -1006927 [I][SavedStruct] Loading "/int/.desktop.settings" -1007039 [I][SavedStruct] Loading "/int/.desktop.settings" -1007127 [I][SavedStruct] Loading "/int/.desktop.settings" -1007301 [I][SavedStruct] Loading "/int/.desktop.settings" -1007327 [I][SavedStruct] Loading "/int/.desktop.settings" -1007371 [I][SavedStruct] Loading "/int/.desktop.settings" -1007388 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -1007527 [I][SavedStruct] Loading "/int/.desktop.settings" -1007704 [I][SavedStruct] Loading "/int/.desktop.settings" -1007727 [I][SavedStruct] Loading "/int/.desktop.settings" -1007801 [I][SavedStruct] Loading "/int/.desktop.settings" -1007927 [I][SavedStruct] Loading "/int/.desktop.settings" -1008037 [I][SavedStruct] Loading "/int/.desktop.settings" -1008127 [I][SavedStruct] Loading "/int/.desktop.settings" -1008301 [I][SavedStruct] Loading "/int/.desktop.settings" -1008327 [I][SavedStruct] Loading "/int/.desktop.settings" -1008370 [I][SavedStruct] Loading "/int/.desktop.settings" -1008527 [I][SavedStruct] Loading "/int/.desktop.settings" -1008703 [I][SavedStruct] Loading "/int/.desktop.settings" -1008727 [I][SavedStruct] Loading "/int/.desktop.settings" -1008801 [I][SavedStruct] Loading "/int/.desktop.settings" -1008927 [I][SavedStruct] Loading "/int/.desktop.settings" -1008996 [D][BtGap] RSSI: -79 -1008997 [I][BadBleWorker] BLE Key timeout : 33 -1008999 [D][BadBleWorker] line:DELAY 200 -1009001 [D][BtGap] RSSI: -74 -1009004 [I][BadBleWorker] BLE Key timeout : 33 -1009036 [I][SavedStruct] Loading "/int/.desktop.settings" -1009127 [I][SavedStruct] Loading "/int/.desktop.settings" -1009207 [D][BadBleWorker] line:ENTER -1009209 [I][BadBleWorker] Special key pressed 28 - -1009246 [D][BtGap] RSSI: -79 -1009248 [I][BadBleWorker] BLE Key timeout : 33 -1009252 [D][BadBleWorker] line:GUI SPACE -1009254 [I][BadBleWorker] Special key pressed 82c - -1009291 [D][BtGap] RSSI: -75 -1009293 [I][BadBleWorker] BLE Key timeout : 33 -1009297 [D][BadBleWorker] line:DELAY 500 -1009299 [D][BtGap] RSSI: -75 -1009302 [I][BadBleWorker] BLE Key timeout : 33 -1009305 [I][SavedStruct] Loading "/int/.desktop.settings" -1009327 [I][SavedStruct] Loading "/int/.desktop.settings" -1009369 [I][SavedStruct] Loading "/int/.desktop.settings" -1009527 [I][SavedStruct] Loading "/int/.desktop.settings" -1009702 [I][SavedStruct] Loading "/int/.desktop.settings" -1009727 [I][SavedStruct] Loading "/int/.desktop.settings" -1009801 [I][SavedStruct] Loading "/int/.desktop.settings" -1009813 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -1009927 [I][SavedStruct] Loading "/int/.desktop.settings" -1010035 [I][SavedStruct] Loading "/int/.desktop.settings" -1010127 [I][SavedStruct] Loading "/int/.desktop.settings" -1010301 [I][SavedStruct] Loading "/int/.desktop.settings" -1010327 [I][SavedStruct] Loading "/int/.desktop.settings" -1010368 [I][SavedStruct] Loading "/int/.desktop.settings" -1010527 [I][SavedStruct] Loading "/int/.desktop.settings" -1010701 [I][SavedStruct] Loading "/int/.desktop.settings" -1010727 [I][SavedStruct] Loading "/int/.desktop.settings" -1010801 [I][SavedStruct] Loading "/int/.desktop.settings" -1010927 [I][SavedStruct] Loading "/int/.desktop.settings" -1011034 [I][SavedStruct] Loading "/int/.desktop.settings" -1011127 [I][SavedStruct] Loading "/int/.desktop.settings" -1011254 [D][BtGap] RSSI: -85 -1011256 [I][BadBleWorker] BLE Key timeout : 33 -1011260 [D][BadBleWorker] line:DELAY 200 -1011262 [D][BtGap] RSSI: -85 -1011264 [I][BadBleWorker] BLE Key timeout : 33 -1011301 [I][SavedStruct] Loading "/int/.desktop.settings" -1011327 [I][SavedStruct] Loading "/int/.desktop.settings" -1011367 [I][SavedStruct] Loading "/int/.desktop.settings" -1011466 [D][BadBleWorker] line:ENTER -1011468 [I][BadBleWorker] Special key pressed 28 - -1011505 [D][BtGap] RSSI: -85 -1011507 [I][BadBleWorker] BLE Key timeout : 33 -1011511 [D][BadBleWorker] line:GUI SPACE -1011513 [I][BadBleWorker] Special key pressed 82c - -1011527 [I][SavedStruct] Loading "/int/.desktop.settings" -1011549 [D][BtGap] RSSI: -85 -1011551 [I][BadBleWorker] BLE Key timeout : 33 -1011555 [D][BadBleWorker] line:DELAY 500 -1011558 [D][BtGap] RSSI: -85 -1011560 [I][BadBleWorker] BLE Key timeout : 33 -1011700 [I][SavedStruct] Loading "/int/.desktop.settings" -1011727 [I][SavedStruct] Loading "/int/.desktop.settings" -1011801 [I][SavedStruct] Loading "/int/.desktop.settings" -1011927 [I][SavedStruct] Loading "/int/.desktop.settings" -1012033 [I][SavedStruct] Loading "/int/.desktop.settings" -1012062 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -1012127 [I][SavedStruct] Loading "/int/.desktop.settings" -1012301 [I][SavedStruct] Loading "/int/.desktop.settings" -1012327 [I][SavedStruct] Loading "/int/.desktop.settings" -1012366 [I][SavedStruct] Loading "/int/.desktop.settings" -1012527 [I][SavedStruct] Loading "/int/.desktop.settings" -1012699 [I][SavedStruct] Loading "/int/.desktop.settings" -1012727 [I][SavedStruct] Loading "/int/.desktop.settings" -1012801 [I][SavedStruct] Loading "/int/.desktop.settings" -1012927 [I][SavedStruct] Loading "/int/.desktop.settings" -1013032 [I][SavedStruct] Loading "/int/.desktop.settings" -1013127 [I][SavedStruct] Loading "/int/.desktop.settings" -1013301 [I][SavedStruct] Loading "/int/.desktop.settings" -1013327 [I][SavedStruct] Loading "/int/.desktop.settings" -1013365 [I][SavedStruct] Loading "/int/.desktop.settings" -1013505 [D][BtGap] RSSI: -91 -1013507 [I][BadBleWorker] BLE Key timeout : 16 -1013511 [D][BadBleWorker] line:DELAY 200 -1013513 [D][BtGap] RSSI: -91 -1013515 [I][BadBleWorker] BLE Key timeout : 16 -1013527 [I][SavedStruct] Loading "/int/.desktop.settings" -1013698 [I][SavedStruct] Loading "/int/.desktop.settings" -1013717 [D][BadBleWorker] line:ENTER -1013719 [I][BadBleWorker] Special key pressed 28 - -1013727 [I][SavedStruct] Loading "/int/.desktop.settings" -1013741 [D][BtGap] RSSI: -99 -1013743 [I][BadBleWorker] BLE Key timeout : 16 -1013749 [D][BadBleWorker] line:GUI SPACE -1013751 [I][BadBleWorker] Special key pressed 82c - -1013770 [D][BtGap] RSSI: -99 -1013772 [I][BadBleWorker] BLE Key timeout : 16 -1013776 [D][BadBleWorker] line:DELAY 500 -1013778 [D][BtGap] RSSI: -99 -1013780 [I][BadBleWorker] BLE Key timeout : 16 -1013801 [I][SavedStruct] Loading "/int/.desktop.settings" -1013927 [I][SavedStruct] Loading "/int/.desktop.settings" -1014031 [I][SavedStruct] Loading "/int/.desktop.settings" -1014134 [I][SavedStruct] Loading "/int/.desktop.settings" -1014282 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -1014301 [I][SavedStruct] Loading "/int/.desktop.settings" -1014327 [I][SavedStruct] Loading "/int/.desktop.settings" -1014364 [I][SavedStruct] Loading "/int/.desktop.settings" -1014527 [I][SavedStruct] Loading "/int/.desktop.settings" -1014593 [E][BtHid] Failed updating report characteristic: 100 -1014596 [E][BtHid] Failed updating report characteristic: 100 -1014616 [E][BtHid] Failed updating report characteristic: 100 -1014619 [E][BtHid] Failed updating report characteristic: 100 -1014640 [E][BtHid] Failed updating report characteristic: 100 -1014643 [E][BtHid] Failed updating report characteristic: 100 -1014664 [E][BtHid] Failed updating report characteristic: 100 -1014667 [E][BtHid] Failed updating report characteristic: 100 -1014688 [E][BtHid] Failed updating report characteristic: 100 -1014691 [E][BtHid] Failed updating report characteristic: 100 -1014697 [I][SavedStruct] Loading "/int/.desktop.settings" -1014712 [E][BtHid] Failed updating report characteristic: 100 -1014717 [E][BtHid] Failed updating report characteristic: 100 -1014727 [I][SavedStruct] Loading "/int/.desktop.settings" -1014739 [E][BtHid] Failed updating report characteristic: 100 -1014744 [E][BtHid] Failed updating report characteristic: 100 -1014765 [E][BtHid] Failed updating report characteristic: 100 -1014768 [E][BtHid] Failed updating report characteristic: 100 -1014789 [E][BtHid] Failed updating report characteristic: 100 -1014792 [E][BtHid] Failed updating report characteristic: 100 -1014801 [I][SavedStruct] Loading "/int/.desktop.settings" -1014814 [E][BtHid] Failed updating report characteristic: 100 -1014819 [E][BtHid] Failed updating report characteristic: 100 -1014840 [E][BtHid] Failed updating report characteristic: 100 -1014843 [E][BtHid] Failed updating report characteristic: 100 -1014862 [E][BtHid] Failed updating report characteristic: 100 -1014865 [E][BtHid] Failed updating report characteristic: 100 -1014885 [E][BtHid] Failed updating report characteristic: 100 -1014888 [E][BtHid] Failed updating report characteristic: 100 -1014907 [E][BtHid] Failed updating report characteristic: 100 -1014910 [E][BtHid] Failed updating report characteristic: 100 -1014927 [I][SavedStruct] Loading "/int/.desktop.settings" -1014931 [E][BtHid] Failed updating report characteristic: 100 -1014936 [E][BtHid] Failed updating report characteristic: 100 -1014957 [E][BtHid] Failed updating report characteristic: 100 -1014960 [E][BtHid] Failed updating report characteristic: 100 -1014981 [E][BtHid] Failed updating report characteristic: 100 -1014984 [E][BtHid] Failed updating report characteristic: 100 -1015004 [E][BtHid] Failed updating report characteristic: 100 -1015007 [E][BtHid] Failed updating report characteristic: 100 -1015027 [E][BtHid] Failed updating report characteristic: 100 -1015031 [E][BtHid] Failed updating report characteristic: 100 -1015033 [I][SavedStruct] Loading "/int/.desktop.settings" -1015051 [E][BtHid] Failed updating report characteristic: 100 -1015055 [E][BtHid] Failed updating report characteristic: 100 -1015075 [E][BtHid] Failed updating report characteristic: 100 -1015078 [E][BtHid] Failed updating report characteristic: 100 -1015099 [E][BtHid] Failed updating report characteristic: 100 -1015102 [E][BtHid] Failed updating report characteristic: 100 -1015121 [E][BtHid] Failed updating report characteristic: 100 -1015124 [E][BtHid] Failed updating report characteristic: 100 -1015129 [I][SavedStruct] Loading "/int/.desktop.settings" -1015146 [E][BtHid] Failed updating report characteristic: 100 -1015153 [E][BtHid] Failed updating report characteristic: 100 -1015174 [E][BtHid] Failed updating report characteristic: 100 -1015177 [D][BtGap] RSSI: -99 -1015179 [I][BadBleWorker] BLE Key timeout : 16 -1015181 [D][BadBleWorker] line:DELAY 200 -1015183 [D][BtGap] RSSI: -99 -1015184 [I][BadBleWorker] BLE Key timeout : 16 -1015301 [I][SavedStruct] Loading "/int/.desktop.settings" -1015327 [I][SavedStruct] Loading "/int/.desktop.settings" -1015363 [I][SavedStruct] Loading "/int/.desktop.settings" -1015386 [D][BadBleWorker] line:ENTER -1015388 [I][BadBleWorker] Special key pressed 28 - -1015391 [E][BtHid] Failed updating report characteristic: 100 -1015410 [D][BtGap] RSSI: -89 -1015412 [I][BadBleWorker] BLE Key timeout : 16 -1015416 [D][BtGap] RSSI: -89 -1015418 [I][BadBleWorker] BLE Key timeout : 16 -1015527 [I][SavedStruct] Loading "/int/.desktop.settings" -1015696 [I][SavedStruct] Loading "/int/.desktop.settings" -1015727 [I][SavedStruct] Loading "/int/.desktop.settings" -1015801 [I][SavedStruct] Loading "/int/.desktop.settings" -1015927 [I][SavedStruct] Loading "/int/.desktop.settings" -1016029 [I][SavedStruct] Loading "/int/.desktop.settings" -1016127 [I][SavedStruct] Loading "/int/.desktop.settings" -1016301 [I][SavedStruct] Loading "/int/.desktop.settings" -1016327 [I][SavedStruct] Loading "/int/.desktop.settings" -1016362 [I][SavedStruct] Loading "/int/.desktop.settings" -1016527 [I][SavedStruct] Loading "/int/.desktop.settings" -1016695 [I][SavedStruct] Loading "/int/.desktop.settings" -1016727 [I][SavedStruct] Loading "/int/.desktop.settings" -1016801 [I][SavedStruct] Loading "/int/.desktop.settings" -1016927 [I][SavedStruct] Loading "/int/.desktop.settings" -1017028 [I][SavedStruct] Loading "/int/.desktop.settings" -1017127 [I][SavedStruct] Loading "/int/.desktop.settings" -1017301 [I][SavedStruct] Loading "/int/.desktop.settings" -1017327 [I][SavedStruct] Loading "/int/.desktop.settings" -1017361 [I][SavedStruct] Loading "/int/.desktop.settings" -1017527 [I][SavedStruct] Loading "/int/.desktop.settings" -1017694 [I][SavedStruct] Loading "/int/.desktop.settings" -1017727 [I][SavedStruct] Loading "/int/.desktop.settings" -1017801 [I][SavedStruct] Loading "/int/.desktop.settings" -1017927 [I][SavedStruct] Loading "/int/.desktop.settings" -1018027 [I][SavedStruct] Loading "/int/.desktop.settings" -1018127 [I][SavedStruct] Loading "/int/.desktop.settings" -1018301 [I][SavedStruct] Loading "/int/.desktop.settings" -1018327 [I][SavedStruct] Loading "/int/.desktop.settings" -1018360 [I][SavedStruct] Loading "/int/.desktop.settings" -1018527 [I][SavedStruct] Loading "/int/.desktop.settings" -1018693 [I][SavedStruct] Loading "/int/.desktop.settings" -1018727 [I][SavedStruct] Loading "/int/.desktop.settings" -1018801 [I][SavedStruct] Loading "/int/.desktop.settings" -1018927 [I][SavedStruct] Loading "/int/.desktop.settings" -1019026 [I][SavedStruct] Loading "/int/.desktop.settings" -1019127 [I][SavedStruct] Loading "/int/.desktop.settings" -1019301 [I][SavedStruct] Loading "/int/.desktop.settings" -1019327 [I][SavedStruct] Loading "/int/.desktop.settings" -1019359 [I][SavedStruct] Loading "/int/.desktop.settings" -1019527 [I][SavedStruct] Loading "/int/.desktop.settings" -1019692 [I][SavedStruct] Loading "/int/.desktop.settings" -1019727 [I][SavedStruct] Loading "/int/.desktop.settings" -1019801 [I][SavedStruct] Loading "/int/.desktop.settings" -1019927 [I][SavedStruct] Loading "/int/.desktop.settings" -1020025 [I][SavedStruct] Loading "/int/.desktop.settings" -1020127 [I][SavedStruct] Loading "/int/.desktop.settings" -1020301 [I][SavedStruct] Loading "/int/.desktop.settings" -1020327 [I][SavedStruct] Loading "/int/.desktop.settings" -1020358 [I][SavedStruct] Loading "/int/.desktop.settings" -1020527 [I][SavedStruct] Loading "/int/.desktop.settings" -1020691 [I][SavedStruct] Loading "/int/.desktop.settings" -1020727 [I][SavedStruct] Loading "/int/.desktop.settings" -1020801 [I][SavedStruct] Loading "/int/.desktop.settings" -1020927 [I][SavedStruct] Loading "/int/.desktop.settings" -1021024 [I][SavedStruct] Loading "/int/.desktop.settings" -1021127 [I][SavedStruct] Loading "/int/.desktop.settings" -1021301 [I][SavedStruct] Loading "/int/.desktop.settings" -1021327 [I][SavedStruct] Loading "/int/.desktop.settings" -1021357 [I][SavedStruct] Loading "/int/.desktop.settings" -1021527 [I][SavedStruct] Loading "/int/.desktop.settings" -1021690 [I][SavedStruct] Loading "/int/.desktop.settings" -1021727 [I][SavedStruct] Loading "/int/.desktop.settings" -1021801 [I][SavedStruct] Loading "/int/.desktop.settings" -1021927 [I][SavedStruct] Loading "/int/.desktop.settings" -1022023 [I][SavedStruct] Loading "/int/.desktop.settings" -1022127 [I][SavedStruct] Loading "/int/.desktop.settings" -1022301 [I][SavedStruct] Loading "/int/.desktop.settings" -1022327 [I][SavedStruct] Loading "/int/.desktop.settings" -1022356 [I][SavedStruct] Loading "/int/.desktop.settings" - ->: - _.-------.._ -, - .-"```"--..,,_/ /`-, -, \ - .:" /:/ /'\ \ ,_..., `. | | - / ,----/:/ /`\ _\~`_-"` _; - ' / /`"""'\ \ \.~`_-' ,-"'/ - | | | 0 | | .-' ,/` / - | ,..\ \ ,.-"` ,/` / - ; : `/`""\` ,/--==,/-----, - | `-...| -.___-Z:_______J...---; - : ` _-' - _L_ _ ___ ___ ___ ___ ____--"`___ _ ___ -| __|| | |_ _|| _ \| _ \| __|| _ \ / __|| | |_ _| -| _| | |__ | | | _/| _/| _| | / | (__ | |__ | | -|_| |____||___||_| |_| |___||_|_\ \___||____||___| - -Welcome to Flipper Zero Command Line Interface! -Read Manual https://docs.flipperzero.one - -Firmware version: dev 0.74.3 (XFW-0040 built on 26-01-2023) - ->: log -Press CTRL+C to stop... -27492 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: -1 -27494 [D][BrowserWorker] Load offset: 0 cnt: 50 -28939 [D][BrowserWorker] End -28952 [I][BtGap] Stop advertising -28956 [D][BtGap] set_non_discoverable success -28970 [I][SavedStruct] Loading "/int/.desktop.settings" -29075 [I][SavedStruct] Loading "/int/.desktop.settings" -29162 [I][FuriHalBt] Disconnect and stop advertising -29164 [I][FuriHalBt] Stop current profile services -29173 [I][FuriHalBt] Stop BLE related RTOS threads -29197 [I][FuriHalBt] Reset SHCI -29275 [I][SavedStruct] Loading "/int/.desktop.settings" -29311 [I][FuriHalBt] Start BT initialization -29316 [I][Core2] Core2 started -29318 [I][Core2] C2 boot completed, mode: Stack -29321 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -29323 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -29327 [I][Core2] Radio stack started -29330 [I][Core2] Flash activity control switched to SEM7 -29332 [I][BtGap] Advertising name: Keyboard -29334 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -29350 [D][BtBatterySvc] Updating power state characteristic -29356 [I][BtGap] Start advertising -29358 [I][SavedStruct] Loading "/int/.bt.settings" -29376 [I][SavedStruct] Loading "/ext/apps/Tools/.bt_hid.keys" -29385 [I][FuriHalBt] Disconnect and stop advertising -29387 [I][BtGap] Stop advertising -29390 [D][BtGap] set_non_discoverable success -29392 [I][FuriHalBt] Stop current profile services -29402 [I][FuriHalBt] Stop BLE related RTOS threads -29427 [I][FuriHalBt] Reset SHCI -29466 [I][SavedStruct] Loading "/int/.desktop.settings" -29482 [I][SavedStruct] Loading "/int/.desktop.settings" -29541 [I][FuriHalBt] Start BT initialization -29546 [I][Core2] Core2 started -29548 [I][Core2] C2 boot completed, mode: Stack -29551 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -29553 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -29557 [I][Core2] Radio stack started -29560 [I][Core2] Flash activity control switched to SEM7 -29562 [I][BtGap] Advertising name: Rumik1 -29565 [I][BtGap] MAC @ : 6C:7A:D9:AC:57:72 -29582 [D][BtBatterySvc] Updating power state characteristic -29591 [I][BtSrv] Bt App started -29593 [I][BtGap] Start advertising -29596 [I][BadBleWorker] Init -29598 [I][SavedStruct] Loading "/int/.desktop.settings" -29625 [I][BadBleWorker] BLE Key timeout : 16 -29675 [I][SavedStruct] Loading "/int/.desktop.settings" -29875 [I][SavedStruct] Loading "/int/.desktop.settings" -29966 [I][SavedStruct] Loading "/int/.desktop.settings" -30075 [I][SavedStruct] Loading "/int/.desktop.settings" -30275 [I][SavedStruct] Loading "/int/.desktop.settings" -30466 [I][SavedStruct] Loading "/int/.desktop.settings" -30486 [I][SavedStruct] Loading "/int/.desktop.settings" -30675 [I][SavedStruct] Loading "/int/.desktop.settings" -30726 [I][BtGap] Connection parameters: Connection Interval: 24 (30 ms), Slave Latency: 0, Supervision Timeout: 72 -30839 [D][BtGap] Slave security initiated -30875 [I][SavedStruct] Loading "/int/.desktop.settings" -30966 [I][SavedStruct] Loading "/int/.desktop.settings" -31018 [I][BtGap] Pairing complete -31021 [D][BtGap] RSSI: -47 -31023 [D][BtBatterySvc] Updating battery level characteristic -31026 [D][BtGap] RSSI: -47 -31028 [I][BadBleWorker] BLE Key timeout : 33 -31075 [I][SavedStruct] Loading "/int/.desktop.settings" -31136 [I][BtGap] Rx MTU size: 414 -31275 [I][SavedStruct] Loading "/int/.desktop.settings" -31466 [I][SavedStruct] Loading "/int/.desktop.settings" -31484 [I][SavedStruct] Loading "/int/.desktop.settings" -31675 [I][SavedStruct] Loading "/int/.desktop.settings" -31702 [I][BtGap] Connection parameters event complete -31704 [I][BtGap] Connection parameters: Connection Interval: 12 (15 ms), Slave Latency: 4, Supervision Timeout: 100 -31706 [W][BtGap] Unsupported connection interval. Request connection parameters update -31739 [D][BtGap] Connection parameters accepted -31875 [I][SavedStruct] Loading "/int/.desktop.settings" -31902 [I][BtGap] Connection parameters event complete -31906 [I][BtGap] Connection parameters: Connection Interval: 36 (45 ms), Slave Latency: 4, Supervision Timeout: 100 -31968 [I][SavedStruct] Loading "/int/.desktop.settings" -32075 [I][SavedStruct] Loading "/int/.desktop.settings" -32275 [I][SavedStruct] Loading "/int/.desktop.settings" -32466 [I][SavedStruct] Loading "/int/.desktop.settings" -32484 [I][SavedStruct] Loading "/int/.desktop.settings" -32675 [I][SavedStruct] Loading "/int/.desktop.settings" -32875 [I][SavedStruct] Loading "/int/.desktop.settings" -32966 [I][SavedStruct] Loading "/int/.desktop.settings" -33075 [I][SavedStruct] Loading "/int/.desktop.settings" -33275 [I][SavedStruct] Loading "/int/.desktop.settings" -33466 [I][SavedStruct] Loading "/int/.desktop.settings" -33484 [I][SavedStruct] Loading "/int/.desktop.settings" -33675 [I][SavedStruct] Loading "/int/.desktop.settings" -33875 [I][SavedStruct] Loading "/int/.desktop.settings" -33966 [I][SavedStruct] Loading "/int/.desktop.settings" -34075 [I][SavedStruct] Loading "/int/.desktop.settings" -34275 [I][SavedStruct] Loading "/int/.desktop.settings" -34466 [I][SavedStruct] Loading "/int/.desktop.settings" -34484 [I][SavedStruct] Loading "/int/.desktop.settings" -34675 [I][SavedStruct] Loading "/int/.desktop.settings" -34875 [I][SavedStruct] Loading "/int/.desktop.settings" -34966 [I][SavedStruct] Loading "/int/.desktop.settings" -35075 [I][SavedStruct] Loading "/int/.desktop.settings" -35275 [I][SavedStruct] Loading "/int/.desktop.settings" -35359 [D][DolphinState] icounter 1325, butthurt 0 -35362 [D][BtGap] RSSI: -53 -35363 [I][BadBleWorker] BLE Key timeout : 33 -35367 [D][BadBleWorker] line:REM Troll scrip to open vx-underground on an iphone -35370 [D][BtGap] RSSI: -53 -35371 [I][BadBleWorker] BLE Key timeout : 33 -35373 [D][BadBleWorker] line:DELAY 1000 -35375 [D][BtGap] RSSI: -53 -35376 [I][BadBleWorker] BLE Key timeout : 33 -35475 [I][SavedStruct] Loading "/int/.desktop.settings" -35675 [I][SavedStruct] Loading "/int/.desktop.settings" -35860 [I][SavedStruct] Loading "/int/.desktop.settings" -35878 [I][SavedStruct] Loading "/int/.desktop.settings" -36075 [I][SavedStruct] Loading "/int/.desktop.settings" -36275 [I][SavedStruct] Loading "/int/.desktop.settings" -36360 [I][SavedStruct] Loading "/int/.desktop.settings" -36378 [D][BadBleWorker] line:GUI SPACE -36380 [I][BadBleWorker] Special key pressed 82c - -36418 [D][BtGap] RSSI: -57 -36420 [I][BadBleWorker] BLE Key timeout : 33 -36423 [D][BadBleWorker] line:DELAY 500 -36426 [D][BtGap] RSSI: -57 -36428 [I][BadBleWorker] BLE Key timeout : 33 -36475 [I][SavedStruct] Loading "/int/.desktop.settings" -36675 [I][SavedStruct] Loading "/int/.desktop.settings" -36860 [I][SavedStruct] Loading "/int/.desktop.settings" -36878 [I][SavedStruct] Loading "/int/.desktop.settings" -36930 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -37075 [I][SavedStruct] Loading "/int/.desktop.settings" -37275 [I][SavedStruct] Loading "/int/.desktop.settings" -37360 [I][SavedStruct] Loading "/int/.desktop.settings" -37475 [I][SavedStruct] Loading "/int/.desktop.settings" -37675 [I][SavedStruct] Loading "/int/.desktop.settings" -37860 [I][SavedStruct] Loading "/int/.desktop.settings" -37878 [I][SavedStruct] Loading "/int/.desktop.settings" -38075 [I][SavedStruct] Loading "/int/.desktop.settings" -38275 [I][SavedStruct] Loading "/int/.desktop.settings" -38360 [I][SavedStruct] Loading "/int/.desktop.settings" -38370 [D][BtGap] RSSI: -71 -38372 [I][BadBleWorker] BLE Key timeout : 37 -38376 [D][BadBleWorker] line:DELAY 200 -38380 [D][BtGap] RSSI: -74 -38382 [I][BadBleWorker] BLE Key timeout : 37 -38475 [I][SavedStruct] Loading "/int/.desktop.settings" -38586 [D][BadBleWorker] line:ENTER -38588 [I][BadBleWorker] Special key pressed 28 - -38629 [D][BtGap] RSSI: -88 -38631 [I][BadBleWorker] BLE Key timeout : 41 -38633 [D][BadBleWorker] line:GUI SPACE -38635 [I][BadBleWorker] Special key pressed 82c - -38675 [I][SavedStruct] Loading "/int/.desktop.settings" -38682 [D][BtGap] RSSI: -71 -38684 [I][BadBleWorker] BLE Key timeout : 37 -38688 [D][BadBleWorker] line:DELAY 500 -38692 [D][BtGap] RSSI: -71 -38694 [I][BadBleWorker] BLE Key timeout : 37 -38860 [I][SavedStruct] Loading "/int/.desktop.settings" -38878 [I][SavedStruct] Loading "/int/.desktop.settings" -39075 [I][SavedStruct] Loading "/int/.desktop.settings" -39198 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -39275 [I][SavedStruct] Loading "/int/.desktop.settings" -39360 [I][SavedStruct] Loading "/int/.desktop.settings" -39475 [I][SavedStruct] Loading "/int/.desktop.settings" -39675 [I][SavedStruct] Loading "/int/.desktop.settings" -39860 [I][SavedStruct] Loading "/int/.desktop.settings" -39878 [I][SavedStruct] Loading "/int/.desktop.settings" -40086 [I][SavedStruct] Loading "/int/.desktop.settings" -40275 [I][SavedStruct] Loading "/int/.desktop.settings" -40360 [I][SavedStruct] Loading "/int/.desktop.settings" -40475 [I][SavedStruct] Loading "/int/.desktop.settings" -40675 [I][SavedStruct] Loading "/int/.desktop.settings" -40803 [D][BtGap] RSSI: -98 -40805 [I][BadBleWorker] BLE Key timeout : 41 -40809 [D][BadBleWorker] line:DELAY 200 -40812 [D][BtGap] RSSI: -98 -40814 [I][BadBleWorker] BLE Key timeout : 41 -40860 [I][SavedStruct] Loading "/int/.desktop.settings" -40878 [I][SavedStruct] Loading "/int/.desktop.settings" -41017 [D][BadBleWorker] line:ENTER -41019 [I][BadBleWorker] Special key pressed 28 - -41063 [D][BtGap] RSSI: -89 -41065 [I][BadBleWorker] BLE Key timeout : 41 -41068 [D][BadBleWorker] line:GUI SPACE -41070 [I][BadBleWorker] Special key pressed 82c - -41075 [I][SavedStruct] Loading "/int/.desktop.settings" -41115 [D][BtGap] RSSI: -91 -41117 [I][BadBleWorker] BLE Key timeout : 41 -41119 [D][BadBleWorker] line:DELAY 500 -41121 [D][BtGap] RSSI: -91 -41122 [I][BadBleWorker] BLE Key timeout : 41 -41275 [I][SavedStruct] Loading "/int/.desktop.settings" -41360 [I][SavedStruct] Loading "/int/.desktop.settings" -41475 [I][SavedStruct] Loading "/int/.desktop.settings" -41624 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -41675 [I][SavedStruct] Loading "/int/.desktop.settings" -41860 [I][SavedStruct] Loading "/int/.desktop.settings" -41878 [I][SavedStruct] Loading "/int/.desktop.settings" -42075 [I][SavedStruct] Loading "/int/.desktop.settings" -42275 [I][SavedStruct] Loading "/int/.desktop.settings" -42360 [I][SavedStruct] Loading "/int/.desktop.settings" -42475 [I][SavedStruct] Loading "/int/.desktop.settings" -42675 [I][SavedStruct] Loading "/int/.desktop.settings" -42860 [I][SavedStruct] Loading "/int/.desktop.settings" -42878 [I][SavedStruct] Loading "/int/.desktop.settings" -43075 [I][SavedStruct] Loading "/int/.desktop.settings" -43275 [I][SavedStruct] Loading "/int/.desktop.settings" -43360 [I][SavedStruct] Loading "/int/.desktop.settings" -43389 [D][BtGap] RSSI: -85 -43391 [I][BadBleWorker] BLE Key timeout : 41 -43394 [D][BadBleWorker] line:DELAY 200 -43397 [D][BtGap] RSSI: -85 -43399 [I][BadBleWorker] BLE Key timeout : 41 -43475 [I][SavedStruct] Loading "/int/.desktop.settings" -43601 [D][BadBleWorker] line:ENTER -43603 [I][BadBleWorker] Special key pressed 28 - -43647 [D][BtGap] RSSI: -86 -43649 [I][BadBleWorker] BLE Key timeout : 41 -43652 [D][BadBleWorker] line:GUI SPACE -43654 [I][BadBleWorker] Special key pressed 82c - -43675 [I][SavedStruct] Loading "/int/.desktop.settings" -43699 [D][BtGap] RSSI: -91 -43701 [I][BadBleWorker] BLE Key timeout : 41 -43704 [D][BadBleWorker] line:DELAY 500 -43706 [D][BtGap] RSSI: -91 -43708 [I][BadBleWorker] BLE Key timeout : 41 -43860 [I][SavedStruct] Loading "/int/.desktop.settings" -43878 [I][SavedStruct] Loading "/int/.desktop.settings" -44075 [I][SavedStruct] Loading "/int/.desktop.settings" -44211 [D][BadBleWorker] line:STRING https://www.vx=underground.org/index.html -44275 [I][SavedStruct] Loading "/int/.desktop.settings" -44360 [I][SavedStruct] Loading "/int/.desktop.settings" -44475 [I][SavedStruct] Loading "/int/.desktop.settings" -44675 [I][SavedStruct] Loading "/int/.desktop.settings" -44860 [I][SavedStruct] Loading "/int/.desktop.settings" -44878 [I][SavedStruct] Loading "/int/.desktop.settings" -45075 [I][SavedStruct] Loading "/int/.desktop.settings" -45275 [I][SavedStruct] Loading "/int/.desktop.settings" -45360 [I][SavedStruct] Loading "/int/.desktop.settings" -45475 [I][SavedStruct] Loading "/int/.desktop.settings" -45675 [I][SavedStruct] Loading "/int/.desktop.settings" -45860 [I][SavedStruct] Loading "/int/.desktop.settings" -45878 [I][SavedStruct] Loading "/int/.desktop.settings" -45978 [D][BtGap] RSSI: -89 -45980 [I][BadBleWorker] BLE Key timeout : 41 -45983 [D][BadBleWorker] line:DELAY 200 -45986 [D][BtGap] RSSI: -86 -45987 [I][BadBleWorker] BLE Key timeout : 41 -46075 [I][SavedStruct] Loading "/int/.desktop.settings" -46190 [D][BadBleWorker] line:ENTER -46192 [I][BadBleWorker] Special key pressed 28 - -46237 [D][BtGap] RSSI: -97 -46239 [I][BadBleWorker] BLE Key timeout : 41 -46242 [D][BtGap] RSSI: -97 -46244 [I][BadBleWorker] BLE Key timeout : 41 -46275 [I][SavedStruct] Loading "/int/.desktop.settings" -46360 [I][SavedStruct] Loading "/int/.desktop.settings" -46475 [I][SavedStruct] Loading "/int/.desktop.settings" -46675 [I][SavedStruct] Loading "/int/.desktop.settings" -46860 [I][SavedStruct] Loading "/int/.desktop.settings" -46879 [I][SavedStruct] Loading "/int/.desktop.settings" -47075 [I][SavedStruct] Loading "/int/.desktop.settings" -47275 [I][SavedStruct] Loading "/int/.desktop.settings" -47360 [I][SavedStruct] Loading "/int/.desktop.settings" -47475 [I][SavedStruct] Loading "/int/.desktop.settings" -47675 [I][SavedStruct] Loading "/int/.desktop.settings" -47860 [I][SavedStruct] Loading "/int/.desktop.settings" -47879 [I][SavedStruct] Loading "/int/.desktop.settings" -48075 [I][SavedStruct] Loading "/int/.desktop.settings" -48275 [I][SavedStruct] Loading "/int/.desktop.settings" -48360 [I][SavedStruct] Loading "/int/.desktop.settings" -48475 [I][SavedStruct] Loading "/int/.desktop.settings" -48675 [I][SavedStruct] Loading "/int/.desktop.settings" -48860 [I][SavedStruct] Loading "/int/.desktop.settings" -48879 [I][SavedStruct] Loading "/int/.desktop.settings" -49075 [I][SavedStruct] Loading "/int/.desktop.settings" -49275 [I][SavedStruct] Loading "/int/.desktop.settings" -49360 [I][SavedStruct] Loading "/int/.desktop.settings" -49475 [I][SavedStruct] Loading "/int/.desktop.settings" -49675 [I][SavedStruct] Loading "/int/.desktop.settings" -49860 [I][SavedStruct] Loading "/int/.desktop.settings" -49879 [I][SavedStruct] Loading "/int/.desktop.settings" -50075 [I][SavedStruct] Loading "/int/.desktop.settings" -50275 [I][SavedStruct] Loading "/int/.desktop.settings" -50360 [I][SavedStruct] Loading "/int/.desktop.settings" -50475 [I][SavedStruct] Loading "/int/.desktop.settings" -50675 [I][SavedStruct] Loading "/int/.desktop.settings" -50860 [I][SavedStruct] Loading "/int/.desktop.settings" -50879 [I][SavedStruct] Loading "/int/.desktop.settings" -51075 [I][SavedStruct] Loading "/int/.desktop.settings" -51275 [I][SavedStruct] Loading "/int/.desktop.settings" -51360 [I][SavedStruct] Loading "/int/.desktop.settings" -51475 [I][SavedStruct] Loading "/int/.desktop.settings" -51675 [I][SavedStruct] Loading "/int/.desktop.settings" -51860 [I][SavedStruct] Loading "/int/.desktop.settings" -51879 [I][SavedStruct] Loading "/int/.desktop.settings" -52075 [I][SavedStruct] Loading "/int/.desktop.settings" -52275 [I][SavedStruct] Loading "/int/.desktop.settings" -52360 [I][SavedStruct] Loading "/int/.desktop.settings" -52475 [I][SavedStruct] Loading "/int/.desktop.settings" -52675 [I][SavedStruct] Loading "/int/.desktop.settings" -52860 [I][SavedStruct] Loading "/int/.desktop.settings" -52879 [I][SavedStruct] Loading "/int/.desktop.settings" -53075 [I][SavedStruct] Loading "/int/.desktop.settings" -53275 [I][SavedStruct] Loading "/int/.desktop.settings" -53360 [I][SavedStruct] Loading "/int/.desktop.settings" -53475 [I][SavedStruct] Loading "/int/.desktop.settings" -53675 [I][SavedStruct] Loading "/int/.desktop.settings" -53860 [I][SavedStruct] Loading "/int/.desktop.settings" -53879 [I][SavedStruct] Loading "/int/.desktop.settings" -54075 [I][SavedStruct] Loading "/int/.desktop.settings" -54101 [I][BtGap] Stop advertising -54104 [D][BtGap] terminate success -54107 [E][BtGap] set_non_discoverable failed 12 -54111 [I][SavedStruct] Loading "/int/.desktop.settings" -54275 [I][SavedStruct] Loading "/int/.desktop.settings" -54311 [I][SavedStruct] Loading "/int/.bt.settings" -54324 [I][SavedStruct] Loading "/int/.bt.keys" -54335 [I][FuriHalBt] Disconnect and stop advertising -54337 [I][FuriHalBt] Stop current profile services -54339 [I][BtGap] Disconnect from client. Reason: 16 -54349 [I][FuriHalBt] Stop BLE related RTOS threads -54373 [I][FuriHalBt] Reset SHCI -54475 [I][SavedStruct] Loading "/int/.desktop.settings" -54487 [I][FuriHalBt] Start BT initialization -54494 [I][Core2] Core2 started -54496 [I][Core2] C2 boot completed, mode: Stack -54500 [I][Core2] Core2: FUS: 1.2.0, mem 16/0, flash 6 pages -54504 [I][Core2] Core2: Stack: 1.13.3, branch 0, reltype 2, stacktype 3, flash 30 pages -54508 [I][Core2] Radio stack started -54511 [I][Core2] Flash activity control switched to SEM7 -54513 [I][BtGap] Advertising name: Keyboard -54516 [I][BtGap] MAC @ : 35:F2:47:26:E1:80 -54534 [D][BtBatterySvc] Updating power state characteristic -54540 [I][BtSrv] Bt App started -54542 [I][BtGap] Start advertising -54545 [I][BadBleWorker] End -54547 [I][SavedStruct] Loading "/int/.desktop.settings" -54568 [I][SavedStruct] Loading "/int/.desktop.settings" -54570 [D][BrowserWorker] Start -54598 [D][BrowserWorker] Enter folder: /any/BadUsb/fun items: 9 idx: 4 -54600 [D][BrowserWorker] Load offset: 0 cnt: 50 -54676 [D][BrowserWorker] Exit to: /any/BadUsb items: 10 idx: -1 -54678 [D][BrowserWorker] Load offset: 0 cnt: 50 -54888 [D][BrowserWorker] End -54890 [I][SavedStruct] Loading "/int/.desktop.settings" -54946 [I][fap_loader_app] FAP app returned: 0 -54982 [I][LoaderSrv] Application stopped. Free heap: 140272 -55011 [I][AnimationStorage] Custom Manifest selected -55299 [I][AnimationManager] Select 'HANDS' animation -55303 [I][AnimationManager] Load animation 'HANDS' -55331 [I][SavedStruct] Loading "/int/.desktop.settings" -65361 [I][Dolphin] Flush stats -65363 [I][SavedStruct] Saving "/int/.dolphin.state" -65373 [D][StorageInt] Device erase: page 2, translated page: cf -65468 [D][StorageInt] Device sync: skipping -65473 [I][DolphinState] State saved -72183 [I][AnimationStorage] Custom Manifest selected -73040 [I][AnimationManager] Select 'SKULL' animation -103081 [I][AnimationStorage] Custom Manifest selected -104016 [I][AnimationManager] Select 'LOGO_WD2' animation -114771 [D][BtGap] set_non_discoverable success -134057 [I][AnimationStorage] Custom Manifest selected -134395 [I][AnimationManager] Select 'MUMMY' animation -164438 [I][AnimationStorage] Custom Manifest selected -164953 [I][AnimationManager] Select 'DEDSEC_TALK' animation -174773 [D][BtGap] set_non_discoverable success -194994 [I][AnimationStorage] Custom Manifest selected -195897 [I][AnimationManager] Select 'REAPER_ALT' animation -225938 [I][AnimationStorage] Custom Manifest selected -226509 [I][AnimationManager] Select 'DEDSEC_OLD' animation -234775 [D][BtGap] set_non_discoverable success -256552 [I][AnimationStorage] Custom Manifest selected -256819 [I][AnimationManager] Select 'JOIN_US' animation -286859 [I][AnimationStorage] Custom Manifest selected -287374 [I][AnimationManager] Select 'DEDSEC_TALK' animation -294777 [D][BtGap] set_non_discoverable success -317415 [I][AnimationStorage] Custom Manifest selected -318273 [I][AnimationManager] Select 'SKULL' animation -348316 [I][AnimationStorage] Custom Manifest selected -349083 [I][AnimationManager] Select 'SPIRAL' animation -354779 [D][BtGap] set_non_discoverable success -379124 [I][AnimationStorage] Custom Manifest selected -379787 [I][AnimationManager] Select 'SKULL_SPIN' animation -409828 [I][AnimationStorage] Custom Manifest selected -410316 [I][AnimationManager] Select 'DEDSEC_AD' animation -414781 [D][BtGap] set_non_discoverable success -440358 [I][AnimationStorage] Custom Manifest selected -440698 [I][AnimationManager] Select 'MUMMY' animation -470740 [I][AnimationStorage] Custom Manifest selected -471138 [I][AnimationManager] Select 'HANDS' animation -474783 [D][BtGap] set_non_discoverable success -501180 [I][AnimationStorage] Custom Manifest selected -502243 [I][AnimationManager] Select 'DEDSEC_ANIM' animation -532285 [I][AnimationStorage] Custom Manifest selected -532547 [I][AnimationManager] Select 'BOTTY_CALL' animation -534785 [D][BtGap] set_non_discoverable success -562592 [I][AnimationStorage] Custom Manifest selected -563449 [I][AnimationManager] Select 'SKULL' animation -593489 [I][AnimationStorage] Custom Manifest selected -594414 [I][AnimationManager] Select 'LOGO_WD2' animation -594787 [D][BtGap] set_non_discoverable success -624465 [I][AnimationStorage] Custom Manifest selected -624658 [I][AnimationManager] Select 'thank_you_128x64' animation -654700 [I][AnimationStorage] Custom Manifest selected -655440 [I][AnimationManager] Select 'GUNS_CAR' animation -655471 [D][BtGap] set_non_discoverable success -685480 [I][AnimationStorage] Custom Manifest selected -686535 [I][AnimationManager] Select 'DEDSEC_ANIM' animation -715480 [D][BtGap] set_non_discoverable success -716577 [I][AnimationStorage] Custom Manifest selected -717479 [I][AnimationManager] Select 'REAPER_ALT' animation -747521 [I][AnimationStorage] Custom Manifest selected -748026 [I][AnimationManager] Select 'DEDSEC_TALK' animation -775484 [D][BtGap] set_non_discoverable success -778069 [I][AnimationStorage] Custom Manifest selected -779065 [I][AnimationManager] Select 'REAPER' animation -809108 [I][AnimationStorage] Custom Manifest selected -809625 [I][AnimationManager] Select 'DEDSEC_TALK' animation -835486 [D][BtGap] set_non_discoverable success -839669 [I][AnimationStorage] Custom Manifest selected -840573 [I][AnimationManager] Select 'REAPER_ALT' animation -870614 [I][AnimationStorage] Custom Manifest selected -871392 [I][AnimationManager] Select 'SPIRAL' animation -895488 [D][BtGap] set_non_discoverable success -901433 [I][AnimationStorage] Custom Manifest selected -902487 [I][AnimationManager] Select 'DEDSEC_ANIM' animation -932529 [I][AnimationStorage] Custom Manifest selected -932843 [I][AnimationManager] Select 'FINGER' animation From 75a01459f578c0f99782d9cad98e62715ca5f463 Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 27 Jan 2023 19:37:49 +0100 Subject: [PATCH 08/36] some fix + api_symbols correct export --- firmware/targets/f7/api_symbols.csv | 30 ++++++++++++++--------------- firmware/targets/f7/ble_glue/gap.c | 5 ++++- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index a5ce0b489..cc6c7d1c6 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -571,14 +571,14 @@ Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t" Function,+,bt_disconnect,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* -Function,?,bt_get_profile_adv_name,const char*,Bt* -Function,?,bt_get_profile_mac_address,const uint8_t*,Bt* +Function,+,bt_get_profile_adv_name,const char*,Bt* +Function,+,bt_get_profile_mac_address,const uint8_t*,Bt* Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*" -Function,?,bt_remote_rssi,_Bool,"Bt*, BtRssi*" -Function,?,bt_set_profile,_Bool,"Bt*, BtProfile" -Function,?,bt_set_profile_adv_name,void,"Bt*, const char*, ..." -Function,?,bt_set_profile_mac_address,void,"Bt*, const uint8_t[6]" +Function,+,bt_remote_rssi,_Bool,"Bt*, BtRssi*" +Function,+,bt_set_profile,_Bool,"Bt*, BtProfile" +Function,+,bt_set_profile_adv_name,void,"Bt*, const char*, ..." +Function,+,bt_set_profile_mac_address,void,"Bt*, const uint8_t[6]" Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*" Function,+,buffered_file_stream_alloc,Stream*,Storage* Function,+,buffered_file_stream_close,_Bool,Stream* @@ -608,7 +608,7 @@ Function,+,byte_input_set_result_callback,void,"ByteInput*, ByteInputCallback, B Function,-,bzero,void,"void*, size_t" Function,-,calloc,void*,"size_t, size_t" Function,+,canvas_clear,void,Canvas* -Function,-,canvas_commit,void,Canvas* +Function,+,canvas_commit,void,Canvas* Function,+,canvas_current_font_height,uint8_t,Canvas* Function,+,canvas_draw_bitmap,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t, const uint8_t*" Function,+,canvas_draw_box,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint8_t" @@ -637,7 +637,7 @@ Function,+,canvas_glyph_width,uint8_t,"Canvas*, char" Function,+,canvas_height,uint8_t,Canvas* Function,-,canvas_init,Canvas*, Function,+,canvas_invert_color,void,Canvas* -Function,-,canvas_reset,void,Canvas* +Function,+,canvas_reset,void,Canvas* Function,+,canvas_set_bitmap_mode,void,"Canvas*, _Bool" Function,+,canvas_set_color,void,"Canvas*, Color" Function,+,canvas_set_font,void,"Canvas*, Font" @@ -1000,17 +1000,17 @@ Function,+,furi_hal_bt_change_app,_Bool,"FuriHalBtProfile, GapEventCallback, voi Function,+,furi_hal_bt_clear_white_list,_Bool, Function,+,furi_hal_bt_dump_state,void,FuriString* Function,+,furi_hal_bt_ensure_c2_mode,_Bool,BleGlueC2Mode -Function,?,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* +Function,+,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* Function,+,furi_hal_bt_get_key_storage_buff,void,"uint8_t**, uint16_t*" -Function,?,furi_hal_bt_get_profile_adv_name,const char*,FuriHalBtProfile -Function,?,furi_hal_bt_get_profile_mac_addr,const uint8_t*,FuriHalBtProfile +Function,+,furi_hal_bt_get_profile_adv_name,const char*,FuriHalBtProfile +Function,+,furi_hal_bt_get_profile_mac_addr,const uint8_t*,FuriHalBtProfile Function,+,furi_hal_bt_get_radio_stack,FuriHalBtStack, Function,+,furi_hal_bt_get_rssi,float, Function,+,furi_hal_bt_get_transmitted_packets,uint32_t, Function,+,furi_hal_bt_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release_all,_Bool, -Function,?,furi_hal_bt_hid_kb_free_slots,_Bool,uint8_t +Function,+,furi_hal_bt_hid_kb_free_slots,_Bool,uint8_t Function,+,furi_hal_bt_hid_kb_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release_all,_Bool, @@ -1037,8 +1037,8 @@ Function,+,furi_hal_bt_serial_start,void, Function,+,furi_hal_bt_serial_stop,void, Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t" Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*" -Function,?,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" -Function,?,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" +Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" +Function,+furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" Function,+,furi_hal_bt_start_advertising,void, Function,+,furi_hal_bt_start_app,_Bool,"FuriHalBtProfile, GapEventCallback, void*" Function,+,furi_hal_bt_start_packet_rx,void,"uint8_t, uint8_t" @@ -1580,7 +1580,7 @@ Function,-,gamma,double,double Function,-,gamma_r,double,"double, int*" Function,-,gammaf,float,float Function,-,gammaf_r,float,"float, int*" -Function,?,gap_get_remote_conn_rssi,uint32_t,int8_t* +Function,+,gap_get_remote_conn_rssi,uint32_t,int8_t* Function,-,gap_get_state,GapState, Function,-,gap_init,_Bool,"GapConfig*, GapEventCallback, void*" Function,-,gap_start_advertising,void, diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 725a69dfb..668509218 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -54,6 +54,9 @@ static const uint8_t gap_erk[16] = static Gap* gap = NULL; +/** function for updating rssi informations in global Gap object + * +*/ static inline void fetch_rssi() { uint8_t ret_rssi = 127; if(hci_read_rssi(gap->service.connection_handle, &ret_rssi) == BLE_STATUS_SUCCESS) { @@ -61,7 +64,7 @@ static inline void fetch_rssi() { gap->time_rssi_sample = furi_get_tick(); return; } - FURI_LOG_E(TAG, "Failed to read RSSI"); + FURI_LOG_D(TAG, "Failed to read RSSI"); } static void gap_advertise_start(GapState new_state); From 35473ffafef370f1873457aa63609688122b32c2 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sat, 28 Jan 2023 06:53:55 +0000 Subject: [PATCH 09/36] Move most Bad BLE code to Bad USB --- applications/main/bad_ble/application.fam | 18 - applications/main/bad_ble/bad_ble_app.c | 194 ------- applications/main/bad_ble/bad_ble_app.h | 13 - applications/main/bad_ble/bad_ble_app_i.h | 63 -- .../main/bad_ble/bad_ble_custom_event.h | 7 - applications/main/bad_ble/bad_ble_script.c | 537 +++++++++--------- applications/main/bad_ble/bad_ble_script.h | 49 -- .../main/bad_ble/bad_ble_settings_filename.h | 3 - applications/main/bad_ble/badusb_10px.png | Bin 576 -> 0 bytes .../bad_ble/images/ActiveConnection_50x64.png | Bin 3842 -> 0 bytes .../main/bad_ble/images/Clock_18x18.png | Bin 1083 -> 0 bytes .../main/bad_ble/images/Error_18x18.png | Bin 1083 -> 0 bytes .../main/bad_ble/images/EviSmile1_18x21.png | Bin 3645 -> 0 bytes .../main/bad_ble/images/EviSmile2_18x21.png | Bin 3649 -> 0 bytes .../main/bad_ble/images/EviWaiting1_18x21.png | Bin 13020 -> 0 bytes .../main/bad_ble/images/EviWaiting2_18x21.png | Bin 12913 -> 0 bytes .../main/bad_ble/images/Percent_10x14.png | Bin 3624 -> 0 bytes .../main/bad_ble/images/SDQuestion_35x43.png | Bin 1950 -> 0 bytes .../main/bad_ble/images/Smile_18x18.png | Bin 1080 -> 0 bytes .../main/bad_ble/images/UsbTree_48x22.png | Bin 3653 -> 0 bytes .../main/bad_ble/images/badusb_10px.png | Bin 576 -> 0 bytes .../main/bad_ble/images/keyboard_10px.png | Bin 147 -> 0 bytes .../main/bad_ble/scenes/bad_ble_scene.c | 30 - .../main/bad_ble/scenes/bad_ble_scene.h | 29 - .../bad_ble/scenes/bad_ble_scene_config.c | 72 --- .../bad_ble/scenes/bad_ble_scene_config.h | 7 - .../scenes/bad_ble_scene_config_layout.c | 47 -- .../bad_ble/scenes/bad_ble_scene_config_mac.c | 57 -- .../scenes/bad_ble_scene_config_name.c | 46 -- .../main/bad_ble/scenes/bad_ble_scene_error.c | 65 --- .../scenes/bad_ble_scene_file_select.c | 51 -- .../main/bad_ble/scenes/bad_ble_scene_work.c | 54 -- applications/main/bad_ble/switch_ble.py | 24 - .../main/bad_ble/views/bad_ble_view.c | 221 ------- .../main/bad_ble/views/bad_ble_view.h | 21 - applications/main/bad_usb/bad_usb_app.c | 56 +- applications/main/bad_usb/bad_usb_app.h | 2 + applications/main/bad_usb/bad_usb_app_i.h | 30 +- applications/main/bad_usb/bad_usb_script.c | 82 ++- applications/main/bad_usb/bad_usb_script.h | 3 +- .../bad_usb/scenes/bad_usb_scene_config.c | 53 -- .../bad_usb/scenes/bad_usb_scene_config.h | 5 +- .../bad_usb/scenes/bad_usb_scene_config_bt.c | 81 +++ .../bad_usb/scenes/bad_usb_scene_config_mac.c | 57 ++ .../scenes/bad_usb_scene_config_name.c | 46 ++ .../bad_usb/scenes/bad_usb_scene_config_usb.c | 69 +++ .../main/bad_usb/scenes/bad_usb_scene_error.c | 4 - .../scenes/bad_usb_scene_file_select.c | 2 +- .../main/bad_usb/scenes/bad_usb_scene_work.c | 6 +- firmware/targets/f7/api_symbols.csv | 5 +- 50 files changed, 694 insertions(+), 1415 deletions(-) delete mode 100644 applications/main/bad_ble/application.fam delete mode 100644 applications/main/bad_ble/bad_ble_app.c delete mode 100644 applications/main/bad_ble/bad_ble_app.h delete mode 100644 applications/main/bad_ble/bad_ble_app_i.h delete mode 100644 applications/main/bad_ble/bad_ble_custom_event.h delete mode 100644 applications/main/bad_ble/bad_ble_script.h delete mode 100644 applications/main/bad_ble/bad_ble_settings_filename.h delete mode 100644 applications/main/bad_ble/badusb_10px.png delete mode 100644 applications/main/bad_ble/images/ActiveConnection_50x64.png delete mode 100644 applications/main/bad_ble/images/Clock_18x18.png delete mode 100644 applications/main/bad_ble/images/Error_18x18.png delete mode 100644 applications/main/bad_ble/images/EviSmile1_18x21.png delete mode 100644 applications/main/bad_ble/images/EviSmile2_18x21.png delete mode 100644 applications/main/bad_ble/images/EviWaiting1_18x21.png delete mode 100644 applications/main/bad_ble/images/EviWaiting2_18x21.png delete mode 100644 applications/main/bad_ble/images/Percent_10x14.png delete mode 100644 applications/main/bad_ble/images/SDQuestion_35x43.png delete mode 100644 applications/main/bad_ble/images/Smile_18x18.png delete mode 100644 applications/main/bad_ble/images/UsbTree_48x22.png delete mode 100644 applications/main/bad_ble/images/badusb_10px.png delete mode 100644 applications/main/bad_ble/images/keyboard_10px.png delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene.h delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config.h delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_config_name.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_error.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_file_select.c delete mode 100644 applications/main/bad_ble/scenes/bad_ble_scene_work.c delete mode 100644 applications/main/bad_ble/switch_ble.py delete mode 100644 applications/main/bad_ble/views/bad_ble_view.c delete mode 100644 applications/main/bad_ble/views/bad_ble_view.h delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config.c create mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c create mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c create mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_name.c create mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c diff --git a/applications/main/bad_ble/application.fam b/applications/main/bad_ble/application.fam deleted file mode 100644 index ac4106eac..000000000 --- a/applications/main/bad_ble/application.fam +++ /dev/null @@ -1,18 +0,0 @@ -App( - appid="bad_ble", - name="Bad BLE", - apptype=FlipperAppType.EXTERNAL, - entry_point="bad_ble_app", - cdefines=["APP_BAD_BLE"], - requires=[ - "gui", - "dialogs", - ], - stack_size=2 * 1024, - # icon="A_BadUsb_14", - order=70, - fap_category="Main", - fap_icon="badusb_10px.png", - fap_icon_assets="images", - fap_libs=["assets"], -) diff --git a/applications/main/bad_ble/bad_ble_app.c b/applications/main/bad_ble/bad_ble_app.c deleted file mode 100644 index c5a7e72d0..000000000 --- a/applications/main/bad_ble/bad_ble_app.c +++ /dev/null @@ -1,194 +0,0 @@ -#include "bad_ble_app_i.h" -#include "bad_ble_settings_filename.h" -#include -#include -#include -#include - -#include -#include - -#define BAD_BLE_SETTINGS_PATH BAD_BLE_APP_BASE_FOLDER "/" BAD_BLE_SETTINGS_FILE_NAME - -static bool bad_ble_app_custom_event_callback(void* context, uint32_t event) { - furi_assert(context); - BadBleApp* app = context; - return scene_manager_handle_custom_event(app->scene_manager, event); -} - -static bool bad_ble_app_back_event_callback(void* context) { - furi_assert(context); - BadBleApp* app = context; - return scene_manager_handle_back_event(app->scene_manager); -} - -static void bad_ble_app_tick_event_callback(void* context) { - furi_assert(context); - BadBleApp* app = context; - scene_manager_handle_tick_event(app->scene_manager); -} - -static void bad_ble_load_settings(BadBleApp* app) { - File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_BLE_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { - char chr; - while((storage_file_read(settings_file, &chr, 1) == 1) && - !storage_file_eof(settings_file) && !isspace(chr)) { - furi_string_push_back(app->keyboard_layout, chr); - } - } - storage_file_close(settings_file); - storage_file_free(settings_file); -} - -static void bad_ble_save_settings(BadBleApp* app) { - File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_BLE_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) { - storage_file_write( - settings_file, - furi_string_get_cstr(app->keyboard_layout), - furi_string_size(app->keyboard_layout)); - storage_file_write(settings_file, "\n", 1); - } - storage_file_close(settings_file); - storage_file_free(settings_file); -} - -void bad_ble_set_name(BadBleApp* app, const char* fmt, ...) { - furi_assert(app); - - va_list args; - va_start(args, fmt); - - vsnprintf(app->name, BAD_BLE_ADV_NAME_MAX_LEN, fmt, args); - - va_end(args); -} - -BadBleApp* bad_ble_app_alloc(char* arg) { - BadBleApp* app = malloc(sizeof(BadBleApp)); - - app->bad_ble_script = NULL; - - app->file_path = furi_string_alloc(); - app->keyboard_layout = furi_string_alloc(); - if(arg && strlen(arg)) { - furi_string_set(app->file_path, arg); - } - - bad_ble_load_settings(app); - - app->gui = furi_record_open(RECORD_GUI); - app->notifications = furi_record_open(RECORD_NOTIFICATION); - app->dialogs = furi_record_open(RECORD_DIALOGS); - - app->view_dispatcher = view_dispatcher_alloc(); - view_dispatcher_enable_queue(app->view_dispatcher); - - app->scene_manager = scene_manager_alloc(&bad_ble_scene_handlers, app); - - view_dispatcher_set_event_callback_context(app->view_dispatcher, app); - view_dispatcher_set_tick_event_callback( - app->view_dispatcher, bad_ble_app_tick_event_callback, 500); - view_dispatcher_set_custom_event_callback( - app->view_dispatcher, bad_ble_app_custom_event_callback); - view_dispatcher_set_navigation_event_callback( - app->view_dispatcher, bad_ble_app_back_event_callback); - - Bt* bt = furi_record_open(RECORD_BT); - app->bt = bt; - const char* adv_name = bt_get_profile_adv_name(bt); - memcpy(app->name, adv_name, BAD_BLE_ADV_NAME_MAX_LEN); - - const uint8_t* mac_addr = bt_get_profile_mac_address(bt); - memcpy(app->mac, mac_addr, BAD_BLE_MAC_ADDRESS_LEN); - - // Custom Widget - app->widget = widget_alloc(); - view_dispatcher_add_view( - app->view_dispatcher, BadBleAppViewError, widget_get_view(app->widget)); - - app->submenu = submenu_alloc(); - view_dispatcher_add_view( - app->view_dispatcher, BadBleAppViewConfig, submenu_get_view(app->submenu)); - - app->bad_ble_view = bad_ble_alloc(); - view_dispatcher_add_view( - app->view_dispatcher, BadBleAppViewWork, bad_ble_get_view(app->bad_ble_view)); - - app->text_input = text_input_alloc(); - view_dispatcher_add_view( - app->view_dispatcher, BadBleAppViewConfigName, text_input_get_view(app->text_input)); - - app->byte_input = byte_input_alloc(); - view_dispatcher_add_view( - app->view_dispatcher, BadBleAppViewConfigMac, byte_input_get_view(app->byte_input)); - - view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); - - if(!furi_string_empty(app->file_path)) { - app->bad_ble_script = bad_ble_script_open(app->file_path, bt); - bad_ble_script_set_keyboard_layout(app->bad_ble_script, app->keyboard_layout); - scene_manager_next_scene(app->scene_manager, BadBleSceneWork); - } else { - furi_string_set(app->file_path, BAD_BLE_APP_BASE_FOLDER); - scene_manager_next_scene(app->scene_manager, BadBleSceneFileSelect); - } - - return app; -} - -void bad_ble_app_free(BadBleApp* app) { - furi_assert(app); - - if(app->bad_ble_script) { - bad_ble_script_close(app->bad_ble_script); - app->bad_ble_script = NULL; - } - - // Views - view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewWork); - bad_ble_free(app->bad_ble_view); - - // Custom Widget - view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewError); - widget_free(app->widget); - - // Submenu - view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewConfig); - submenu_free(app->submenu); - - // Text Input - view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewConfigName); - text_input_free(app->text_input); - - // Byte Input - view_dispatcher_remove_view(app->view_dispatcher, BadBleAppViewConfigMac); - byte_input_free(app->byte_input); - - // View dispatcher - view_dispatcher_free(app->view_dispatcher); - scene_manager_free(app->scene_manager); - - // Close records - furi_record_close(RECORD_GUI); - furi_record_close(RECORD_NOTIFICATION); - furi_record_close(RECORD_DIALOGS); - furi_record_close(RECORD_BT); - - bad_ble_save_settings(app); - - furi_string_free(app->file_path); - furi_string_free(app->keyboard_layout); - - free(app); -} - -int32_t bad_ble_app(void* p) { - BadBleApp* bad_ble_app = bad_ble_app_alloc((char*)p); - - view_dispatcher_run(bad_ble_app->view_dispatcher); - - bad_ble_app_free(bad_ble_app); - return 0; -} diff --git a/applications/main/bad_ble/bad_ble_app.h b/applications/main/bad_ble/bad_ble_app.h deleted file mode 100644 index ff681e849..000000000 --- a/applications/main/bad_ble/bad_ble_app.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct BadBleApp BadBleApp; - -void bad_ble_set_name(BadBleApp* app, const char* fmt, ...); - -#ifdef __cplusplus -} -#endif diff --git a/applications/main/bad_ble/bad_ble_app_i.h b/applications/main/bad_ble/bad_ble_app_i.h deleted file mode 100644 index fd2405c51..000000000 --- a/applications/main/bad_ble/bad_ble_app_i.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include "bad_ble_app.h" -#include "scenes/bad_ble_scene.h" -#include "bad_ble_script.h" -#include "bad_ble_custom_event.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "views/bad_ble_view.h" - -#define BAD_BLE_APP_BASE_FOLDER ANY_PATH("BadUsb") -#define BAD_BLE_APP_PATH_LAYOUT_FOLDER BAD_BLE_APP_BASE_FOLDER "/layouts" -#define BAD_BLE_APP_SCRIPT_EXTENSION ".txt" -#define BAD_BLE_APP_LAYOUT_EXTENSION ".kl" - -#define BAD_BLE_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro -#define BAD_BLE_ADV_NAME_MAX_LEN 18 - -typedef enum { - BadBleAppErrorNoFiles, - BadBleAppErrorCloseRpc, -} BadBleAppError; - -struct BadBleApp { - Gui* gui; - ViewDispatcher* view_dispatcher; - SceneManager* scene_manager; - NotificationApp* notifications; - DialogsApp* dialogs; - Widget* widget; - Submenu* submenu; - - TextInput* text_input; - ByteInput* byte_input; - uint8_t mac[BAD_BLE_MAC_ADDRESS_LEN]; - char name[BAD_BLE_ADV_NAME_MAX_LEN + 1]; - - BadBleAppError error; - FuriString* file_path; - FuriString* keyboard_layout; - BadBle* bad_ble_view; - BadBleScript* bad_ble_script; - - Bt* bt; -}; - -typedef enum { - BadBleAppViewError, - BadBleAppViewWork, - BadBleAppViewConfig, - BadBleAppViewConfigMac, - BadBleAppViewConfigName -} BadBleAppView; \ No newline at end of file diff --git a/applications/main/bad_ble/bad_ble_custom_event.h b/applications/main/bad_ble/bad_ble_custom_event.h deleted file mode 100644 index ba31411d0..000000000 --- a/applications/main/bad_ble/bad_ble_custom_event.h +++ /dev/null @@ -1,7 +0,0 @@ - - -typedef enum BadBleCustomEvent { - BadBleAppCustomEventTextEditResult, - BadBleAppCustomEventByteInputDone, - BadBleCustomEventErrorBack -} BadBleCustomEvent; \ No newline at end of file diff --git a/applications/main/bad_ble/bad_ble_script.c b/applications/main/bad_ble/bad_ble_script.c index 7a14c4498..a969df7dd 100644 --- a/applications/main/bad_ble/bad_ble_script.c +++ b/applications/main/bad_ble/bad_ble_script.c @@ -1,198 +1,199 @@ -#include -#include -#include -#include -#include -#include -#include -#include "bad_ble_script.h" -#include +// #include +// #include +// #include +// #include +// #include +// #include -#include +// #include +// #include "bad_ble_script.h" +// #include -#define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") +// #include -#define TAG "BadBle" -#define WORKER_TAG TAG "Worker" -#define FILE_BUFFER_LEN 16 +// #define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") -#define SCRIPT_STATE_ERROR (-1) -#define SCRIPT_STATE_END (-2) -#define SCRIPT_STATE_NEXT_LINE (-3) +// #define TAG "BadBle" +// #define WORKER_TAG TAG "Worker" +// #define FILE_BUFFER_LEN 16 -#define BADBLE_ASCII_TO_KEY(script, x) \ - (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE) +// #define SCRIPT_STATE_ERROR (-1) +// #define SCRIPT_STATE_END (-2) +// #define SCRIPT_STATE_NEXT_LINE (-3) -typedef enum { - WorkerEvtToggle = (1 << 0), - WorkerEvtEnd = (1 << 1), - WorkerEvtConnect = (1 << 2), - WorkerEvtDisconnect = (1 << 3), -} WorkerEvtFlags; +// #define BADBLE_ASCII_TO_KEY(script, x) \ +// (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE) -typedef enum { - LevelRssi122_100, - LevelRssi99_80, - LevelRssi79_60, - LevelRssi59_40, - LevelRssi39_0, - LevelRssiNum, - LevelRssiError = 0xFF, -} LevelRssiRange; +// typedef enum { +// WorkerEvtToggle = (1 << 0), +// WorkerEvtEnd = (1 << 1), +// WorkerEvtConnect = (1 << 2), +// WorkerEvtDisconnect = (1 << 3), +// } WorkerEvtFlags; -/** - * Delays for waiting between HID key press and key release -*/ -const uint8_t bt_hid_delays[LevelRssiNum] = { - 30, // LevelRssi122_100 - 25, // LevelRssi99_80 - 20, // LevelRssi79_60 - 17, // LevelRssi59_40 - 14, // LevelRssi39_0 -}; +// typedef enum { +// LevelRssi122_100, +// LevelRssi99_80, +// LevelRssi79_60, +// LevelRssi59_40, +// LevelRssi39_0, +// LevelRssiNum, +// LevelRssiError = 0xFF, +// } LevelRssiRange; -struct BadBleScript { - BadBleState st; - FuriString* file_path; - uint32_t defdelay; - uint16_t layout[128]; - FuriThread* thread; - uint8_t file_buf[FILE_BUFFER_LEN + 1]; - uint8_t buf_start; - uint8_t buf_len; - bool file_end; - FuriString* line; +// /** +// * Delays for waiting between HID key press and key release +// */ +// const uint8_t bt_hid_delays[LevelRssiNum] = { +// 30, // LevelRssi122_100 +// 25, // LevelRssi99_80 +// 20, // LevelRssi79_60 +// 17, // LevelRssi59_40 +// 14, // LevelRssi39_0 +// }; - FuriString* line_prev; - uint32_t repeat_cnt; +// struct BadBleScript { - File* debug_file; - Bt* bt; -}; +// BadBleState st; +// FuriString* file_path; +// uint32_t defdelay; +// uint16_t layout[128]; +// FuriThread* thread; +// uint8_t file_buf[FILE_BUFFER_LEN + 1]; +// uint8_t buf_start; +// uint8_t buf_len; +// bool file_end; +// FuriString* line; -typedef struct { - char* name; - uint16_t keycode; -} DuckyKey; +// FuriString* line_prev; +// uint32_t repeat_cnt; -static const DuckyKey ducky_keys[] = { - {"CTRL-ALT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_ALT}, - {"CTRL-SHIFT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT}, - {"ALT-SHIFT", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT}, - {"ALT-GUI", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_GUI}, - {"GUI-SHIFT", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT}, +// Bt* bt; +// }; - {"CTRL", KEY_MOD_LEFT_CTRL}, - {"CONTROL", KEY_MOD_LEFT_CTRL}, - {"SHIFT", KEY_MOD_LEFT_SHIFT}, - {"ALT", KEY_MOD_LEFT_ALT}, - {"GUI", KEY_MOD_LEFT_GUI}, - {"WINDOWS", KEY_MOD_LEFT_GUI}, +// typedef struct { +// char* name; +// uint16_t keycode; +// } DuckyKey; - {"DOWNARROW", HID_KEYBOARD_DOWN_ARROW}, - {"DOWN", HID_KEYBOARD_DOWN_ARROW}, - {"LEFTARROW", HID_KEYBOARD_LEFT_ARROW}, - {"LEFT", HID_KEYBOARD_LEFT_ARROW}, - {"RIGHTARROW", HID_KEYBOARD_RIGHT_ARROW}, - {"RIGHT", HID_KEYBOARD_RIGHT_ARROW}, - {"UPARROW", HID_KEYBOARD_UP_ARROW}, - {"UP", HID_KEYBOARD_UP_ARROW}, +// static const DuckyKey ducky_keys[] = { +// {"CTRL-ALT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_ALT}, +// {"CTRL-SHIFT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT}, +// {"ALT-SHIFT", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT}, +// {"ALT-GUI", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_GUI}, +// {"GUI-SHIFT", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT}, - {"ENTER", HID_KEYBOARD_RETURN}, - {"BREAK", HID_KEYBOARD_PAUSE}, - {"PAUSE", HID_KEYBOARD_PAUSE}, - {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK}, - {"DELETE", HID_KEYBOARD_DELETE}, - {"BACKSPACE", HID_KEYPAD_BACKSPACE}, - {"END", HID_KEYBOARD_END}, - {"ESC", HID_KEYBOARD_ESCAPE}, - {"ESCAPE", HID_KEYBOARD_ESCAPE}, - {"HOME", HID_KEYBOARD_HOME}, - {"INSERT", HID_KEYBOARD_INSERT}, - {"NUMLOCK", HID_KEYPAD_NUMLOCK}, - {"PAGEUP", HID_KEYBOARD_PAGE_UP}, - {"PAGEDOWN", HID_KEYBOARD_PAGE_DOWN}, - {"PRINTSCREEN", HID_KEYBOARD_PRINT_SCREEN}, - {"SCROLLLOCK", HID_KEYBOARD_SCROLL_LOCK}, - {"SPACE", HID_KEYBOARD_SPACEBAR}, - {"TAB", HID_KEYBOARD_TAB}, - {"MENU", HID_KEYBOARD_APPLICATION}, - {"APP", HID_KEYBOARD_APPLICATION}, +// {"CTRL", KEY_MOD_LEFT_CTRL}, +// {"CONTROL", KEY_MOD_LEFT_CTRL}, +// {"SHIFT", KEY_MOD_LEFT_SHIFT}, +// {"ALT", KEY_MOD_LEFT_ALT}, +// {"GUI", KEY_MOD_LEFT_GUI}, +// {"WINDOWS", KEY_MOD_LEFT_GUI}, - {"F1", HID_KEYBOARD_F1}, - {"F2", HID_KEYBOARD_F2}, - {"F3", HID_KEYBOARD_F3}, - {"F4", HID_KEYBOARD_F4}, - {"F5", HID_KEYBOARD_F5}, - {"F6", HID_KEYBOARD_F6}, - {"F7", HID_KEYBOARD_F7}, - {"F8", HID_KEYBOARD_F8}, - {"F9", HID_KEYBOARD_F9}, - {"F10", HID_KEYBOARD_F10}, - {"F11", HID_KEYBOARD_F11}, - {"F12", HID_KEYBOARD_F12}, -}; +// {"DOWNARROW", HID_KEYBOARD_DOWN_ARROW}, +// {"DOWN", HID_KEYBOARD_DOWN_ARROW}, +// {"LEFTARROW", HID_KEYBOARD_LEFT_ARROW}, +// {"LEFT", HID_KEYBOARD_LEFT_ARROW}, +// {"RIGHTARROW", HID_KEYBOARD_RIGHT_ARROW}, +// {"RIGHT", HID_KEYBOARD_RIGHT_ARROW}, +// {"UPARROW", HID_KEYBOARD_UP_ARROW}, +// {"UP", HID_KEYBOARD_UP_ARROW}, -static const char ducky_cmd_comment[] = {"REM"}; -static const char ducky_cmd_id[] = {"ID"}; -static const char ducky_cmd_delay[] = {"DELAY "}; -static const char ducky_cmd_string[] = {"STRING "}; -static const char ducky_cmd_defdelay_1[] = {"DEFAULT_DELAY "}; -static const char ducky_cmd_defdelay_2[] = {"DEFAULTDELAY "}; -static const char ducky_cmd_repeat[] = {"REPEAT "}; -static const char ducky_cmd_sysrq[] = {"SYSRQ "}; +// {"ENTER", HID_KEYBOARD_RETURN}, +// {"BREAK", HID_KEYBOARD_PAUSE}, +// {"PAUSE", HID_KEYBOARD_PAUSE}, +// {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK}, +// {"DELETE", HID_KEYBOARD_DELETE}, +// {"BACKSPACE", HID_KEYPAD_BACKSPACE}, +// {"END", HID_KEYBOARD_END}, +// {"ESC", HID_KEYBOARD_ESCAPE}, +// {"ESCAPE", HID_KEYBOARD_ESCAPE}, +// {"HOME", HID_KEYBOARD_HOME}, +// {"INSERT", HID_KEYBOARD_INSERT}, +// {"NUMLOCK", HID_KEYPAD_NUMLOCK}, +// {"PAGEUP", HID_KEYBOARD_PAGE_UP}, +// {"PAGEDOWN", HID_KEYBOARD_PAGE_DOWN}, +// {"PRINTSCREEN", HID_KEYBOARD_PRINT_SCREEN}, +// {"SCROLLLOCK", HID_KEYBOARD_SCROLL_LOCK}, +// {"SPACE", HID_KEYBOARD_SPACEBAR}, +// {"TAB", HID_KEYBOARD_TAB}, +// {"MENU", HID_KEYBOARD_APPLICATION}, +// {"APP", HID_KEYBOARD_APPLICATION}, -static const char ducky_cmd_altchar[] = {"ALTCHAR "}; -static const char ducky_cmd_altstr_1[] = {"ALTSTRING "}; -static const char ducky_cmd_altstr_2[] = {"ALTCODE "}; +// {"F1", HID_KEYBOARD_F1}, +// {"F2", HID_KEYBOARD_F2}, +// {"F3", HID_KEYBOARD_F3}, +// {"F4", HID_KEYBOARD_F4}, +// {"F5", HID_KEYBOARD_F5}, +// {"F6", HID_KEYBOARD_F6}, +// {"F7", HID_KEYBOARD_F7}, +// {"F8", HID_KEYBOARD_F8}, +// {"F9", HID_KEYBOARD_F9}, +// {"F10", HID_KEYBOARD_F10}, +// {"F11", HID_KEYBOARD_F11}, +// {"F12", HID_KEYBOARD_F12}, +// }; -static const char ducky_cmd_lang[] = {"DUCKY_LANG"}; +// static const char ducky_cmd_comment[] = {"REM"}; +// static const char ducky_cmd_id[] = {"ID"}; +// static const char ducky_cmd_delay[] = {"DELAY "}; +// static const char ducky_cmd_string[] = {"STRING "}; +// static const char ducky_cmd_defdelay_1[] = {"DEFAULT_DELAY "}; +// static const char ducky_cmd_defdelay_2[] = {"DEFAULTDELAY "}; +// static const char ducky_cmd_repeat[] = {"REPEAT "}; +// static const char ducky_cmd_sysrq[] = {"SYSRQ "}; -static const uint8_t numpad_keys[10] = { - HID_KEYPAD_0, - HID_KEYPAD_1, - HID_KEYPAD_2, - HID_KEYPAD_3, - HID_KEYPAD_4, - HID_KEYPAD_5, - HID_KEYPAD_6, - HID_KEYPAD_7, - HID_KEYPAD_8, - HID_KEYPAD_9, -}; +// static const char ducky_cmd_altchar[] = {"ALTCHAR "}; +// static const char ducky_cmd_altstr_1[] = {"ALTSTRING "}; +// static const char ducky_cmd_altstr_2[] = {"ALTCODE "}; -uint8_t bt_timeout = 0; +// static const char ducky_cmd_lang[] = {"DUCKY_LANG"}; -static LevelRssiRange bt_remote_rssi_range(Bt* bt) { - BtRssi rssi_data = {0}; +// static const uint8_t numpad_keys[10] = { +// HID_KEYPAD_0, +// HID_KEYPAD_1, +// HID_KEYPAD_2, +// HID_KEYPAD_3, +// HID_KEYPAD_4, +// HID_KEYPAD_5, +// HID_KEYPAD_6, +// HID_KEYPAD_7, +// HID_KEYPAD_8, +// HID_KEYPAD_9, +// }; - if(!bt_remote_rssi(bt, &rssi_data)) return LevelRssiError; +// uint8_t bt_timeout = 0; - if(rssi_data.rssi <= 39) - return LevelRssi39_0; - else if(rssi_data.rssi <= 59) - return LevelRssi59_40; - else if(rssi_data.rssi <= 79) - return LevelRssi79_60; - else if(rssi_data.rssi <= 99) - return LevelRssi99_80; - else if(rssi_data.rssi <= 122) - return LevelRssi122_100; +// static LevelRssiRange bt_remote_rssi_range(Bt* bt) { +// BtRssi rssi_data = {0}; - return LevelRssiError; -} +// if(!bt_remote_rssi(bt, &rssi_data)) return LevelRssiError; -static inline void update_bt_timeout(Bt* bt) { - LevelRssiRange r = bt_remote_rssi_range(bt); - if(r < LevelRssiNum) { - bt_timeout = bt_hid_delays[r]; - } -} +// if(rssi_data.rssi <= 39) +// return LevelRssi39_0; +// else if(rssi_data.rssi <= 59) +// return LevelRssi59_40; +// else if(rssi_data.rssi <= 79) +// return LevelRssi79_60; +// else if(rssi_data.rssi <= 99) +// return LevelRssi99_80; +// else if(rssi_data.rssi <= 122) +// return LevelRssi122_100; + +// return LevelRssiError; +// } + +// static inline void update_bt_timeout(Bt* bt) { +// LevelRssiRange r = bt_remote_rssi_range(bt); +// if(r < LevelRssiNum) { +// bt_timeout = bt_hid_delays[r]; +// } +// } /** * @brief Wait until there are enough free slots in the keyboard buffer - * - * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) + * + * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) */ static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { uint32_t start = furi_get_tick(); @@ -206,26 +207,26 @@ static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t } } -static bool ducky_get_number(const char* param, uint32_t* val) { - uint32_t value = 0; - if(sscanf(param, "%lu", &value) == 1) { - *val = value; - return true; - } - return false; -} +// static bool ducky_get_number(const char* param, uint32_t* val) { +// uint32_t value = 0; +// if(sscanf(param, "%lu", &value) == 1) { +// *val = value; +// return true; +// } +// return false; +// } -static uint32_t ducky_get_command_len(const char* line) { - uint32_t len = strlen(line); - for(uint32_t i = 0; i < len; i++) { - if(line[i] == ' ') return i; - } - return 0; -} +// static uint32_t ducky_get_command_len(const char* line) { +// uint32_t len = strlen(line); +// for(uint32_t i = 0; i < len; i++) { +// if(line[i] == ' ') return i; +// } +// return 0; +// } -static bool ducky_is_line_end(const char chr) { - return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); -} +// static bool ducky_is_line_end(const char chr) { +// return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); +// } static void ducky_numlock_on() { if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { @@ -269,25 +270,25 @@ static bool ducky_altchar(const char* charcode) { return state; } -static bool ducky_altstring(const char* param) { - uint32_t i = 0; - bool state = false; +// static bool ducky_altstring(const char* param) { +// uint32_t i = 0; +// bool state = false; - while(param[i] != '\0') { - if((param[i] < ' ') || (param[i] > '~')) { - i++; - continue; // Skip non-printable chars - } +// while(param[i] != '\0') { +// if((param[i] < ' ') || (param[i] > '~')) { +// i++; +// continue; // Skip non-printable chars +// } - char temp_str[4]; - snprintf(temp_str, 4, "%u", param[i]); +// char temp_str[4]; +// snprintf(temp_str, 4, "%u", param[i]); - state = ducky_altchar(temp_str); - if(state == false) break; - i++; - } - return state; -} +// state = ducky_altchar(temp_str); +// if(state == false) break; +// i++; +// } +// return state; +// } static bool ducky_string(BadBleScript* bad_ble, const char* param) { uint32_t i = 0; @@ -305,19 +306,19 @@ static bool ducky_string(BadBleScript* bad_ble, const char* param) { return true; } -static uint16_t ducky_get_keycode(BadBleScript* bad_ble, const char* param, bool accept_chars) { - for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) { - size_t key_cmd_len = strlen(ducky_keys[i].name); - if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) && - (ducky_is_line_end(param[key_cmd_len]))) { - return ducky_keys[i].keycode; - } - } - if((accept_chars) && (strlen(param) > 0)) { - return (BADBLE_ASCII_TO_KEY(bad_ble, param[0]) & 0xFF); - } - return 0; -} +// static uint16_t ducky_get_keycode(BadBleScript* bad_ble, const char* param, bool accept_chars) { +// for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) { +// size_t key_cmd_len = strlen(ducky_keys[i].name); +// if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) && +// (ducky_is_line_end(param[key_cmd_len]))) { +// return ducky_keys[i].keycode; +// } +// } +// if((accept_chars) && (strlen(param) > 0)) { +// return (BADBLE_ASCII_TO_KEY(bad_ble, param[0]) & 0xFF); +// } +// return 0; +// } static int32_t ducky_parse_line(BadBleScript* bad_ble, FuriString* line, char* error, size_t error_len) { @@ -749,70 +750,70 @@ static int32_t bad_ble_worker(void* context) { return 0; } -static void bad_ble_script_set_default_keyboard_layout(BadBleScript* bad_ble) { - furi_assert(bad_ble); - memset(bad_ble->layout, HID_KEYBOARD_NONE, sizeof(bad_ble->layout)); - memcpy(bad_ble->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_ble->layout))); -} +// static void bad_ble_script_set_default_keyboard_layout(BadBleScript* bad_ble) { +// furi_assert(bad_ble); +// memset(bad_ble->layout, HID_KEYBOARD_NONE, sizeof(bad_ble->layout)); +// memcpy(bad_ble->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_ble->layout))); +// } -BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt) { - furi_assert(file_path); +// BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt) { +// furi_assert(file_path); - BadBleScript* bad_ble = malloc(sizeof(BadBleScript)); - bad_ble->file_path = furi_string_alloc(); - furi_string_set(bad_ble->file_path, file_path); - bad_ble_script_set_default_keyboard_layout(bad_ble); +// BadBleScript* bad_ble = malloc(sizeof(BadBleScript)); +// bad_ble->file_path = furi_string_alloc(); +// furi_string_set(bad_ble->file_path, file_path); +// bad_ble_script_set_default_keyboard_layout(bad_ble); - bad_ble->st.state = BadBleStateInit; - bad_ble->st.error[0] = '\0'; +// bad_ble->st.state = BadBleStateInit; +// bad_ble->st.error[0] = '\0'; - bad_ble->bt = bt; +// bad_ble->bt = bt; - bad_ble->thread = furi_thread_alloc_ex("BadBleWorker", 2048, bad_ble_worker, bad_ble); - furi_thread_start(bad_ble->thread); - return bad_ble; -} //-V773 +// bad_ble->thread = furi_thread_alloc_ex("BadBleWorker", 2048, bad_ble_worker, bad_ble); +// furi_thread_start(bad_ble->thread); +// return bad_ble; +// } //-V773 -void bad_ble_script_close(BadBleScript* bad_ble) { - furi_assert(bad_ble); - furi_record_close(RECORD_STORAGE); - furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtEnd); - furi_thread_join(bad_ble->thread); - furi_thread_free(bad_ble->thread); - furi_string_free(bad_ble->file_path); - free(bad_ble); -} +// void bad_ble_script_close(BadBleScript* bad_ble) { +// furi_assert(bad_ble); +// furi_record_close(RECORD_STORAGE); +// furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtEnd); +// furi_thread_join(bad_ble->thread); +// furi_thread_free(bad_ble->thread); +// furi_string_free(bad_ble->file_path); +// free(bad_ble); +// } -void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path) { - furi_assert(bad_ble); +// void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path) { +// furi_assert(bad_ble); - if((bad_ble->st.state == BadBleStateRunning) || (bad_ble->st.state == BadBleStateDelay)) { - // do not update keyboard layout while a script is running - return; - } +// if((bad_ble->st.state == BadBleStateRunning) || (bad_ble->st.state == BadBleStateDelay)) { +// // do not update keyboard layout while a script is running +// return; +// } - File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(!furi_string_empty(layout_path)) { - if(storage_file_open( - layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { - uint16_t layout[128]; - if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) { - memcpy(bad_ble->layout, layout, sizeof(layout)); - } - } - storage_file_close(layout_file); - } else { - bad_ble_script_set_default_keyboard_layout(bad_ble); - } - storage_file_free(layout_file); -} +// File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); +// if(!furi_string_empty(layout_path)) { +// if(storage_file_open( +// layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { +// uint16_t layout[128]; +// if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) { +// memcpy(bad_ble->layout, layout, sizeof(layout)); +// } +// } +// storage_file_close(layout_file); +// } else { +// bad_ble_script_set_default_keyboard_layout(bad_ble); +// } +// storage_file_free(layout_file); +// } -void bad_ble_script_toggle(BadBleScript* bad_ble) { - furi_assert(bad_ble); - furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtToggle); -} +// void bad_ble_script_toggle(BadBleScript* bad_ble) { +// furi_assert(bad_ble); +// furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtToggle); +// } -BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble) { - furi_assert(bad_ble); - return &(bad_ble->st); -} +// BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble) { +// furi_assert(bad_ble); +// return &(bad_ble->st); +// } diff --git a/applications/main/bad_ble/bad_ble_script.h b/applications/main/bad_ble/bad_ble_script.h deleted file mode 100644 index 5445c45ed..000000000 --- a/applications/main/bad_ble/bad_ble_script.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -typedef struct BadBleScript BadBleScript; - -typedef enum { - BadBleStateInit, - BadBleStateNotConnected, - BadBleStateIdle, - BadBleStateWillRun, - BadBleStateRunning, - BadBleStateDelay, - BadBleStateDone, - BadBleStateScriptError, - BadBleStateFileError, -} BadBleWorkerState; - -typedef struct { - BadBleWorkerState state; - uint16_t line_cur; - uint16_t line_nb; - uint32_t delay_remain; - uint16_t error_line; - char error[64]; -} BadBleState; - -BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt); - -void bad_ble_script_close(BadBleScript* bad_ble); - -void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path); - -void bad_ble_script_start(BadBleScript* bad_ble); - -void bad_ble_script_stop(BadBleScript* bad_ble); - -void bad_ble_script_toggle(BadBleScript* bad_ble); - -BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble); - -#ifdef __cplusplus -} -#endif diff --git a/applications/main/bad_ble/bad_ble_settings_filename.h b/applications/main/bad_ble/bad_ble_settings_filename.h deleted file mode 100644 index 73245ad5f..000000000 --- a/applications/main/bad_ble/bad_ble_settings_filename.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define BAD_BLE_SETTINGS_FILE_NAME ".BadBle.settings" diff --git a/applications/main/bad_ble/badusb_10px.png b/applications/main/bad_ble/badusb_10px.png deleted file mode 100644 index 037474aa3bc9c2e1aca79a68483e69980432bcf5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 576 zcmV-G0>AxEX>4Tx04R}tkv&MmKpe$i(`rSk4t5Z6$WWau6cusQDionYs1;guFuC*#nlvOW zE{=k0!NHHks)LKOt`4q(Aou~|=;Wm6A|?JWDYS_3;J6>}?mh0_0Yan9G%FATG`(u3 z5^*t;T@{0`5D-8=V(6BcWz0!Z5}xDh9zMR_MR}I@xj#prnzI<-6NzV;VOEJZh^IHJ z2Iqa^Fe}O`@j3ChNf#u3C`-Nm{=@yu+qV-Xlle$#1U1~DPPFA zta9Gstd(o5bx;1nP)=W2<~q$0B(R7jND!f*h7!uCB1)@HiiH&I$36VRj$a~|Laq`R zITlcX2HEk0|H1EWt^DMKn-q!zT`#u%F$x5Cfo9#dzmILZc>?&Kfh)c3uQY&}Ptxmc zEph}5Yy%h9ZB5w&E_Z;TCqp)6NAlAY@_FF>jJ_!g4Bi60Yi@6?eVjf3Y3eF@0~{Oz zV+G1y_jq?tXK(+WY4!I5C=YUpXXIhH00006VoOIv0RI600RN!9r;`8x010qNS#tmY z3ljhU3ljkVnw%H_000McNliru<^lu`HWXkp{t5s906j@WK~xyijZi@f05Awj>HlAL zr$MwDdI>{Qf+U53tOUR#xOeyy)jcQo#JNRv)7r6DVVK|+*(cmT+R+EbO(O#X#REG4 O0000&vafZq~f zielZNtkaN-gLNhGzPAJb9uu62iLIrH35ZM~dExL_00Y=T+{c5+j+w|kQsr%QBj$9h<5`_= zvcrYX!$Oz~3!5J{Yi6=$wz_EDf)T3YU<@oW!^@U{0@_p^+Qfji z{lF9ZXP!JjG63Ldp~hg~AwMwx-BN!KFi@N{EC~$c9Vq4kZm|LBM=TDr8@>e2J4T|E z*&7;xT)H7xm9wFgEyA?|YQY{+y9Wr2b4d_1JP$;q8!LAJARTtVV==bq+y8?q5g)7dgSlylFvP4D0V9$wxB1&@2RYM*2Ee`$=9#$v)`Zg50U)VMn4d_fO_zVCwU-q9ZN|r>nZ~=g6Zsf5iM*H|)iP0MbvR)mm zX^><`?=>~#JKUfrWW0AW;sDRR{i#M$4h^sY&gV}!q;rKc#)ZmXsq661jES6$oFhx_ zJ-Xh>mnd2e79;EtHvsP9l1z`|1fvm}w<8KbvoT_J;N~_;0ei8rZ=xGQ zep!VgrhDtG;m?GjHW2j2){Pnq_2kH>b{y~70}Njj$x7d7$@TA{Y6`kVq~`hcNS7ai zM^xk$_MG|>Kn22X#9<o9w4gy=lixvN5r_{#|i7A{B^lOlzA`ErqJE@$p5SJfN;0w)#Olq-aYY%~RXz{(O_ z%;}2X6~bj973UHN?Vl#O zo<`6?X^E8yf(bUaH``xNR*J!zV(3vS=!YEM5?|Ykp^Tw_FKxV1c+#^>GnWeo=>-GDxZ+2$( z%J(2X{%HOytq6}JQhrhwr3&{~Nf`v8?m_r4=|hvevTZ0%U6c;Xw8 z6j+K=N_fi5LkCBHM}t1vLtckRj)ITQIfXqicYJ31xtROC#G}6AgN`qYwM)BDL8y4! zZaeq~S?sF6{&Z&Ub^0AAeJ7gJs?!I$W&hbZ9FmdU6nD#^1-PDhDcgqnxs9U@J1o=ZU`e~ zO8Q%M@AG%7`I#>>hf6*Z-j8&^o5LP$TB&Brw7b2AGmXA4uDeWJ==hvnm|57kk}v}~ z7kJL~+-B_|n`c>yIsIycwxOmoW3`Nn=VAJA?9Z-Q4*eE=_PZf>uhl)M1CPS%J z)5G^|{Z0d8l7FF1nj*R4APEU;{bZQNa~6 zW`U2XlEq1-OKyaT9X$qpsQT5e+@5-Yx~|+$pLE^yu8muYFTVNW#E@?VCD5Dhi$~!x z^O;o}ep6z1f z1nIeIxh90_MBNcddulLs1!Qas*>5vdNVGaAx_mV=%EqiN?^d2&S!LBpz1!2-PAO|T zBPYU4e)>e)mliGPwdO?V@dbnVUhr2K~e%8)od3fYrijw-bkkU&C;l!DLfKNDPqs70K9uQBSi z^L0a>_p(H2ZNd}Vswd9|s)AjY#=!MvFD2w-?InX$)!k6lp24`q-Y|v_<7w))?Su=; zaoLwPyc~zR(tH2DiPB|f&6MKgb_TKZ`{@@Lade8OBhxpn?~K!>W0EQEbTYlD^v4tP zs_6-5Yxlm;RT^P%@YBi4Hw$x!xq>+&eciSG@yS|WqrSJ%i~J=rOSh(E+zBT?QSXKL zuEuqicfRT5&_Zi1oav~b4=vx*&R+}3zU0Pm+AeuiS@%(Ku)lsJ=;DgNm4o6ZJ~5N$ zYo03wJNwm|g{=~Mzg-@Qm-djUuAdGcsj>*NY0inic>m(QH8bX%FO`HJeq3Mwl$(Ik zzI6xzBTr>UkOngsGJ>9yPahL#G@5$#*XV=Li=S=3-0ONh{JL{A{Zi#B*BpYT)C;Q* zpsVB)a^d%CnO|<^XCFLw(4wyLS2$DsGbW%_E8aOLH~R>DX=Czo(&s|Y!klbt1Ni&& zVcI%!E8Wk{&aKwlq&vqzlKKr<>Av2+@@XdCZLx;@9lY)_q)>UP1YQca2q$lkBOae2 z&0*IW3(k6_)bCbvCwiFgF8%av==1;Z{W#xnzWcSSAX9+*TFy@LuXoqRdo4OF`sB^! zZ^dWJ%F6Id*DiZ@C5;z8Efnp36YlhjHs}9nW^{XE^HjIX*1#g~Mr?O|DXn;g!hBTx z7}hG^DqGVVN>R;RsP-f;Y7m-&1&lmN9$1hi0qu=NVbPwn3+-4v0N^-+b8w-$SRr8;5deQ<~n3f4Zv+5r>d zhtc%}8|Z`df?+HH0+xyf1rzW@e^@Xa{I@QQW$(HnV9?(XsvjKupQK!@Y(XX@3Kn!+ z6{>|JenB{I4w0|DQ^+Y6b~LlOgJ=YP-Ao4YacQ|DgoJzi59d z3j5!D|4(6m2O1d*L1Fz#0Tc|YcV6~A`jDt3e;*PV1l3U0 z1Rb$LV{pV>&(XgrR#q@eqCXW)#9%E=;b4}CDh}rf(>5`OnnI83nw#sGsH>Zq7@2Dr znVK4znQH22Le)*pe{)Sqm;eHnNd3+A{4dw&kKEmXAdp#+O|cYQAlB2ILLz|v-Zc#O z=Uk5eQSTqF=bv-Y`6Cy?N(Qpq+yB+;-!9ew?VA4%FKhAd_+yEznWwOZTSahmj`d>f zwM9CZ{rdHbWjZ##3kLu;K}%C3hv32CR3nMkATHDNP50`@*G0JbZdhsG&#ag}kt-x* zbi6EjpiYUf^utT&I-ggwTw)8K9Wu<#NjKCWviOGnxNwI<3!$qd0;#|wTaC0<=DJ&4 z-o}fdK$^-X*DQay#`Ty87;GIAW(;r{nhujLM{vr&Ry`!wB1~-L(Uq&iu{k>R-V8os2N6zY@I0ry5ZRP(0CFwaUqp$rweNmLEX}MB0yz6DVk6*7o2cu3?B)ufD}ahRLkB^#*BF zW(+6r1en?gi5F5d!xYDp5IRekuuZ(^`X=}D=?ji^k;%=g6;KIFxb04_MR;y)w(hJg zIXdFTFR;bLpadQ!kWIXf9~+6u^?41tPp?Ie?VFG#lN*R?RH|$#h%l=O67K*2SWOoY zY(l5mJkQENmPDY4lEMREdK@474sq7K^@ouJQ&cpTmLrE2q%}4K)8rlOC^e*NjLVTrs{%V#;4FLC zC$?pB^pAjCWaN;hs}59oNrgFH$!nM|I5OsSpkPOmF>o*%^6ZOOHK6O|ypof1l2k5D z6iP}#E0is5(vovJ7-DTdCeU~A(6^iV9$?i2u|_GvkOWaZ2s*MpIGXvHdg~?miN9E#E=_7kHFcWtsy;;hPX5UXe8_3#zDq zXb1y5`rq`4RFs(Z%0Im`yrK=6Zudrk9`=R_`*eaLIw~^@<_9`vhpRL7GF^MU-sbj$ zk923-)AZh6%COnY%az{dohuhNinsKw?88Ir*M#iW8F~86kI!WN-olal-?vXQ tH&1*4&tJE{{+|EzEA!;>$7pBdE|X#GcTBi({Mk23%Gl*u>(S)GjXwlaS&0Au diff --git a/applications/main/bad_ble/images/Error_18x18.png b/applications/main/bad_ble/images/Error_18x18.png deleted file mode 100644 index 16a5a74d96686c9ff2d9d96984a285f3885cffbe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1083 zcmbVLO=#0l91nDeA53H@GKcca5EPcrrb`o6$JVsAu+G{QR&T!My{=(RUY5MA>A)Sl zdD4@f#M8iCym|7VCs7c=gNnj#9z6JU@F>)meoPNz2Ls9f|6cyT-~an|dGX5V(KAOm zjvFl&tO}E3@q0MIzVO5rW@4P?YIKP-Xd4EYn?t0ILD7XPxPl?-ti8fB9GBQ|sx?|G zEtocOMHt(Nk?S)w$IZ+}KD1Xc1$DgQcp3i3(`P(zP=;SlmE@A2#Z9NM8Q`VO#j3rz zY8!~3y$og|lM%R>LJ+wvFEpbJ-{Uoz9$!m5=$X*f4Bro`Rw{!m2{6z_MX+UA2D%|4 zSci7KJ_S@+RU}!H6itw2GijKb1_lq$+y$s%R;>KM89Qb8CZ)b9N$qx9Y$rt$tVoJs z7?P|?swyxGA?$b*MuHbk4jC*Q+JWO!hj<`ngmtn`Gdv5mpM&d{N_)g!IH(k>nG``^ zQbbvD-8iwHbx14tZy5Vpht-acr3wzodSJ7LG$w~&R=k59#fB^z^J?I*uE3T>>~$A= zv}k2`_D4hxGLuL*QZ`HpN(v?gZCb}d+E%e($Qrg470Wh8L!SNcdRo!)nwHX%a#B%p z*|~I9OY7;JrO#Vx(vXMPq8C!=*?8#NVZH}g?Le%V4KSo6s1ni|jzPIeC<&Xy2dXNj zz{L`@9WTDQ6nCkgw1op_1EYLET+l1C>Fg7Np-(rEjMD;|PN}R0nkLjCM1rR3EG3vi zX~a_KYA3hc1AOxR-^6tGo!e{*7ot=XaSLN&)^x7*$R z_;8nL#iBJ=jXt&Rz8&Mh$jFComtIimxkqQi diff --git a/applications/main/bad_ble/images/EviSmile1_18x21.png b/applications/main/bad_ble/images/EviSmile1_18x21.png deleted file mode 100644 index 987af32587ca7fbada8810abd0cabf788c9c04f9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3645 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 V0A_Pz|1^geur#waEi!h!{2vr@XiES9 diff --git a/applications/main/bad_ble/images/EviSmile2_18x21.png b/applications/main/bad_ble/images/EviSmile2_18x21.png deleted file mode 100644 index 7e28c9f018a0f2cb572e5f5ce1db2e5c71511dd9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3649 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 NjisGMnc1oH{{vTjXlVcd diff --git a/applications/main/bad_ble/images/EviWaiting1_18x21.png b/applications/main/bad_ble/images/EviWaiting1_18x21.png deleted file mode 100644 index d39d2173329d5317fc2cdfb18738922a5eeec6fe..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13020 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%0DogpcYr`$ z++qJ}>3@a%wq1X@`yto-TOabSio8kl{&AQ7JzRfg^#9`P_cZuloB>JwpGp2Leg7lZ zf8_eN6!^Em|B0^u$n|e2@Na?t6J7t`SN77L~l0$9an+)c;9a+DZRZZS8{^eP~v1|B4dJsqoRU?V`GD5l`ss3 nQ0V!FVYmG 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 diff --git a/applications/main/bad_ble/images/SDQuestion_35x43.png b/applications/main/bad_ble/images/SDQuestion_35x43.png deleted file mode 100644 index 9b9c9a58e3257f926677533f8cc99ffb19dd74f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1950 zcmcIlTWs7!6g5TAQV0(rqPBcsIS921UeDNG@7i=zCA)d7sMC-vG>8gyJRa{_+4UIP z$!=1i2t*O^Q!1)9DGybMBGF3a6SW|L6h5LVfJD{LegT4thW>zPQHvPws{yrXept!t zv3=&;bMHMf^XAC#V8_NS8##{a$PeX4*}aQh-5b`i|CfLH7_-|w{?PLw$KCsIeBHqv zeQy)T-TjJN7>~xyod%|r1hT0`619rY&>XjYN6klgf<(MUimsOtE`R=|z`J%v*qt1RpF9hwQq*vxPN&rD$57IyUT+iM0RsE`QpwMy9wjao*i^BQa%zm^2P4v8i*LT?<9 zA2&z%EDZ>+C4h(lkolCJfSRgm;7MKvGLS%0g0cuT1E>Z}@y(yWq6M~NjOGTKvDi~a zC`FNPNK&<0O;nWx4T=)fbzK6oB+DX0h~cysp_=H0T`h(j331^1kxM;3W<(a9j4}dK z+DM_|w`skwSteF6sfK(BCP1803uv0FLo1awI*j_KSd^yTn-YhGX`e`=B&3r8CjC>y zi@I9D{1T05SfaPk*8co2g*I*n^e2OIy*xISNSRa^cgV1?uFp5J0YMQB3Y3;xjT&i1 zyC$M##e?pUVhLRKj&_L)9?Wld>u%HCq;SStTN}Y*kccThRe>U`i)-U2J}i z;>oxY@%)BuZHgI3yPAgMs43vsNJP47iHfQ!qLpHl$)u9T2onYB=@#3rz-223l~=OH zs_a-*O3@VL0MW4s7KyDoOqHyNDzSA4a2n~Dsk#w2OUpDcsm-dZtbCu(W=8_*xMlVs z93AZA^Zi*3>Y66X2`KP3HXIsM5Hp%vK}90@UNN>klflv*azobR>E=QjBQG^aWtXqJ z(?B?06d3`>ZXmYMeC^(>%xg-hL0c^mM!Jei8nBQ$Q56NGx5!#@TNg^V5+9y5Z&x22##B&{B?u64ye+M3KZ=XlsY71%@jTp=Dy zHDISkcY5&@J8>5Bx!%I~{^i3@-@m}$cNaW+{nKk_j+x(U>F+k}c?6!^@X+fADi3lO z_rLKG{`yum;ZU>ayk!Z+q>VzZOn^bqQ>?UO0Drz@_TNg$rjt zNcQEpt?wS&gMaKe^8V2SorGL{ZtT%R?yPd~`n9FG(}zAOOPl5My;t&Z3(*F9I?g}- zvp)ag@#QCe{o%9hrGrn+&dpu9`rFcD;MqUV>^-?JG4|Gpeamy-PL6)jzu5T`{Cd7~ fwr}T&J8Rt1;5!ej|9##1_yo=O59dzx?S1thQe1#H diff --git a/applications/main/bad_ble/images/Smile_18x18.png b/applications/main/bad_ble/images/Smile_18x18.png deleted file mode 100644 index d2aae0dc37f4fd3453e3254e4a9cd33e753019b9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1080 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 O0000gN=z( mnGc5;aHhO3XW%q4U|?wcz_Hx?k)a$=ErX}4pUXO@geCyYPARJZ diff --git a/applications/main/bad_ble/scenes/bad_ble_scene.c b/applications/main/bad_ble/scenes/bad_ble_scene.c deleted file mode 100644 index 351bb1e79..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "bad_ble_scene.h" - -// Generate scene on_enter handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, -void (*const bad_ble_scene_on_enter_handlers[])(void*) = { -#include "bad_ble_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_event handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, -bool (*const bad_ble_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { -#include "bad_ble_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_exit handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, -void (*const bad_ble_scene_on_exit_handlers[])(void* context) = { -#include "bad_ble_scene_config.h" -}; -#undef ADD_SCENE - -// Initialize scene handlers configuration structure -const SceneManagerHandlers bad_ble_scene_handlers = { - .on_enter_handlers = bad_ble_scene_on_enter_handlers, - .on_event_handlers = bad_ble_scene_on_event_handlers, - .on_exit_handlers = bad_ble_scene_on_exit_handlers, - .scene_num = BadBleSceneNum, -}; diff --git a/applications/main/bad_ble/scenes/bad_ble_scene.h b/applications/main/bad_ble/scenes/bad_ble_scene.h deleted file mode 100644 index 25b19fc4b..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include - -// Generate scene id and total number -#define ADD_SCENE(prefix, name, id) BadBleScene##id, -typedef enum { -#include "bad_ble_scene_config.h" - BadBleSceneNum, -} BadBleScene; -#undef ADD_SCENE - -extern const SceneManagerHandlers bad_ble_scene_handlers; - -// Generate scene on_enter handlers declaration -#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); -#include "bad_ble_scene_config.h" -#undef ADD_SCENE - -// Generate scene on_event handlers declaration -#define ADD_SCENE(prefix, name, id) \ - bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); -#include "bad_ble_scene_config.h" -#undef ADD_SCENE - -// Generate scene on_exit handlers declaration -#define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); -#include "bad_ble_scene_config.h" -#undef ADD_SCENE diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config.c b/applications/main/bad_ble/scenes/bad_ble_scene_config.c deleted file mode 100644 index 0987b153b..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "../bad_ble_app_i.h" -#include "furi_hal_power.h" - -enum SubmenuIndex { - SubmenuIndexKeyboardLayout, - SubmenuIndexAdvertisementName, - SubmenuIndexMacAddress, -}; - -void bad_ble_scene_config_submenu_callback(void* context, uint32_t index) { - BadBleApp* bad_ble = context; - view_dispatcher_send_custom_event(bad_ble->view_dispatcher, index); -} - -void bad_ble_scene_config_on_enter(void* context) { - BadBleApp* bad_ble = context; - Submenu* submenu = bad_ble->submenu; - - submenu_add_item( - submenu, - "Keyboard layout", - SubmenuIndexKeyboardLayout, - bad_ble_scene_config_submenu_callback, - bad_ble); - - submenu_add_item( - submenu, - "Change adv name", - SubmenuIndexAdvertisementName, - bad_ble_scene_config_submenu_callback, - bad_ble); - - submenu_add_item( - submenu, - "Change MAC address", - SubmenuIndexMacAddress, - bad_ble_scene_config_submenu_callback, - bad_ble); - - submenu_set_selected_item( - submenu, scene_manager_get_scene_state(bad_ble->scene_manager, BadBleSceneConfig)); - - view_dispatcher_switch_to_view(bad_ble->view_dispatcher, BadBleAppViewConfig); -} - -bool bad_ble_scene_config_on_event(void* context, SceneManagerEvent event) { - BadBleApp* bad_ble = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_ble->scene_manager, BadBleSceneConfig, event.event); - consumed = true; - if(event.event == SubmenuIndexKeyboardLayout) { - scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigLayout); - } else if(event.event == SubmenuIndexAdvertisementName) { - scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigName); - } else if(event.event == SubmenuIndexMacAddress) { - scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneConfigMac); - } else { - furi_crash("Unknown key type"); - } - } - - return consumed; -} - -void bad_ble_scene_config_on_exit(void* context) { - BadBleApp* bad_ble = context; - Submenu* submenu = bad_ble->submenu; - - submenu_reset(submenu); -} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config.h b/applications/main/bad_ble/scenes/bad_ble_scene_config.h deleted file mode 100644 index 73742d9f4..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config.h +++ /dev/null @@ -1,7 +0,0 @@ -ADD_SCENE(bad_ble, file_select, FileSelect) -ADD_SCENE(bad_ble, work, Work) -ADD_SCENE(bad_ble, error, Error) -ADD_SCENE(bad_ble, config, Config) -ADD_SCENE(bad_ble, config_layout, ConfigLayout) -ADD_SCENE(bad_ble, config_name, ConfigName) -ADD_SCENE(bad_ble, config_mac, ConfigMac) diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c deleted file mode 100644 index aabb1b900..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config_layout.c +++ /dev/null @@ -1,47 +0,0 @@ -#include "../bad_ble_app_i.h" -#include "furi_hal_power.h" -#include - -static bool bad_ble_layout_select(BadBleApp* bad_ble) { - furi_assert(bad_ble); - - FuriString* predefined_path; - predefined_path = furi_string_alloc(); - if(!furi_string_empty(bad_ble->keyboard_layout)) { - furi_string_set(predefined_path, bad_ble->keyboard_layout); - } else { - furi_string_set(predefined_path, BAD_BLE_APP_PATH_LAYOUT_FOLDER); - } - - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options( - &browser_options, BAD_BLE_APP_LAYOUT_EXTENSION, &I_keyboard_10px); - - // Input events and views are managed by file_browser - bool res = dialog_file_browser_show( - bad_ble->dialogs, bad_ble->keyboard_layout, predefined_path, &browser_options); - - furi_string_free(predefined_path); - return res; -} - -void bad_ble_scene_config_layout_on_enter(void* context) { - BadBleApp* bad_ble = context; - - if(bad_ble_layout_select(bad_ble)) { - bad_ble_script_set_keyboard_layout(bad_ble->bad_ble_script, bad_ble->keyboard_layout); - } - scene_manager_previous_scene(bad_ble->scene_manager); -} - -bool bad_ble_scene_config_layout_on_event(void* context, SceneManagerEvent event) { - UNUSED(context); - UNUSED(event); - // BadBleApp* bad_ble = context; - return false; -} - -void bad_ble_scene_config_layout_on_exit(void* context) { - UNUSED(context); - // BadBleApp* bad_ble = context; -} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c deleted file mode 100644 index a9ee7e34c..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config_mac.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "../bad_ble_app_i.h" - -#define TAG "BadBleConfigMac" - -static uint8_t* reverse_mac_addr(uint8_t* mac) { - uint8_t tmp; - for(int i = 0; i < 3; i++) { - tmp = mac[i]; - mac[i] = mac[5 - i]; - mac[5 - i] = tmp; - } - return mac; -} - -void bad_ble_scene_config_mac_byte_input_callback(void* context) { - BadBleApp* bad_ble = context; - - view_dispatcher_send_custom_event(bad_ble->view_dispatcher, BadBleAppCustomEventByteInputDone); -} - -void bad_ble_scene_config_mac_on_enter(void* context) { - BadBleApp* bad_ble = context; - - // Setup view - ByteInput* byte_input = bad_ble->byte_input; - byte_input_set_header_text(byte_input, "Enter new MAC address"); - byte_input_set_result_callback( - byte_input, - bad_ble_scene_config_mac_byte_input_callback, - NULL, - bad_ble, - reverse_mac_addr(bad_ble->mac), - GAP_MAC_ADDR_SIZE); - view_dispatcher_switch_to_view(bad_ble->view_dispatcher, BadBleAppViewConfigMac); -} - -bool bad_ble_scene_config_mac_on_event(void* context, SceneManagerEvent event) { - BadBleApp* bad_ble = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == BadBleAppCustomEventByteInputDone) { - bt_set_profile_mac_address(bad_ble->bt, reverse_mac_addr(bad_ble->mac)); - scene_manager_previous_scene(bad_ble->scene_manager); - consumed = true; - } - } - return consumed; -} - -void bad_ble_scene_config_mac_on_exit(void* context) { - BadBleApp* bad_ble = context; - - // Clear view - byte_input_set_result_callback(bad_ble->byte_input, NULL, NULL, NULL, NULL, 0); - byte_input_set_header_text(bad_ble->byte_input, ""); -} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c b/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c deleted file mode 100644 index ae9d16ba4..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_config_name.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "../bad_ble_app_i.h" - -static void bad_ble_scene_config_name_text_input_callback(void* context) { - BadBleApp* bad_ble = context; - - view_dispatcher_send_custom_event( - bad_ble->view_dispatcher, BadBleAppCustomEventTextEditResult); -} - -void bad_ble_scene_config_name_on_enter(void* context) { - BadBleApp* bad_ble = context; - TextInput* text_input = bad_ble->text_input; - - text_input_set_header_text(text_input, "Set BLE adv name"); - - text_input_set_result_callback( - text_input, - bad_ble_scene_config_name_text_input_callback, - bad_ble, - bad_ble->name, - BAD_BLE_ADV_NAME_MAX_LEN, - true); - - view_dispatcher_switch_to_view(bad_ble->view_dispatcher, BadBleAppViewConfigName); -} - -bool bad_ble_scene_config_name_on_event(void* context, SceneManagerEvent event) { - BadBleApp* bad_ble = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - consumed = true; - if(event.event == BadBleAppCustomEventTextEditResult) { - bt_set_profile_adv_name(bad_ble->bt, bad_ble->name); - } - scene_manager_previous_scene(bad_ble->scene_manager); - } - return consumed; -} - -void bad_ble_scene_config_name_on_exit(void* context) { - BadBleApp* bad_ble = context; - TextInput* text_input = bad_ble->text_input; - - text_input_reset(text_input); -} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_error.c b/applications/main/bad_ble/scenes/bad_ble_scene_error.c deleted file mode 100644 index a212f2087..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_error.c +++ /dev/null @@ -1,65 +0,0 @@ -#include "../bad_ble_app_i.h" -#include "../../../settings/desktop_settings/desktop_settings_app.h" - -static void - bad_ble_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { - furi_assert(context); - BadBleApp* app = context; - - if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) { - view_dispatcher_send_custom_event(app->view_dispatcher, BadBleCustomEventErrorBack); - } -} - -void bad_ble_scene_error_on_enter(void* context) { - BadBleApp* app = context; - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - - if(app->error == BadBleAppErrorNoFiles) { - widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43); - widget_add_string_multiline_element( - app->widget, - 81, - 4, - AlignCenter, - AlignTop, - FontSecondary, - "No SD card or\napp data found.\nThis app will not\nwork without\nrequired files."); - widget_add_button_element( - app->widget, GuiButtonTypeLeft, "Back", bad_ble_scene_error_event_callback, app); - } else if(app->error == BadBleAppErrorCloseRpc) { - widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); - widget_add_string_multiline_element( - app->widget, 3, 2, AlignLeft, AlignTop, FontPrimary, "Connection\nis active!"); - widget_add_string_multiline_element( - app->widget, - 3, - 30, - AlignLeft, - AlignTop, - FontSecondary, - "Disconnect from\nPC or phone to\nuse this function."); - } - - view_dispatcher_switch_to_view(app->view_dispatcher, BadBleAppViewError); - free(settings); -} - -bool bad_ble_scene_error_on_event(void* context, SceneManagerEvent event) { - BadBleApp* app = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == BadBleCustomEventErrorBack) { - view_dispatcher_stop(app->view_dispatcher); - consumed = true; - } - } - return consumed; -} - -void bad_ble_scene_error_on_exit(void* context) { - BadBleApp* app = context; - widget_reset(app->widget); -} diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c b/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c deleted file mode 100644 index d60f6a246..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_file_select.c +++ /dev/null @@ -1,51 +0,0 @@ -#include "../bad_ble_app_i.h" -#include "furi_hal_power.h" -#include - -static bool bad_ble_file_select(BadBleApp* bad_ble) { - furi_assert(bad_ble); - - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options( - &browser_options, BAD_BLE_APP_SCRIPT_EXTENSION, &I_badusb_10px); - browser_options.base_path = BAD_BLE_APP_BASE_FOLDER; - browser_options.skip_assets = true; - - // Input events and views are managed by file_browser - bool res = dialog_file_browser_show( - bad_ble->dialogs, bad_ble->file_path, bad_ble->file_path, &browser_options); - - return res; -} - -void bad_ble_scene_file_select_on_enter(void* context) { - BadBleApp* bad_ble = context; - - // furi_hal_ble_disable(); - if(bad_ble->bad_ble_script) { - bad_ble_script_close(bad_ble->bad_ble_script); - bad_ble->bad_ble_script = NULL; - } - - if(bad_ble_file_select(bad_ble)) { - bad_ble->bad_ble_script = bad_ble_script_open(bad_ble->file_path, bad_ble->bt); - bad_ble_script_set_keyboard_layout(bad_ble->bad_ble_script, bad_ble->keyboard_layout); - - scene_manager_next_scene(bad_ble->scene_manager, BadBleSceneWork); - } else { - // furi_hal_ble_enable(); - view_dispatcher_stop(bad_ble->view_dispatcher); - } -} - -bool bad_ble_scene_file_select_on_event(void* context, SceneManagerEvent event) { - UNUSED(context); - UNUSED(event); - // BadBleApp* bad_ble = context; - return false; -} - -void bad_ble_scene_file_select_on_exit(void* context) { - UNUSED(context); - // BadBleApp* bad_ble = context; -} \ No newline at end of file diff --git a/applications/main/bad_ble/scenes/bad_ble_scene_work.c b/applications/main/bad_ble/scenes/bad_ble_scene_work.c deleted file mode 100644 index a2c009fc3..000000000 --- a/applications/main/bad_ble/scenes/bad_ble_scene_work.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "../bad_ble_script.h" -#include "../bad_ble_app_i.h" -#include "../views/bad_ble_view.h" -#include "furi_hal.h" -#include "toolbox/path.h" - -void bad_ble_scene_work_button_callback(InputKey key, void* context) { - furi_assert(context); - BadBleApp* app = context; - view_dispatcher_send_custom_event(app->view_dispatcher, key); -} - -bool bad_ble_scene_work_on_event(void* context, SceneManagerEvent event) { - BadBleApp* app = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == InputKeyLeft) { - scene_manager_next_scene(app->scene_manager, BadBleSceneConfig); - consumed = true; - } else if(event.event == InputKeyOk) { - bad_ble_script_toggle(app->bad_ble_script); - consumed = true; - } - } else if(event.type == SceneManagerEventTypeTick) { - bad_ble_set_state(app->bad_ble_view, bad_ble_script_get_state(app->bad_ble_script)); - } - return consumed; -} - -void bad_ble_scene_work_on_enter(void* context) { - BadBleApp* app = context; - - FuriString* file_name; - file_name = furi_string_alloc(); - path_extract_filename(app->file_path, file_name, true); - bad_ble_set_file_name(app->bad_ble_view, furi_string_get_cstr(file_name)); - furi_string_free(file_name); - - FuriString* layout; - layout = furi_string_alloc(); - path_extract_filename(app->keyboard_layout, layout, true); - bad_ble_set_layout(app->bad_ble_view, furi_string_get_cstr(layout)); - furi_string_free(layout); - - bad_ble_set_state(app->bad_ble_view, bad_ble_script_get_state(app->bad_ble_script)); - - bad_ble_set_button_callback(app->bad_ble_view, bad_ble_scene_work_button_callback, app); - view_dispatcher_switch_to_view(app->view_dispatcher, BadBleAppViewWork); -} - -void bad_ble_scene_work_on_exit(void* context) { - UNUSED(context); -} diff --git a/applications/main/bad_ble/switch_ble.py b/applications/main/bad_ble/switch_ble.py deleted file mode 100644 index 32ed65492..000000000 --- a/applications/main/bad_ble/switch_ble.py +++ /dev/null @@ -1,24 +0,0 @@ -import os -import re - -def analyze_and_replace(directory): - # Recursively search for .c and .h files in the given directory - for root, dirs, files in os.walk(directory): - for file in files: - if file.endswith(".c") or file.endswith(".h"): - # Read the contents of the file - with open(os.path.join(root, file), "r") as f: - contents = f.read() - - # Replace all occurrences of "BadUsb" and "bad_usb" with "BadBle" and "bad_ble" - contents = contents.replace("usb", "ble") - contents = contents.replace("USB", "BLE") - contents = contents.replace("Usb", "Ble") - - - # Write the modified contents back to the file - with open(os.path.join(root, file), "w") as f: - f.write(contents) - -# Test the function with a sample directory -analyze_and_replace(".") diff --git a/applications/main/bad_ble/views/bad_ble_view.c b/applications/main/bad_ble/views/bad_ble_view.c deleted file mode 100644 index 2690b6702..000000000 --- a/applications/main/bad_ble/views/bad_ble_view.c +++ /dev/null @@ -1,221 +0,0 @@ -#include "bad_ble_view.h" -#include "../bad_ble_script.h" -#include -#include -#include -#include "../../../settings/desktop_settings/desktop_settings_app.h" - -#define MAX_NAME_LEN 64 - -struct BadBle { - View* view; - BadBleButtonCallback callback; - void* context; -}; - -typedef struct { - char file_name[MAX_NAME_LEN]; - char layout[MAX_NAME_LEN]; - BadBleState state; - uint8_t anim_frame; -} BadBleModel; - -static void bad_ble_draw_callback(Canvas* canvas, void* _model) { - BadBleModel* model = _model; - - FuriString* disp_str; - disp_str = furi_string_alloc_set(model->file_name); - elements_string_fit_width(canvas, disp_str, 128 - 2); - canvas_set_font(canvas, FontSecondary); - canvas_draw_str(canvas, 2, 8, furi_string_get_cstr(disp_str)); - DesktopSettings* settings = malloc(sizeof(DesktopSettings)); - DESKTOP_SETTINGS_LOAD(settings); - - if(strlen(model->layout) == 0) { - furi_string_set(disp_str, "(default)"); - } else { - furi_string_reset(disp_str); - furi_string_push_back(disp_str, '('); - for(size_t i = 0; i < strlen(model->layout); i++) - furi_string_push_back(disp_str, model->layout[i]); - furi_string_push_back(disp_str, ')'); - } - elements_string_fit_width(canvas, disp_str, 128 - 2); - canvas_draw_str( - canvas, 2, 8 + canvas_current_font_height(canvas), furi_string_get_cstr(disp_str)); - - furi_string_reset(disp_str); - - canvas_draw_icon(canvas, 22, 24, &I_UsbTree_48x22); - - if((model->state.state == BadBleStateIdle) || (model->state.state == BadBleStateDone) || - (model->state.state == BadBleStateNotConnected)) { - elements_button_center(canvas, "Start"); - } else if((model->state.state == BadBleStateRunning) || (model->state.state == BadBleStateDelay)) { - elements_button_center(canvas, "Stop"); - } else if(model->state.state == BadBleStateWillRun) { - elements_button_center(canvas, "Cancel"); - } - - if((model->state.state == BadBleStateNotConnected) || - (model->state.state == BadBleStateIdle) || (model->state.state == BadBleStateDone)) { - elements_button_left(canvas, "Config"); - } - - if(model->state.state == BadBleStateNotConnected) { - canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect me"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "to a computer"); - } else if(model->state.state == BadBleStateWillRun) { - canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect"); - } else if(model->state.state == BadBleStateFileError) { - canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "File"); - canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "ERROR"); - } else if(model->state.state == BadBleStateScriptError) { - canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:"); - canvas_set_font(canvas, FontSecondary); - furi_string_printf(disp_str, "line %u", model->state.error_line); - canvas_draw_str_aligned( - canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); - furi_string_reset(disp_str); - canvas_draw_str_aligned(canvas, 127, 56, AlignRight, AlignBottom, model->state.error); - } else if(model->state.state == BadBleStateIdle) { - canvas_draw_icon(canvas, 4, 26, &I_Smile_18x18); - canvas_set_font(canvas, FontBigNumbers); - canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "0"); - canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadBleStateRunning) { - if(model->anim_frame == 0) { - canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); - } else { - canvas_draw_icon(canvas, 4, 23, &I_EviSmile2_18x21); - } - canvas_set_font(canvas, FontBigNumbers); - furi_string_printf( - disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); - canvas_draw_str_aligned( - canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); - furi_string_reset(disp_str); - canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadBleStateDone) { - canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); - canvas_set_font(canvas, FontBigNumbers); - canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "100"); - furi_string_reset(disp_str); - canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadBleStateDelay) { - if(model->anim_frame == 0) { - canvas_draw_icon(canvas, 4, 23, &I_EviWaiting1_18x21); - } else { - canvas_draw_icon(canvas, 4, 23, &I_EviWaiting2_18x21); - } - canvas_set_font(canvas, FontBigNumbers); - furi_string_printf( - disp_str, "%u", ((model->state.line_cur - 1) * 100) / model->state.line_nb); - canvas_draw_str_aligned( - canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); - furi_string_reset(disp_str); - canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - canvas_set_font(canvas, FontSecondary); - furi_string_printf(disp_str, "delay %lus", model->state.delay_remain); - canvas_draw_str_aligned( - canvas, 127, 50, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); - furi_string_reset(disp_str); - } else { - canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); - } - - furi_string_free(disp_str); - free(settings); -} - -static bool bad_ble_input_callback(InputEvent* event, void* context) { - furi_assert(context); - BadBle* bad_ble = context; - bool consumed = false; - - if(event->type == InputTypeShort) { - if((event->key == InputKeyLeft) || (event->key == InputKeyOk)) { - consumed = true; - furi_assert(bad_ble->callback); - bad_ble->callback(event->key, bad_ble->context); - } - } - - return consumed; -} - -BadBle* bad_ble_alloc() { - BadBle* bad_ble = malloc(sizeof(BadBle)); - - bad_ble->view = view_alloc(); - view_allocate_model(bad_ble->view, ViewModelTypeLocking, sizeof(BadBleModel)); - view_set_context(bad_ble->view, bad_ble); - view_set_draw_callback(bad_ble->view, bad_ble_draw_callback); - view_set_input_callback(bad_ble->view, bad_ble_input_callback); - - return bad_ble; -} - -void bad_ble_free(BadBle* bad_ble) { - furi_assert(bad_ble); - view_free(bad_ble->view); - free(bad_ble); -} - -View* bad_ble_get_view(BadBle* bad_ble) { - furi_assert(bad_ble); - return bad_ble->view; -} - -void bad_ble_set_button_callback(BadBle* bad_ble, BadBleButtonCallback callback, void* context) { - furi_assert(bad_ble); - furi_assert(callback); - with_view_model( - bad_ble->view, - BadBleModel * model, - { - UNUSED(model); - bad_ble->callback = callback; - bad_ble->context = context; - }, - true); -} - -void bad_ble_set_file_name(BadBle* bad_ble, const char* name) { - furi_assert(name); - with_view_model( - bad_ble->view, - BadBleModel * model, - { strlcpy(model->file_name, name, MAX_NAME_LEN); }, - true); -} - -void bad_ble_set_layout(BadBle* bad_ble, const char* layout) { - furi_assert(layout); - with_view_model( - bad_ble->view, - BadBleModel * model, - { strlcpy(model->layout, layout, MAX_NAME_LEN); }, - true); -} - -void bad_ble_set_state(BadBle* bad_ble, BadBleState* st) { - furi_assert(st); - with_view_model( - bad_ble->view, - BadBleModel * model, - { - memcpy(&(model->state), st, sizeof(BadBleState)); - model->anim_frame ^= 1; - }, - true); -} diff --git a/applications/main/bad_ble/views/bad_ble_view.h b/applications/main/bad_ble/views/bad_ble_view.h deleted file mode 100644 index ccbd1d97b..000000000 --- a/applications/main/bad_ble/views/bad_ble_view.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include "../bad_ble_script.h" - -typedef struct BadBle BadBle; -typedef void (*BadBleButtonCallback)(InputKey key, void* context); - -BadBle* bad_ble_alloc(); - -void bad_ble_free(BadBle* bad_ble); - -View* bad_ble_get_view(BadBle* bad_ble); - -void bad_ble_set_button_callback(BadBle* bad_ble, BadBleButtonCallback callback, void* context); - -void bad_ble_set_file_name(BadBle* bad_ble, const char* name); - -void bad_ble_set_layout(BadBle* bad_ble, const char* layout); - -void bad_ble_set_state(BadBle* bad_ble, BadBleState* st); diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index bb29d3be5..94717cd37 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -5,6 +5,9 @@ #include #include +#include +#include + #define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/" BAD_USB_SETTINGS_FILE_NAME static bool bad_usb_app_custom_event_callback(void* context, uint32_t event) { @@ -51,6 +54,17 @@ static void bad_usb_save_settings(BadUsbApp* app) { storage_file_free(settings_file); } +void bad_usb_set_name(BadUsbApp* app, const char* fmt, ...) { + furi_assert(app); + + va_list args; + va_start(args, fmt); + + vsnprintf(app->name, BAD_USB_ADV_NAME_MAX_LEN, fmt, args); + + va_end(args); +} + BadUsbApp* bad_usb_app_alloc(char* arg) { BadUsbApp* app = malloc(sizeof(BadUsbApp)); @@ -81,19 +95,38 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { view_dispatcher_set_navigation_event_callback( app->view_dispatcher, bad_usb_app_back_event_callback); + Bt* bt = furi_record_open(RECORD_BT); + app->bt = bt; + const char* adv_name = bt_get_profile_adv_name(bt); + memcpy(app->name, adv_name, BAD_USB_ADV_NAME_MAX_LEN); + + const uint8_t* mac_addr = bt_get_profile_mac_address(bt); + memcpy(app->mac, mac_addr, BAD_USB_MAC_ADDRESS_LEN); + // Custom Widget app->widget = widget_alloc(); view_dispatcher_add_view( app->view_dispatcher, BadUsbAppViewError, widget_get_view(app->widget)); - app->submenu = submenu_alloc(); + app->var_item_list_bt = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfig, submenu_get_view(app->submenu)); + app->view_dispatcher, BadUsbAppViewConfigBt, variable_item_list_get_view(app->var_item_list_bt)); + app->var_item_list_usb = variable_item_list_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadUsbAppViewConfigUsb, variable_item_list_get_view(app->var_item_list_usb)); app->bad_usb_view = bad_usb_alloc(); view_dispatcher_add_view( app->view_dispatcher, BadUsbAppViewWork, bad_usb_get_view(app->bad_usb_view)); + app->text_input = text_input_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadUsbAppViewConfigName, text_input_get_view(app->text_input)); + + app->byte_input = byte_input_alloc(); + view_dispatcher_add_view( + app->view_dispatcher, BadUsbAppViewConfigMac, byte_input_get_view(app->byte_input)); + view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); if(furi_hal_usb_is_locked()) { @@ -101,7 +134,7 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { scene_manager_next_scene(app->scene_manager, BadUsbSceneError); } else { if(!furi_string_empty(app->file_path)) { - app->bad_usb_script = bad_usb_script_open(app->file_path); + app->bad_usb_script = bad_usb_script_open(app->file_path, bt); bad_usb_script_set_keyboard_layout(app->bad_usb_script, app->keyboard_layout); scene_manager_next_scene(app->scene_manager, BadUsbSceneWork); } else { @@ -129,9 +162,19 @@ void bad_usb_app_free(BadUsbApp* app) { view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewError); widget_free(app->widget); - // Submenu - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfig); - submenu_free(app->submenu); + // Variable item list + view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigBt); + variable_item_list_free(app->var_item_list_bt); + view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigUsb); + variable_item_list_free(app->var_item_list_usb); + + // Text Input + view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigName); + text_input_free(app->text_input); + + // Byte Input + view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigMac); + byte_input_free(app->byte_input); // View dispatcher view_dispatcher_free(app->view_dispatcher); @@ -141,6 +184,7 @@ void bad_usb_app_free(BadUsbApp* app) { furi_record_close(RECORD_GUI); furi_record_close(RECORD_NOTIFICATION); furi_record_close(RECORD_DIALOGS); + furi_record_close(RECORD_BT); bad_usb_save_settings(app); diff --git a/applications/main/bad_usb/bad_usb_app.h b/applications/main/bad_usb/bad_usb_app.h index afadd87e9..4192a59c9 100644 --- a/applications/main/bad_usb/bad_usb_app.h +++ b/applications/main/bad_usb/bad_usb_app.h @@ -6,6 +6,8 @@ extern "C" { typedef struct BadUsbApp BadUsbApp; +void bad_usb_set_name(BadUsbApp* app, const char* fmt, ...); + #ifdef __cplusplus } #endif diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index b3fbb1679..93b5cf08d 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -8,11 +8,12 @@ #include #include #include -#include #include #include #include #include +#include +#include #include "views/bad_usb_view.h" #define BAD_USB_APP_BASE_FOLDER ANY_PATH("badusb") @@ -20,11 +21,20 @@ #define BAD_USB_APP_SCRIPT_EXTENSION ".txt" #define BAD_USB_APP_LAYOUT_EXTENSION ".kl" +#define BAD_USB_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro +#define BAD_USB_ADV_NAME_MAX_LEN 18 + typedef enum { BadUsbAppErrorNoFiles, BadUsbAppErrorCloseRpc, } BadUsbAppError; +typedef enum BadUsbCustomEvent { + BadUsbAppCustomEventTextEditResult, + BadUsbAppCustomEventByteInputDone, + BadUsbCustomEventErrorBack +} BadUsbCustomEvent; + struct BadUsbApp { Gui* gui; ViewDispatcher* view_dispatcher; @@ -32,17 +42,29 @@ struct BadUsbApp { NotificationApp* notifications; DialogsApp* dialogs; Widget* widget; - Submenu* submenu; + VariableItemList* var_item_list_bt; + VariableItemList* var_item_list_usb; + + Bt* bt; + TextInput* text_input; + ByteInput* byte_input; + uint8_t mac[BAD_USB_MAC_ADDRESS_LEN]; + char name[BAD_USB_ADV_NAME_MAX_LEN + 1]; BadUsbAppError error; FuriString* file_path; FuriString* keyboard_layout; BadUsb* bad_usb_view; BadUsbScript* bad_usb_script; + + bool is_bluetooth; }; typedef enum { BadUsbAppViewError, BadUsbAppViewWork, - BadUsbAppViewConfig, -} BadUsbAppView; \ No newline at end of file + BadUsbAppViewConfigBt, + BadUsbAppViewConfigUsb, + BadUsbAppViewConfigMac, + BadUsbAppViewConfigName +} BadUsbAppView; diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index 1a73150a5..9c24ff777 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -3,11 +3,16 @@ #include #include #include +#include #include #include #include "bad_usb_script.h" #include +#include + +#define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") + #define TAG "BadUSB" #define WORKER_TAG TAG "Worker" #define FILE_BUFFER_LEN 16 @@ -26,6 +31,27 @@ typedef enum { WorkerEvtDisconnect = (1 << 3), } WorkerEvtFlags; +typedef enum { + LevelRssi122_100, + LevelRssi99_80, + LevelRssi79_60, + LevelRssi59_40, + LevelRssi39_0, + LevelRssiNum, + LevelRssiError = 0xFF, +} LevelRssiRange; + +/** + * Delays for waiting between HID key press and key release +*/ +const uint8_t bt_hid_delays[LevelRssiNum] = { + 30, // LevelRssi122_100 + 25, // LevelRssi99_80 + 20, // LevelRssi79_60 + 17, // LevelRssi59_40 + 14, // LevelRssi39_0 +}; + struct BadUsbScript { FuriHalUsbHidConfig hid_cfg; BadUsbState st; @@ -41,6 +67,8 @@ struct BadUsbScript { FuriString* line_prev; uint32_t repeat_cnt; + + Bt* bt; }; typedef struct { @@ -75,8 +103,8 @@ static const DuckyKey ducky_keys[] = { {"BREAK", HID_KEYBOARD_PAUSE}, {"PAUSE", HID_KEYBOARD_PAUSE}, {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK}, - {"DELETE", HID_KEYBOARD_DELETE_FORWARD}, - {"BACKSPACE", HID_KEYBOARD_DELETE}, + {"DELETE", HID_KEYBOARD_DELETE}, + {"BACKSPACE", HID_KEYPAD_BACKSPACE}, {"END", HID_KEYBOARD_END}, {"ESC", HID_KEYBOARD_ESCAPE}, {"ESCAPE", HID_KEYBOARD_ESCAPE}, @@ -134,6 +162,51 @@ static const uint8_t numpad_keys[10] = { HID_KEYPAD_9, }; +uint8_t bt_timeout = 0; + +static LevelRssiRange bt_remote_rssi_range(Bt* bt) { + BtRssi rssi_data = {0}; + + if(!bt_remote_rssi(bt, &rssi_data)) return LevelRssiError; + + if(rssi_data.rssi <= 39) + return LevelRssi39_0; + else if(rssi_data.rssi <= 59) + return LevelRssi59_40; + else if(rssi_data.rssi <= 79) + return LevelRssi79_60; + else if(rssi_data.rssi <= 99) + return LevelRssi99_80; + else if(rssi_data.rssi <= 122) + return LevelRssi122_100; + + return LevelRssiError; +} + +static inline void update_bt_timeout(Bt* bt) { + LevelRssiRange r = bt_remote_rssi_range(bt); + if(r < LevelRssiNum) { + bt_timeout = bt_hid_delays[r]; + } +} + +/** + * @brief Wait until there are enough free slots in the keyboard buffer + * + * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) +*/ +// static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { +// uint32_t start = furi_get_tick(); +// uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; +// while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { +// furi_delay_ms(100); + +// if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { +// break; +// } +// } +// } + static bool ducky_get_number(const char* param, uint32_t* val) { uint32_t value = 0; if(sscanf(param, "%lu", &value) == 1) { @@ -664,7 +737,7 @@ static void bad_usb_script_set_default_keyboard_layout(BadUsbScript* bad_usb) { memcpy(bad_usb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_usb->layout))); } -BadUsbScript* bad_usb_script_open(FuriString* file_path) { +BadUsbScript* bad_usb_script_open(FuriString* file_path, Bt* bt) { furi_assert(file_path); BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript)); @@ -675,6 +748,8 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path) { bad_usb->st.state = BadUsbStateInit; bad_usb->st.error[0] = '\0'; + bad_usb->bt = bt; + bad_usb->thread = furi_thread_alloc_ex("BadUsbWorker", 2048, bad_usb_worker, bad_usb); furi_thread_start(bad_usb->thread); return bad_usb; @@ -682,6 +757,7 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path) { void bad_usb_script_close(BadUsbScript* bad_usb) { furi_assert(bad_usb); + furi_record_close(RECORD_STORAGE); furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtEnd); furi_thread_join(bad_usb->thread); furi_thread_free(bad_usb->thread); diff --git a/applications/main/bad_usb/bad_usb_script.h b/applications/main/bad_usb/bad_usb_script.h index 1e4d98fe7..5c37bcec2 100644 --- a/applications/main/bad_usb/bad_usb_script.h +++ b/applications/main/bad_usb/bad_usb_script.h @@ -5,6 +5,7 @@ extern "C" { #endif #include +#include typedef struct BadUsbScript BadUsbScript; @@ -29,7 +30,7 @@ typedef struct { char error[64]; } BadUsbState; -BadUsbScript* bad_usb_script_open(FuriString* file_path); +BadUsbScript* bad_usb_script_open(FuriString* file_path, Bt* bt); void bad_usb_script_close(BadUsbScript* bad_usb); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.c b/applications/main/bad_usb/scenes/bad_usb_scene_config.c deleted file mode 100644 index 2a9f2f76c..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.c +++ /dev/null @@ -1,53 +0,0 @@ -#include "../bad_usb_app_i.h" -#include "furi_hal_power.h" -#include "furi_hal_usb.h" - -enum SubmenuIndex { - SubmenuIndexKeyboardLayout, -}; - -void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) { - BadUsbApp* bad_usb = context; - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); -} - -void bad_usb_scene_config_on_enter(void* context) { - BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; - - submenu_add_item( - submenu, - "Keyboard layout", - SubmenuIndexKeyboardLayout, - bad_usb_scene_config_submenu_callback, - bad_usb); - - submenu_set_selected_item( - submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig)); - - view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfig); -} - -bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* bad_usb = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event); - consumed = true; - if(event.event == SubmenuIndexKeyboardLayout) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); - } else { - furi_crash("Unknown key type"); - } - } - - return consumed; -} - -void bad_usb_scene_config_on_exit(void* context) { - BadUsbApp* bad_usb = context; - Submenu* submenu = bad_usb->submenu; - - submenu_reset(submenu); -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.h b/applications/main/bad_usb/scenes/bad_usb_scene_config.h index 423aedc51..2524464f1 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.h +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config.h @@ -1,5 +1,8 @@ ADD_SCENE(bad_usb, file_select, FileSelect) ADD_SCENE(bad_usb, work, Work) ADD_SCENE(bad_usb, error, Error) -ADD_SCENE(bad_usb, config, Config) +ADD_SCENE(bad_usb, config_bt, ConfigBt) +ADD_SCENE(bad_usb, config_usb, ConfigUsb) ADD_SCENE(bad_usb, config_layout, ConfigLayout) +ADD_SCENE(bad_usb, config_name, ConfigName) +ADD_SCENE(bad_usb, config_mac, ConfigMac) diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c new file mode 100644 index 000000000..19576ddd0 --- /dev/null +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c @@ -0,0 +1,81 @@ +#include "../bad_usb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" + +enum VarItemListIndex { + VarItemListIndexConnection, + VarItemListIndexKeyboardLayout, + VarItemListIndexAdvertisementName, + VarItemListIndexMacAddress, +}; + +void bad_usb_scene_config_bt_connection_callback(VariableItem* item) { + BadUsbApp* bad_usb = variable_item_get_context(item); + bad_usb->is_bluetooth = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); +} + +void bad_usb_scene_config_bt_var_item_list_callback(void* context, uint32_t index) { + BadUsbApp* bad_usb = context; + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); +} + +void bad_usb_scene_config_bt_on_enter(void* context) { + BadUsbApp* bad_usb = context; + VariableItemList* var_item_list = bad_usb->var_item_list_bt; + VariableItem* item; + + item = variable_item_list_add( + var_item_list, "Connection", 2, bad_usb_scene_config_bt_connection_callback, bad_usb); + variable_item_set_current_value_index(item, bad_usb->is_bluetooth); + variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + + item = variable_item_list_add( + var_item_list, "Keyboard layout", 0, NULL, bad_usb); + + item = variable_item_list_add( + var_item_list, "Change adv name", 0, NULL, bad_usb); + + item = variable_item_list_add( + var_item_list, "Change MAC address", 0, NULL, bad_usb); + + variable_item_list_set_enter_callback(var_item_list, bad_usb_scene_config_bt_var_item_list_callback, bad_usb); + + view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigBt); +} + +bool bad_usb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { + BadUsbApp* bad_usb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfigBt, event.event); + consumed = true; + if(event.event == VarItemListIndexKeyboardLayout) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); + } else if(event.event == VarItemListIndexConnection) { + scene_manager_previous_scene(bad_usb->scene_manager); + if (bad_usb->is_bluetooth) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); + } else { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); + } + } else if(event.event == VarItemListIndexAdvertisementName) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigName); + } else if(event.event == VarItemListIndexMacAddress) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigMac); + // } else { + // furi_crash("Unknown key type"); + } + } + + return consumed; +} + +void bad_usb_scene_config_bt_on_exit(void* context) { + BadUsbApp* bad_usb = context; + VariableItemList* var_item_list = bad_usb->var_item_list_bt; + + variable_item_list_reset(var_item_list); +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c new file mode 100644 index 000000000..597cbcbd7 --- /dev/null +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c @@ -0,0 +1,57 @@ +#include "../bad_usb_app_i.h" + +#define TAG "BadUsbConfigMac" + +static uint8_t* reverse_mac_addr(uint8_t* mac) { + uint8_t tmp; + for(int i = 0; i < 3; i++) { + tmp = mac[i]; + mac[i] = mac[5 - i]; + mac[5 - i] = tmp; + } + return mac; +} + +void bad_usb_scene_config_mac_byte_input_callback(void* context) { + BadUsbApp* bad_usb = context; + + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, BadUsbAppCustomEventByteInputDone); +} + +void bad_usb_scene_config_mac_on_enter(void* context) { + BadUsbApp* bad_usb = context; + + // Setup view + ByteInput* byte_input = bad_usb->byte_input; + byte_input_set_header_text(byte_input, "Enter new MAC address"); + byte_input_set_result_callback( + byte_input, + bad_usb_scene_config_mac_byte_input_callback, + NULL, + bad_usb, + reverse_mac_addr(bad_usb->mac), + GAP_MAC_ADDR_SIZE); + view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigMac); +} + +bool bad_usb_scene_config_mac_on_event(void* context, SceneManagerEvent event) { + BadUsbApp* bad_usb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == BadUsbAppCustomEventByteInputDone) { + bt_set_profile_mac_address(bad_usb->bt, reverse_mac_addr(bad_usb->mac)); + scene_manager_previous_scene(bad_usb->scene_manager); + consumed = true; + } + } + return consumed; +} + +void bad_usb_scene_config_mac_on_exit(void* context) { + BadUsbApp* bad_usb = context; + + // Clear view + byte_input_set_result_callback(bad_usb->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(bad_usb->byte_input, ""); +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c new file mode 100644 index 000000000..c22558d58 --- /dev/null +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c @@ -0,0 +1,46 @@ +#include "../bad_usb_app_i.h" + +static void bad_usb_scene_config_name_text_input_callback(void* context) { + BadUsbApp* bad_usb = context; + + view_dispatcher_send_custom_event( + bad_usb->view_dispatcher, BadUsbAppCustomEventTextEditResult); +} + +void bad_usb_scene_config_name_on_enter(void* context) { + BadUsbApp* bad_usb = context; + TextInput* text_input = bad_usb->text_input; + + text_input_set_header_text(text_input, "Set BLE adv name"); + + text_input_set_result_callback( + text_input, + bad_usb_scene_config_name_text_input_callback, + bad_usb, + bad_usb->name, + BAD_USB_ADV_NAME_MAX_LEN, + true); + + view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigName); +} + +bool bad_usb_scene_config_name_on_event(void* context, SceneManagerEvent event) { + BadUsbApp* bad_usb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + consumed = true; + if(event.event == BadUsbAppCustomEventTextEditResult) { + bt_set_profile_adv_name(bad_usb->bt, bad_usb->name); + } + scene_manager_previous_scene(bad_usb->scene_manager); + } + return consumed; +} + +void bad_usb_scene_config_name_on_exit(void* context) { + BadUsbApp* bad_usb = context; + TextInput* text_input = bad_usb->text_input; + + text_input_reset(text_input); +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c new file mode 100644 index 000000000..77a08611c --- /dev/null +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c @@ -0,0 +1,69 @@ +#include "../bad_usb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" + +enum VarItemListIndex { + VarItemListIndexConnection, + VarItemListIndexKeyboardLayout, +}; + +void bad_usb_scene_config_usb_connection_callback(VariableItem* item) { + BadUsbApp* bad_usb = variable_item_get_context(item); + bad_usb->is_bluetooth = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); +} + +void bad_usb_scene_config_usb_var_item_list_callback(void* context, uint32_t index) { + BadUsbApp* bad_usb = context; + view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); +} + +void bad_usb_scene_config_usb_on_enter(void* context) { + BadUsbApp* bad_usb = context; + VariableItemList* var_item_list = bad_usb->var_item_list_usb; + VariableItem* item; + + item = variable_item_list_add( + var_item_list, "Connection", 2, bad_usb_scene_config_usb_connection_callback, bad_usb); + variable_item_set_current_value_index(item, bad_usb->is_bluetooth); + variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + + item = variable_item_list_add( + var_item_list, "Keyboard layout", 0, NULL, bad_usb); + + variable_item_list_set_enter_callback(var_item_list, bad_usb_scene_config_usb_var_item_list_callback, bad_usb); + + view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigUsb); +} + +bool bad_usb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { + BadUsbApp* bad_usb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfigUsb, event.event); + consumed = true; + if(event.event == VarItemListIndexKeyboardLayout) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); + } else if(event.event == VarItemListIndexConnection) { + scene_manager_previous_scene(bad_usb->scene_manager); + if (bad_usb->is_bluetooth) { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); + } else { + scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); + } + // } else { + // furi_crash("Unknown key type"); + } + } + + return consumed; +} + +void bad_usb_scene_config_usb_on_exit(void* context) { + BadUsbApp* bad_usb = context; + VariableItemList* var_item_list = bad_usb->var_item_list_usb; + + variable_item_list_reset(var_item_list); +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_error.c b/applications/main/bad_usb/scenes/bad_usb_scene_error.c index 2c707bbf1..d1290e0e0 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_error.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_error.c @@ -1,10 +1,6 @@ #include "../bad_usb_app_i.h" #include "../../../settings/xtreme_settings/xtreme_settings.h" -typedef enum { - BadUsbCustomEventErrorBack, -} BadUsbCustomEvent; - static void bad_usb_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { furi_assert(context); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c index 21a2ce024..5176e3b28 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c @@ -29,7 +29,7 @@ void bad_usb_scene_file_select_on_enter(void* context) { } if(bad_usb_file_select(bad_usb)) { - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path); + bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->bt); bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_work.c b/applications/main/bad_usb/scenes/bad_usb_scene_work.c index 2971c01e9..1f6af5545 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_work.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_work.c @@ -16,7 +16,11 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == InputKeyLeft) { - scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig); + if (app->is_bluetooth) { + scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigBt); + } else { + scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigUsb); + } consumed = true; } else if(event.event == InputKeyOk) { bad_usb_script_toggle(app->bad_usb_script); diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index e4ed2e142..aabe45714 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,12.4,, +Version,+,13.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1038,7 +1038,7 @@ Function,+,furi_hal_bt_serial_stop,void, Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t" Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*" Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" -Function,+furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" +Function,+,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" Function,+,furi_hal_bt_start_advertising,void, Function,+,furi_hal_bt_start_app,_Bool,"FuriHalBtProfile, GapEventCallback, void*" Function,+,furi_hal_bt_start_packet_rx,void,"uint8_t, uint8_t" @@ -4422,6 +4422,7 @@ Function,+,validator_is_file_callback,_Bool,"const char*, FuriString*, void*" Function,+,validator_is_file_free,void,ValidatorIsFile* Function,+,value_index_bool,uint8_t,"const _Bool, const _Bool[], uint8_t" Function,+,value_index_float,uint8_t,"const float, const float[], uint8_t" +Function,+,value_index_int32,uint8_t,"const int32_t, const int32_t[], uint8_t" Function,+,value_index_uint32,uint8_t,"const uint32_t, const uint32_t[], uint8_t" Function,+,variable_item_get_context,void*,VariableItem* Function,+,variable_item_get_current_value_index,uint8_t,VariableItem* From 4ec539ff996b139e74f14a5173eac40b8beab9fb Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 29 Jan 2023 03:24:42 +0000 Subject: [PATCH 10/36] Move all Bad BLE functionality to Bad USB --- applications/main/bad_ble/bad_ble_script.c | 819 ------------------ applications/main/bad_usb/bad_usb_app.c | 2 +- applications/main/bad_usb/bad_usb_app_i.h | 2 +- applications/main/bad_usb/bad_usb_script.c | 240 +++-- .../bad_usb/scenes/bad_usb_scene_config_bt.c | 12 +- .../bad_usb/scenes/bad_usb_scene_config_usb.c | 12 +- .../scenes/bad_usb_scene_file_select.c | 2 +- .../main/bad_usb/scenes/bad_usb_scene_work.c | 2 +- 8 files changed, 202 insertions(+), 889 deletions(-) delete mode 100644 applications/main/bad_ble/bad_ble_script.c diff --git a/applications/main/bad_ble/bad_ble_script.c b/applications/main/bad_ble/bad_ble_script.c deleted file mode 100644 index a969df7dd..000000000 --- a/applications/main/bad_ble/bad_ble_script.c +++ /dev/null @@ -1,819 +0,0 @@ -// #include -// #include -// #include -// #include -// #include -// #include - -// #include -// #include "bad_ble_script.h" -// #include - -// #include - -// #define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") - -// #define TAG "BadBle" -// #define WORKER_TAG TAG "Worker" -// #define FILE_BUFFER_LEN 16 - -// #define SCRIPT_STATE_ERROR (-1) -// #define SCRIPT_STATE_END (-2) -// #define SCRIPT_STATE_NEXT_LINE (-3) - -// #define BADBLE_ASCII_TO_KEY(script, x) \ -// (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE) - -// typedef enum { -// WorkerEvtToggle = (1 << 0), -// WorkerEvtEnd = (1 << 1), -// WorkerEvtConnect = (1 << 2), -// WorkerEvtDisconnect = (1 << 3), -// } WorkerEvtFlags; - -// typedef enum { -// LevelRssi122_100, -// LevelRssi99_80, -// LevelRssi79_60, -// LevelRssi59_40, -// LevelRssi39_0, -// LevelRssiNum, -// LevelRssiError = 0xFF, -// } LevelRssiRange; - -// /** -// * Delays for waiting between HID key press and key release -// */ -// const uint8_t bt_hid_delays[LevelRssiNum] = { -// 30, // LevelRssi122_100 -// 25, // LevelRssi99_80 -// 20, // LevelRssi79_60 -// 17, // LevelRssi59_40 -// 14, // LevelRssi39_0 -// }; - -// struct BadBleScript { - -// BadBleState st; -// FuriString* file_path; -// uint32_t defdelay; -// uint16_t layout[128]; -// FuriThread* thread; -// uint8_t file_buf[FILE_BUFFER_LEN + 1]; -// uint8_t buf_start; -// uint8_t buf_len; -// bool file_end; -// FuriString* line; - -// FuriString* line_prev; -// uint32_t repeat_cnt; - -// Bt* bt; -// }; - -// typedef struct { -// char* name; -// uint16_t keycode; -// } DuckyKey; - -// static const DuckyKey ducky_keys[] = { -// {"CTRL-ALT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_ALT}, -// {"CTRL-SHIFT", KEY_MOD_LEFT_CTRL | KEY_MOD_LEFT_SHIFT}, -// {"ALT-SHIFT", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_SHIFT}, -// {"ALT-GUI", KEY_MOD_LEFT_ALT | KEY_MOD_LEFT_GUI}, -// {"GUI-SHIFT", KEY_MOD_LEFT_GUI | KEY_MOD_LEFT_SHIFT}, - -// {"CTRL", KEY_MOD_LEFT_CTRL}, -// {"CONTROL", KEY_MOD_LEFT_CTRL}, -// {"SHIFT", KEY_MOD_LEFT_SHIFT}, -// {"ALT", KEY_MOD_LEFT_ALT}, -// {"GUI", KEY_MOD_LEFT_GUI}, -// {"WINDOWS", KEY_MOD_LEFT_GUI}, - -// {"DOWNARROW", HID_KEYBOARD_DOWN_ARROW}, -// {"DOWN", HID_KEYBOARD_DOWN_ARROW}, -// {"LEFTARROW", HID_KEYBOARD_LEFT_ARROW}, -// {"LEFT", HID_KEYBOARD_LEFT_ARROW}, -// {"RIGHTARROW", HID_KEYBOARD_RIGHT_ARROW}, -// {"RIGHT", HID_KEYBOARD_RIGHT_ARROW}, -// {"UPARROW", HID_KEYBOARD_UP_ARROW}, -// {"UP", HID_KEYBOARD_UP_ARROW}, - -// {"ENTER", HID_KEYBOARD_RETURN}, -// {"BREAK", HID_KEYBOARD_PAUSE}, -// {"PAUSE", HID_KEYBOARD_PAUSE}, -// {"CAPSLOCK", HID_KEYBOARD_CAPS_LOCK}, -// {"DELETE", HID_KEYBOARD_DELETE}, -// {"BACKSPACE", HID_KEYPAD_BACKSPACE}, -// {"END", HID_KEYBOARD_END}, -// {"ESC", HID_KEYBOARD_ESCAPE}, -// {"ESCAPE", HID_KEYBOARD_ESCAPE}, -// {"HOME", HID_KEYBOARD_HOME}, -// {"INSERT", HID_KEYBOARD_INSERT}, -// {"NUMLOCK", HID_KEYPAD_NUMLOCK}, -// {"PAGEUP", HID_KEYBOARD_PAGE_UP}, -// {"PAGEDOWN", HID_KEYBOARD_PAGE_DOWN}, -// {"PRINTSCREEN", HID_KEYBOARD_PRINT_SCREEN}, -// {"SCROLLLOCK", HID_KEYBOARD_SCROLL_LOCK}, -// {"SPACE", HID_KEYBOARD_SPACEBAR}, -// {"TAB", HID_KEYBOARD_TAB}, -// {"MENU", HID_KEYBOARD_APPLICATION}, -// {"APP", HID_KEYBOARD_APPLICATION}, - -// {"F1", HID_KEYBOARD_F1}, -// {"F2", HID_KEYBOARD_F2}, -// {"F3", HID_KEYBOARD_F3}, -// {"F4", HID_KEYBOARD_F4}, -// {"F5", HID_KEYBOARD_F5}, -// {"F6", HID_KEYBOARD_F6}, -// {"F7", HID_KEYBOARD_F7}, -// {"F8", HID_KEYBOARD_F8}, -// {"F9", HID_KEYBOARD_F9}, -// {"F10", HID_KEYBOARD_F10}, -// {"F11", HID_KEYBOARD_F11}, -// {"F12", HID_KEYBOARD_F12}, -// }; - -// static const char ducky_cmd_comment[] = {"REM"}; -// static const char ducky_cmd_id[] = {"ID"}; -// static const char ducky_cmd_delay[] = {"DELAY "}; -// static const char ducky_cmd_string[] = {"STRING "}; -// static const char ducky_cmd_defdelay_1[] = {"DEFAULT_DELAY "}; -// static const char ducky_cmd_defdelay_2[] = {"DEFAULTDELAY "}; -// static const char ducky_cmd_repeat[] = {"REPEAT "}; -// static const char ducky_cmd_sysrq[] = {"SYSRQ "}; - -// static const char ducky_cmd_altchar[] = {"ALTCHAR "}; -// static const char ducky_cmd_altstr_1[] = {"ALTSTRING "}; -// static const char ducky_cmd_altstr_2[] = {"ALTCODE "}; - -// static const char ducky_cmd_lang[] = {"DUCKY_LANG"}; - -// static const uint8_t numpad_keys[10] = { -// HID_KEYPAD_0, -// HID_KEYPAD_1, -// HID_KEYPAD_2, -// HID_KEYPAD_3, -// HID_KEYPAD_4, -// HID_KEYPAD_5, -// HID_KEYPAD_6, -// HID_KEYPAD_7, -// HID_KEYPAD_8, -// HID_KEYPAD_9, -// }; - -// uint8_t bt_timeout = 0; - -// static LevelRssiRange bt_remote_rssi_range(Bt* bt) { -// BtRssi rssi_data = {0}; - -// if(!bt_remote_rssi(bt, &rssi_data)) return LevelRssiError; - -// if(rssi_data.rssi <= 39) -// return LevelRssi39_0; -// else if(rssi_data.rssi <= 59) -// return LevelRssi59_40; -// else if(rssi_data.rssi <= 79) -// return LevelRssi79_60; -// else if(rssi_data.rssi <= 99) -// return LevelRssi99_80; -// else if(rssi_data.rssi <= 122) -// return LevelRssi122_100; - -// return LevelRssiError; -// } - -// static inline void update_bt_timeout(Bt* bt) { -// LevelRssiRange r = bt_remote_rssi_range(bt); -// if(r < LevelRssiNum) { -// bt_timeout = bt_hid_delays[r]; -// } -// } - -/** - * @brief Wait until there are enough free slots in the keyboard buffer - * - * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) -*/ -static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { - uint32_t start = furi_get_tick(); - uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; - while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { - furi_delay_ms(100); - - if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { - break; - } - } -} - -// static bool ducky_get_number(const char* param, uint32_t* val) { -// uint32_t value = 0; -// if(sscanf(param, "%lu", &value) == 1) { -// *val = value; -// return true; -// } -// return false; -// } - -// static uint32_t ducky_get_command_len(const char* line) { -// uint32_t len = strlen(line); -// for(uint32_t i = 0; i < len; i++) { -// if(line[i] == ' ') return i; -// } -// return 0; -// } - -// static bool ducky_is_line_end(const char chr) { -// return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); -// } - -static void ducky_numlock_on() { - if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); - furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); - - furi_delay_ms(bt_timeout); - furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); - } -} - -static bool ducky_numpad_press(const char num) { - if((num < '0') || (num > '9')) return false; - - uint16_t key = numpad_keys[num - '0']; - bt_hid_hold_while_keyboard_buffer_full(1, -1); - FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); - furi_hal_bt_hid_kb_press(key); - furi_delay_ms(bt_timeout); - furi_hal_bt_hid_kb_release(key); - - return true; -} - -static bool ducky_altchar(const char* charcode) { - uint8_t i = 0; - bool state = false; - - FURI_LOG_I(WORKER_TAG, "char %s", charcode); - - bt_hid_hold_while_keyboard_buffer_full(1, -1); - furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); - - while(!ducky_is_line_end(charcode[i])) { - state = ducky_numpad_press(charcode[i]); - if(state == false) break; - i++; - } - - furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT); - return state; -} - -// static bool ducky_altstring(const char* param) { -// uint32_t i = 0; -// bool state = false; - -// while(param[i] != '\0') { -// if((param[i] < ' ') || (param[i] > '~')) { -// i++; -// continue; // Skip non-printable chars -// } - -// char temp_str[4]; -// snprintf(temp_str, 4, "%u", param[i]); - -// state = ducky_altchar(temp_str); -// if(state == false) break; -// i++; -// } -// return state; -// } - -static bool ducky_string(BadBleScript* bad_ble, const char* param) { - uint32_t i = 0; - while(param[i] != '\0') { - uint16_t keycode = BADBLE_ASCII_TO_KEY(bad_ble, param[i]); - if(keycode != HID_KEYBOARD_NONE) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); - furi_hal_bt_hid_kb_press(keycode); - - furi_delay_ms(bt_timeout); - furi_hal_bt_hid_kb_release(keycode); - } - i++; - } - return true; -} - -// static uint16_t ducky_get_keycode(BadBleScript* bad_ble, const char* param, bool accept_chars) { -// for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) { -// size_t key_cmd_len = strlen(ducky_keys[i].name); -// if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) && -// (ducky_is_line_end(param[key_cmd_len]))) { -// return ducky_keys[i].keycode; -// } -// } -// if((accept_chars) && (strlen(param) > 0)) { -// return (BADBLE_ASCII_TO_KEY(bad_ble, param[0]) & 0xFF); -// } -// return 0; -// } - -static int32_t - ducky_parse_line(BadBleScript* bad_ble, FuriString* line, char* error, size_t error_len) { - uint32_t line_len = furi_string_size(line); - const char* line_tmp = furi_string_get_cstr(line); - bool state = false; - - if(line_len == 0) { - return SCRIPT_STATE_NEXT_LINE; // Skip empty lines - } - - // General commands - if(strncmp(line_tmp, ducky_cmd_comment, strlen(ducky_cmd_comment)) == 0) { - // REM - comment line - return (0); - } else if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { - // ID - executed in ducky_script_preload - return (0); - } else if(strncmp(line_tmp, ducky_cmd_lang, strlen(ducky_cmd_lang)) == 0) { - // DUCKY_LANG - ignore command to retain compatibility with existing scripts - return (0); - } else if(strncmp(line_tmp, ducky_cmd_delay, strlen(ducky_cmd_delay)) == 0) { - // DELAY - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - uint32_t delay_val = 0; - state = ducky_get_number(line_tmp, &delay_val); - if((state) && (delay_val > 0)) { - return (int32_t)delay_val; - } - if(error != NULL) { - snprintf(error, error_len, "Invalid number %s", line_tmp); - } - return SCRIPT_STATE_ERROR; - } else if( - (strncmp(line_tmp, ducky_cmd_defdelay_1, strlen(ducky_cmd_defdelay_1)) == 0) || - (strncmp(line_tmp, ducky_cmd_defdelay_2, strlen(ducky_cmd_defdelay_2)) == 0)) { - // DEFAULT_DELAY - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_get_number(line_tmp, &bad_ble->defdelay); - if(!state && error != NULL) { - snprintf(error, error_len, "Invalid number %s", line_tmp); - } - return (state) ? (0) : SCRIPT_STATE_ERROR; - } else if(strncmp(line_tmp, ducky_cmd_string, strlen(ducky_cmd_string)) == 0) { - // STRING - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_string(bad_ble, line_tmp); - if(!state && error != NULL) { - snprintf(error, error_len, "Invalid string %s", line_tmp); - } - return (state) ? (0) : SCRIPT_STATE_ERROR; - } else if(strncmp(line_tmp, ducky_cmd_altchar, strlen(ducky_cmd_altchar)) == 0) { - // ALTCHAR - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(); - state = ducky_altchar(line_tmp); - if(!state && error != NULL) { - snprintf(error, error_len, "Invalid altchar %s", line_tmp); - } - return (state) ? (0) : SCRIPT_STATE_ERROR; - } else if( - (strncmp(line_tmp, ducky_cmd_altstr_1, strlen(ducky_cmd_altstr_1)) == 0) || - (strncmp(line_tmp, ducky_cmd_altstr_2, strlen(ducky_cmd_altstr_2)) == 0)) { - // ALTSTRING - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(); - state = ducky_altstring(line_tmp); - if(!state && error != NULL) { - snprintf(error, error_len, "Invalid altstring %s", line_tmp); - } - return (state) ? (0) : SCRIPT_STATE_ERROR; - } else if(strncmp(line_tmp, ducky_cmd_repeat, strlen(ducky_cmd_repeat)) == 0) { - // REPEAT - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_get_number(line_tmp, &bad_ble->repeat_cnt); - if(!state && error != NULL) { - snprintf(error, error_len, "Invalid number %s", line_tmp); - } - return (state) ? (0) : SCRIPT_STATE_ERROR; - } else if(strncmp(line_tmp, ducky_cmd_sysrq, strlen(ducky_cmd_sysrq)) == 0) { - // SYSRQ - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - uint16_t key = ducky_get_keycode(bad_ble, line_tmp, true); - bt_hid_hold_while_keyboard_buffer_full(1, -1); - furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); - furi_hal_bt_hid_kb_press(key); - - furi_delay_ms(bt_timeout); - furi_hal_bt_hid_kb_release(key); - furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); - return (0); - } else { - // Special keys + modifiers - uint16_t key = ducky_get_keycode(bad_ble, line_tmp, false); - if(key == HID_KEYBOARD_NONE) { - if(error != NULL) { - snprintf(error, error_len, "No keycode defined for %s", line_tmp); - } - return SCRIPT_STATE_ERROR; - } - if((key & 0xFF00) != 0) { - // It's a modifier key - line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - key |= ducky_get_keycode(bad_ble, line_tmp, true); - } - furi_hal_bt_hid_kb_press(key); - - furi_delay_ms(bt_timeout); - furi_hal_bt_hid_kb_release(key); - return (0); - } -} - -static bool ducky_script_preload(BadBleScript* bad_ble, File* script_file) { - uint8_t ret = 0; - uint32_t line_len = 0; - - furi_string_reset(bad_ble->line); - - do { - ret = storage_file_read(script_file, bad_ble->file_buf, FILE_BUFFER_LEN); - for(uint16_t i = 0; i < ret; i++) { - if(bad_ble->file_buf[i] == '\n' && line_len > 0) { - bad_ble->st.line_nb++; - line_len = 0; - } else { - if(bad_ble->st.line_nb == 0) { // Save first line - furi_string_push_back(bad_ble->line, bad_ble->file_buf[i]); - } - line_len++; - } - } - if(storage_file_eof(script_file)) { - if(line_len > 0) { - bad_ble->st.line_nb++; - break; - } - } - } while(ret > 0); - - storage_file_seek(script_file, 0, true); - furi_string_reset(bad_ble->line); - - return true; -} - -static int32_t ducky_script_execute_next(BadBleScript* bad_ble, File* script_file) { - int32_t delay_val = 0; - - if(bad_ble->repeat_cnt > 0) { - bad_ble->repeat_cnt--; - delay_val = ducky_parse_line( - bad_ble, bad_ble->line_prev, bad_ble->st.error, sizeof(bad_ble->st.error)); - if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line - return 0; - } else if(delay_val < 0) { // Script error - bad_ble->st.error_line = bad_ble->st.line_cur - 1; - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_ble->st.line_cur - 1U); - return SCRIPT_STATE_ERROR; - } else { - return (delay_val + bad_ble->defdelay); - } - } - - furi_string_set(bad_ble->line_prev, bad_ble->line); - furi_string_reset(bad_ble->line); - - while(1) { - if(bad_ble->buf_len == 0) { - bad_ble->buf_len = storage_file_read(script_file, bad_ble->file_buf, FILE_BUFFER_LEN); - if(storage_file_eof(script_file)) { - if((bad_ble->buf_len < FILE_BUFFER_LEN) && (bad_ble->file_end == false)) { - bad_ble->file_buf[bad_ble->buf_len] = '\n'; - bad_ble->buf_len++; - bad_ble->file_end = true; - } - } - - bad_ble->buf_start = 0; - if(bad_ble->buf_len == 0) return SCRIPT_STATE_END; - } - for(uint8_t i = bad_ble->buf_start; i < (bad_ble->buf_start + bad_ble->buf_len); i++) { - if(bad_ble->file_buf[i] == '\n' && furi_string_size(bad_ble->line) > 0) { - bad_ble->st.line_cur++; - bad_ble->buf_len = bad_ble->buf_len + bad_ble->buf_start - (i + 1); - bad_ble->buf_start = i + 1; - furi_string_trim(bad_ble->line); - delay_val = ducky_parse_line( - bad_ble, bad_ble->line, bad_ble->st.error, sizeof(bad_ble->st.error)); - if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line - return 0; - } else if(delay_val < 0) { - bad_ble->st.error_line = bad_ble->st.line_cur; - if(delay_val == SCRIPT_STATE_NEXT_LINE) { - snprintf( - bad_ble->st.error, sizeof(bad_ble->st.error), "Forbidden empty line"); - FURI_LOG_E( - WORKER_TAG, "Forbidden empty line at line %u", bad_ble->st.line_cur); - } else { - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_ble->st.line_cur); - } - return SCRIPT_STATE_ERROR; - } else { - return (delay_val + bad_ble->defdelay); - } - } else { - furi_string_push_back(bad_ble->line, bad_ble->file_buf[i]); - } - } - bad_ble->buf_len = 0; - if(bad_ble->file_end) return SCRIPT_STATE_END; - } - - return 0; -} - -static void bad_ble_hid_state_callback(BtStatus status, void* context) { - furi_assert(context); - BadBleScript* bad_ble = (BadBleScript*)context; - bool state = (status == BtStatusConnected); - - if(state == true) { - LevelRssiRange r = bt_remote_rssi_range(bad_ble->bt); - if(r != LevelRssiError) { - bt_timeout = bt_hid_delays[r]; - } - furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtConnect); - } else - furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtDisconnect); -} - -static int32_t bad_ble_worker(void* context) { - BadBleScript* bad_ble = context; - - BadBleWorkerState worker_state = BadBleStateInit; - int32_t delay_val = 0; - - // BLE HID init - bt_timeout = bt_hid_delays[LevelRssi39_0]; - - bt_disconnect(bad_ble->bt); - - // Wait 2nd core to update nvm storage - furi_delay_ms(200); - - bt_keys_storage_set_storage_path(bad_ble->bt, HID_BT_KEYS_STORAGE_PATH); - - if(!bt_set_profile(bad_ble->bt, BtProfileHidKeyboard)) { - FURI_LOG_E(TAG, "Failed to switch to HID profile"); - return -1; - } - - furi_hal_bt_start_advertising(); - - FURI_LOG_I(WORKER_TAG, "Init"); - File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - bad_ble->line = furi_string_alloc(); - bad_ble->line_prev = furi_string_alloc(); - - bt_set_status_changed_callback(bad_ble->bt, bad_ble_hid_state_callback, bad_ble); - while(1) { - if(worker_state == BadBleStateInit) { // State: initialization - if(storage_file_open( - script_file, - furi_string_get_cstr(bad_ble->file_path), - FSAM_READ, - FSOM_OPEN_EXISTING)) { - if((ducky_script_preload(bad_ble, script_file)) && (bad_ble->st.line_nb > 0)) { - worker_state = BadBleStateNotConnected; // Ready to run - } else { - worker_state = BadBleStateScriptError; // Script preload error - } - } else { - FURI_LOG_E(WORKER_TAG, "File open error"); - worker_state = BadBleStateFileError; // File open error - } - bad_ble->st.state = worker_state; - - } else if(worker_state == BadBleStateNotConnected) { // State: ble not connected - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, - FuriFlagWaitAny, - FuriWaitForever); - furi_check((flags & FuriFlagError) == 0); - if(flags & WorkerEvtEnd) { - break; - } else if(flags & WorkerEvtConnect) { - worker_state = BadBleStateIdle; // Ready to run - } else if(flags & WorkerEvtToggle) { - worker_state = BadBleStateWillRun; // Will run when ble is connected - } - bad_ble->st.state = worker_state; - - } else if(worker_state == BadBleStateIdle) { // State: ready to start - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, - FuriFlagWaitAny, - FuriWaitForever); - furi_check((flags & FuriFlagError) == 0); - if(flags & WorkerEvtEnd) { - break; - } else if(flags & WorkerEvtToggle) { // Start executing script - DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); - delay_val = 0; - bad_ble->buf_len = 0; - bad_ble->st.line_cur = 0; - bad_ble->defdelay = 0; - bad_ble->repeat_cnt = 0; - bad_ble->file_end = false; - storage_file_seek(script_file, 0, true); - worker_state = BadBleStateRunning; - } else if(flags & WorkerEvtDisconnect) { - worker_state = BadBleStateNotConnected; // ble disconnected - } - bad_ble->st.state = worker_state; - - } else if(worker_state == BadBleStateWillRun) { // State: start on connection - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, - FuriFlagWaitAny, - FuriWaitForever); - furi_check((flags & FuriFlagError) == 0); - if(flags & WorkerEvtEnd) { - break; - } else if(flags & WorkerEvtConnect) { // Start executing script - DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); - delay_val = 0; - bad_ble->buf_len = 0; - bad_ble->st.line_cur = 0; - bad_ble->defdelay = 0; - bad_ble->repeat_cnt = 0; - bad_ble->file_end = false; - storage_file_seek(script_file, 0, true); - // extra time for PC to recognize Flipper as keyboard - furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); - - update_bt_timeout(bad_ble->bt); - FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); - - worker_state = BadBleStateRunning; - } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution - worker_state = BadBleStateNotConnected; - } - bad_ble->st.state = worker_state; - - } else if(worker_state == BadBleStateRunning) { // State: running - uint16_t delay_cur = (delay_val > 1000) ? (1000) : (delay_val); - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, FuriFlagWaitAny, delay_cur); - delay_val -= delay_cur; - if(!(flags & FuriFlagError)) { - if(flags & WorkerEvtEnd) { - break; - } else if(flags & WorkerEvtToggle) { - worker_state = BadBleStateIdle; // Stop executing script - furi_hal_bt_hid_kb_release_all(); - } else if(flags & WorkerEvtDisconnect) { - worker_state = BadBleStateNotConnected; // ble disconnected - furi_hal_bt_hid_kb_release_all(); - } - bad_ble->st.state = worker_state; - continue; - } else if( - (flags == (unsigned)FuriFlagErrorTimeout) || - (flags == (unsigned)FuriFlagErrorResource)) { - if(delay_val > 0) { - bad_ble->st.delay_remain--; - continue; - } - bad_ble->st.state = BadBleStateRunning; - delay_val = ducky_script_execute_next(bad_ble, script_file); - if(delay_val == SCRIPT_STATE_ERROR) { // Script error - delay_val = 0; - worker_state = BadBleStateScriptError; - bad_ble->st.state = worker_state; - } else if(delay_val == SCRIPT_STATE_END) { // End of script - delay_val = 0; - worker_state = BadBleStateIdle; - bad_ble->st.state = BadBleStateDone; - furi_hal_bt_hid_kb_release_all(); - continue; - } else if(delay_val > 1000) { - bad_ble->st.state = BadBleStateDelay; // Show long delays - bad_ble->st.delay_remain = delay_val / 1000; - } - } else { - furi_check((flags & FuriFlagError) == 0); - } - - } else if( - (worker_state == BadBleStateFileError) || - (worker_state == BadBleStateScriptError)) { // State: error - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd, FuriFlagWaitAny, FuriWaitForever); // Waiting for exit command - furi_check((flags & FuriFlagError) == 0); - if(flags & WorkerEvtEnd) { - break; - } - } - - update_bt_timeout(bad_ble->bt); - FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); - } - - // release all keys - bt_hid_hold_while_keyboard_buffer_full(6, 3000); - - // stop ble - bt_set_status_changed_callback(bad_ble->bt, NULL, NULL); - - bt_disconnect(bad_ble->bt); - - // Wait 2nd core to update nvm storage - furi_delay_ms(200); - - bt_keys_storage_set_default_path(bad_ble->bt); - - if(!bt_set_profile(bad_ble->bt, BtProfileSerial)) { - FURI_LOG_E(TAG, "Failed to switch to Serial profile"); - } - - storage_file_close(script_file); - storage_file_free(script_file); - furi_string_free(bad_ble->line); - furi_string_free(bad_ble->line_prev); - - FURI_LOG_I(WORKER_TAG, "End"); - - return 0; -} - -// static void bad_ble_script_set_default_keyboard_layout(BadBleScript* bad_ble) { -// furi_assert(bad_ble); -// memset(bad_ble->layout, HID_KEYBOARD_NONE, sizeof(bad_ble->layout)); -// memcpy(bad_ble->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_ble->layout))); -// } - -// BadBleScript* bad_ble_script_open(FuriString* file_path, Bt* bt) { -// furi_assert(file_path); - -// BadBleScript* bad_ble = malloc(sizeof(BadBleScript)); -// bad_ble->file_path = furi_string_alloc(); -// furi_string_set(bad_ble->file_path, file_path); -// bad_ble_script_set_default_keyboard_layout(bad_ble); - -// bad_ble->st.state = BadBleStateInit; -// bad_ble->st.error[0] = '\0'; - -// bad_ble->bt = bt; - -// bad_ble->thread = furi_thread_alloc_ex("BadBleWorker", 2048, bad_ble_worker, bad_ble); -// furi_thread_start(bad_ble->thread); -// return bad_ble; -// } //-V773 - -// void bad_ble_script_close(BadBleScript* bad_ble) { -// furi_assert(bad_ble); -// furi_record_close(RECORD_STORAGE); -// furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtEnd); -// furi_thread_join(bad_ble->thread); -// furi_thread_free(bad_ble->thread); -// furi_string_free(bad_ble->file_path); -// free(bad_ble); -// } - -// void bad_ble_script_set_keyboard_layout(BadBleScript* bad_ble, FuriString* layout_path) { -// furi_assert(bad_ble); - -// if((bad_ble->st.state == BadBleStateRunning) || (bad_ble->st.state == BadBleStateDelay)) { -// // do not update keyboard layout while a script is running -// return; -// } - -// File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); -// if(!furi_string_empty(layout_path)) { -// if(storage_file_open( -// layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { -// uint16_t layout[128]; -// if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) { -// memcpy(bad_ble->layout, layout, sizeof(layout)); -// } -// } -// storage_file_close(layout_file); -// } else { -// bad_ble_script_set_default_keyboard_layout(bad_ble); -// } -// storage_file_free(layout_file); -// } - -// void bad_ble_script_toggle(BadBleScript* bad_ble) { -// furi_assert(bad_ble); -// furi_thread_flags_set(furi_thread_get_id(bad_ble->thread), WorkerEvtToggle); -// } - -// BadBleState* bad_ble_script_get_state(BadBleScript* bad_ble) { -// furi_assert(bad_ble); -// return &(bad_ble->st); -// } diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index 94717cd37..63f95a860 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -134,7 +134,7 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { scene_manager_next_scene(app->scene_manager, BadUsbSceneError); } else { if(!furi_string_empty(app->file_path)) { - app->bad_usb_script = bad_usb_script_open(app->file_path, bt); + app->bad_usb_script = bad_usb_script_open(app->file_path, app->is_bt ? app->bt : NULL); bad_usb_script_set_keyboard_layout(app->bad_usb_script, app->keyboard_layout); scene_manager_next_scene(app->scene_manager, BadUsbSceneWork); } else { diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index 93b5cf08d..ba0dee88b 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -57,7 +57,7 @@ struct BadUsbApp { BadUsb* bad_usb_view; BadUsbScript* bad_usb_script; - bool is_bluetooth; + bool is_bt; }; typedef enum { diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index 9c24ff777..a61bc1e06 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -195,17 +195,17 @@ static inline void update_bt_timeout(Bt* bt) { * * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) */ -// static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { -// uint32_t start = furi_get_tick(); -// uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; -// while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { -// furi_delay_ms(100); +static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { + uint32_t start = furi_get_tick(); + uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; + while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { + furi_delay_ms(100); -// if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { -// break; -// } -// } -// } + if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { + break; + } + } +} static bool ducky_get_number(const char* param, uint32_t* val) { uint32_t value = 0; @@ -228,42 +228,68 @@ static bool ducky_is_line_end(const char chr) { return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); } -static void ducky_numlock_on() { - if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { - furi_hal_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); - furi_hal_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); +static void ducky_numlock_on(BadUsbScript* bad_usb) { + if (bad_usb->bt) { + if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); + furi_delay_ms(bt_timeout); + furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); + } + } else { + if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { + furi_hal_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); + furi_hal_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); + } } } -static bool ducky_numpad_press(const char num) { +static bool ducky_numpad_press(BadUsbScript* bad_usb, const char num) { if((num < '0') || (num > '9')) return false; uint16_t key = numpad_keys[num - '0']; - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release(key); + FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); + if (bad_usb->bt) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(key); + furi_delay_ms(bt_timeout); + furi_hal_bt_hid_kb_release(key); + } else { + furi_hal_hid_kb_press(key); + furi_hal_hid_kb_release(key); + } return true; } -static bool ducky_altchar(const char* charcode) { +static bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode) { uint8_t i = 0; bool state = false; FURI_LOG_I(WORKER_TAG, "char %s", charcode); - furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT); + if (bad_usb->bt) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); + } else { + furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT); + } while(!ducky_is_line_end(charcode[i])) { - state = ducky_numpad_press(charcode[i]); + state = ducky_numpad_press(bad_usb, charcode[i]); if(state == false) break; i++; } - furi_hal_hid_kb_release(KEY_MOD_LEFT_ALT); + if (bad_usb->bt) { + furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT); + } else { + furi_hal_hid_kb_release(KEY_MOD_LEFT_ALT); + } return state; } -static bool ducky_altstring(const char* param) { +static bool ducky_altstring(BadUsbScript* bad_usb, const char* param) { uint32_t i = 0; bool state = false; @@ -276,7 +302,7 @@ static bool ducky_altstring(const char* param) { char temp_str[4]; snprintf(temp_str, 4, "%u", param[i]); - state = ducky_altchar(temp_str); + state = ducky_altchar(bad_usb, temp_str); if(state == false) break; i++; } @@ -288,8 +314,15 @@ static bool ducky_string(BadUsbScript* bad_usb, const char* param) { while(param[i] != '\0') { uint16_t keycode = BADUSB_ASCII_TO_KEY(bad_usb, param[i]); if(keycode != HID_KEYBOARD_NONE) { - furi_hal_hid_kb_press(keycode); - furi_hal_hid_kb_release(keycode); + if (bad_usb->bt) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(keycode); + furi_delay_ms(bt_timeout); + furi_hal_bt_hid_kb_release(keycode); + } else { + furi_hal_hid_kb_press(keycode); + furi_hal_hid_kb_release(keycode); + } } i++; } @@ -365,8 +398,8 @@ static int32_t } else if(strncmp(line_tmp, ducky_cmd_altchar, strlen(ducky_cmd_altchar)) == 0) { // ALTCHAR line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(); - state = ducky_altchar(line_tmp); + ducky_numlock_on(bad_usb); + state = ducky_altchar(bad_usb, line_tmp); if(!state && error != NULL) { snprintf(error, error_len, "Invalid altchar %s", line_tmp); } @@ -376,8 +409,8 @@ static int32_t (strncmp(line_tmp, ducky_cmd_altstr_2, strlen(ducky_cmd_altstr_2)) == 0)) { // ALTSTRING line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(); - state = ducky_altstring(line_tmp); + ducky_numlock_on(bad_usb); + state = ducky_altstring(bad_usb, line_tmp); if(!state && error != NULL) { snprintf(error, error_len, "Invalid altstring %s", line_tmp); } @@ -394,9 +427,18 @@ static int32_t // SYSRQ line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; uint16_t key = ducky_get_keycode(bad_usb, line_tmp, true); - furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release_all(); + if (bad_usb->bt) { + bt_hid_hold_while_keyboard_buffer_full(1, -1); + furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + furi_hal_bt_hid_kb_press(key); + furi_delay_ms(bt_timeout); + furi_hal_bt_hid_kb_release(key); + furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + } else { + furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); + furi_hal_hid_kb_press(key); + furi_hal_hid_kb_release_all(); + } return (0); } else { // Special keys + modifiers @@ -412,8 +454,14 @@ static int32_t line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; key |= ducky_get_keycode(bad_usb, line_tmp, true); } - furi_hal_hid_kb_press(key); - furi_hal_hid_kb_release(key); + if (bad_usb->bt) { + furi_hal_bt_hid_kb_press(key); + furi_delay_ms(bt_timeout); + furi_hal_bt_hid_kb_release(key); + } else { + furi_hal_hid_kb_press(key); + furi_hal_hid_kb_release(key); + } return (0); } } @@ -470,16 +518,18 @@ static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) { } } while(ret > 0); - const char* line_tmp = furi_string_get_cstr(bad_usb->line); - bool id_set = false; // Looking for ID command at first line - if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { - id_set = ducky_set_usb_id(bad_usb, &line_tmp[strlen(ducky_cmd_id) + 1]); - } + if (!bad_usb->bt) { + const char* line_tmp = furi_string_get_cstr(bad_usb->line); + bool id_set = false; // Looking for ID command at first line + if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { + id_set = ducky_set_usb_id(bad_usb, &line_tmp[strlen(ducky_cmd_id) + 1]); + } - if(id_set) { - furi_check(furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg)); - } else { - furi_check(furi_hal_usb_set_config(&usb_hid, NULL)); + if(id_set) { + furi_check(furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg)); + } else { + furi_check(furi_hal_usb_set_config(&usb_hid, NULL)); + } } storage_file_seek(script_file, 0, true); @@ -535,7 +585,14 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil return 0; } else if(delay_val < 0) { bad_usb->st.error_line = bad_usb->st.line_cur; - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur); + if(delay_val == SCRIPT_STATE_NEXT_LINE) { + snprintf( + bad_usb->st.error, sizeof(bad_usb->st.error), "Forbidden empty line"); + FURI_LOG_E( + WORKER_TAG, "Forbidden empty line at line %u", bad_usb->st.line_cur); + } else { + FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur); + } return SCRIPT_STATE_ERROR; } else { return (delay_val + bad_usb->defdelay); @@ -551,7 +608,22 @@ static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_fil return 0; } -static void bad_usb_hid_state_callback(bool state, void* context) { +static void bad_usb_bt_hid_state_callback(BtStatus status, void* context) { + furi_assert(context); + BadUsbScript* bad_usb = (BadUsbScript*)context; + bool state = (status == BtStatusConnected); + + if(state == true) { + LevelRssiRange r = bt_remote_rssi_range(bad_usb->bt); + if(r != LevelRssiError) { + bt_timeout = bt_hid_delays[r]; + } + furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtConnect); + } else + furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtDisconnect); +} + +static void bad_usb_usb_hid_state_callback(bool state, void* context) { furi_assert(context); BadUsbScript* bad_usb = context; @@ -567,15 +639,28 @@ static int32_t bad_usb_worker(void* context) { BadUsbWorkerState worker_state = BadUsbStateInit; int32_t delay_val = 0; - FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config(); + FuriHalUsbInterface* usb_mode_prev = NULL; + if (bad_usb->bt) { + bt_timeout = bt_hid_delays[LevelRssi39_0]; + bt_disconnect(bad_usb->bt); + furi_delay_ms(200); + bt_keys_storage_set_storage_path(bad_usb->bt, HID_BT_KEYS_STORAGE_PATH); + if(!bt_set_profile(bad_usb->bt, BtProfileHidKeyboard)) { + FURI_LOG_E(TAG, "Failed to switch to HID profile"); + return -1; + } + furi_hal_bt_start_advertising(); + bt_set_status_changed_callback(bad_usb->bt, bad_usb_bt_hid_state_callback, bad_usb); + } else { + usb_mode_prev = furi_hal_usb_get_config(); + furi_hal_hid_set_state_callback(bad_usb_usb_hid_state_callback, bad_usb); + } FURI_LOG_I(WORKER_TAG, "Init"); File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); bad_usb->line = furi_string_alloc(); bad_usb->line_prev = furi_string_alloc(); - furi_hal_hid_set_state_callback(bad_usb_hid_state_callback, bad_usb); - while(1) { if(worker_state == BadUsbStateInit) { // State: initialization if(storage_file_open( @@ -584,10 +669,14 @@ static int32_t bad_usb_worker(void* context) { FSAM_READ, FSOM_OPEN_EXISTING)) { if((ducky_script_preload(bad_usb, script_file)) && (bad_usb->st.line_nb > 0)) { - if(furi_hal_hid_is_connected()) { - worker_state = BadUsbStateIdle; // Ready to run + if (bad_usb->bt) { + worker_state = BadUsbStateNotConnected; // Ready to run } else { - worker_state = BadUsbStateNotConnected; // USB not connected + if(furi_hal_hid_is_connected()) { + worker_state = BadUsbStateIdle; // Ready to run + } else { + worker_state = BadUsbStateNotConnected; // USB not connected + } } } else { worker_state = BadUsbStateScriptError; // Script preload error @@ -655,6 +744,10 @@ static int32_t bad_usb_worker(void* context) { storage_file_seek(script_file, 0, true); // extra time for PC to recognize Flipper as keyboard furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); + if (bad_usb->bt) { + update_bt_timeout(bad_usb->bt); + FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); + } worker_state = BadUsbStateRunning; } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution worker_state = BadUsbStateNotConnected; @@ -671,10 +764,18 @@ static int32_t bad_usb_worker(void* context) { break; } else if(flags & WorkerEvtToggle) { worker_state = BadUsbStateIdle; // Stop executing script - furi_hal_hid_kb_release_all(); + if (bad_usb->bt) { + furi_hal_bt_hid_kb_release_all(); + } else { + furi_hal_hid_kb_release_all(); + } } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected - furi_hal_hid_kb_release_all(); + if (bad_usb->bt) { + furi_hal_bt_hid_kb_release_all(); + } else { + furi_hal_hid_kb_release_all(); + } } bad_usb->st.state = worker_state; continue; @@ -695,7 +796,11 @@ static int32_t bad_usb_worker(void* context) { delay_val = 0; worker_state = BadUsbStateIdle; bad_usb->st.state = BadUsbStateDone; - furi_hal_hid_kb_release_all(); + if (bad_usb->bt) { + furi_hal_bt_hid_kb_release_all(); + } else { + furi_hal_hid_kb_release_all(); + } continue; } else if(delay_val > 1000) { bad_usb->st.state = BadUsbStateDelay; // Show long delays @@ -715,11 +820,34 @@ static int32_t bad_usb_worker(void* context) { break; } } + if (bad_usb->bt) { + update_bt_timeout(bad_usb->bt); + FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); + } } - furi_hal_hid_set_state_callback(NULL, NULL); + if (bad_usb->bt) { + // release all keys + bt_hid_hold_while_keyboard_buffer_full(6, 3000); - furi_hal_usb_set_config(usb_mode_prev, NULL); + // stop ble + bt_set_status_changed_callback(bad_usb->bt, NULL, NULL); + + bt_disconnect(bad_usb->bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_default_path(bad_usb->bt); + + if(!bt_set_profile(bad_usb->bt, BtProfileSerial)) { + FURI_LOG_E(TAG, "Failed to switch to Serial profile"); + } + } else { + furi_hal_hid_set_state_callback(NULL, NULL); + + furi_hal_usb_set_config(usb_mode_prev, NULL); + } storage_file_close(script_file); storage_file_free(script_file); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c index 19576ddd0..494e56b1f 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c @@ -11,8 +11,8 @@ enum VarItemListIndex { void bad_usb_scene_config_bt_connection_callback(VariableItem* item) { BadUsbApp* bad_usb = variable_item_get_context(item); - bad_usb->is_bluetooth = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + bad_usb->is_bt = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); } @@ -28,8 +28,8 @@ void bad_usb_scene_config_bt_on_enter(void* context) { item = variable_item_list_add( var_item_list, "Connection", 2, bad_usb_scene_config_bt_connection_callback, bad_usb); - variable_item_set_current_value_index(item, bad_usb->is_bluetooth); - variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + variable_item_set_current_value_index(item, bad_usb->is_bt); + variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); item = variable_item_list_add( var_item_list, "Keyboard layout", 0, NULL, bad_usb); @@ -55,8 +55,10 @@ bool bad_usb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { if(event.event == VarItemListIndexKeyboardLayout) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { + bad_usb_script_close(bad_usb->bad_usb_script); + bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); scene_manager_previous_scene(bad_usb->scene_manager); - if (bad_usb->is_bluetooth) { + if (bad_usb->is_bt) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); } else { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c index 77a08611c..7cc81de11 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c @@ -9,8 +9,8 @@ enum VarItemListIndex { void bad_usb_scene_config_usb_connection_callback(VariableItem* item) { BadUsbApp* bad_usb = variable_item_get_context(item); - bad_usb->is_bluetooth = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + bad_usb->is_bt = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); } @@ -26,8 +26,8 @@ void bad_usb_scene_config_usb_on_enter(void* context) { item = variable_item_list_add( var_item_list, "Connection", 2, bad_usb_scene_config_usb_connection_callback, bad_usb); - variable_item_set_current_value_index(item, bad_usb->is_bluetooth); - variable_item_set_current_value_text(item, bad_usb->is_bluetooth ? "BT" : "USB"); + variable_item_set_current_value_index(item, bad_usb->is_bt); + variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); item = variable_item_list_add( var_item_list, "Keyboard layout", 0, NULL, bad_usb); @@ -47,8 +47,10 @@ bool bad_usb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { if(event.event == VarItemListIndexKeyboardLayout) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { + bad_usb_script_close(bad_usb->bad_usb_script); + bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); scene_manager_previous_scene(bad_usb->scene_manager); - if (bad_usb->is_bluetooth) { + if (bad_usb->is_bt) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); } else { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c index 5176e3b28..eb72f1765 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c @@ -29,7 +29,7 @@ void bad_usb_scene_file_select_on_enter(void* context) { } if(bad_usb_file_select(bad_usb)) { - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->bt); + bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_work.c b/applications/main/bad_usb/scenes/bad_usb_scene_work.c index 1f6af5545..03a8114e0 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_work.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_work.c @@ -16,7 +16,7 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == InputKeyLeft) { - if (app->is_bluetooth) { + if (app->is_bt) { scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigBt); } else { scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigUsb); From feac699dcbab1eb36609c938b94a9346b5c433a3 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 29 Jan 2023 19:35:20 +0000 Subject: [PATCH 11/36] Fix keyboard layouts on ble bad usb --- applications/main/bad_usb/bad_usb_script.c | 7 +++++++ applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c | 1 + .../main/bad_usb/scenes/bad_usb_scene_config_usb.c | 1 + 3 files changed, 9 insertions(+) diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index a61bc1e06..6ad428b4d 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -56,6 +56,7 @@ struct BadUsbScript { FuriHalUsbHidConfig hid_cfg; BadUsbState st; FuriString* file_path; + FuriString* keyboard_layout; uint32_t defdelay; uint16_t layout[128]; FuriThread* thread; @@ -719,6 +720,7 @@ static int32_t bad_usb_worker(void* context) { bad_usb->repeat_cnt = 0; bad_usb->file_end = false; storage_file_seek(script_file, 0, true); + bad_usb_script_set_keyboard_layout(bad_usb, bad_usb->keyboard_layout); worker_state = BadUsbStateRunning; } else if(flags & WorkerEvtDisconnect) { worker_state = BadUsbStateNotConnected; // USB disconnected @@ -748,6 +750,7 @@ static int32_t bad_usb_worker(void* context) { update_bt_timeout(bad_usb->bt); FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } + bad_usb_script_set_keyboard_layout(bad_usb, bad_usb->keyboard_layout); worker_state = BadUsbStateRunning; } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution worker_state = BadUsbStateNotConnected; @@ -861,6 +864,7 @@ static int32_t bad_usb_worker(void* context) { static void bad_usb_script_set_default_keyboard_layout(BadUsbScript* bad_usb) { furi_assert(bad_usb); + furi_string_set_str(bad_usb->keyboard_layout, ""); memset(bad_usb->layout, HID_KEYBOARD_NONE, sizeof(bad_usb->layout)); memcpy(bad_usb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_usb->layout))); } @@ -871,6 +875,7 @@ BadUsbScript* bad_usb_script_open(FuriString* file_path, Bt* bt) { BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript)); bad_usb->file_path = furi_string_alloc(); furi_string_set(bad_usb->file_path, file_path); + bad_usb->keyboard_layout = furi_string_alloc(); bad_usb_script_set_default_keyboard_layout(bad_usb); bad_usb->st.state = BadUsbStateInit; @@ -890,6 +895,7 @@ void bad_usb_script_close(BadUsbScript* bad_usb) { furi_thread_join(bad_usb->thread); furi_thread_free(bad_usb->thread); furi_string_free(bad_usb->file_path); + furi_string_free(bad_usb->keyboard_layout); free(bad_usb); } @@ -903,6 +909,7 @@ void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, FuriString* layou File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); if(!furi_string_empty(layout_path)) { + furi_string_set(bad_usb->keyboard_layout, layout_path); if(storage_file_open( layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { uint16_t layout[128]; diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c index 494e56b1f..7071e748e 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c @@ -57,6 +57,7 @@ bool bad_usb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { } else if(event.event == VarItemListIndexConnection) { bad_usb_script_close(bad_usb->bad_usb_script); bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); + bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_previous_scene(bad_usb->scene_manager); if (bad_usb->is_bt) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c index 7cc81de11..af7abd570 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c +++ b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c @@ -49,6 +49,7 @@ bool bad_usb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { } else if(event.event == VarItemListIndexConnection) { bad_usb_script_close(bad_usb->bad_usb_script); bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); + bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); scene_manager_previous_scene(bad_usb->scene_manager); if (bad_usb->is_bt) { scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); From fb1218c9a55e74c3a4bb67c06e19a1b5b3975d7c Mon Sep 17 00:00:00 2001 From: yocvito Date: Mon, 30 Jan 2023 13:31:24 +0100 Subject: [PATCH 12/36] Removes pin verif when using BT for bad-USB --- applications/main/bad_usb/bad_usb_script.c | 6 +++ applications/services/bt/bt_service/bt.c | 47 +++++++++---------- applications/services/bt/bt_service/bt.h | 4 ++ firmware/targets/f7/api_symbols.csv | 6 ++- firmware/targets/f7/ble_glue/gap.c | 13 ++++- firmware/targets/f7/furi_hal/furi_hal_bt.c | 10 ++++ .../targets/furi_hal_include/furi_hal_bt.h | 4 ++ 7 files changed, 63 insertions(+), 27 deletions(-) diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index 6ad428b4d..a93a18046 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -641,15 +641,19 @@ static int32_t bad_usb_worker(void* context) { int32_t delay_val = 0; FuriHalUsbInterface* usb_mode_prev = NULL; + GapPairing old_pairing_method = GapPairingNone; if (bad_usb->bt) { bt_timeout = bt_hid_delays[LevelRssi39_0]; bt_disconnect(bad_usb->bt); furi_delay_ms(200); bt_keys_storage_set_storage_path(bad_usb->bt, HID_BT_KEYS_STORAGE_PATH); + if(!bt_set_profile(bad_usb->bt, BtProfileHidKeyboard)) { FURI_LOG_E(TAG, "Failed to switch to HID profile"); return -1; } + old_pairing_method = bt_get_profile_pairing_method(bad_usb->bt); + bt_set_profile_pairing_method(bad_usb->bt, GapPairingNone); furi_hal_bt_start_advertising(); bt_set_status_changed_callback(bad_usb->bt, bad_usb_bt_hid_state_callback, bad_usb); } else { @@ -843,6 +847,8 @@ static int32_t bad_usb_worker(void* context) { bt_keys_storage_set_default_path(bad_usb->bt); + bt_set_profile_pairing_method(bad_usb->bt, old_pairing_method); + if(!bt_set_profile(bad_usb->bt, BtProfileSerial)) { FURI_LOG_E(TAG, "Failed to switch to Serial profile"); } diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index ad3ae71c9..d37216bad 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -370,12 +370,16 @@ static void bt_close_connection(Bt* bt) { furi_event_flag_set(bt->api_event, BT_API_UNLOCK_EVENT); } -static void bt_restart(Bt* bt) { - if(bt->profile == BtProfileHidKeyboard) { - furi_hal_bt_change_app(FuriHalBtProfileHidKeyboard, bt_on_gap_event_callback, bt); +static inline FuriHalBtProfile get_hal_bt_profile(BtProfile profile) { + if(profile == BtProfileHidKeyboard) { + return FuriHalBtProfileHidKeyboard; } else { - furi_hal_bt_change_app(FuriHalBtProfileSerial, bt_on_gap_event_callback, bt); + return FuriHalBtProfileSerial; } +} + +static void bt_restart(Bt* bt) { + furi_hal_bt_change_app(get_hal_bt_profile(bt->profile), bt_on_gap_event_callback, bt); furi_hal_bt_start_advertising(); } @@ -388,44 +392,28 @@ void bt_set_profile_adv_name(Bt* bt, const char* fmt, ...) { va_start(args, fmt); vsnprintf(name, sizeof(name), fmt, args); va_end(args); - if(bt->profile == BtProfileHidKeyboard) { - furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, name); - } else { - furi_hal_bt_set_profile_adv_name(FuriHalBtProfileSerial, name); - } + furi_hal_bt_set_profile_adv_name(get_hal_bt_profile(bt->profile), name); bt_restart(bt); } const char* bt_get_profile_adv_name(Bt* bt) { furi_assert(bt); - if(bt->profile == BtProfileHidKeyboard) { - return furi_hal_bt_get_profile_adv_name(FuriHalBtProfileHidKeyboard); - } else { - return furi_hal_bt_get_profile_adv_name(FuriHalBtProfileSerial); - } + return furi_hal_bt_get_profile_adv_name(get_hal_bt_profile(bt->profile)); } void bt_set_profile_mac_address(Bt* bt, const uint8_t mac[6]) { furi_assert(bt); furi_assert(mac); - if(bt->profile == BtProfileHidKeyboard) { - furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, mac); - } else { - furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileSerial, mac); - } + furi_hal_bt_set_profile_mac_addr(get_hal_bt_profile(bt->profile), mac); bt_restart(bt); } const uint8_t* bt_get_profile_mac_address(Bt* bt) { furi_assert(bt); - if(bt->profile == BtProfileHidKeyboard) { - return furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileHidKeyboard); - } else { - return furi_hal_bt_get_profile_mac_addr(FuriHalBtProfileSerial); - } + return furi_hal_bt_get_profile_mac_addr(get_hal_bt_profile(bt->profile)); } bool bt_remote_rssi(Bt* bt, BtRssi* rssi) { @@ -443,6 +431,17 @@ bool bt_remote_rssi(Bt* bt, BtRssi* rssi) { return true; } +void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method) { + furi_assert(bt); + furi_hal_bt_set_profile_pairing_method(get_hal_bt_profile(bt->profile), pairing_method); + bt_restart(bt); +} + +GapPairing bt_get_profile_pairing_method(Bt* bt) { + furi_assert(bt); + return furi_hal_bt_get_profile_pairing_method(get_hal_bt_profile(bt->profile)); +} + int32_t bt_srv(void* p) { UNUSED(p); Bt* bt = bt_alloc(); diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index 60420a7f7..046887a2c 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -2,6 +2,7 @@ #include #include +#include #ifdef __cplusplus extern "C" { @@ -48,6 +49,9 @@ const uint8_t* bt_get_profile_mac_address(Bt* bt); bool bt_remote_rssi(Bt* bt, BtRssi* rssi); +void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method); +GapPairing bt_get_profile_pairing_method(Bt* bt); + /** Disconnect from Central * * @param bt Bt instance diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index aabe45714..213e6061f 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,13.0,, +Version,+,13.2,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -573,12 +573,14 @@ Function,+,bt_disconnect,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_get_profile_adv_name,const char*,Bt* Function,+,bt_get_profile_mac_address,const uint8_t*,Bt* +Function,+,bt_get_profile_pairing_method,GapPairing,Bt* Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*" Function,+,bt_remote_rssi,_Bool,"Bt*, BtRssi*" Function,+,bt_set_profile,_Bool,"Bt*, BtProfile" Function,+,bt_set_profile_adv_name,void,"Bt*, const char*, ..." Function,+,bt_set_profile_mac_address,void,"Bt*, const uint8_t[6]" +Function,+,bt_set_profile_pairing_method,void,"Bt*, GapPairing" Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*" Function,+,buffered_file_stream_alloc,Stream*,Storage* Function,+,buffered_file_stream_close,_Bool,Stream* @@ -1004,6 +1006,7 @@ Function,+,furi_hal_bt_get_conn_rssi,uint32_t,uint8_t* Function,+,furi_hal_bt_get_key_storage_buff,void,"uint8_t**, uint16_t*" Function,+,furi_hal_bt_get_profile_adv_name,const char*,FuriHalBtProfile Function,+,furi_hal_bt_get_profile_mac_addr,const uint8_t*,FuriHalBtProfile +Function,+,furi_hal_bt_get_profile_pairing_method,GapPairing,FuriHalBtProfile Function,+,furi_hal_bt_get_radio_stack,FuriHalBtStack, Function,+,furi_hal_bt_get_rssi,float, Function,+,furi_hal_bt_get_transmitted_packets,uint32_t, @@ -1039,6 +1042,7 @@ Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t" Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*" Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" Function,+,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" +Function,+,furi_hal_bt_set_profile_pairing_method,void,"FuriHalBtProfile, GapPairing" Function,+,furi_hal_bt_start_advertising,void, Function,+,furi_hal_bt_start_app,_Bool,"FuriHalBtProfile, GapEventCallback, void*" Function,+,furi_hal_bt_start_packet_rx,void,"uint8_t, uint8_t" diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 668509218..66786297f 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -377,15 +377,24 @@ static void gap_init_svc(Gap* gap) { aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO); keypress_supported = true; } + + uint8_t conf_mitm = CFG_MITM_PROTECTION; + uint8_t conf_used_fixed_pin = CFG_USED_FIXED_PIN; + + if (gap->config->pairing_method == GapPairingNone) { + conf_mitm = 0; + conf_used_fixed_pin = 0; + } + // Setup authentication aci_gap_set_authentication_requirement( gap->config->bonding_mode, - CFG_MITM_PROTECTION, + conf_mitm, CFG_SC_SUPPORT, keypress_supported, CFG_ENCRYPTION_KEY_SIZE_MIN, CFG_ENCRYPTION_KEY_SIZE_MAX, - CFG_USED_FIXED_PIN, // 0x0 for no pin + conf_used_fixed_pin, // 0x0 for no pin 0, PUBLIC_ADDR); // Configure whitelist diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index 1e7b80040..f33c92c62 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -495,3 +495,13 @@ const uint8_t* furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile) { furi_assert(profile < FuriHalBtProfileNumber); return profile_config[profile].config.mac_address; } + +void furi_hal_bt_set_profile_pairing_method(FuriHalBtProfile profile, GapPairing pairing_method) { + furi_assert(profile < FuriHalBtProfileNumber); + profile_config[profile].config.pairing_method = pairing_method; +} + +GapPairing furi_hal_bt_get_profile_pairing_method(FuriHalBtProfile profile) { + furi_assert(profile < FuriHalBtProfileNumber); + return profile_config[profile].config.pairing_method; +} diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index fb17436f4..3e554bb4f 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -246,6 +246,10 @@ const uint8_t* furi_hal_bt_get_profile_mac_addr(FuriHalBtProfile profile); uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi); +void furi_hal_bt_set_profile_pairing_method(FuriHalBtProfile profile, GapPairing pairing_method); + +GapPairing furi_hal_bt_get_profile_pairing_method(FuriHalBtProfile profile); + #ifdef __cplusplus } #endif From cf89c9db898286a374e653cd4e6e16bffdc93e30 Mon Sep 17 00:00:00 2001 From: yocvito Date: Mon, 30 Jan 2023 21:32:55 +0100 Subject: [PATCH 13/36] Automatically accepts PIN verif when GapPairingNone was selected, but the remote host refused the non-auth pairing and switched to numeric comparaison ethod (pin verif yes or no) --- applications/services/bt/bt_service/bt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index d37216bad..6108a7790 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -76,7 +76,10 @@ static void bt_pin_code_hide(Bt* bt) { static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { furi_assert(bt); - + + if (bt_get_profile_pairing_method(bt) == GapPairingNone) + return true; + notification_message(bt->notification, &sequence_display_backlight_on); FuriString* pin_str; dialog_message_set_icon(bt->dialog_message, XTREME_ASSETS()->I_BLE_Pairing_128x64, 0, 0); @@ -86,6 +89,7 @@ static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { dialog_message_set_buttons(bt->dialog_message, "Cancel", "OK", NULL); DialogMessageButton button = dialog_message_show(bt->dialogs, bt->dialog_message); furi_string_free(pin_str); + return button == DialogMessageButtonCenter; } @@ -431,7 +435,7 @@ bool bt_remote_rssi(Bt* bt, BtRssi* rssi) { return true; } -void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method) { +void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method) { furi_assert(bt); furi_hal_bt_set_profile_pairing_method(get_hal_bt_profile(bt->profile), pairing_method); bt_restart(bt); From f3848724497f703c5e8020d3e045a812636b2b96 Mon Sep 17 00:00:00 2001 From: yocvito Date: Mon, 30 Jan 2023 22:01:38 +0100 Subject: [PATCH 14/36] BLE GAP: specifies Keyboard yes/no IO capability for GapPairingNone case during gap init, in case 'Just works' pairing method is not accepted by remote host --- firmware/targets/f7/ble_glue/gap.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 66786297f..892fbd2a9 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -371,21 +371,24 @@ static void gap_init_svc(Gap* gap) { hci_le_set_default_phy(ALL_PHYS_PREFERENCE, TX_2M_PREFERRED, RX_2M_PREFERRED); // Set I/O capability bool keypress_supported = false; + uint8_t conf_mitm = CFG_MITM_PROTECTION; + uint8_t conf_used_fixed_pin = CFG_USED_FIXED_PIN; if(gap->config->pairing_method == GapPairingPinCodeShow) { aci_gap_set_io_capability(IO_CAP_DISPLAY_ONLY); } else if(gap->config->pairing_method == GapPairingPinCodeVerifyYesNo) { aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO); keypress_supported = true; - } - - uint8_t conf_mitm = CFG_MITM_PROTECTION; - uint8_t conf_used_fixed_pin = CFG_USED_FIXED_PIN; - - if (gap->config->pairing_method == GapPairingNone) { + } else if (gap->config->pairing_method == GapPairingNone) { + // Just works pairing method (IOS accept it, it seems android and linux doesn't) conf_mitm = 0; conf_used_fixed_pin = 0; + // if just works isn't supported, we want the numeric comparaison method + aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO); + keypress_supported = true; } + + // Setup authentication aci_gap_set_authentication_requirement( gap->config->bonding_mode, From 5ebed42995aa0f121c9589e02323f66391ccbd95 Mon Sep 17 00:00:00 2001 From: yocvito Date: Tue, 31 Jan 2023 22:05:36 +0100 Subject: [PATCH 15/36] moves faps_copy syntax to new fap_deploy one in fbt help message --- scripts/fbt_tools/fbt_help.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/fbt_tools/fbt_help.py b/scripts/fbt_tools/fbt_help.py index 9921588ed..afdb36665 100644 --- a/scripts/fbt_tools/fbt_help.py +++ b/scripts/fbt_tools/fbt_help.py @@ -11,7 +11,7 @@ Building: Build all FAP apps fap_{APPID}, launch_app APPSRC={APPID}: Build FAP app with appid={APPID}; upload & start it over USB - faps_copy: + fap_deploy: Build and upload all FAP apps over USB Flashing & debugging: From e4c642b72c758984a6fe7daca0719d43dd8c8846 Mon Sep 17 00:00:00 2001 From: yocvito Date: Wed, 1 Feb 2023 12:01:55 +0100 Subject: [PATCH 16/36] Restores bt mac @ and adv name before quitting bad usb app --- applications/main/bad_usb/bad_usb_app.c | 13 +++++++++++++ applications/main/bad_usb/bad_usb_app_i.h | 10 ++++++++++ applications/main/bad_usb/bad_usb_script.c | 11 +++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_usb/bad_usb_app.c index 63f95a860..43ed76c37 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_usb/bad_usb_app.c @@ -99,9 +99,11 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { app->bt = bt; const char* adv_name = bt_get_profile_adv_name(bt); memcpy(app->name, adv_name, BAD_USB_ADV_NAME_MAX_LEN); + memcpy(app->bt_old_config.name, adv_name, BAD_USB_ADV_NAME_MAX_LEN); const uint8_t* mac_addr = bt_get_profile_mac_address(bt); memcpy(app->mac, mac_addr, BAD_USB_MAC_ADDRESS_LEN); + memcpy(app->bt_old_config.mac, mac_addr, BAD_USB_MAC_ADDRESS_LEN); // Custom Widget app->widget = widget_alloc(); @@ -180,6 +182,17 @@ void bad_usb_app_free(BadUsbApp* app) { view_dispatcher_free(app->view_dispatcher); scene_manager_free(app->scene_manager); + // restores bt config + // BtProfile have already been switched to the previous one + // so we directly modify the right profile + if (strcmp(app->bt_old_config.name, app->name) != 0) { + furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->bt_old_config.name); + } + if (memcmp(app->bt_old_config.mac, app->mac, BAD_USB_MAC_ADDRESS_LEN) != 0) { + furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->bt_old_config.mac); + } + + // Close records furi_record_close(RECORD_GUI); furi_record_close(RECORD_NOTIFICATION); diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h index ba0dee88b..abd252bb4 100644 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ b/applications/main/bad_usb/bad_usb_app_i.h @@ -35,6 +35,15 @@ typedef enum BadUsbCustomEvent { BadUsbCustomEventErrorBack } BadUsbCustomEvent; +typedef struct { + uint8_t mac[BAD_USB_MAC_ADDRESS_LEN]; + char name[BAD_USB_ADV_NAME_MAX_LEN + 1]; + + // number of bt keys before starting the app (all keys added in + // the bt keys file then will be removed) + uint16_t n_keys; +} BadUsbBtConfig; + struct BadUsbApp { Gui* gui; ViewDispatcher* view_dispatcher; @@ -50,6 +59,7 @@ struct BadUsbApp { ByteInput* byte_input; uint8_t mac[BAD_USB_MAC_ADDRESS_LEN]; char name[BAD_USB_ADV_NAME_MAX_LEN + 1]; + BadUsbBtConfig bt_old_config; BadUsbAppError error; FuriString* file_path; diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index 2e4c35a83..51ce49df9 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -648,8 +648,7 @@ static int32_t bad_usb_worker(void* context) { bt_disconnect(bad_usb->bt); furi_delay_ms(200); bt_keys_storage_set_storage_path(bad_usb->bt, HID_BT_KEYS_STORAGE_PATH); - - if(!bt_set_profile(bad_usb->bt, BtProfileHidKeyboard)) { + if (!bt_set_profile(bad_usb->bt, BtProfileHidKeyboard)) { FURI_LOG_E(TAG, "Failed to switch to HID profile"); return -1; } @@ -849,10 +848,10 @@ static int32_t bad_usb_worker(void* context) { bt_keys_storage_set_default_path(bad_usb->bt); bt_set_profile_pairing_method(bad_usb->bt, old_pairing_method); - - if(!bt_set_profile(bad_usb->bt, BtProfileSerial)) { - FURI_LOG_E(TAG, "Failed to switch to Serial profile"); - } + + // fails if ble radio stack isn't ready when switching profile + // if it happens, maybe we should increase the delay after bt_disconnect + bt_set_profile(bad_usb->bt, BtProfileSerial); } else { furi_hal_hid_set_state_callback(NULL, NULL); From f3bb068fd71a864e360fec037e836f183a1d5c52 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 17:43:59 +0000 Subject: [PATCH 17/36] Rename bad usb to bad kb --- applications/ReadMe.md | 2 +- .../file_browser_test/file_browser_app.c | 2 +- .../icons/{badusb_10px.png => badkb_10px.png} | Bin .../scenes/file_browser_scene_start.c | 2 +- applications/main/application.fam | 4 +- .../main/archive/helpers/archive_browser.h | 6 +- .../main/archive/helpers/archive_files.c | 6 +- .../main/archive/helpers/archive_files.h | 2 +- .../archive/scenes/archive_scene_browser.c | 2 +- .../main/archive/views/archive_browser_view.c | 12 +- .../main/archive/views/archive_browser_view.h | 2 +- .../main/{bad_usb => bad_kb}/application.fam | 10 +- .../bad_usb_app.c => bad_kb/bad_kb_app.c} | 116 ++--- applications/main/bad_kb/bad_kb_app.h | 13 + applications/main/bad_kb/bad_kb_app_i.h | 80 ++++ .../bad_kb_script.c} | 426 +++++++++--------- applications/main/bad_kb/bad_kb_script.h | 49 ++ .../main/bad_kb/bad_kb_settings_filename.h | 3 + .../main/bad_kb/scenes/bad_kb_scene.c | 30 ++ .../scenes/bad_kb_scene.h} | 16 +- .../main/bad_kb/scenes/bad_kb_scene_config.h | 8 + .../bad_kb/scenes/bad_kb_scene_config_bt.c | 84 ++++ .../scenes/bad_kb_scene_config_layout.c | 48 ++ .../bad_kb/scenes/bad_kb_scene_config_mac.c | 57 +++ .../bad_kb/scenes/bad_kb_scene_config_name.c | 46 ++ .../bad_kb/scenes/bad_kb_scene_config_usb.c | 72 +++ .../scenes/bad_kb_scene_error.c} | 30 +- .../bad_kb/scenes/bad_kb_scene_file_select.c | 52 +++ .../main/bad_kb/scenes/bad_kb_scene_work.c | 58 +++ .../views/bad_kb_view.c} | 114 ++--- applications/main/bad_kb/views/bad_kb_view.h | 21 + applications/main/bad_usb/bad_usb_app.h | 13 - applications/main/bad_usb/bad_usb_app_i.h | 80 ---- applications/main/bad_usb/bad_usb_script.h | 49 -- .../main/bad_usb/bad_usb_settings_filename.h | 3 - .../main/bad_usb/scenes/bad_usb_scene.c | 30 -- .../bad_usb/scenes/bad_usb_scene_config.h | 8 - .../bad_usb/scenes/bad_usb_scene_config_bt.c | 84 ---- .../scenes/bad_usb_scene_config_layout.c | 48 -- .../bad_usb/scenes/bad_usb_scene_config_mac.c | 57 --- .../scenes/bad_usb_scene_config_name.c | 46 -- .../bad_usb/scenes/bad_usb_scene_config_usb.c | 72 --- .../scenes/bad_usb_scene_file_select.c | 52 --- .../main/bad_usb/scenes/bad_usb_scene_work.c | 58 --- .../main/bad_usb/views/bad_usb_view.h | 21 - .../dolphinbackup/storage_DolphinBackup.c | 2 +- .../icons/{badusb_10px.png => badkb_10px.png} | Bin .../{badusb_10px.png => badkb_10px.png} | Bin .../plugins/mousejacker/mousejacker.c | 4 +- .../plugins/totp/services/config/config.c | 4 +- .../totp_scene_generate_token.c | 40 +- .../services/dolphin/helpers/dolphin_deed.c | 4 +- .../services/dolphin/helpers/dolphin_deed.h | 4 +- .../gui/modules/file_browser_worker.c | 4 +- .../{badusb_10px.png => badkb_10px.png} | Bin .../icons/{BadUsb => BadKb}/Clock_18x18.png | Bin .../icons/{BadUsb => BadKb}/Error_18x18.png | Bin .../{BadUsb => BadKb}/EviSmile1_18x21.png | Bin .../{BadUsb => BadKb}/EviSmile2_18x21.png | Bin .../{BadUsb => BadKb}/EviWaiting1_18x21.png | Bin .../{BadUsb => BadKb}/EviWaiting2_18x21.png | Bin .../icons/{BadUsb => BadKb}/Percent_10x14.png | Bin .../icons/{BadUsb => BadKb}/Smile_18x18.png | Bin .../icons/{BadUsb => BadKb}/UsbTree_48x22.png | Bin .../{BadUsb_14 => BadKb_14}/frame_01.png | Bin .../{BadUsb_14 => BadKb_14}/frame_02.png | Bin .../{BadUsb_14 => BadKb_14}/frame_03.png | Bin .../{BadUsb_14 => BadKb_14}/frame_04.png | Bin .../{BadUsb_14 => BadKb_14}/frame_05.png | Bin .../{BadUsb_14 => BadKb_14}/frame_06.png | Bin .../{BadUsb_14 => BadKb_14}/frame_07.png | Bin .../{BadUsb_14 => BadKb_14}/frame_08.png | Bin .../{BadUsb_14 => BadKb_14}/frame_09.png | Bin .../{BadUsb_14 => BadKb_14}/frame_10.png | Bin .../{BadUsb_14 => BadKb_14}/frame_11.png | Bin .../{BadUsb_14 => BadKb_14}/frame_rate | 0 assets/resources/badkb/.badkb.settings | 1 + .../Kiosk-Evasion-Bruteforce.txt | 0 .../{badusb => badkb}/Wifi-Stealer_ORG.txt | 0 .../{badusb => badkb}/demo_macos.txt | 4 +- .../{badusb => badkb}/demo_windows.txt | 4 +- .../{badusb => badkb}/layouts/ba-BA.kl | Bin .../{badusb => badkb}/layouts/cz_CS.kl | Bin .../{badusb => badkb}/layouts/da-DA.kl | Bin .../{badusb => badkb}/layouts/de-CH.kl | Bin .../{badusb => badkb}/layouts/de-DE.kl | Bin .../{badusb => badkb}/layouts/dvorak.kl | Bin .../{badusb => badkb}/layouts/en-UK.kl | Bin .../{badusb => badkb}/layouts/en-US.kl | Bin .../{badusb => badkb}/layouts/es-ES.kl | Bin .../{badusb => badkb}/layouts/fr-BE.kl | Bin .../{badusb => badkb}/layouts/fr-CH.kl | Bin .../{badusb => badkb}/layouts/fr-FR.kl | Bin .../{badusb => badkb}/layouts/hr-HR.kl | Bin .../{badusb => badkb}/layouts/hu-HU.kl | Bin .../{badusb => badkb}/layouts/it-IT.kl | Bin .../{badusb => badkb}/layouts/nb-NO.kl | Bin .../{badusb => badkb}/layouts/nl-NL.kl | Bin .../{badusb => badkb}/layouts/pt-BR.kl | Bin .../{badusb => badkb}/layouts/pt-PT.kl | Bin .../{badusb => badkb}/layouts/si-SI.kl | Bin .../{badusb => badkb}/layouts/sk-SK.kl | Bin .../{badusb => badkb}/layouts/sv-SE.kl | Bin .../{badusb => badkb}/layouts/tr-TR.kl | Bin assets/resources/badusb/.badusb.settings | 1 - 105 files changed, 1033 insertions(+), 1033 deletions(-) rename applications/debug/file_browser_test/icons/{badusb_10px.png => badkb_10px.png} (100%) rename applications/main/{bad_usb => bad_kb}/application.fam (55%) rename applications/main/{bad_usb/bad_usb_app.c => bad_kb/bad_kb_app.c} (52%) create mode 100644 applications/main/bad_kb/bad_kb_app.h create mode 100644 applications/main/bad_kb/bad_kb_app_i.h rename applications/main/{bad_usb/bad_usb_script.c => bad_kb/bad_kb_script.c} (65%) create mode 100644 applications/main/bad_kb/bad_kb_script.h create mode 100644 applications/main/bad_kb/bad_kb_settings_filename.h create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene.c rename applications/main/{bad_usb/scenes/bad_usb_scene.h => bad_kb/scenes/bad_kb_scene.h} (68%) create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config.h create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config_layout.c create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config_mac.c create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config_name.c create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c rename applications/main/{bad_usb/scenes/bad_usb_scene_error.c => bad_kb/scenes/bad_kb_scene_error.c} (70%) create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_file_select.c create mode 100644 applications/main/bad_kb/scenes/bad_kb_scene_work.c rename applications/main/{bad_usb/views/bad_usb_view.c => bad_kb/views/bad_kb_view.c} (70%) create mode 100644 applications/main/bad_kb/views/bad_kb_view.h delete mode 100644 applications/main/bad_usb/bad_usb_app.h delete mode 100644 applications/main/bad_usb/bad_usb_app_i.h delete mode 100644 applications/main/bad_usb/bad_usb_script.h delete mode 100644 applications/main/bad_usb/bad_usb_settings_filename.h delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config.h delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_name.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_file_select.c delete mode 100644 applications/main/bad_usb/scenes/bad_usb_scene_work.c delete mode 100644 applications/main/bad_usb/views/bad_usb_view.h rename applications/plugins/mousejacker/icons/{badusb_10px.png => badkb_10px.png} (100%) rename applications/plugins/mousejacker/images/{badusb_10px.png => badkb_10px.png} (100%) rename assets/icons/Archive/{badusb_10px.png => badkb_10px.png} (100%) rename assets/icons/{BadUsb => BadKb}/Clock_18x18.png (100%) rename assets/icons/{BadUsb => BadKb}/Error_18x18.png (100%) rename assets/icons/{BadUsb => BadKb}/EviSmile1_18x21.png (100%) rename assets/icons/{BadUsb => BadKb}/EviSmile2_18x21.png (100%) rename assets/icons/{BadUsb => BadKb}/EviWaiting1_18x21.png (100%) rename assets/icons/{BadUsb => BadKb}/EviWaiting2_18x21.png (100%) rename assets/icons/{BadUsb => BadKb}/Percent_10x14.png (100%) rename assets/icons/{BadUsb => BadKb}/Smile_18x18.png (100%) rename assets/icons/{BadUsb => BadKb}/UsbTree_48x22.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_01.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_02.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_03.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_04.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_05.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_06.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_07.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_08.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_09.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_10.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_11.png (100%) rename assets/icons/MainMenu/{BadUsb_14 => BadKb_14}/frame_rate (100%) create mode 100644 assets/resources/badkb/.badkb.settings rename assets/resources/{badusb => badkb}/Kiosk-Evasion-Bruteforce.txt (100%) rename assets/resources/{badusb => badkb}/Wifi-Stealer_ORG.txt (100%) rename assets/resources/{badusb => badkb}/demo_macos.txt (92%) rename assets/resources/{badusb => badkb}/demo_windows.txt (92%) rename assets/resources/{badusb => badkb}/layouts/ba-BA.kl (100%) rename assets/resources/{badusb => badkb}/layouts/cz_CS.kl (100%) rename assets/resources/{badusb => badkb}/layouts/da-DA.kl (100%) rename assets/resources/{badusb => badkb}/layouts/de-CH.kl (100%) rename assets/resources/{badusb => badkb}/layouts/de-DE.kl (100%) rename assets/resources/{badusb => badkb}/layouts/dvorak.kl (100%) rename assets/resources/{badusb => badkb}/layouts/en-UK.kl (100%) rename assets/resources/{badusb => badkb}/layouts/en-US.kl (100%) rename assets/resources/{badusb => badkb}/layouts/es-ES.kl (100%) rename assets/resources/{badusb => badkb}/layouts/fr-BE.kl (100%) rename assets/resources/{badusb => badkb}/layouts/fr-CH.kl (100%) rename assets/resources/{badusb => badkb}/layouts/fr-FR.kl (100%) rename assets/resources/{badusb => badkb}/layouts/hr-HR.kl (100%) rename assets/resources/{badusb => badkb}/layouts/hu-HU.kl (100%) rename assets/resources/{badusb => badkb}/layouts/it-IT.kl (100%) rename assets/resources/{badusb => badkb}/layouts/nb-NO.kl (100%) rename assets/resources/{badusb => badkb}/layouts/nl-NL.kl (100%) rename assets/resources/{badusb => badkb}/layouts/pt-BR.kl (100%) rename assets/resources/{badusb => badkb}/layouts/pt-PT.kl (100%) rename assets/resources/{badusb => badkb}/layouts/si-SI.kl (100%) rename assets/resources/{badusb => badkb}/layouts/sk-SK.kl (100%) rename assets/resources/{badusb => badkb}/layouts/sv-SE.kl (100%) rename assets/resources/{badusb => badkb}/layouts/tr-TR.kl (100%) delete mode 100644 assets/resources/badusb/.badusb.settings diff --git a/applications/ReadMe.md b/applications/ReadMe.md index 3bd2aeb06..efc9afd86 100644 --- a/applications/ReadMe.md +++ b/applications/ReadMe.md @@ -25,7 +25,7 @@ Applications for factory testing the Flipper. Applications for main Flipper menu. - `archive` - Archive and file manager -- `bad_usb` - Bad USB application +- `bad_kb` - Bad KB application - `fap_loader` - External applications loader - `gpio` - GPIO application: includes USART bridge and GPIO control - `ibutton` - iButton application, onewire keys and more diff --git a/applications/debug/file_browser_test/file_browser_app.c b/applications/debug/file_browser_test/file_browser_app.c index bf423d34e..1df4891cd 100644 --- a/applications/debug/file_browser_test/file_browser_app.c +++ b/applications/debug/file_browser_test/file_browser_app.c @@ -48,7 +48,7 @@ FileBrowserApp* file_browser_app_alloc(char* arg) { app->file_path = furi_string_alloc(); app->file_browser = file_browser_alloc(app->file_path); - file_browser_configure(app->file_browser, "*", NULL, true, false, &I_badusb_10px, true); + file_browser_configure(app->file_browser, "*", NULL, true, false, &I_badkb_10px, true); view_dispatcher_add_view( app->view_dispatcher, FileBrowserAppViewStart, widget_get_view(app->widget)); diff --git a/applications/debug/file_browser_test/icons/badusb_10px.png b/applications/debug/file_browser_test/icons/badkb_10px.png similarity index 100% rename from applications/debug/file_browser_test/icons/badusb_10px.png rename to applications/debug/file_browser_test/icons/badkb_10px.png diff --git a/applications/debug/file_browser_test/scenes/file_browser_scene_start.c b/applications/debug/file_browser_test/scenes/file_browser_scene_start.c index 9eb26944f..9211ff3bb 100644 --- a/applications/debug/file_browser_test/scenes/file_browser_scene_start.c +++ b/applications/debug/file_browser_test/scenes/file_browser_scene_start.c @@ -19,7 +19,7 @@ bool file_browser_scene_start_on_event(void* context, SceneManagerEvent event) { bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { - furi_string_set(app->file_path, ANY_PATH("badusb/demo_windows.txt")); + furi_string_set(app->file_path, ANY_PATH("badkb/demo_windows.txt")); scene_manager_next_scene(app->scene_manager, FileBrowserSceneBrowser); consumed = true; } else if(event.type == SceneManagerEventTypeTick) { diff --git a/applications/main/application.fam b/applications/main/application.fam index 9820ee3ac..eefb801b3 100644 --- a/applications/main/application.fam +++ b/applications/main/application.fam @@ -9,7 +9,7 @@ App( "lfrfid", "nfc", "subghz", - "bad_usb", + "bad_kb", "u2f", "fap_loader", "sub_playlist", @@ -30,7 +30,7 @@ App( "lfrfid", "nfc", "subghz", - # "bad_usb", + # "bad_kb", # "u2f", "fap_loader", "archive", diff --git a/applications/main/archive/helpers/archive_browser.h b/applications/main/archive/helpers/archive_browser.h index 5b13e98da..ece04ad72 100644 --- a/applications/main/archive/helpers/archive_browser.h +++ b/applications/main/archive/helpers/archive_browser.h @@ -14,7 +14,7 @@ static const char* tab_default_paths[] = { [ArchiveTabSubGhz] = ANY_PATH("subghz"), [ArchiveTabLFRFID] = ANY_PATH("lfrfid"), [ArchiveTabInfrared] = ANY_PATH("infrared"), - [ArchiveTabBadUsb] = ANY_PATH("badusb"), + [ArchiveTabBadKb] = ANY_PATH("badkb"), [ArchiveTabU2f] = "/app:u2f", [ArchiveTabApplications] = ANY_PATH("apps"), [ArchiveTabBrowser] = STORAGE_ANY_PATH_PREFIX, @@ -26,7 +26,7 @@ static const char* known_ext[] = { [ArchiveFileTypeSubGhz] = ".sub", [ArchiveFileTypeLFRFID] = ".rfid", [ArchiveFileTypeInfrared] = ".ir", - [ArchiveFileTypeBadUsb] = ".txt", + [ArchiveFileTypeBadKb] = ".txt", [ArchiveFileTypeU2f] = "?", [ArchiveFileTypeApplication] = ".fap", [ArchiveFileTypeUpdateManifest] = ".fuf", @@ -41,7 +41,7 @@ static const ArchiveFileTypeEnum known_type[] = { [ArchiveTabSubGhz] = ArchiveFileTypeSubGhz, [ArchiveTabLFRFID] = ArchiveFileTypeLFRFID, [ArchiveTabInfrared] = ArchiveFileTypeInfrared, - [ArchiveTabBadUsb] = ArchiveFileTypeBadUsb, + [ArchiveTabBadKb] = ArchiveFileTypeBadKb, [ArchiveTabU2f] = ArchiveFileTypeU2f, [ArchiveTabApplications] = ArchiveFileTypeApplication, [ArchiveTabBrowser] = ArchiveFileTypeUnknown, diff --git a/applications/main/archive/helpers/archive_files.c b/applications/main/archive/helpers/archive_files.c index 5c06c1bda..7e7ab1774 100644 --- a/applications/main/archive/helpers/archive_files.c +++ b/applications/main/archive/helpers/archive_files.c @@ -16,11 +16,11 @@ void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder for(size_t i = 0; i < COUNT_OF(known_ext); i++) { if((known_ext[i][0] == '?') || (known_ext[i][0] == '*')) continue; if(furi_string_search(file->path, known_ext[i], 0) != FURI_STRING_FAILURE) { - if(i == ArchiveFileTypeBadUsb) { + if(i == ArchiveFileTypeBadKb) { if(furi_string_search( - file->path, archive_get_default_path(ArchiveTabBadUsb)) == 0) { + file->path, archive_get_default_path(ArchiveTabBadKb)) == 0) { file->type = i; - return; // *.txt file is a BadUSB script only if it is in BadUSB folder + return; // *.txt file is a BadKB script only if it is in BadKB folder } } else { file->type = i; diff --git a/applications/main/archive/helpers/archive_files.h b/applications/main/archive/helpers/archive_files.h index db624f5b5..62d635461 100644 --- a/applications/main/archive/helpers/archive_files.h +++ b/applications/main/archive/helpers/archive_files.h @@ -15,7 +15,7 @@ typedef enum { ArchiveFileTypeSubGhz, ArchiveFileTypeLFRFID, ArchiveFileTypeInfrared, - ArchiveFileTypeBadUsb, + ArchiveFileTypeBadKb, ArchiveFileTypeU2f, ArchiveFileTypeApplication, ArchiveFileTypeUpdateManifest, diff --git a/applications/main/archive/scenes/archive_scene_browser.c b/applications/main/archive/scenes/archive_scene_browser.c index f88efb0c4..0696647ea 100644 --- a/applications/main/archive/scenes/archive_scene_browser.c +++ b/applications/main/archive/scenes/archive_scene_browser.c @@ -17,7 +17,7 @@ static const char* flipper_app_name[] = { [ArchiveFileTypeSubGhz] = "Sub-GHz", [ArchiveFileTypeLFRFID] = "125 kHz RFID", [ArchiveFileTypeInfrared] = "Infrared", - [ArchiveFileTypeBadUsb] = "Bad USB", + [ArchiveFileTypeBadKb] = "Bad KB", [ArchiveFileTypeU2f] = "U2F", [ArchiveFileTypeApplication] = "Applications", [ArchiveFileTypeUpdateManifest] = "UpdaterApp", diff --git a/applications/main/archive/views/archive_browser_view.c b/applications/main/archive/views/archive_browser_view.c index dce753fde..213d65512 100644 --- a/applications/main/archive/views/archive_browser_view.c +++ b/applications/main/archive/views/archive_browser_view.c @@ -16,7 +16,7 @@ static const char* ArchiveTabNames[] = { [ArchiveTabSubGhz] = "Sub-GHz", [ArchiveTabLFRFID] = "RFID LF", [ArchiveTabInfrared] = "Infrared", - [ArchiveTabBadUsb] = "Bad USB", + [ArchiveTabBadKb] = "Bad KB", [ArchiveTabU2f] = "U2F", [ArchiveTabApplications] = "Apps", [ArchiveTabBrowser] = "Browser", @@ -28,7 +28,7 @@ static const Icon* ArchiveItemIcons[] = { [ArchiveFileTypeSubGhz] = &I_sub1_10px, [ArchiveFileTypeLFRFID] = &I_125_10px, [ArchiveFileTypeInfrared] = &I_ir_10px, - [ArchiveFileTypeBadUsb] = &I_badusb_10px, + [ArchiveFileTypeBadKb] = &I_badkb_10px, [ArchiveFileTypeU2f] = &I_u2f_10px, [ArchiveFileTypeApplication] = &I_Apps_10px, [ArchiveFileTypeUpdateManifest] = &I_update_10px, @@ -109,7 +109,7 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) { menu_array_push_raw(model->context_menu), item_pin, ArchiveBrowserEventFileMenuPin); - if(selected->type <= ArchiveFileTypeBadUsb) { + if(selected->type <= ArchiveFileTypeBadKb) { archive_menu_add_item( menu_array_push_raw(model->context_menu), item_show, @@ -129,7 +129,7 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) { menu_array_push_raw(model->context_menu), item_info, ArchiveBrowserEventFileMenuInfo); - if(selected->type <= ArchiveFileTypeBadUsb) { + if(selected->type <= ArchiveFileTypeBadKb) { archive_menu_add_item( menu_array_push_raw(model->context_menu), item_show, @@ -157,7 +157,7 @@ static void render_item_menu(Canvas* canvas, ArchiveBrowserViewModel* model) { menu_array_push_raw(model->context_menu), item_info, ArchiveBrowserEventFileMenuInfo); - if(selected->type <= ArchiveFileTypeBadUsb) { + if(selected->type <= ArchiveFileTypeBadKb) { archive_menu_add_item( menu_array_push_raw(model->context_menu), item_show, @@ -588,4 +588,4 @@ void browser_free(ArchiveBrowserView* browser) { view_free(browser->view); free(browser); -} \ No newline at end of file +} diff --git a/applications/main/archive/views/archive_browser_view.h b/applications/main/archive/views/archive_browser_view.h index dfe18d13b..1e6cbf036 100644 --- a/applications/main/archive/views/archive_browser_view.h +++ b/applications/main/archive/views/archive_browser_view.h @@ -25,7 +25,7 @@ typedef enum { ArchiveTabNFC, ArchiveTabInfrared, ArchiveTabIButton, - ArchiveTabBadUsb, + ArchiveTabBadKb, ArchiveTabU2f, ArchiveTabApplications, ArchiveTabBrowser, diff --git a/applications/main/bad_usb/application.fam b/applications/main/bad_kb/application.fam similarity index 55% rename from applications/main/bad_usb/application.fam rename to applications/main/bad_kb/application.fam index 2442dd3aa..09531da81 100644 --- a/applications/main/bad_usb/application.fam +++ b/applications/main/bad_kb/application.fam @@ -1,15 +1,15 @@ App( - appid="bad_usb", - name="Bad USB", + appid="bad_kb", + name="Bad KB", apptype=FlipperAppType.APP, - entry_point="bad_usb_app", - cdefines=["APP_BAD_USB"], + entry_point="bad_kb_app", + cdefines=["APP_BAD_KB"], requires=[ "gui", "dialogs", ], stack_size=2 * 1024, - icon="A_BadUsb_14", + icon="A_BadKb_14", order=70, fap_libs=["assets"], ) diff --git a/applications/main/bad_usb/bad_usb_app.c b/applications/main/bad_kb/bad_kb_app.c similarity index 52% rename from applications/main/bad_usb/bad_usb_app.c rename to applications/main/bad_kb/bad_kb_app.c index 43ed76c37..c62af4733 100644 --- a/applications/main/bad_usb/bad_usb_app.c +++ b/applications/main/bad_kb/bad_kb_app.c @@ -1,5 +1,5 @@ -#include "bad_usb_app_i.h" -#include "bad_usb_settings_filename.h" +#include "bad_kb_app_i.h" +#include "bad_kb_settings_filename.h" #include #include #include @@ -8,29 +8,29 @@ #include #include -#define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/" BAD_USB_SETTINGS_FILE_NAME +#define BAD_KB_SETTINGS_PATH BAD_KB_APP_BASE_FOLDER "/" BAD_KB_SETTINGS_FILE_NAME -static bool bad_usb_app_custom_event_callback(void* context, uint32_t event) { +static bool bad_kb_app_custom_event_callback(void* context, uint32_t event) { furi_assert(context); - BadUsbApp* app = context; + BadKbApp* app = context; return scene_manager_handle_custom_event(app->scene_manager, event); } -static bool bad_usb_app_back_event_callback(void* context) { +static bool bad_kb_app_back_event_callback(void* context) { furi_assert(context); - BadUsbApp* app = context; + BadKbApp* app = context; return scene_manager_handle_back_event(app->scene_manager); } -static void bad_usb_app_tick_event_callback(void* context) { +static void bad_kb_app_tick_event_callback(void* context) { furi_assert(context); - BadUsbApp* app = context; + BadKbApp* app = context; scene_manager_handle_tick_event(app->scene_manager); } -static void bad_usb_load_settings(BadUsbApp* app) { +static void bad_kb_load_settings(BadKbApp* app) { File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { + if(storage_file_open(settings_file, BAD_KB_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) { char chr; while((storage_file_read(settings_file, &chr, 1) == 1) && !storage_file_eof(settings_file) && !isspace(chr)) { @@ -41,9 +41,9 @@ static void bad_usb_load_settings(BadUsbApp* app) { storage_file_free(settings_file); } -static void bad_usb_save_settings(BadUsbApp* app) { +static void bad_kb_save_settings(BadKbApp* app) { File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) { + if(storage_file_open(settings_file, BAD_KB_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) { storage_file_write( settings_file, furi_string_get_cstr(app->keyboard_layout), @@ -54,21 +54,21 @@ static void bad_usb_save_settings(BadUsbApp* app) { storage_file_free(settings_file); } -void bad_usb_set_name(BadUsbApp* app, const char* fmt, ...) { +void bad_kb_set_name(BadKbApp* app, const char* fmt, ...) { furi_assert(app); va_list args; va_start(args, fmt); - vsnprintf(app->name, BAD_USB_ADV_NAME_MAX_LEN, fmt, args); + vsnprintf(app->name, BAD_KB_ADV_NAME_MAX_LEN, fmt, args); va_end(args); } -BadUsbApp* bad_usb_app_alloc(char* arg) { - BadUsbApp* app = malloc(sizeof(BadUsbApp)); +BadKbApp* bad_kb_app_alloc(char* arg) { + BadKbApp* app = malloc(sizeof(BadKbApp)); - app->bad_usb_script = NULL; + app->bad_kb_script = NULL; app->file_path = furi_string_alloc(); app->keyboard_layout = furi_string_alloc(); @@ -76,7 +76,7 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { furi_string_set(app->file_path, arg); } - bad_usb_load_settings(app); + bad_kb_load_settings(app); app->gui = furi_record_open(RECORD_GUI); app->notifications = furi_record_open(RECORD_NOTIFICATION); @@ -85,97 +85,97 @@ BadUsbApp* bad_usb_app_alloc(char* arg) { app->view_dispatcher = view_dispatcher_alloc(); view_dispatcher_enable_queue(app->view_dispatcher); - app->scene_manager = scene_manager_alloc(&bad_usb_scene_handlers, app); + app->scene_manager = scene_manager_alloc(&bad_kb_scene_handlers, app); view_dispatcher_set_event_callback_context(app->view_dispatcher, app); view_dispatcher_set_tick_event_callback( - app->view_dispatcher, bad_usb_app_tick_event_callback, 500); + app->view_dispatcher, bad_kb_app_tick_event_callback, 500); view_dispatcher_set_custom_event_callback( - app->view_dispatcher, bad_usb_app_custom_event_callback); + app->view_dispatcher, bad_kb_app_custom_event_callback); view_dispatcher_set_navigation_event_callback( - app->view_dispatcher, bad_usb_app_back_event_callback); + app->view_dispatcher, bad_kb_app_back_event_callback); Bt* bt = furi_record_open(RECORD_BT); app->bt = bt; const char* adv_name = bt_get_profile_adv_name(bt); - memcpy(app->name, adv_name, BAD_USB_ADV_NAME_MAX_LEN); - memcpy(app->bt_old_config.name, adv_name, BAD_USB_ADV_NAME_MAX_LEN); + memcpy(app->name, adv_name, BAD_KB_ADV_NAME_MAX_LEN); + memcpy(app->bt_old_config.name, adv_name, BAD_KB_ADV_NAME_MAX_LEN); const uint8_t* mac_addr = bt_get_profile_mac_address(bt); - memcpy(app->mac, mac_addr, BAD_USB_MAC_ADDRESS_LEN); - memcpy(app->bt_old_config.mac, mac_addr, BAD_USB_MAC_ADDRESS_LEN); + memcpy(app->mac, mac_addr, BAD_KB_MAC_ADDRESS_LEN); + memcpy(app->bt_old_config.mac, mac_addr, BAD_KB_MAC_ADDRESS_LEN); // Custom Widget app->widget = widget_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewError, widget_get_view(app->widget)); + app->view_dispatcher, BadKbAppViewError, widget_get_view(app->widget)); app->var_item_list_bt = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfigBt, variable_item_list_get_view(app->var_item_list_bt)); + app->view_dispatcher, BadKbAppViewConfigBt, variable_item_list_get_view(app->var_item_list_bt)); app->var_item_list_usb = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfigUsb, variable_item_list_get_view(app->var_item_list_usb)); + app->view_dispatcher, BadKbAppViewConfigUsb, variable_item_list_get_view(app->var_item_list_usb)); - app->bad_usb_view = bad_usb_alloc(); + app->bad_kb_view = bad_kb_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewWork, bad_usb_get_view(app->bad_usb_view)); + app->view_dispatcher, BadKbAppViewWork, bad_kb_get_view(app->bad_kb_view)); app->text_input = text_input_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfigName, text_input_get_view(app->text_input)); + app->view_dispatcher, BadKbAppViewConfigName, text_input_get_view(app->text_input)); app->byte_input = byte_input_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadUsbAppViewConfigMac, byte_input_get_view(app->byte_input)); + app->view_dispatcher, BadKbAppViewConfigMac, byte_input_get_view(app->byte_input)); view_dispatcher_attach_to_gui(app->view_dispatcher, app->gui, ViewDispatcherTypeFullscreen); if(furi_hal_usb_is_locked()) { - app->error = BadUsbAppErrorCloseRpc; - scene_manager_next_scene(app->scene_manager, BadUsbSceneError); + app->error = BadKbAppErrorCloseRpc; + scene_manager_next_scene(app->scene_manager, BadKbSceneError); } else { if(!furi_string_empty(app->file_path)) { - app->bad_usb_script = bad_usb_script_open(app->file_path, app->is_bt ? app->bt : NULL); - bad_usb_script_set_keyboard_layout(app->bad_usb_script, app->keyboard_layout); - scene_manager_next_scene(app->scene_manager, BadUsbSceneWork); + app->bad_kb_script = bad_kb_script_open(app->file_path, app->is_bt ? app->bt : NULL); + bad_kb_script_set_keyboard_layout(app->bad_kb_script, app->keyboard_layout); + scene_manager_next_scene(app->scene_manager, BadKbSceneWork); } else { - furi_string_set(app->file_path, BAD_USB_APP_BASE_FOLDER); - scene_manager_next_scene(app->scene_manager, BadUsbSceneFileSelect); + furi_string_set(app->file_path, BAD_KB_APP_BASE_FOLDER); + scene_manager_next_scene(app->scene_manager, BadKbSceneFileSelect); } } return app; } -void bad_usb_app_free(BadUsbApp* app) { +void bad_kb_app_free(BadKbApp* app) { furi_assert(app); - if(app->bad_usb_script) { - bad_usb_script_close(app->bad_usb_script); - app->bad_usb_script = NULL; + if(app->bad_kb_script) { + bad_kb_script_close(app->bad_kb_script); + app->bad_kb_script = NULL; } // Views - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork); - bad_usb_free(app->bad_usb_view); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewWork); + bad_kb_free(app->bad_kb_view); // Custom Widget - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewError); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewError); widget_free(app->widget); // Variable item list - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigBt); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewConfigBt); variable_item_list_free(app->var_item_list_bt); - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigUsb); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewConfigUsb); variable_item_list_free(app->var_item_list_usb); // Text Input - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigName); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewConfigName); text_input_free(app->text_input); // Byte Input - view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigMac); + view_dispatcher_remove_view(app->view_dispatcher, BadKbAppViewConfigMac); byte_input_free(app->byte_input); // View dispatcher @@ -188,7 +188,7 @@ void bad_usb_app_free(BadUsbApp* app) { if (strcmp(app->bt_old_config.name, app->name) != 0) { furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->bt_old_config.name); } - if (memcmp(app->bt_old_config.mac, app->mac, BAD_USB_MAC_ADDRESS_LEN) != 0) { + if (memcmp(app->bt_old_config.mac, app->mac, BAD_KB_MAC_ADDRESS_LEN) != 0) { furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->bt_old_config.mac); } @@ -199,7 +199,7 @@ void bad_usb_app_free(BadUsbApp* app) { furi_record_close(RECORD_DIALOGS); furi_record_close(RECORD_BT); - bad_usb_save_settings(app); + bad_kb_save_settings(app); furi_string_free(app->file_path); furi_string_free(app->keyboard_layout); @@ -207,11 +207,11 @@ void bad_usb_app_free(BadUsbApp* app) { free(app); } -int32_t bad_usb_app(void* p) { - BadUsbApp* bad_usb_app = bad_usb_app_alloc((char*)p); +int32_t bad_kb_app(void* p) { + BadKbApp* bad_kb_app = bad_kb_app_alloc((char*)p); - view_dispatcher_run(bad_usb_app->view_dispatcher); + view_dispatcher_run(bad_kb_app->view_dispatcher); - bad_usb_app_free(bad_usb_app); + bad_kb_app_free(bad_kb_app); return 0; } diff --git a/applications/main/bad_kb/bad_kb_app.h b/applications/main/bad_kb/bad_kb_app.h new file mode 100644 index 000000000..e75a94651 --- /dev/null +++ b/applications/main/bad_kb/bad_kb_app.h @@ -0,0 +1,13 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct BadKbApp BadKbApp; + +void bad_kb_set_name(BadKbApp* app, const char* fmt, ...); + +#ifdef __cplusplus +} +#endif diff --git a/applications/main/bad_kb/bad_kb_app_i.h b/applications/main/bad_kb/bad_kb_app_i.h new file mode 100644 index 000000000..913830e72 --- /dev/null +++ b/applications/main/bad_kb/bad_kb_app_i.h @@ -0,0 +1,80 @@ +#pragma once + +#include "bad_kb_app.h" +#include "scenes/bad_kb_scene.h" +#include "bad_kb_script.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "views/bad_kb_view.h" + +#define BAD_KB_APP_BASE_FOLDER ANY_PATH("badkb") +#define BAD_KB_APP_PATH_LAYOUT_FOLDER BAD_KB_APP_BASE_FOLDER "/layouts" +#define BAD_KB_APP_SCRIPT_EXTENSION ".txt" +#define BAD_KB_APP_LAYOUT_EXTENSION ".kl" + +#define BAD_KB_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro +#define BAD_KB_ADV_NAME_MAX_LEN 18 + +typedef enum { + BadKbAppErrorNoFiles, + BadKbAppErrorCloseRpc, +} BadKbAppError; + +typedef enum BadKbCustomEvent { + BadKbAppCustomEventTextEditResult, + BadKbAppCustomEventByteInputDone, + BadKbCustomEventErrorBack +} BadKbCustomEvent; + +typedef struct { + uint8_t mac[BAD_KB_MAC_ADDRESS_LEN]; + char name[BAD_KB_ADV_NAME_MAX_LEN + 1]; + + // number of bt keys before starting the app (all keys added in + // the bt keys file then will be removed) + uint16_t n_keys; +} BadKbBtConfig; + +struct BadKbApp { + Gui* gui; + ViewDispatcher* view_dispatcher; + SceneManager* scene_manager; + NotificationApp* notifications; + DialogsApp* dialogs; + Widget* widget; + VariableItemList* var_item_list_bt; + VariableItemList* var_item_list_usb; + + Bt* bt; + TextInput* text_input; + ByteInput* byte_input; + uint8_t mac[BAD_KB_MAC_ADDRESS_LEN]; + char name[BAD_KB_ADV_NAME_MAX_LEN + 1]; + BadKbBtConfig bt_old_config; + + BadKbAppError error; + FuriString* file_path; + FuriString* keyboard_layout; + BadKb* bad_kb_view; + BadKbScript* bad_kb_script; + + bool is_bt; +}; + +typedef enum { + BadKbAppViewError, + BadKbAppViewWork, + BadKbAppViewConfigBt, + BadKbAppViewConfigUsb, + BadKbAppViewConfigMac, + BadKbAppViewConfigName +} BadKbAppView; diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_kb/bad_kb_script.c similarity index 65% rename from applications/main/bad_usb/bad_usb_script.c rename to applications/main/bad_kb/bad_kb_script.c index 51ce49df9..e63a39c05 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -6,14 +6,14 @@ #include #include #include -#include "bad_usb_script.h" +#include "bad_kb_script.h" #include #include #define HID_BT_KEYS_STORAGE_PATH EXT_PATH("apps/Tools/.bt_hid.keys") -#define TAG "BadUSB" +#define TAG "BadKB" #define WORKER_TAG TAG "Worker" #define FILE_BUFFER_LEN 16 @@ -21,7 +21,7 @@ #define SCRIPT_STATE_END (-2) #define SCRIPT_STATE_NEXT_LINE (-3) -#define BADUSB_ASCII_TO_KEY(script, x) \ +#define BADKB_ASCII_TO_KEY(script, x) \ (((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE) typedef enum { @@ -52,9 +52,9 @@ const uint8_t bt_hid_delays[LevelRssiNum] = { 14, // LevelRssi39_0 }; -struct BadUsbScript { +struct BadKbScript { FuriHalUsbHidConfig hid_cfg; - BadUsbState st; + BadKbState st; FuriString* file_path; FuriString* keyboard_layout; uint32_t defdelay; @@ -230,8 +230,8 @@ static bool ducky_is_line_end(const char chr) { return ((chr == ' ') || (chr == '\0') || (chr == '\r') || (chr == '\n')); } -static void ducky_numlock_on(BadUsbScript* bad_usb) { - if (bad_usb->bt) { +static void ducky_numlock_on(BadKbScript* bad_kb) { + if (bad_kb->bt) { if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); @@ -246,12 +246,12 @@ static void ducky_numlock_on(BadUsbScript* bad_usb) { } } -static bool ducky_numpad_press(BadUsbScript* bad_usb, const char num) { +static bool ducky_numpad_press(BadKbScript* bad_kb, const char num) { if((num < '0') || (num > '9')) return false; uint16_t key = numpad_keys[num - '0']; FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); - if (bad_usb->bt) { + if (bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); @@ -264,13 +264,13 @@ static bool ducky_numpad_press(BadUsbScript* bad_usb, const char num) { return true; } -static bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode) { +static bool ducky_altchar(BadKbScript* bad_kb, const char* charcode) { uint8_t i = 0; bool state = false; FURI_LOG_I(WORKER_TAG, "char %s", charcode); - if (bad_usb->bt) { + if (bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); } else { @@ -278,12 +278,12 @@ static bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode) { } while(!ducky_is_line_end(charcode[i])) { - state = ducky_numpad_press(bad_usb, charcode[i]); + state = ducky_numpad_press(bad_kb, charcode[i]); if(state == false) break; i++; } - if (bad_usb->bt) { + if (bad_kb->bt) { furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT); } else { furi_hal_hid_kb_release(KEY_MOD_LEFT_ALT); @@ -291,7 +291,7 @@ static bool ducky_altchar(BadUsbScript* bad_usb, const char* charcode) { return state; } -static bool ducky_altstring(BadUsbScript* bad_usb, const char* param) { +static bool ducky_altstring(BadKbScript* bad_kb, const char* param) { uint32_t i = 0; bool state = false; @@ -304,19 +304,19 @@ static bool ducky_altstring(BadUsbScript* bad_usb, const char* param) { char temp_str[4]; snprintf(temp_str, 4, "%u", param[i]); - state = ducky_altchar(bad_usb, temp_str); + state = ducky_altchar(bad_kb, temp_str); if(state == false) break; i++; } return state; } -static bool ducky_string(BadUsbScript* bad_usb, const char* param) { +static bool ducky_string(BadKbScript* bad_kb, const char* param) { uint32_t i = 0; while(param[i] != '\0') { - uint16_t keycode = BADUSB_ASCII_TO_KEY(bad_usb, param[i]); + uint16_t keycode = BADKB_ASCII_TO_KEY(bad_kb, param[i]); if(keycode != HID_KEYBOARD_NONE) { - if (bad_usb->bt) { + if (bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(keycode); furi_delay_ms(bt_timeout); @@ -331,7 +331,7 @@ static bool ducky_string(BadUsbScript* bad_usb, const char* param) { return true; } -static uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) { +static uint16_t ducky_get_keycode(BadKbScript* bad_kb, const char* param, bool accept_chars) { for(size_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) { size_t key_cmd_len = strlen(ducky_keys[i].name); if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) && @@ -340,13 +340,13 @@ static uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool } } if((accept_chars) && (strlen(param) > 0)) { - return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF); + return (BADKB_ASCII_TO_KEY(bad_kb, param[0]) & 0xFF); } return 0; } static int32_t - ducky_parse_line(BadUsbScript* bad_usb, FuriString* line, char* error, size_t error_len) { + ducky_parse_line(BadKbScript* bad_kb, FuriString* line, char* error, size_t error_len) { uint32_t line_len = furi_string_size(line); const char* line_tmp = furi_string_get_cstr(line); bool state = false; @@ -384,7 +384,7 @@ static int32_t (strncmp(line_tmp, ducky_cmd_defdelay_2, strlen(ducky_cmd_defdelay_2)) == 0)) { // DEFAULT_DELAY line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_get_number(line_tmp, &bad_usb->defdelay); + state = ducky_get_number(line_tmp, &bad_kb->defdelay); if(!state && error != NULL) { snprintf(error, error_len, "Invalid number %s", line_tmp); } @@ -392,7 +392,7 @@ static int32_t } else if(strncmp(line_tmp, ducky_cmd_string, strlen(ducky_cmd_string)) == 0) { // STRING line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_string(bad_usb, line_tmp); + state = ducky_string(bad_kb, line_tmp); if(!state && error != NULL) { snprintf(error, error_len, "Invalid string %s", line_tmp); } @@ -400,8 +400,8 @@ static int32_t } else if(strncmp(line_tmp, ducky_cmd_altchar, strlen(ducky_cmd_altchar)) == 0) { // ALTCHAR line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(bad_usb); - state = ducky_altchar(bad_usb, line_tmp); + ducky_numlock_on(bad_kb); + state = ducky_altchar(bad_kb, line_tmp); if(!state && error != NULL) { snprintf(error, error_len, "Invalid altchar %s", line_tmp); } @@ -411,8 +411,8 @@ static int32_t (strncmp(line_tmp, ducky_cmd_altstr_2, strlen(ducky_cmd_altstr_2)) == 0)) { // ALTSTRING line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - ducky_numlock_on(bad_usb); - state = ducky_altstring(bad_usb, line_tmp); + ducky_numlock_on(bad_kb); + state = ducky_altstring(bad_kb, line_tmp); if(!state && error != NULL) { snprintf(error, error_len, "Invalid altstring %s", line_tmp); } @@ -420,7 +420,7 @@ static int32_t } else if(strncmp(line_tmp, ducky_cmd_repeat, strlen(ducky_cmd_repeat)) == 0) { // REPEAT line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - state = ducky_get_number(line_tmp, &bad_usb->repeat_cnt); + state = ducky_get_number(line_tmp, &bad_kb->repeat_cnt); if(!state && error != NULL) { snprintf(error, error_len, "Invalid number %s", line_tmp); } @@ -428,8 +428,8 @@ static int32_t } else if(strncmp(line_tmp, ducky_cmd_sysrq, strlen(ducky_cmd_sysrq)) == 0) { // SYSRQ line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - uint16_t key = ducky_get_keycode(bad_usb, line_tmp, true); - if (bad_usb->bt) { + uint16_t key = ducky_get_keycode(bad_kb, line_tmp, true); + if (bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); furi_hal_bt_hid_kb_press(key); @@ -444,7 +444,7 @@ static int32_t return (0); } else { // Special keys + modifiers - uint16_t key = ducky_get_keycode(bad_usb, line_tmp, false); + uint16_t key = ducky_get_keycode(bad_kb, line_tmp, false); if(key == HID_KEYBOARD_NONE) { if(error != NULL) { snprintf(error, error_len, "No keycode defined for %s", line_tmp); @@ -454,9 +454,9 @@ static int32_t if((key & 0xFF00) != 0) { // It's a modifier key line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; - key |= ducky_get_keycode(bad_usb, line_tmp, true); + key |= ducky_get_keycode(bad_kb, line_tmp, true); } - if (bad_usb->bt) { + if (bad_kb->bt) { furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); @@ -468,231 +468,231 @@ static int32_t } } -static bool ducky_set_usb_id(BadUsbScript* bad_usb, const char* line) { - if(sscanf(line, "%lX:%lX", &bad_usb->hid_cfg.vid, &bad_usb->hid_cfg.pid) == 2) { - bad_usb->hid_cfg.manuf[0] = '\0'; - bad_usb->hid_cfg.product[0] = '\0'; +static bool ducky_set_usb_id(BadKbScript* bad_kb, const char* line) { + if(sscanf(line, "%lX:%lX", &bad_kb->hid_cfg.vid, &bad_kb->hid_cfg.pid) == 2) { + bad_kb->hid_cfg.manuf[0] = '\0'; + bad_kb->hid_cfg.product[0] = '\0'; uint8_t id_len = ducky_get_command_len(line); if(!ducky_is_line_end(line[id_len + 1])) { sscanf( &line[id_len + 1], "%31[^\r\n:]:%31[^\r\n]", - bad_usb->hid_cfg.manuf, - bad_usb->hid_cfg.product); + bad_kb->hid_cfg.manuf, + bad_kb->hid_cfg.product); } FURI_LOG_D( WORKER_TAG, "set id: %04lX:%04lX mfr:%s product:%s", - bad_usb->hid_cfg.vid, - bad_usb->hid_cfg.pid, - bad_usb->hid_cfg.manuf, - bad_usb->hid_cfg.product); + bad_kb->hid_cfg.vid, + bad_kb->hid_cfg.pid, + bad_kb->hid_cfg.manuf, + bad_kb->hid_cfg.product); return true; } return false; } -static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) { +static bool ducky_script_preload(BadKbScript* bad_kb, File* script_file) { uint8_t ret = 0; uint32_t line_len = 0; - furi_string_reset(bad_usb->line); + furi_string_reset(bad_kb->line); do { - ret = storage_file_read(script_file, bad_usb->file_buf, FILE_BUFFER_LEN); + ret = storage_file_read(script_file, bad_kb->file_buf, FILE_BUFFER_LEN); for(uint16_t i = 0; i < ret; i++) { - if(bad_usb->file_buf[i] == '\n' && line_len > 0) { - bad_usb->st.line_nb++; + if(bad_kb->file_buf[i] == '\n' && line_len > 0) { + bad_kb->st.line_nb++; line_len = 0; } else { - if(bad_usb->st.line_nb == 0) { // Save first line - furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]); + if(bad_kb->st.line_nb == 0) { // Save first line + furi_string_push_back(bad_kb->line, bad_kb->file_buf[i]); } line_len++; } } if(storage_file_eof(script_file)) { if(line_len > 0) { - bad_usb->st.line_nb++; + bad_kb->st.line_nb++; break; } } } while(ret > 0); - if (!bad_usb->bt) { - const char* line_tmp = furi_string_get_cstr(bad_usb->line); + if (!bad_kb->bt) { + const char* line_tmp = furi_string_get_cstr(bad_kb->line); bool id_set = false; // Looking for ID command at first line if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { - id_set = ducky_set_usb_id(bad_usb, &line_tmp[strlen(ducky_cmd_id) + 1]); + id_set = ducky_set_usb_id(bad_kb, &line_tmp[strlen(ducky_cmd_id) + 1]); } if(id_set) { - furi_check(furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg)); + furi_check(furi_hal_usb_set_config(&usb_hid, &bad_kb->hid_cfg)); } else { furi_check(furi_hal_usb_set_config(&usb_hid, NULL)); } } storage_file_seek(script_file, 0, true); - furi_string_reset(bad_usb->line); + furi_string_reset(bad_kb->line); return true; } -static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_file) { +static int32_t ducky_script_execute_next(BadKbScript* bad_kb, File* script_file) { int32_t delay_val = 0; - if(bad_usb->repeat_cnt > 0) { - bad_usb->repeat_cnt--; + if(bad_kb->repeat_cnt > 0) { + bad_kb->repeat_cnt--; delay_val = ducky_parse_line( - bad_usb, bad_usb->line_prev, bad_usb->st.error, sizeof(bad_usb->st.error)); + bad_kb, bad_kb->line_prev, bad_kb->st.error, sizeof(bad_kb->st.error)); if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line return 0; } else if(delay_val < 0) { // Script error - bad_usb->st.error_line = bad_usb->st.line_cur - 1; - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur - 1U); + bad_kb->st.error_line = bad_kb->st.line_cur - 1; + FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_kb->st.line_cur - 1U); return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return (delay_val + bad_kb->defdelay); } } - furi_string_set(bad_usb->line_prev, bad_usb->line); - furi_string_reset(bad_usb->line); + furi_string_set(bad_kb->line_prev, bad_kb->line); + furi_string_reset(bad_kb->line); while(1) { - if(bad_usb->buf_len == 0) { - bad_usb->buf_len = storage_file_read(script_file, bad_usb->file_buf, FILE_BUFFER_LEN); + if(bad_kb->buf_len == 0) { + bad_kb->buf_len = storage_file_read(script_file, bad_kb->file_buf, FILE_BUFFER_LEN); if(storage_file_eof(script_file)) { - if((bad_usb->buf_len < FILE_BUFFER_LEN) && (bad_usb->file_end == false)) { - bad_usb->file_buf[bad_usb->buf_len] = '\n'; - bad_usb->buf_len++; - bad_usb->file_end = true; + if((bad_kb->buf_len < FILE_BUFFER_LEN) && (bad_kb->file_end == false)) { + bad_kb->file_buf[bad_kb->buf_len] = '\n'; + bad_kb->buf_len++; + bad_kb->file_end = true; } } - bad_usb->buf_start = 0; - if(bad_usb->buf_len == 0) return SCRIPT_STATE_END; + bad_kb->buf_start = 0; + if(bad_kb->buf_len == 0) return SCRIPT_STATE_END; } - for(uint8_t i = bad_usb->buf_start; i < (bad_usb->buf_start + bad_usb->buf_len); i++) { - if(bad_usb->file_buf[i] == '\n' && furi_string_size(bad_usb->line) > 0) { - bad_usb->st.line_cur++; - bad_usb->buf_len = bad_usb->buf_len + bad_usb->buf_start - (i + 1); - bad_usb->buf_start = i + 1; - furi_string_trim(bad_usb->line); + for(uint8_t i = bad_kb->buf_start; i < (bad_kb->buf_start + bad_kb->buf_len); i++) { + if(bad_kb->file_buf[i] == '\n' && furi_string_size(bad_kb->line) > 0) { + bad_kb->st.line_cur++; + bad_kb->buf_len = bad_kb->buf_len + bad_kb->buf_start - (i + 1); + bad_kb->buf_start = i + 1; + furi_string_trim(bad_kb->line); delay_val = ducky_parse_line( - bad_usb, bad_usb->line, bad_usb->st.error, sizeof(bad_usb->st.error)); + bad_kb, bad_kb->line, bad_kb->st.error, sizeof(bad_kb->st.error)); if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line return 0; } else if(delay_val < 0) { - bad_usb->st.error_line = bad_usb->st.line_cur; + bad_kb->st.error_line = bad_kb->st.line_cur; if(delay_val == SCRIPT_STATE_NEXT_LINE) { snprintf( - bad_usb->st.error, sizeof(bad_usb->st.error), "Forbidden empty line"); + bad_kb->st.error, sizeof(bad_kb->st.error), "Forbidden empty line"); FURI_LOG_E( - WORKER_TAG, "Forbidden empty line at line %u", bad_usb->st.line_cur); + WORKER_TAG, "Forbidden empty line at line %u", bad_kb->st.line_cur); } else { - FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_usb->st.line_cur); + FURI_LOG_E(WORKER_TAG, "Unknown command at line %u", bad_kb->st.line_cur); } return SCRIPT_STATE_ERROR; } else { - return (delay_val + bad_usb->defdelay); + return (delay_val + bad_kb->defdelay); } } else { - furi_string_push_back(bad_usb->line, bad_usb->file_buf[i]); + furi_string_push_back(bad_kb->line, bad_kb->file_buf[i]); } } - bad_usb->buf_len = 0; - if(bad_usb->file_end) return SCRIPT_STATE_END; + bad_kb->buf_len = 0; + if(bad_kb->file_end) return SCRIPT_STATE_END; } return 0; } -static void bad_usb_bt_hid_state_callback(BtStatus status, void* context) { +static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) { furi_assert(context); - BadUsbScript* bad_usb = (BadUsbScript*)context; + BadKbScript* bad_kb = (BadKbScript*)context; bool state = (status == BtStatusConnected); if(state == true) { - LevelRssiRange r = bt_remote_rssi_range(bad_usb->bt); + LevelRssiRange r = bt_remote_rssi_range(bad_kb->bt); if(r != LevelRssiError) { bt_timeout = bt_hid_delays[r]; } - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtConnect); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtConnect); } else - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtDisconnect); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); } -static void bad_usb_usb_hid_state_callback(bool state, void* context) { +static void bad_kb_usb_hid_state_callback(bool state, void* context) { furi_assert(context); - BadUsbScript* bad_usb = context; + BadKbScript* bad_kb = context; if(state == true) - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtConnect); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtConnect); else - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtDisconnect); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); } -static int32_t bad_usb_worker(void* context) { - BadUsbScript* bad_usb = context; +static int32_t bad_kb_worker(void* context) { + BadKbScript* bad_kb = context; - BadUsbWorkerState worker_state = BadUsbStateInit; + BadKbWorkerState worker_state = BadKbStateInit; int32_t delay_val = 0; FuriHalUsbInterface* usb_mode_prev = NULL; GapPairing old_pairing_method = GapPairingNone; - if (bad_usb->bt) { + if (bad_kb->bt) { bt_timeout = bt_hid_delays[LevelRssi39_0]; - bt_disconnect(bad_usb->bt); + bt_disconnect(bad_kb->bt); furi_delay_ms(200); - bt_keys_storage_set_storage_path(bad_usb->bt, HID_BT_KEYS_STORAGE_PATH); - if (!bt_set_profile(bad_usb->bt, BtProfileHidKeyboard)) { + bt_keys_storage_set_storage_path(bad_kb->bt, HID_BT_KEYS_STORAGE_PATH); + if (!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { FURI_LOG_E(TAG, "Failed to switch to HID profile"); return -1; } - old_pairing_method = bt_get_profile_pairing_method(bad_usb->bt); - bt_set_profile_pairing_method(bad_usb->bt, GapPairingNone); + old_pairing_method = bt_get_profile_pairing_method(bad_kb->bt); + bt_set_profile_pairing_method(bad_kb->bt, GapPairingNone); furi_hal_bt_start_advertising(); - bt_set_status_changed_callback(bad_usb->bt, bad_usb_bt_hid_state_callback, bad_usb); + bt_set_status_changed_callback(bad_kb->bt, bad_kb_bt_hid_state_callback, bad_kb); } else { usb_mode_prev = furi_hal_usb_get_config(); - furi_hal_hid_set_state_callback(bad_usb_usb_hid_state_callback, bad_usb); + furi_hal_hid_set_state_callback(bad_kb_usb_hid_state_callback, bad_kb); } FURI_LOG_I(WORKER_TAG, "Init"); File* script_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); - bad_usb->line = furi_string_alloc(); - bad_usb->line_prev = furi_string_alloc(); + bad_kb->line = furi_string_alloc(); + bad_kb->line_prev = furi_string_alloc(); while(1) { - if(worker_state == BadUsbStateInit) { // State: initialization + if(worker_state == BadKbStateInit) { // State: initialization if(storage_file_open( script_file, - furi_string_get_cstr(bad_usb->file_path), + furi_string_get_cstr(bad_kb->file_path), FSAM_READ, FSOM_OPEN_EXISTING)) { - if((ducky_script_preload(bad_usb, script_file)) && (bad_usb->st.line_nb > 0)) { - if (bad_usb->bt) { - worker_state = BadUsbStateNotConnected; // Ready to run + if((ducky_script_preload(bad_kb, script_file)) && (bad_kb->st.line_nb > 0)) { + if (bad_kb->bt) { + worker_state = BadKbStateNotConnected; // Ready to run } else { if(furi_hal_hid_is_connected()) { - worker_state = BadUsbStateIdle; // Ready to run + worker_state = BadKbStateIdle; // Ready to run } else { - worker_state = BadUsbStateNotConnected; // USB not connected + worker_state = BadKbStateNotConnected; // USB not connected } } } else { - worker_state = BadUsbStateScriptError; // Script preload error + worker_state = BadKbStateScriptError; // Script preload error } } else { FURI_LOG_E(WORKER_TAG, "File open error"); - worker_state = BadUsbStateFileError; // File open error + worker_state = BadKbStateFileError; // File open error } - bad_usb->st.state = worker_state; + bad_kb->st.state = worker_state; - } else if(worker_state == BadUsbStateNotConnected) { // State: USB not connected + } else if(worker_state == BadKbStateNotConnected) { // State: USB not connected uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, FuriFlagWaitAny, @@ -701,13 +701,13 @@ static int32_t bad_usb_worker(void* context) { if(flags & WorkerEvtEnd) { break; } else if(flags & WorkerEvtConnect) { - worker_state = BadUsbStateIdle; // Ready to run + worker_state = BadKbStateIdle; // Ready to run } else if(flags & WorkerEvtToggle) { - worker_state = BadUsbStateWillRun; // Will run when USB is connected + worker_state = BadKbStateWillRun; // Will run when USB is connected } - bad_usb->st.state = worker_state; + bad_kb->st.state = worker_state; - } else if(worker_state == BadUsbStateIdle) { // State: ready to start + } else if(worker_state == BadKbStateIdle) { // State: ready to start uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, FuriFlagWaitAny, @@ -716,22 +716,22 @@ static int32_t bad_usb_worker(void* context) { if(flags & WorkerEvtEnd) { break; } else if(flags & WorkerEvtToggle) { // Start executing script - DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); + DOLPHIN_DEED(DolphinDeedBadKbPlayScript); delay_val = 0; - bad_usb->buf_len = 0; - bad_usb->st.line_cur = 0; - bad_usb->defdelay = 0; - bad_usb->repeat_cnt = 0; - bad_usb->file_end = false; + bad_kb->buf_len = 0; + bad_kb->st.line_cur = 0; + bad_kb->defdelay = 0; + bad_kb->repeat_cnt = 0; + bad_kb->file_end = false; storage_file_seek(script_file, 0, true); - bad_usb_script_set_keyboard_layout(bad_usb, bad_usb->keyboard_layout); - worker_state = BadUsbStateRunning; + bad_kb_script_set_keyboard_layout(bad_kb, bad_kb->keyboard_layout); + worker_state = BadKbStateRunning; } else if(flags & WorkerEvtDisconnect) { - worker_state = BadUsbStateNotConnected; // USB disconnected + worker_state = BadKbStateNotConnected; // USB disconnected } - bad_usb->st.state = worker_state; + bad_kb->st.state = worker_state; - } else if(worker_state == BadUsbStateWillRun) { // State: start on connection + } else if(worker_state == BadKbStateWillRun) { // State: start on connection uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, FuriFlagWaitAny, @@ -740,28 +740,28 @@ static int32_t bad_usb_worker(void* context) { if(flags & WorkerEvtEnd) { break; } else if(flags & WorkerEvtConnect) { // Start executing script - DOLPHIN_DEED(DolphinDeedBadUsbPlayScript); + DOLPHIN_DEED(DolphinDeedBadKbPlayScript); delay_val = 0; - bad_usb->buf_len = 0; - bad_usb->st.line_cur = 0; - bad_usb->defdelay = 0; - bad_usb->repeat_cnt = 0; - bad_usb->file_end = false; + bad_kb->buf_len = 0; + bad_kb->st.line_cur = 0; + bad_kb->defdelay = 0; + bad_kb->repeat_cnt = 0; + bad_kb->file_end = false; storage_file_seek(script_file, 0, true); // extra time for PC to recognize Flipper as keyboard furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); - if (bad_usb->bt) { - update_bt_timeout(bad_usb->bt); + if (bad_kb->bt) { + update_bt_timeout(bad_kb->bt); FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } - bad_usb_script_set_keyboard_layout(bad_usb, bad_usb->keyboard_layout); - worker_state = BadUsbStateRunning; + bad_kb_script_set_keyboard_layout(bad_kb, bad_kb->keyboard_layout); + worker_state = BadKbStateRunning; } else if(flags & WorkerEvtToggle) { // Cancel scheduled execution - worker_state = BadUsbStateNotConnected; + worker_state = BadKbStateNotConnected; } - bad_usb->st.state = worker_state; + bad_kb->st.state = worker_state; - } else if(worker_state == BadUsbStateRunning) { // State: running + } else if(worker_state == BadKbStateRunning) { // State: running uint16_t delay_cur = (delay_val > 1000) ? (1000) : (delay_val); uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd | WorkerEvtToggle | WorkerEvtDisconnect, FuriFlagWaitAny, delay_cur); @@ -770,56 +770,56 @@ static int32_t bad_usb_worker(void* context) { if(flags & WorkerEvtEnd) { break; } else if(flags & WorkerEvtToggle) { - worker_state = BadUsbStateIdle; // Stop executing script - if (bad_usb->bt) { + worker_state = BadKbStateIdle; // Stop executing script + if (bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); } } else if(flags & WorkerEvtDisconnect) { - worker_state = BadUsbStateNotConnected; // USB disconnected - if (bad_usb->bt) { + worker_state = BadKbStateNotConnected; // USB disconnected + if (bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); } } - bad_usb->st.state = worker_state; + bad_kb->st.state = worker_state; continue; } else if( (flags == (unsigned)FuriFlagErrorTimeout) || (flags == (unsigned)FuriFlagErrorResource)) { if(delay_val > 0) { - bad_usb->st.delay_remain--; + bad_kb->st.delay_remain--; continue; } - bad_usb->st.state = BadUsbStateRunning; - delay_val = ducky_script_execute_next(bad_usb, script_file); + bad_kb->st.state = BadKbStateRunning; + delay_val = ducky_script_execute_next(bad_kb, script_file); if(delay_val == SCRIPT_STATE_ERROR) { // Script error delay_val = 0; - worker_state = BadUsbStateScriptError; - bad_usb->st.state = worker_state; + worker_state = BadKbStateScriptError; + bad_kb->st.state = worker_state; } else if(delay_val == SCRIPT_STATE_END) { // End of script delay_val = 0; - worker_state = BadUsbStateIdle; - bad_usb->st.state = BadUsbStateDone; - if (bad_usb->bt) { + worker_state = BadKbStateIdle; + bad_kb->st.state = BadKbStateDone; + if (bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); } continue; } else if(delay_val > 1000) { - bad_usb->st.state = BadUsbStateDelay; // Show long delays - bad_usb->st.delay_remain = delay_val / 1000; + bad_kb->st.state = BadKbStateDelay; // Show long delays + bad_kb->st.delay_remain = delay_val / 1000; } } else { furi_check((flags & FuriFlagError) == 0); } } else if( - (worker_state == BadUsbStateFileError) || - (worker_state == BadUsbStateScriptError)) { // State: error + (worker_state == BadKbStateFileError) || + (worker_state == BadKbStateScriptError)) { // State: error uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd, FuriFlagWaitAny, FuriWaitForever); // Waiting for exit command furi_check((flags & FuriFlagError) == 0); @@ -827,31 +827,31 @@ static int32_t bad_usb_worker(void* context) { break; } } - if (bad_usb->bt) { - update_bt_timeout(bad_usb->bt); + if (bad_kb->bt) { + update_bt_timeout(bad_kb->bt); FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } } - if (bad_usb->bt) { + if (bad_kb->bt) { // release all keys bt_hid_hold_while_keyboard_buffer_full(6, 3000); // stop ble - bt_set_status_changed_callback(bad_usb->bt, NULL, NULL); + bt_set_status_changed_callback(bad_kb->bt, NULL, NULL); - bt_disconnect(bad_usb->bt); + bt_disconnect(bad_kb->bt); // Wait 2nd core to update nvm storage furi_delay_ms(200); - bt_keys_storage_set_default_path(bad_usb->bt); + bt_keys_storage_set_default_path(bad_kb->bt); - bt_set_profile_pairing_method(bad_usb->bt, old_pairing_method); + bt_set_profile_pairing_method(bad_kb->bt, old_pairing_method); // fails if ble radio stack isn't ready when switching profile // if it happens, maybe we should increase the delay after bt_disconnect - bt_set_profile(bad_usb->bt, BtProfileSerial); + bt_set_profile(bad_kb->bt, BtProfileSerial); } else { furi_hal_hid_set_state_callback(NULL, NULL); @@ -860,82 +860,82 @@ static int32_t bad_usb_worker(void* context) { storage_file_close(script_file); storage_file_free(script_file); - furi_string_free(bad_usb->line); - furi_string_free(bad_usb->line_prev); + furi_string_free(bad_kb->line); + furi_string_free(bad_kb->line_prev); FURI_LOG_I(WORKER_TAG, "End"); return 0; } -static void bad_usb_script_set_default_keyboard_layout(BadUsbScript* bad_usb) { - furi_assert(bad_usb); - furi_string_set_str(bad_usb->keyboard_layout, ""); - memset(bad_usb->layout, HID_KEYBOARD_NONE, sizeof(bad_usb->layout)); - memcpy(bad_usb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_usb->layout))); +static void bad_kb_script_set_default_keyboard_layout(BadKbScript* bad_kb) { + furi_assert(bad_kb); + furi_string_set_str(bad_kb->keyboard_layout, ""); + memset(bad_kb->layout, HID_KEYBOARD_NONE, sizeof(bad_kb->layout)); + memcpy(bad_kb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_kb->layout))); } -BadUsbScript* bad_usb_script_open(FuriString* file_path, Bt* bt) { +BadKbScript* bad_kb_script_open(FuriString* file_path, Bt* bt) { furi_assert(file_path); - BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript)); - bad_usb->file_path = furi_string_alloc(); - furi_string_set(bad_usb->file_path, file_path); - bad_usb->keyboard_layout = furi_string_alloc(); - bad_usb_script_set_default_keyboard_layout(bad_usb); + BadKbScript* bad_kb = malloc(sizeof(BadKbScript)); + bad_kb->file_path = furi_string_alloc(); + furi_string_set(bad_kb->file_path, file_path); + bad_kb->keyboard_layout = furi_string_alloc(); + bad_kb_script_set_default_keyboard_layout(bad_kb); - bad_usb->st.state = BadUsbStateInit; - bad_usb->st.error[0] = '\0'; + bad_kb->st.state = BadKbStateInit; + bad_kb->st.error[0] = '\0'; - bad_usb->bt = bt; + bad_kb->bt = bt; - bad_usb->thread = furi_thread_alloc_ex("BadUsbWorker", 2048, bad_usb_worker, bad_usb); - furi_thread_start(bad_usb->thread); - return bad_usb; + bad_kb->thread = furi_thread_alloc_ex("BadKbWorker", 2048, bad_kb_worker, bad_kb); + furi_thread_start(bad_kb->thread); + return bad_kb; } //-V773 -void bad_usb_script_close(BadUsbScript* bad_usb) { - furi_assert(bad_usb); +void bad_kb_script_close(BadKbScript* bad_kb) { + furi_assert(bad_kb); furi_record_close(RECORD_STORAGE); - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtEnd); - furi_thread_join(bad_usb->thread); - furi_thread_free(bad_usb->thread); - furi_string_free(bad_usb->file_path); - furi_string_free(bad_usb->keyboard_layout); - free(bad_usb); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtEnd); + furi_thread_join(bad_kb->thread); + furi_thread_free(bad_kb->thread); + furi_string_free(bad_kb->file_path); + furi_string_free(bad_kb->keyboard_layout); + free(bad_kb); } -void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, FuriString* layout_path) { - furi_assert(bad_usb); +void bad_kb_script_set_keyboard_layout(BadKbScript* bad_kb, FuriString* layout_path) { + furi_assert(bad_kb); - if((bad_usb->st.state == BadUsbStateRunning) || (bad_usb->st.state == BadUsbStateDelay)) { + if((bad_kb->st.state == BadKbStateRunning) || (bad_kb->st.state == BadKbStateDelay)) { // do not update keyboard layout while a script is running return; } File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE)); if(!furi_string_empty(layout_path)) { - furi_string_set(bad_usb->keyboard_layout, layout_path); + furi_string_set(bad_kb->keyboard_layout, layout_path); if(storage_file_open( layout_file, furi_string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) { uint16_t layout[128]; if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) { - memcpy(bad_usb->layout, layout, sizeof(layout)); + memcpy(bad_kb->layout, layout, sizeof(layout)); } } storage_file_close(layout_file); } else { - bad_usb_script_set_default_keyboard_layout(bad_usb); + bad_kb_script_set_default_keyboard_layout(bad_kb); } storage_file_free(layout_file); } -void bad_usb_script_toggle(BadUsbScript* bad_usb) { - furi_assert(bad_usb); - furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtToggle); +void bad_kb_script_toggle(BadKbScript* bad_kb) { + furi_assert(bad_kb); + furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtToggle); } -BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb) { - furi_assert(bad_usb); - return &(bad_usb->st); +BadKbState* bad_kb_script_get_state(BadKbScript* bad_kb) { + furi_assert(bad_kb); + return &(bad_kb->st); } diff --git a/applications/main/bad_kb/bad_kb_script.h b/applications/main/bad_kb/bad_kb_script.h new file mode 100644 index 000000000..35c57c112 --- /dev/null +++ b/applications/main/bad_kb/bad_kb_script.h @@ -0,0 +1,49 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +typedef struct BadKbScript BadKbScript; + +typedef enum { + BadKbStateInit, + BadKbStateNotConnected, + BadKbStateIdle, + BadKbStateWillRun, + BadKbStateRunning, + BadKbStateDelay, + BadKbStateDone, + BadKbStateScriptError, + BadKbStateFileError, +} BadKbWorkerState; + +typedef struct { + BadKbWorkerState state; + uint16_t line_cur; + uint16_t line_nb; + uint32_t delay_remain; + uint16_t error_line; + char error[64]; +} BadKbState; + +BadKbScript* bad_kb_script_open(FuriString* file_path, Bt* bt); + +void bad_kb_script_close(BadKbScript* bad_kb); + +void bad_kb_script_set_keyboard_layout(BadKbScript* bad_kb, FuriString* layout_path); + +void bad_kb_script_start(BadKbScript* bad_kb); + +void bad_kb_script_stop(BadKbScript* bad_kb); + +void bad_kb_script_toggle(BadKbScript* bad_kb); + +BadKbState* bad_kb_script_get_state(BadKbScript* bad_kb); + +#ifdef __cplusplus +} +#endif diff --git a/applications/main/bad_kb/bad_kb_settings_filename.h b/applications/main/bad_kb/bad_kb_settings_filename.h new file mode 100644 index 000000000..3eb7d3c0a --- /dev/null +++ b/applications/main/bad_kb/bad_kb_settings_filename.h @@ -0,0 +1,3 @@ +#pragma once + +#define BAD_KB_SETTINGS_FILE_NAME ".badkb.settings" diff --git a/applications/main/bad_kb/scenes/bad_kb_scene.c b/applications/main/bad_kb/scenes/bad_kb_scene.c new file mode 100644 index 000000000..f90d23a77 --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene.c @@ -0,0 +1,30 @@ +#include "bad_kb_scene.h" + +// Generate scene on_enter handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, +void (*const bad_kb_scene_on_enter_handlers[])(void*) = { +#include "bad_kb_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_event handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, +bool (*const bad_kb_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { +#include "bad_kb_scene_config.h" +}; +#undef ADD_SCENE + +// Generate scene on_exit handlers array +#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, +void (*const bad_kb_scene_on_exit_handlers[])(void* context) = { +#include "bad_kb_scene_config.h" +}; +#undef ADD_SCENE + +// Initialize scene handlers configuration structure +const SceneManagerHandlers bad_kb_scene_handlers = { + .on_enter_handlers = bad_kb_scene_on_enter_handlers, + .on_event_handlers = bad_kb_scene_on_event_handlers, + .on_exit_handlers = bad_kb_scene_on_exit_handlers, + .scene_num = BadKbSceneNum, +}; diff --git a/applications/main/bad_usb/scenes/bad_usb_scene.h b/applications/main/bad_kb/scenes/bad_kb_scene.h similarity index 68% rename from applications/main/bad_usb/scenes/bad_usb_scene.h rename to applications/main/bad_kb/scenes/bad_kb_scene.h index 68a753210..82db02873 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene.h +++ b/applications/main/bad_kb/scenes/bad_kb_scene.h @@ -3,27 +3,27 @@ #include // Generate scene id and total number -#define ADD_SCENE(prefix, name, id) BadUsbScene##id, +#define ADD_SCENE(prefix, name, id) BadKbScene##id, typedef enum { -#include "bad_usb_scene_config.h" - BadUsbSceneNum, -} BadUsbScene; +#include "bad_kb_scene_config.h" + BadKbSceneNum, +} BadKbScene; #undef ADD_SCENE -extern const SceneManagerHandlers bad_usb_scene_handlers; +extern const SceneManagerHandlers bad_kb_scene_handlers; // Generate scene on_enter handlers declaration #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_enter(void*); -#include "bad_usb_scene_config.h" +#include "bad_kb_scene_config.h" #undef ADD_SCENE // Generate scene on_event handlers declaration #define ADD_SCENE(prefix, name, id) \ bool prefix##_scene_##name##_on_event(void* context, SceneManagerEvent event); -#include "bad_usb_scene_config.h" +#include "bad_kb_scene_config.h" #undef ADD_SCENE // Generate scene on_exit handlers declaration #define ADD_SCENE(prefix, name, id) void prefix##_scene_##name##_on_exit(void* context); -#include "bad_usb_scene_config.h" +#include "bad_kb_scene_config.h" #undef ADD_SCENE diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config.h b/applications/main/bad_kb/scenes/bad_kb_scene_config.h new file mode 100644 index 000000000..794468eba --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config.h @@ -0,0 +1,8 @@ +ADD_SCENE(bad_kb, file_select, FileSelect) +ADD_SCENE(bad_kb, work, Work) +ADD_SCENE(bad_kb, error, Error) +ADD_SCENE(bad_kb, config_bt, ConfigBt) +ADD_SCENE(bad_kb, config_usb, ConfigUsb) +ADD_SCENE(bad_kb, config_layout, ConfigLayout) +ADD_SCENE(bad_kb, config_name, ConfigName) +ADD_SCENE(bad_kb, config_mac, ConfigMac) diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c new file mode 100644 index 000000000..fc1d19e76 --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c @@ -0,0 +1,84 @@ +#include "../bad_kb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" + +enum VarItemListIndex { + VarItemListIndexConnection, + VarItemListIndexKeyboardLayout, + VarItemListIndexAdvertisementName, + VarItemListIndexMacAddress, +}; + +void bad_kb_scene_config_bt_connection_callback(VariableItem* item) { + BadKbApp* bad_kb = variable_item_get_context(item); + bad_kb->is_bt = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, VarItemListIndexConnection); +} + +void bad_kb_scene_config_bt_var_item_list_callback(void* context, uint32_t index) { + BadKbApp* bad_kb = context; + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, index); +} + +void bad_kb_scene_config_bt_on_enter(void* context) { + BadKbApp* bad_kb = context; + VariableItemList* var_item_list = bad_kb->var_item_list_bt; + VariableItem* item; + + item = variable_item_list_add( + var_item_list, "Connection", 2, bad_kb_scene_config_bt_connection_callback, bad_kb); + variable_item_set_current_value_index(item, bad_kb->is_bt); + variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); + + item = variable_item_list_add( + var_item_list, "Keyboard layout", 0, NULL, bad_kb); + + item = variable_item_list_add( + var_item_list, "Change adv name", 0, NULL, bad_kb); + + item = variable_item_list_add( + var_item_list, "Change MAC address", 0, NULL, bad_kb); + + variable_item_list_set_enter_callback(var_item_list, bad_kb_scene_config_bt_var_item_list_callback, bad_kb); + + view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigBt); +} + +bool bad_kb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { + BadKbApp* bad_kb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(bad_kb->scene_manager, BadKbSceneConfigBt, event.event); + consumed = true; + if(event.event == VarItemListIndexKeyboardLayout) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); + } else if(event.event == VarItemListIndexConnection) { + bad_kb_script_close(bad_kb->bad_kb_script); + bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); + scene_manager_previous_scene(bad_kb->scene_manager); + if (bad_kb->is_bt) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigBt); + } else { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigUsb); + } + } else if(event.event == VarItemListIndexAdvertisementName) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigName); + } else if(event.event == VarItemListIndexMacAddress) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigMac); + // } else { + // furi_crash("Unknown key type"); + } + } + + return consumed; +} + +void bad_kb_scene_config_bt_on_exit(void* context) { + BadKbApp* bad_kb = context; + VariableItemList* var_item_list = bad_kb->var_item_list_bt; + + variable_item_list_reset(var_item_list); +} diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_layout.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_layout.c new file mode 100644 index 000000000..006ad31bd --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_layout.c @@ -0,0 +1,48 @@ +#include "../bad_kb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" +#include + +static bool bad_kb_layout_select(BadKbApp* bad_kb) { + furi_assert(bad_kb); + + FuriString* predefined_path; + predefined_path = furi_string_alloc(); + if(!furi_string_empty(bad_kb->keyboard_layout)) { + furi_string_set(predefined_path, bad_kb->keyboard_layout); + } else { + furi_string_set(predefined_path, BAD_KB_APP_PATH_LAYOUT_FOLDER); + } + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options( + &browser_options, BAD_KB_APP_LAYOUT_EXTENSION, &I_keyboard_10px); + + // Input events and views are managed by file_browser + bool res = dialog_file_browser_show( + bad_kb->dialogs, bad_kb->keyboard_layout, predefined_path, &browser_options); + + furi_string_free(predefined_path); + return res; +} + +void bad_kb_scene_config_layout_on_enter(void* context) { + BadKbApp* bad_kb = context; + + if(bad_kb_layout_select(bad_kb)) { + bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); + } + scene_manager_previous_scene(bad_kb->scene_manager); +} + +bool bad_kb_scene_config_layout_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + // BadKbApp* bad_kb = context; + return false; +} + +void bad_kb_scene_config_layout_on_exit(void* context) { + UNUSED(context); + // BadKbApp* bad_kb = context; +} diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_mac.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_mac.c new file mode 100644 index 000000000..0dc4be10a --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_mac.c @@ -0,0 +1,57 @@ +#include "../bad_kb_app_i.h" + +#define TAG "BadKbConfigMac" + +static uint8_t* reverse_mac_addr(uint8_t* mac) { + uint8_t tmp; + for(int i = 0; i < 3; i++) { + tmp = mac[i]; + mac[i] = mac[5 - i]; + mac[5 - i] = tmp; + } + return mac; +} + +void bad_kb_scene_config_mac_byte_input_callback(void* context) { + BadKbApp* bad_kb = context; + + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, BadKbAppCustomEventByteInputDone); +} + +void bad_kb_scene_config_mac_on_enter(void* context) { + BadKbApp* bad_kb = context; + + // Setup view + ByteInput* byte_input = bad_kb->byte_input; + byte_input_set_header_text(byte_input, "Enter new MAC address"); + byte_input_set_result_callback( + byte_input, + bad_kb_scene_config_mac_byte_input_callback, + NULL, + bad_kb, + reverse_mac_addr(bad_kb->mac), + GAP_MAC_ADDR_SIZE); + view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigMac); +} + +bool bad_kb_scene_config_mac_on_event(void* context, SceneManagerEvent event) { + BadKbApp* bad_kb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == BadKbAppCustomEventByteInputDone) { + bt_set_profile_mac_address(bad_kb->bt, reverse_mac_addr(bad_kb->mac)); + scene_manager_previous_scene(bad_kb->scene_manager); + consumed = true; + } + } + return consumed; +} + +void bad_kb_scene_config_mac_on_exit(void* context) { + BadKbApp* bad_kb = context; + + // Clear view + byte_input_set_result_callback(bad_kb->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(bad_kb->byte_input, ""); +} diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c new file mode 100644 index 000000000..d3d7628b1 --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c @@ -0,0 +1,46 @@ +#include "../bad_kb_app_i.h" + +static void bad_kb_scene_config_name_text_input_callback(void* context) { + BadKbApp* bad_kb = context; + + view_dispatcher_send_custom_event( + bad_kb->view_dispatcher, BadKbAppCustomEventTextEditResult); +} + +void bad_kb_scene_config_name_on_enter(void* context) { + BadKbApp* bad_kb = context; + TextInput* text_input = bad_kb->text_input; + + text_input_set_header_text(text_input, "Set BLE adv name"); + + text_input_set_result_callback( + text_input, + bad_kb_scene_config_name_text_input_callback, + bad_kb, + bad_kb->name, + BAD_KB_ADV_NAME_MAX_LEN, + true); + + view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigName); +} + +bool bad_kb_scene_config_name_on_event(void* context, SceneManagerEvent event) { + BadKbApp* bad_kb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + consumed = true; + if(event.event == BadKbAppCustomEventTextEditResult) { + bt_set_profile_adv_name(bad_kb->bt, bad_kb->name); + } + scene_manager_previous_scene(bad_kb->scene_manager); + } + return consumed; +} + +void bad_kb_scene_config_name_on_exit(void* context) { + BadKbApp* bad_kb = context; + TextInput* text_input = bad_kb->text_input; + + text_input_reset(text_input); +} diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c new file mode 100644 index 000000000..35c5ab8d2 --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c @@ -0,0 +1,72 @@ +#include "../bad_kb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" + +enum VarItemListIndex { + VarItemListIndexConnection, + VarItemListIndexKeyboardLayout, +}; + +void bad_kb_scene_config_usb_connection_callback(VariableItem* item) { + BadKbApp* bad_kb = variable_item_get_context(item); + bad_kb->is_bt = variable_item_get_current_value_index(item); + variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, VarItemListIndexConnection); +} + +void bad_kb_scene_config_usb_var_item_list_callback(void* context, uint32_t index) { + BadKbApp* bad_kb = context; + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, index); +} + +void bad_kb_scene_config_usb_on_enter(void* context) { + BadKbApp* bad_kb = context; + VariableItemList* var_item_list = bad_kb->var_item_list_usb; + VariableItem* item; + + item = variable_item_list_add( + var_item_list, "Connection", 2, bad_kb_scene_config_usb_connection_callback, bad_kb); + variable_item_set_current_value_index(item, bad_kb->is_bt); + variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); + + item = variable_item_list_add( + var_item_list, "Keyboard layout", 0, NULL, bad_kb); + + variable_item_list_set_enter_callback(var_item_list, bad_kb_scene_config_usb_var_item_list_callback, bad_kb); + + view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigUsb); +} + +bool bad_kb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { + BadKbApp* bad_kb = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + scene_manager_set_scene_state(bad_kb->scene_manager, BadKbSceneConfigUsb, event.event); + consumed = true; + if(event.event == VarItemListIndexKeyboardLayout) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); + } else if(event.event == VarItemListIndexConnection) { + bad_kb_script_close(bad_kb->bad_kb_script); + bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); + scene_manager_previous_scene(bad_kb->scene_manager); + if (bad_kb->is_bt) { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigBt); + } else { + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigUsb); + } + // } else { + // furi_crash("Unknown key type"); + } + } + + return consumed; +} + +void bad_kb_scene_config_usb_on_exit(void* context) { + BadKbApp* bad_kb = context; + VariableItemList* var_item_list = bad_kb->var_item_list_usb; + + variable_item_list_reset(var_item_list); +} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_error.c b/applications/main/bad_kb/scenes/bad_kb_scene_error.c similarity index 70% rename from applications/main/bad_usb/scenes/bad_usb_scene_error.c rename to applications/main/bad_kb/scenes/bad_kb_scene_error.c index d1290e0e0..bd1796d7a 100644 --- a/applications/main/bad_usb/scenes/bad_usb_scene_error.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_error.c @@ -1,20 +1,20 @@ -#include "../bad_usb_app_i.h" +#include "../bad_kb_app_i.h" #include "../../../settings/xtreme_settings/xtreme_settings.h" static void - bad_usb_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { + bad_kb_scene_error_event_callback(GuiButtonType result, InputType type, void* context) { furi_assert(context); - BadUsbApp* app = context; + BadKbApp* app = context; if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) { - view_dispatcher_send_custom_event(app->view_dispatcher, BadUsbCustomEventErrorBack); + view_dispatcher_send_custom_event(app->view_dispatcher, BadKbCustomEventErrorBack); } } -void bad_usb_scene_error_on_enter(void* context) { - BadUsbApp* app = context; +void bad_kb_scene_error_on_enter(void* context) { + BadKbApp* app = context; - if(app->error == BadUsbAppErrorNoFiles) { + if(app->error == BadKbAppErrorNoFiles) { widget_add_icon_element(app->widget, 0, 0, &I_SDQuestion_35x43); widget_add_string_multiline_element( app->widget, @@ -25,8 +25,8 @@ void bad_usb_scene_error_on_enter(void* context) { FontSecondary, "No SD card or\napp data found.\nThis app will not\nwork without\nrequired files."); widget_add_button_element( - app->widget, GuiButtonTypeLeft, "Back", bad_usb_scene_error_event_callback, app); - } else if(app->error == BadUsbAppErrorCloseRpc) { + app->widget, GuiButtonTypeLeft, "Back", bad_kb_scene_error_event_callback, app); + } else if(app->error == BadKbAppErrorCloseRpc) { widget_add_icon_element(app->widget, 78, 0, &I_ActiveConnection_50x64); if(XTREME_SETTINGS()->nsfw_mode) { widget_add_string_multiline_element( @@ -53,15 +53,15 @@ void bad_usb_scene_error_on_enter(void* context) { } } - view_dispatcher_switch_to_view(app->view_dispatcher, BadUsbAppViewError); + view_dispatcher_switch_to_view(app->view_dispatcher, BadKbAppViewError); } -bool bad_usb_scene_error_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* app = context; +bool bad_kb_scene_error_on_event(void* context, SceneManagerEvent event) { + BadKbApp* app = context; bool consumed = false; if(event.type == SceneManagerEventTypeCustom) { - if(event.event == BadUsbCustomEventErrorBack) { + if(event.event == BadKbCustomEventErrorBack) { view_dispatcher_stop(app->view_dispatcher); consumed = true; } @@ -69,7 +69,7 @@ bool bad_usb_scene_error_on_event(void* context, SceneManagerEvent event) { return consumed; } -void bad_usb_scene_error_on_exit(void* context) { - BadUsbApp* app = context; +void bad_kb_scene_error_on_exit(void* context) { + BadKbApp* app = context; widget_reset(app->widget); } diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c b/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c new file mode 100644 index 000000000..44012f68d --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c @@ -0,0 +1,52 @@ +#include "../bad_kb_app_i.h" +#include "furi_hal_power.h" +#include "furi_hal_usb.h" +#include + +static bool bad_kb_file_select(BadKbApp* bad_kb) { + furi_assert(bad_kb); + + DialogsFileBrowserOptions browser_options; + dialog_file_browser_set_basic_options( + &browser_options, BAD_KB_APP_SCRIPT_EXTENSION, &I_badkb_10px); + browser_options.base_path = BAD_KB_APP_BASE_FOLDER; + browser_options.skip_assets = true; + + // Input events and views are managed by file_browser + bool res = dialog_file_browser_show( + bad_kb->dialogs, bad_kb->file_path, bad_kb->file_path, &browser_options); + + return res; +} + +void bad_kb_scene_file_select_on_enter(void* context) { + BadKbApp* bad_kb = context; + + furi_hal_usb_disable(); + if(bad_kb->bad_kb_script) { + bad_kb_script_close(bad_kb->bad_kb_script); + bad_kb->bad_kb_script = NULL; + } + + if(bad_kb_file_select(bad_kb)) { + bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); + + scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneWork); + } else { + furi_hal_usb_enable(); + view_dispatcher_stop(bad_kb->view_dispatcher); + } +} + +bool bad_kb_scene_file_select_on_event(void* context, SceneManagerEvent event) { + UNUSED(context); + UNUSED(event); + // BadKbApp* bad_kb = context; + return false; +} + +void bad_kb_scene_file_select_on_exit(void* context) { + UNUSED(context); + // BadKbApp* bad_kb = context; +} diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_work.c b/applications/main/bad_kb/scenes/bad_kb_scene_work.c new file mode 100644 index 000000000..a7eac1786 --- /dev/null +++ b/applications/main/bad_kb/scenes/bad_kb_scene_work.c @@ -0,0 +1,58 @@ +#include "../bad_kb_script.h" +#include "../bad_kb_app_i.h" +#include "../views/bad_kb_view.h" +#include "furi_hal.h" +#include "toolbox/path.h" + +void bad_kb_scene_work_button_callback(InputKey key, void* context) { + furi_assert(context); + BadKbApp* app = context; + view_dispatcher_send_custom_event(app->view_dispatcher, key); +} + +bool bad_kb_scene_work_on_event(void* context, SceneManagerEvent event) { + BadKbApp* app = context; + bool consumed = false; + + if(event.type == SceneManagerEventTypeCustom) { + if(event.event == InputKeyLeft) { + if (app->is_bt) { + scene_manager_next_scene(app->scene_manager, BadKbSceneConfigBt); + } else { + scene_manager_next_scene(app->scene_manager, BadKbSceneConfigUsb); + } + consumed = true; + } else if(event.event == InputKeyOk) { + bad_kb_script_toggle(app->bad_kb_script); + consumed = true; + } + } else if(event.type == SceneManagerEventTypeTick) { + bad_kb_set_state(app->bad_kb_view, bad_kb_script_get_state(app->bad_kb_script)); + } + return consumed; +} + +void bad_kb_scene_work_on_enter(void* context) { + BadKbApp* app = context; + + FuriString* file_name; + file_name = furi_string_alloc(); + path_extract_filename(app->file_path, file_name, true); + bad_kb_set_file_name(app->bad_kb_view, furi_string_get_cstr(file_name)); + furi_string_free(file_name); + + FuriString* layout; + layout = furi_string_alloc(); + path_extract_filename(app->keyboard_layout, layout, true); + bad_kb_set_layout(app->bad_kb_view, furi_string_get_cstr(layout)); + furi_string_free(layout); + + bad_kb_set_state(app->bad_kb_view, bad_kb_script_get_state(app->bad_kb_script)); + + bad_kb_set_button_callback(app->bad_kb_view, bad_kb_scene_work_button_callback, app); + view_dispatcher_switch_to_view(app->view_dispatcher, BadKbAppViewWork); +} + +void bad_kb_scene_work_on_exit(void* context) { + UNUSED(context); +} diff --git a/applications/main/bad_usb/views/bad_usb_view.c b/applications/main/bad_kb/views/bad_kb_view.c similarity index 70% rename from applications/main/bad_usb/views/bad_usb_view.c rename to applications/main/bad_kb/views/bad_kb_view.c index ad889cd1c..a0fb39f88 100644 --- a/applications/main/bad_usb/views/bad_usb_view.c +++ b/applications/main/bad_kb/views/bad_kb_view.c @@ -1,5 +1,5 @@ -#include "bad_usb_view.h" -#include "../bad_usb_script.h" +#include "bad_kb_view.h" +#include "../bad_kb_script.h" #include #include #include @@ -7,21 +7,21 @@ #define MAX_NAME_LEN 64 -struct BadUsb { +struct BadKb { View* view; - BadUsbButtonCallback callback; + BadKbButtonCallback callback; void* context; }; typedef struct { char file_name[MAX_NAME_LEN]; char layout[MAX_NAME_LEN]; - BadUsbState state; + BadKbState state; uint8_t anim_frame; -} BadUsbModel; +} BadKbModel; -static void bad_usb_draw_callback(Canvas* canvas, void* _model) { - BadUsbModel* model = _model; +static void bad_kb_draw_callback(Canvas* canvas, void* _model) { + BadKbModel* model = _model; FuriString* disp_str; disp_str = furi_string_alloc_set(model->file_name); @@ -47,25 +47,25 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas_draw_icon(canvas, 22, 24, &I_UsbTree_48x22); - if((model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone) || - (model->state.state == BadUsbStateNotConnected)) { + if((model->state.state == BadKbStateIdle) || (model->state.state == BadKbStateDone) || + (model->state.state == BadKbStateNotConnected)) { if(xtreme_settings->nsfw_mode) { elements_button_center(canvas, "Cum"); } else { elements_button_center(canvas, "Start"); } - } else if((model->state.state == BadUsbStateRunning) || (model->state.state == BadUsbStateDelay)) { + } else if((model->state.state == BadKbStateRunning) || (model->state.state == BadKbStateDelay)) { elements_button_center(canvas, "Stop"); - } else if(model->state.state == BadUsbStateWillRun) { + } else if(model->state.state == BadKbStateWillRun) { elements_button_center(canvas, "Cancel"); } - if((model->state.state == BadUsbStateNotConnected) || - (model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone)) { + if((model->state.state == BadKbStateNotConnected) || + (model->state.state == BadKbStateIdle) || (model->state.state == BadKbStateDone)) { elements_button_left(canvas, "Config"); } - if(model->state.state == BadUsbStateNotConnected) { + if(model->state.state == BadKbStateNotConnected) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); if(xtreme_settings->nsfw_mode) { @@ -75,7 +75,7 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Connect to"); canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "a device"); } - } else if(model->state.state == BadUsbStateWillRun) { + } else if(model->state.state == BadKbStateWillRun) { canvas_draw_icon(canvas, 4, 26, &I_Clock_18x18); canvas_set_font(canvas, FontPrimary); if(xtreme_settings->nsfw_mode) { @@ -84,12 +84,12 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "Will run"); } canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "on connect"); - } else if(model->state.state == BadUsbStateFileError) { + } else if(model->state.state == BadKbStateFileError) { canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); canvas_set_font(canvas, FontPrimary); canvas_draw_str_aligned(canvas, 127, 31, AlignRight, AlignBottom, "File"); canvas_draw_str_aligned(canvas, 127, 43, AlignRight, AlignBottom, "ERROR"); - } else if(model->state.state == BadUsbStateScriptError) { + } else if(model->state.state == BadKbStateScriptError) { canvas_draw_icon(canvas, 4, 26, &I_Error_18x18); canvas_set_font(canvas, FontPrimary); canvas_draw_str_aligned(canvas, 127, 33, AlignRight, AlignBottom, "ERROR:"); @@ -99,12 +99,12 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas, 127, 46, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); canvas_draw_str_aligned(canvas, 127, 56, AlignRight, AlignBottom, model->state.error); - } else if(model->state.state == BadUsbStateIdle) { + } else if(model->state.state == BadKbStateIdle) { canvas_draw_icon(canvas, 4, 26, &I_Smile_18x18); canvas_set_font(canvas, FontBigNumbers); canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "0"); canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadUsbStateRunning) { + } else if(model->state.state == BadKbStateRunning) { if(model->anim_frame == 0) { canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); } else { @@ -117,13 +117,13 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { canvas, 114, 40, AlignRight, AlignBottom, furi_string_get_cstr(disp_str)); furi_string_reset(disp_str); canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadUsbStateDone) { + } else if(model->state.state == BadKbStateDone) { canvas_draw_icon(canvas, 4, 23, &I_EviSmile1_18x21); canvas_set_font(canvas, FontBigNumbers); canvas_draw_str_aligned(canvas, 114, 40, AlignRight, AlignBottom, "100"); furi_string_reset(disp_str); canvas_draw_icon(canvas, 117, 26, &I_Percent_10x14); - } else if(model->state.state == BadUsbStateDelay) { + } else if(model->state.state == BadKbStateDelay) { if(model->anim_frame == 0) { canvas_draw_icon(canvas, 4, 23, &I_EviWaiting1_18x21); } else { @@ -148,84 +148,84 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) { furi_string_free(disp_str); } -static bool bad_usb_input_callback(InputEvent* event, void* context) { +static bool bad_kb_input_callback(InputEvent* event, void* context) { furi_assert(context); - BadUsb* bad_usb = context; + BadKb* bad_kb = context; bool consumed = false; if(event->type == InputTypeShort) { if((event->key == InputKeyLeft) || (event->key == InputKeyOk)) { consumed = true; - furi_assert(bad_usb->callback); - bad_usb->callback(event->key, bad_usb->context); + furi_assert(bad_kb->callback); + bad_kb->callback(event->key, bad_kb->context); } } return consumed; } -BadUsb* bad_usb_alloc() { - BadUsb* bad_usb = malloc(sizeof(BadUsb)); +BadKb* bad_kb_alloc() { + BadKb* bad_kb = malloc(sizeof(BadKb)); - bad_usb->view = view_alloc(); - view_allocate_model(bad_usb->view, ViewModelTypeLocking, sizeof(BadUsbModel)); - view_set_context(bad_usb->view, bad_usb); - view_set_draw_callback(bad_usb->view, bad_usb_draw_callback); - view_set_input_callback(bad_usb->view, bad_usb_input_callback); + bad_kb->view = view_alloc(); + view_allocate_model(bad_kb->view, ViewModelTypeLocking, sizeof(BadKbModel)); + view_set_context(bad_kb->view, bad_kb); + view_set_draw_callback(bad_kb->view, bad_kb_draw_callback); + view_set_input_callback(bad_kb->view, bad_kb_input_callback); - return bad_usb; + return bad_kb; } -void bad_usb_free(BadUsb* bad_usb) { - furi_assert(bad_usb); - view_free(bad_usb->view); - free(bad_usb); +void bad_kb_free(BadKb* bad_kb) { + furi_assert(bad_kb); + view_free(bad_kb->view); + free(bad_kb); } -View* bad_usb_get_view(BadUsb* bad_usb) { - furi_assert(bad_usb); - return bad_usb->view; +View* bad_kb_get_view(BadKb* bad_kb) { + furi_assert(bad_kb); + return bad_kb->view; } -void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context) { - furi_assert(bad_usb); +void bad_kb_set_button_callback(BadKb* bad_kb, BadKbButtonCallback callback, void* context) { + furi_assert(bad_kb); furi_assert(callback); with_view_model( - bad_usb->view, - BadUsbModel * model, + bad_kb->view, + BadKbModel * model, { UNUSED(model); - bad_usb->callback = callback; - bad_usb->context = context; + bad_kb->callback = callback; + bad_kb->context = context; }, true); } -void bad_usb_set_file_name(BadUsb* bad_usb, const char* name) { +void bad_kb_set_file_name(BadKb* bad_kb, const char* name) { furi_assert(name); with_view_model( - bad_usb->view, - BadUsbModel * model, + bad_kb->view, + BadKbModel * model, { strlcpy(model->file_name, name, MAX_NAME_LEN); }, true); } -void bad_usb_set_layout(BadUsb* bad_usb, const char* layout) { +void bad_kb_set_layout(BadKb* bad_kb, const char* layout) { furi_assert(layout); with_view_model( - bad_usb->view, - BadUsbModel * model, + bad_kb->view, + BadKbModel * model, { strlcpy(model->layout, layout, MAX_NAME_LEN); }, true); } -void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st) { +void bad_kb_set_state(BadKb* bad_kb, BadKbState* st) { furi_assert(st); with_view_model( - bad_usb->view, - BadUsbModel * model, + bad_kb->view, + BadKbModel * model, { - memcpy(&(model->state), st, sizeof(BadUsbState)); + memcpy(&(model->state), st, sizeof(BadKbState)); model->anim_frame ^= 1; }, true); diff --git a/applications/main/bad_kb/views/bad_kb_view.h b/applications/main/bad_kb/views/bad_kb_view.h new file mode 100644 index 000000000..24fdf4792 --- /dev/null +++ b/applications/main/bad_kb/views/bad_kb_view.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include "../bad_kb_script.h" + +typedef struct BadKb BadKb; +typedef void (*BadKbButtonCallback)(InputKey key, void* context); + +BadKb* bad_kb_alloc(); + +void bad_kb_free(BadKb* bad_kb); + +View* bad_kb_get_view(BadKb* bad_kb); + +void bad_kb_set_button_callback(BadKb* bad_kb, BadKbButtonCallback callback, void* context); + +void bad_kb_set_file_name(BadKb* bad_kb, const char* name); + +void bad_kb_set_layout(BadKb* bad_kb, const char* layout); + +void bad_kb_set_state(BadKb* bad_kb, BadKbState* st); diff --git a/applications/main/bad_usb/bad_usb_app.h b/applications/main/bad_usb/bad_usb_app.h deleted file mode 100644 index 4192a59c9..000000000 --- a/applications/main/bad_usb/bad_usb_app.h +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct BadUsbApp BadUsbApp; - -void bad_usb_set_name(BadUsbApp* app, const char* fmt, ...); - -#ifdef __cplusplus -} -#endif diff --git a/applications/main/bad_usb/bad_usb_app_i.h b/applications/main/bad_usb/bad_usb_app_i.h deleted file mode 100644 index abd252bb4..000000000 --- a/applications/main/bad_usb/bad_usb_app_i.h +++ /dev/null @@ -1,80 +0,0 @@ -#pragma once - -#include "bad_usb_app.h" -#include "scenes/bad_usb_scene.h" -#include "bad_usb_script.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "views/bad_usb_view.h" - -#define BAD_USB_APP_BASE_FOLDER ANY_PATH("badusb") -#define BAD_USB_APP_PATH_LAYOUT_FOLDER BAD_USB_APP_BASE_FOLDER "/layouts" -#define BAD_USB_APP_SCRIPT_EXTENSION ".txt" -#define BAD_USB_APP_LAYOUT_EXTENSION ".kl" - -#define BAD_USB_MAC_ADDRESS_LEN 6 // need replace with MAC size maccro -#define BAD_USB_ADV_NAME_MAX_LEN 18 - -typedef enum { - BadUsbAppErrorNoFiles, - BadUsbAppErrorCloseRpc, -} BadUsbAppError; - -typedef enum BadUsbCustomEvent { - BadUsbAppCustomEventTextEditResult, - BadUsbAppCustomEventByteInputDone, - BadUsbCustomEventErrorBack -} BadUsbCustomEvent; - -typedef struct { - uint8_t mac[BAD_USB_MAC_ADDRESS_LEN]; - char name[BAD_USB_ADV_NAME_MAX_LEN + 1]; - - // number of bt keys before starting the app (all keys added in - // the bt keys file then will be removed) - uint16_t n_keys; -} BadUsbBtConfig; - -struct BadUsbApp { - Gui* gui; - ViewDispatcher* view_dispatcher; - SceneManager* scene_manager; - NotificationApp* notifications; - DialogsApp* dialogs; - Widget* widget; - VariableItemList* var_item_list_bt; - VariableItemList* var_item_list_usb; - - Bt* bt; - TextInput* text_input; - ByteInput* byte_input; - uint8_t mac[BAD_USB_MAC_ADDRESS_LEN]; - char name[BAD_USB_ADV_NAME_MAX_LEN + 1]; - BadUsbBtConfig bt_old_config; - - BadUsbAppError error; - FuriString* file_path; - FuriString* keyboard_layout; - BadUsb* bad_usb_view; - BadUsbScript* bad_usb_script; - - bool is_bt; -}; - -typedef enum { - BadUsbAppViewError, - BadUsbAppViewWork, - BadUsbAppViewConfigBt, - BadUsbAppViewConfigUsb, - BadUsbAppViewConfigMac, - BadUsbAppViewConfigName -} BadUsbAppView; diff --git a/applications/main/bad_usb/bad_usb_script.h b/applications/main/bad_usb/bad_usb_script.h deleted file mode 100644 index 5c37bcec2..000000000 --- a/applications/main/bad_usb/bad_usb_script.h +++ /dev/null @@ -1,49 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -typedef struct BadUsbScript BadUsbScript; - -typedef enum { - BadUsbStateInit, - BadUsbStateNotConnected, - BadUsbStateIdle, - BadUsbStateWillRun, - BadUsbStateRunning, - BadUsbStateDelay, - BadUsbStateDone, - BadUsbStateScriptError, - BadUsbStateFileError, -} BadUsbWorkerState; - -typedef struct { - BadUsbWorkerState state; - uint16_t line_cur; - uint16_t line_nb; - uint32_t delay_remain; - uint16_t error_line; - char error[64]; -} BadUsbState; - -BadUsbScript* bad_usb_script_open(FuriString* file_path, Bt* bt); - -void bad_usb_script_close(BadUsbScript* bad_usb); - -void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, FuriString* layout_path); - -void bad_usb_script_start(BadUsbScript* bad_usb); - -void bad_usb_script_stop(BadUsbScript* bad_usb); - -void bad_usb_script_toggle(BadUsbScript* bad_usb); - -BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb); - -#ifdef __cplusplus -} -#endif diff --git a/applications/main/bad_usb/bad_usb_settings_filename.h b/applications/main/bad_usb/bad_usb_settings_filename.h deleted file mode 100644 index 12ba8f31c..000000000 --- a/applications/main/bad_usb/bad_usb_settings_filename.h +++ /dev/null @@ -1,3 +0,0 @@ -#pragma once - -#define BAD_USB_SETTINGS_FILE_NAME ".badusb.settings" diff --git a/applications/main/bad_usb/scenes/bad_usb_scene.c b/applications/main/bad_usb/scenes/bad_usb_scene.c deleted file mode 100644 index 03c7c4471..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene.c +++ /dev/null @@ -1,30 +0,0 @@ -#include "bad_usb_scene.h" - -// Generate scene on_enter handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_enter, -void (*const bad_usb_scene_on_enter_handlers[])(void*) = { -#include "bad_usb_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_event handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_event, -bool (*const bad_usb_scene_on_event_handlers[])(void* context, SceneManagerEvent event) = { -#include "bad_usb_scene_config.h" -}; -#undef ADD_SCENE - -// Generate scene on_exit handlers array -#define ADD_SCENE(prefix, name, id) prefix##_scene_##name##_on_exit, -void (*const bad_usb_scene_on_exit_handlers[])(void* context) = { -#include "bad_usb_scene_config.h" -}; -#undef ADD_SCENE - -// Initialize scene handlers configuration structure -const SceneManagerHandlers bad_usb_scene_handlers = { - .on_enter_handlers = bad_usb_scene_on_enter_handlers, - .on_event_handlers = bad_usb_scene_on_event_handlers, - .on_exit_handlers = bad_usb_scene_on_exit_handlers, - .scene_num = BadUsbSceneNum, -}; diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config.h b/applications/main/bad_usb/scenes/bad_usb_scene_config.h deleted file mode 100644 index 2524464f1..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config.h +++ /dev/null @@ -1,8 +0,0 @@ -ADD_SCENE(bad_usb, file_select, FileSelect) -ADD_SCENE(bad_usb, work, Work) -ADD_SCENE(bad_usb, error, Error) -ADD_SCENE(bad_usb, config_bt, ConfigBt) -ADD_SCENE(bad_usb, config_usb, ConfigUsb) -ADD_SCENE(bad_usb, config_layout, ConfigLayout) -ADD_SCENE(bad_usb, config_name, ConfigName) -ADD_SCENE(bad_usb, config_mac, ConfigMac) diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c deleted file mode 100644 index 7071e748e..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_bt.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "../bad_usb_app_i.h" -#include "furi_hal_power.h" -#include "furi_hal_usb.h" - -enum VarItemListIndex { - VarItemListIndexConnection, - VarItemListIndexKeyboardLayout, - VarItemListIndexAdvertisementName, - VarItemListIndexMacAddress, -}; - -void bad_usb_scene_config_bt_connection_callback(VariableItem* item) { - BadUsbApp* bad_usb = variable_item_get_context(item); - bad_usb->is_bt = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); -} - -void bad_usb_scene_config_bt_var_item_list_callback(void* context, uint32_t index) { - BadUsbApp* bad_usb = context; - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); -} - -void bad_usb_scene_config_bt_on_enter(void* context) { - BadUsbApp* bad_usb = context; - VariableItemList* var_item_list = bad_usb->var_item_list_bt; - VariableItem* item; - - item = variable_item_list_add( - var_item_list, "Connection", 2, bad_usb_scene_config_bt_connection_callback, bad_usb); - variable_item_set_current_value_index(item, bad_usb->is_bt); - variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); - - item = variable_item_list_add( - var_item_list, "Keyboard layout", 0, NULL, bad_usb); - - item = variable_item_list_add( - var_item_list, "Change adv name", 0, NULL, bad_usb); - - item = variable_item_list_add( - var_item_list, "Change MAC address", 0, NULL, bad_usb); - - variable_item_list_set_enter_callback(var_item_list, bad_usb_scene_config_bt_var_item_list_callback, bad_usb); - - view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigBt); -} - -bool bad_usb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* bad_usb = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfigBt, event.event); - consumed = true; - if(event.event == VarItemListIndexKeyboardLayout) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); - } else if(event.event == VarItemListIndexConnection) { - bad_usb_script_close(bad_usb->bad_usb_script); - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); - scene_manager_previous_scene(bad_usb->scene_manager); - if (bad_usb->is_bt) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); - } else { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); - } - } else if(event.event == VarItemListIndexAdvertisementName) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigName); - } else if(event.event == VarItemListIndexMacAddress) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigMac); - // } else { - // furi_crash("Unknown key type"); - } - } - - return consumed; -} - -void bad_usb_scene_config_bt_on_exit(void* context) { - BadUsbApp* bad_usb = context; - VariableItemList* var_item_list = bad_usb->var_item_list_bt; - - variable_item_list_reset(var_item_list); -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c deleted file mode 100644 index 44dcd55af..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_layout.c +++ /dev/null @@ -1,48 +0,0 @@ -#include "../bad_usb_app_i.h" -#include "furi_hal_power.h" -#include "furi_hal_usb.h" -#include - -static bool bad_usb_layout_select(BadUsbApp* bad_usb) { - furi_assert(bad_usb); - - FuriString* predefined_path; - predefined_path = furi_string_alloc(); - if(!furi_string_empty(bad_usb->keyboard_layout)) { - furi_string_set(predefined_path, bad_usb->keyboard_layout); - } else { - furi_string_set(predefined_path, BAD_USB_APP_PATH_LAYOUT_FOLDER); - } - - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options( - &browser_options, BAD_USB_APP_LAYOUT_EXTENSION, &I_keyboard_10px); - - // Input events and views are managed by file_browser - bool res = dialog_file_browser_show( - bad_usb->dialogs, bad_usb->keyboard_layout, predefined_path, &browser_options); - - furi_string_free(predefined_path); - return res; -} - -void bad_usb_scene_config_layout_on_enter(void* context) { - BadUsbApp* bad_usb = context; - - if(bad_usb_layout_select(bad_usb)) { - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); - } - scene_manager_previous_scene(bad_usb->scene_manager); -} - -bool bad_usb_scene_config_layout_on_event(void* context, SceneManagerEvent event) { - UNUSED(context); - UNUSED(event); - // BadUsbApp* bad_usb = context; - return false; -} - -void bad_usb_scene_config_layout_on_exit(void* context) { - UNUSED(context); - // BadUsbApp* bad_usb = context; -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c deleted file mode 100644 index 597cbcbd7..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_mac.c +++ /dev/null @@ -1,57 +0,0 @@ -#include "../bad_usb_app_i.h" - -#define TAG "BadUsbConfigMac" - -static uint8_t* reverse_mac_addr(uint8_t* mac) { - uint8_t tmp; - for(int i = 0; i < 3; i++) { - tmp = mac[i]; - mac[i] = mac[5 - i]; - mac[5 - i] = tmp; - } - return mac; -} - -void bad_usb_scene_config_mac_byte_input_callback(void* context) { - BadUsbApp* bad_usb = context; - - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, BadUsbAppCustomEventByteInputDone); -} - -void bad_usb_scene_config_mac_on_enter(void* context) { - BadUsbApp* bad_usb = context; - - // Setup view - ByteInput* byte_input = bad_usb->byte_input; - byte_input_set_header_text(byte_input, "Enter new MAC address"); - byte_input_set_result_callback( - byte_input, - bad_usb_scene_config_mac_byte_input_callback, - NULL, - bad_usb, - reverse_mac_addr(bad_usb->mac), - GAP_MAC_ADDR_SIZE); - view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigMac); -} - -bool bad_usb_scene_config_mac_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* bad_usb = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == BadUsbAppCustomEventByteInputDone) { - bt_set_profile_mac_address(bad_usb->bt, reverse_mac_addr(bad_usb->mac)); - scene_manager_previous_scene(bad_usb->scene_manager); - consumed = true; - } - } - return consumed; -} - -void bad_usb_scene_config_mac_on_exit(void* context) { - BadUsbApp* bad_usb = context; - - // Clear view - byte_input_set_result_callback(bad_usb->byte_input, NULL, NULL, NULL, NULL, 0); - byte_input_set_header_text(bad_usb->byte_input, ""); -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c deleted file mode 100644 index c22558d58..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_name.c +++ /dev/null @@ -1,46 +0,0 @@ -#include "../bad_usb_app_i.h" - -static void bad_usb_scene_config_name_text_input_callback(void* context) { - BadUsbApp* bad_usb = context; - - view_dispatcher_send_custom_event( - bad_usb->view_dispatcher, BadUsbAppCustomEventTextEditResult); -} - -void bad_usb_scene_config_name_on_enter(void* context) { - BadUsbApp* bad_usb = context; - TextInput* text_input = bad_usb->text_input; - - text_input_set_header_text(text_input, "Set BLE adv name"); - - text_input_set_result_callback( - text_input, - bad_usb_scene_config_name_text_input_callback, - bad_usb, - bad_usb->name, - BAD_USB_ADV_NAME_MAX_LEN, - true); - - view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigName); -} - -bool bad_usb_scene_config_name_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* bad_usb = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - consumed = true; - if(event.event == BadUsbAppCustomEventTextEditResult) { - bt_set_profile_adv_name(bad_usb->bt, bad_usb->name); - } - scene_manager_previous_scene(bad_usb->scene_manager); - } - return consumed; -} - -void bad_usb_scene_config_name_on_exit(void* context) { - BadUsbApp* bad_usb = context; - TextInput* text_input = bad_usb->text_input; - - text_input_reset(text_input); -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c b/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c deleted file mode 100644 index af7abd570..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_config_usb.c +++ /dev/null @@ -1,72 +0,0 @@ -#include "../bad_usb_app_i.h" -#include "furi_hal_power.h" -#include "furi_hal_usb.h" - -enum VarItemListIndex { - VarItemListIndexConnection, - VarItemListIndexKeyboardLayout, -}; - -void bad_usb_scene_config_usb_connection_callback(VariableItem* item) { - BadUsbApp* bad_usb = variable_item_get_context(item); - bad_usb->is_bt = variable_item_get_current_value_index(item); - variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, VarItemListIndexConnection); -} - -void bad_usb_scene_config_usb_var_item_list_callback(void* context, uint32_t index) { - BadUsbApp* bad_usb = context; - view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index); -} - -void bad_usb_scene_config_usb_on_enter(void* context) { - BadUsbApp* bad_usb = context; - VariableItemList* var_item_list = bad_usb->var_item_list_usb; - VariableItem* item; - - item = variable_item_list_add( - var_item_list, "Connection", 2, bad_usb_scene_config_usb_connection_callback, bad_usb); - variable_item_set_current_value_index(item, bad_usb->is_bt); - variable_item_set_current_value_text(item, bad_usb->is_bt ? "BT" : "USB"); - - item = variable_item_list_add( - var_item_list, "Keyboard layout", 0, NULL, bad_usb); - - variable_item_list_set_enter_callback(var_item_list, bad_usb_scene_config_usb_var_item_list_callback, bad_usb); - - view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfigUsb); -} - -bool bad_usb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* bad_usb = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfigUsb, event.event); - consumed = true; - if(event.event == VarItemListIndexKeyboardLayout) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout); - } else if(event.event == VarItemListIndexConnection) { - bad_usb_script_close(bad_usb->bad_usb_script); - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); - scene_manager_previous_scene(bad_usb->scene_manager); - if (bad_usb->is_bt) { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigBt); - } else { - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigUsb); - } - // } else { - // furi_crash("Unknown key type"); - } - } - - return consumed; -} - -void bad_usb_scene_config_usb_on_exit(void* context) { - BadUsbApp* bad_usb = context; - VariableItemList* var_item_list = bad_usb->var_item_list_usb; - - variable_item_list_reset(var_item_list); -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c b/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c deleted file mode 100644 index eb72f1765..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_file_select.c +++ /dev/null @@ -1,52 +0,0 @@ -#include "../bad_usb_app_i.h" -#include "furi_hal_power.h" -#include "furi_hal_usb.h" -#include - -static bool bad_usb_file_select(BadUsbApp* bad_usb) { - furi_assert(bad_usb); - - DialogsFileBrowserOptions browser_options; - dialog_file_browser_set_basic_options( - &browser_options, BAD_USB_APP_SCRIPT_EXTENSION, &I_badusb_10px); - browser_options.base_path = BAD_USB_APP_BASE_FOLDER; - browser_options.skip_assets = true; - - // Input events and views are managed by file_browser - bool res = dialog_file_browser_show( - bad_usb->dialogs, bad_usb->file_path, bad_usb->file_path, &browser_options); - - return res; -} - -void bad_usb_scene_file_select_on_enter(void* context) { - BadUsbApp* bad_usb = context; - - furi_hal_usb_disable(); - if(bad_usb->bad_usb_script) { - bad_usb_script_close(bad_usb->bad_usb_script); - bad_usb->bad_usb_script = NULL; - } - - if(bad_usb_file_select(bad_usb)) { - bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path, bad_usb->is_bt ? bad_usb->bt : NULL); - bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout); - - scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork); - } else { - furi_hal_usb_enable(); - view_dispatcher_stop(bad_usb->view_dispatcher); - } -} - -bool bad_usb_scene_file_select_on_event(void* context, SceneManagerEvent event) { - UNUSED(context); - UNUSED(event); - // BadUsbApp* bad_usb = context; - return false; -} - -void bad_usb_scene_file_select_on_exit(void* context) { - UNUSED(context); - // BadUsbApp* bad_usb = context; -} diff --git a/applications/main/bad_usb/scenes/bad_usb_scene_work.c b/applications/main/bad_usb/scenes/bad_usb_scene_work.c deleted file mode 100644 index 03a8114e0..000000000 --- a/applications/main/bad_usb/scenes/bad_usb_scene_work.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "../bad_usb_script.h" -#include "../bad_usb_app_i.h" -#include "../views/bad_usb_view.h" -#include "furi_hal.h" -#include "toolbox/path.h" - -void bad_usb_scene_work_button_callback(InputKey key, void* context) { - furi_assert(context); - BadUsbApp* app = context; - view_dispatcher_send_custom_event(app->view_dispatcher, key); -} - -bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) { - BadUsbApp* app = context; - bool consumed = false; - - if(event.type == SceneManagerEventTypeCustom) { - if(event.event == InputKeyLeft) { - if (app->is_bt) { - scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigBt); - } else { - scene_manager_next_scene(app->scene_manager, BadUsbSceneConfigUsb); - } - consumed = true; - } else if(event.event == InputKeyOk) { - bad_usb_script_toggle(app->bad_usb_script); - consumed = true; - } - } else if(event.type == SceneManagerEventTypeTick) { - bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); - } - return consumed; -} - -void bad_usb_scene_work_on_enter(void* context) { - BadUsbApp* app = context; - - FuriString* file_name; - file_name = furi_string_alloc(); - path_extract_filename(app->file_path, file_name, true); - bad_usb_set_file_name(app->bad_usb_view, furi_string_get_cstr(file_name)); - furi_string_free(file_name); - - FuriString* layout; - layout = furi_string_alloc(); - path_extract_filename(app->keyboard_layout, layout, true); - bad_usb_set_layout(app->bad_usb_view, furi_string_get_cstr(layout)); - furi_string_free(layout); - - bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script)); - - bad_usb_set_button_callback(app->bad_usb_view, bad_usb_scene_work_button_callback, app); - view_dispatcher_switch_to_view(app->view_dispatcher, BadUsbAppViewWork); -} - -void bad_usb_scene_work_on_exit(void* context) { - UNUSED(context); -} diff --git a/applications/main/bad_usb/views/bad_usb_view.h b/applications/main/bad_usb/views/bad_usb_view.h deleted file mode 100644 index 8447fb055..000000000 --- a/applications/main/bad_usb/views/bad_usb_view.h +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include -#include "../bad_usb_script.h" - -typedef struct BadUsb BadUsb; -typedef void (*BadUsbButtonCallback)(InputKey key, void* context); - -BadUsb* bad_usb_alloc(); - -void bad_usb_free(BadUsb* bad_usb); - -View* bad_usb_get_view(BadUsb* bad_usb); - -void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context); - -void bad_usb_set_file_name(BadUsb* bad_usb, const char* name); - -void bad_usb_set_layout(BadUsb* bad_usb, const char* layout); - -void bad_usb_set_state(BadUsb* bad_usb, BadUsbState* st); diff --git a/applications/plugins/dolphinbackup/storage_DolphinBackup.c b/applications/plugins/dolphinbackup/storage_DolphinBackup.c index 02baddc0f..7e7bd8f36 100644 --- a/applications/plugins/dolphinbackup/storage_DolphinBackup.c +++ b/applications/plugins/dolphinbackup/storage_DolphinBackup.c @@ -16,7 +16,7 @@ static const char* app_dirsDolphinBackup[] = { "nfc", "infrared", "ibutton", - "badusb", + "badkb", ".bt.settings", ".desktop.settings", ".dolphin.state", diff --git a/applications/plugins/mousejacker/icons/badusb_10px.png b/applications/plugins/mousejacker/icons/badkb_10px.png similarity index 100% rename from applications/plugins/mousejacker/icons/badusb_10px.png rename to applications/plugins/mousejacker/icons/badkb_10px.png diff --git a/applications/plugins/mousejacker/images/badusb_10px.png b/applications/plugins/mousejacker/images/badkb_10px.png similarity index 100% rename from applications/plugins/mousejacker/images/badusb_10px.png rename to applications/plugins/mousejacker/images/badkb_10px.png diff --git a/applications/plugins/mousejacker/mousejacker.c b/applications/plugins/mousejacker/mousejacker.c index c45b0e502..3bd772889 100644 --- a/applications/plugins/mousejacker/mousejacker.c +++ b/applications/plugins/mousejacker/mousejacker.c @@ -112,7 +112,7 @@ static bool open_ducky_script(Stream* stream, PluginState* plugin_state) { DialogsFileBrowserOptions browser_options; dialog_file_browser_set_basic_options( - &browser_options, MOUSEJACKER_APP_PATH_EXTENSION, &I_badusb_10px); + &browser_options, MOUSEJACKER_APP_PATH_EXTENSION, &I_badkb_10px); browser_options.hide_ext = false; bool ret = dialog_file_browser_show(dialogs, path, path, &browser_options); @@ -396,4 +396,4 @@ int32_t mousejacker_app(void* p) { free(plugin_state); return 0; -} \ No newline at end of file +} diff --git a/applications/plugins/totp/services/config/config.c b/applications/plugins/totp/services/config/config.c index cd19d19d4..c5193ac2e 100644 --- a/applications/plugins/totp/services/config/config.c +++ b/applications/plugins/totp/services/config/config.c @@ -132,7 +132,7 @@ static TotpConfigFileOpenResult totp_open_config_file(Storage* storage, FlipperF flipper_format_write_comment_cstr(fff_data_file, " "); flipper_format_write_comment_cstr( fff_data_file, - "How to notify user when new token is generated or badusb mode is activated (possible values: 0 - do not notify, 1 - sound, 2 - vibro, 3 sound and vibro)"); + "How to notify user when new token is generated or badkb mode is activated (possible values: 0 - do not notify, 1 - sound, 2 - vibro, 3 sound and vibro)"); flipper_format_write_uint32( fff_data_file, TOTP_CONFIG_KEY_NOTIFICATION_METHOD, &tmp_uint32, 1); @@ -769,4 +769,4 @@ void totp_config_file_reset() { Storage* storage = totp_open_storage(); storage_simply_remove(storage, CONFIG_FILE_PATH); totp_close_storage(); -} \ No newline at end of file +} diff --git a/applications/plugins/totp/ui/scenes/generate_token/totp_scene_generate_token.c b/applications/plugins/totp/ui/scenes/generate_token/totp_scene_generate_token.c index 41c52b435..18d1791f4 100644 --- a/applications/plugins/totp/ui/scenes/generate_token/totp_scene_generate_token.c +++ b/applications/plugins/totp/ui/scenes/generate_token/totp_scene_generate_token.c @@ -24,7 +24,7 @@ typedef struct { uint32_t last_token_gen_time; TotpTypeCodeWorkerContext* type_code_worker_context; NotificationMessage const** notification_sequence_new_token; - NotificationMessage const** notification_sequence_badusb; + NotificationMessage const** notification_sequence_badkb; } SceneState; static const NotificationSequence* @@ -69,8 +69,8 @@ static const NotificationSequence* } static const NotificationSequence* - get_notification_sequence_badusb(const PluginState* plugin_state, SceneState* scene_state) { - if(scene_state->notification_sequence_badusb == NULL) { + get_notification_sequence_badkb(const PluginState* plugin_state, SceneState* scene_state) { + if(scene_state->notification_sequence_badkb == NULL) { uint8_t i = 0; uint8_t length = 3; if(plugin_state->notification_method & NotificationMethodVibro) { @@ -81,36 +81,36 @@ static const NotificationSequence* length += 6; } - scene_state->notification_sequence_badusb = malloc(sizeof(void*) * length); - furi_check(scene_state->notification_sequence_badusb != NULL); + scene_state->notification_sequence_badkb = malloc(sizeof(void*) * length); + furi_check(scene_state->notification_sequence_badkb != NULL); - scene_state->notification_sequence_badusb[i++] = &message_blue_255; + scene_state->notification_sequence_badkb[i++] = &message_blue_255; if(plugin_state->notification_method & NotificationMethodVibro) { - scene_state->notification_sequence_badusb[i++] = &message_vibro_on; + scene_state->notification_sequence_badkb[i++] = &message_vibro_on; } if(plugin_state->notification_method & NotificationMethodSound) { - scene_state->notification_sequence_badusb[i++] = &message_note_d5; //-V525 - scene_state->notification_sequence_badusb[i++] = &message_delay_50; - scene_state->notification_sequence_badusb[i++] = &message_note_e4; - scene_state->notification_sequence_badusb[i++] = &message_delay_50; - scene_state->notification_sequence_badusb[i++] = &message_note_f3; + scene_state->notification_sequence_badkb[i++] = &message_note_d5; //-V525 + scene_state->notification_sequence_badkb[i++] = &message_delay_50; + scene_state->notification_sequence_badkb[i++] = &message_note_e4; + scene_state->notification_sequence_badkb[i++] = &message_delay_50; + scene_state->notification_sequence_badkb[i++] = &message_note_f3; } - scene_state->notification_sequence_badusb[i++] = &message_delay_50; + scene_state->notification_sequence_badkb[i++] = &message_delay_50; if(plugin_state->notification_method & NotificationMethodVibro) { - scene_state->notification_sequence_badusb[i++] = &message_vibro_off; + scene_state->notification_sequence_badkb[i++] = &message_vibro_off; } if(plugin_state->notification_method & NotificationMethodSound) { - scene_state->notification_sequence_badusb[i++] = &message_sound_off; + scene_state->notification_sequence_badkb[i++] = &message_sound_off; } - scene_state->notification_sequence_badusb[i++] = NULL; + scene_state->notification_sequence_badkb[i++] = NULL; } - return (NotificationSequence*)scene_state->notification_sequence_badusb; + return (NotificationSequence*)scene_state->notification_sequence_badkb; } static void int_token_to_str(uint32_t i_token_code, char* str, TokenDigitsCount len) { @@ -340,7 +340,7 @@ bool totp_scene_generate_token_handle_event( scene_state->type_code_worker_context, TotpTypeCodeWorkerEventType); notification_message( plugin_state->notification_app, - get_notification_sequence_badusb(plugin_state, scene_state)); + get_notification_sequence_badkb(plugin_state, scene_state)); return true; } @@ -399,8 +399,8 @@ void totp_scene_generate_token_deactivate(PluginState* plugin_state) { free(scene_state->notification_sequence_new_token); } - if(scene_state->notification_sequence_badusb != NULL) { - free(scene_state->notification_sequence_badusb); + if(scene_state->notification_sequence_badkb != NULL) { + free(scene_state->notification_sequence_badkb); } free(scene_state); diff --git a/applications/services/dolphin/helpers/dolphin_deed.c b/applications/services/dolphin/helpers/dolphin_deed.c index 51db56fdf..4b9f11599 100644 --- a/applications/services/dolphin/helpers/dolphin_deed.c +++ b/applications/services/dolphin/helpers/dolphin_deed.c @@ -34,7 +34,7 @@ static const DolphinDeedWeight dolphin_deed_weights[] = { {2, DolphinAppIbutton}, // DolphinDeedIbuttonEmulate {2, DolphinAppIbutton}, // DolphinDeedIbuttonAdd - {3, DolphinAppBadusb}, // DolphinDeedBadUsbPlayScript + {3, DolphinAppBadKb}, // DolphinDeedBadKbPlayScript {3, DolphinAppPlugin}, // DolphinDeedU2fAuthorized {1, DolphinAppPlugin}, // DolphinDeedGpioUartBridge @@ -50,7 +50,7 @@ static uint8_t dolphin_deed_limits[] = { 20, // DolphinAppNfc 20, // DolphinAppIr 20, // DolphinAppIbutton - 20, // DolphinAppBadusb + 20, // DolphinAppBadKb 20, // DolphinAppPlugin }; diff --git a/applications/services/dolphin/helpers/dolphin_deed.h b/applications/services/dolphin/helpers/dolphin_deed.h index c9cd18f31..51adf6b20 100644 --- a/applications/services/dolphin/helpers/dolphin_deed.h +++ b/applications/services/dolphin/helpers/dolphin_deed.h @@ -12,7 +12,7 @@ typedef enum { DolphinAppNfc, DolphinAppIr, DolphinAppIbutton, - DolphinAppBadusb, + DolphinAppBadKb, DolphinAppPlugin, DolphinAppMAX, } DolphinApp; @@ -50,7 +50,7 @@ typedef enum { DolphinDeedIbuttonEmulate, DolphinDeedIbuttonAdd, - DolphinDeedBadUsbPlayScript, + DolphinDeedBadKbPlayScript, DolphinDeedU2fAuthorized, DolphinDeedGpioUartBridge, diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 4386fdfd0..ce67e789c 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -12,7 +12,7 @@ #define TAG "BrowserWorker" #define ASSETS_DIR "assets" -#define BADUSB_LAYOUTS_DIR "layouts" +#define BADKB_LAYOUTS_DIR "layouts" #define SUBGHZ_TEMP_DIR "tmp_history" #define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX #define FILE_NAME_LEN_MAX 256 @@ -90,7 +90,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo // Skip assets folders (if enabled) if(browser->skip_assets) { return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)) && - ((furi_string_cmp_str(name, BADUSB_LAYOUTS_DIR) == 0) ? (false) : (true)) && + ((furi_string_cmp_str(name, BADKB_LAYOUTS_DIR) == 0) ? (false) : (true)) && ((furi_string_cmp_str(name, SUBGHZ_TEMP_DIR) == 0) ? (false) : (true)); } else { return true; diff --git a/assets/icons/Archive/badusb_10px.png b/assets/icons/Archive/badkb_10px.png similarity index 100% rename from assets/icons/Archive/badusb_10px.png rename to assets/icons/Archive/badkb_10px.png diff --git a/assets/icons/BadUsb/Clock_18x18.png b/assets/icons/BadKb/Clock_18x18.png similarity index 100% rename from assets/icons/BadUsb/Clock_18x18.png rename to assets/icons/BadKb/Clock_18x18.png diff --git a/assets/icons/BadUsb/Error_18x18.png b/assets/icons/BadKb/Error_18x18.png similarity index 100% rename from assets/icons/BadUsb/Error_18x18.png rename to assets/icons/BadKb/Error_18x18.png diff --git a/assets/icons/BadUsb/EviSmile1_18x21.png b/assets/icons/BadKb/EviSmile1_18x21.png similarity index 100% rename from assets/icons/BadUsb/EviSmile1_18x21.png rename to assets/icons/BadKb/EviSmile1_18x21.png diff --git a/assets/icons/BadUsb/EviSmile2_18x21.png b/assets/icons/BadKb/EviSmile2_18x21.png similarity index 100% rename from assets/icons/BadUsb/EviSmile2_18x21.png rename to assets/icons/BadKb/EviSmile2_18x21.png diff --git a/assets/icons/BadUsb/EviWaiting1_18x21.png b/assets/icons/BadKb/EviWaiting1_18x21.png similarity index 100% rename from assets/icons/BadUsb/EviWaiting1_18x21.png rename to assets/icons/BadKb/EviWaiting1_18x21.png diff --git a/assets/icons/BadUsb/EviWaiting2_18x21.png b/assets/icons/BadKb/EviWaiting2_18x21.png similarity index 100% rename from assets/icons/BadUsb/EviWaiting2_18x21.png rename to assets/icons/BadKb/EviWaiting2_18x21.png diff --git a/assets/icons/BadUsb/Percent_10x14.png b/assets/icons/BadKb/Percent_10x14.png similarity index 100% rename from assets/icons/BadUsb/Percent_10x14.png rename to assets/icons/BadKb/Percent_10x14.png diff --git a/assets/icons/BadUsb/Smile_18x18.png b/assets/icons/BadKb/Smile_18x18.png similarity index 100% rename from assets/icons/BadUsb/Smile_18x18.png rename to assets/icons/BadKb/Smile_18x18.png diff --git a/assets/icons/BadUsb/UsbTree_48x22.png b/assets/icons/BadKb/UsbTree_48x22.png similarity index 100% rename from assets/icons/BadUsb/UsbTree_48x22.png rename to assets/icons/BadKb/UsbTree_48x22.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_01.png b/assets/icons/MainMenu/BadKb_14/frame_01.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_01.png rename to assets/icons/MainMenu/BadKb_14/frame_01.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_02.png b/assets/icons/MainMenu/BadKb_14/frame_02.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_02.png rename to assets/icons/MainMenu/BadKb_14/frame_02.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_03.png b/assets/icons/MainMenu/BadKb_14/frame_03.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_03.png rename to assets/icons/MainMenu/BadKb_14/frame_03.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_04.png b/assets/icons/MainMenu/BadKb_14/frame_04.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_04.png rename to assets/icons/MainMenu/BadKb_14/frame_04.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_05.png b/assets/icons/MainMenu/BadKb_14/frame_05.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_05.png rename to assets/icons/MainMenu/BadKb_14/frame_05.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_06.png b/assets/icons/MainMenu/BadKb_14/frame_06.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_06.png rename to assets/icons/MainMenu/BadKb_14/frame_06.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_07.png b/assets/icons/MainMenu/BadKb_14/frame_07.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_07.png rename to assets/icons/MainMenu/BadKb_14/frame_07.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_08.png b/assets/icons/MainMenu/BadKb_14/frame_08.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_08.png rename to assets/icons/MainMenu/BadKb_14/frame_08.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_09.png b/assets/icons/MainMenu/BadKb_14/frame_09.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_09.png rename to assets/icons/MainMenu/BadKb_14/frame_09.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_10.png b/assets/icons/MainMenu/BadKb_14/frame_10.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_10.png rename to assets/icons/MainMenu/BadKb_14/frame_10.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_11.png b/assets/icons/MainMenu/BadKb_14/frame_11.png similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_11.png rename to assets/icons/MainMenu/BadKb_14/frame_11.png diff --git a/assets/icons/MainMenu/BadUsb_14/frame_rate b/assets/icons/MainMenu/BadKb_14/frame_rate similarity index 100% rename from assets/icons/MainMenu/BadUsb_14/frame_rate rename to assets/icons/MainMenu/BadKb_14/frame_rate diff --git a/assets/resources/badkb/.badkb.settings b/assets/resources/badkb/.badkb.settings new file mode 100644 index 000000000..4841c2ded --- /dev/null +++ b/assets/resources/badkb/.badkb.settings @@ -0,0 +1 @@ +/any/badkb/layouts/en-US.kl diff --git a/assets/resources/badusb/Kiosk-Evasion-Bruteforce.txt b/assets/resources/badkb/Kiosk-Evasion-Bruteforce.txt similarity index 100% rename from assets/resources/badusb/Kiosk-Evasion-Bruteforce.txt rename to assets/resources/badkb/Kiosk-Evasion-Bruteforce.txt diff --git a/assets/resources/badusb/Wifi-Stealer_ORG.txt b/assets/resources/badkb/Wifi-Stealer_ORG.txt similarity index 100% rename from assets/resources/badusb/Wifi-Stealer_ORG.txt rename to assets/resources/badkb/Wifi-Stealer_ORG.txt diff --git a/assets/resources/badusb/demo_macos.txt b/assets/resources/badkb/demo_macos.txt similarity index 92% rename from assets/resources/badusb/demo_macos.txt rename to assets/resources/badkb/demo_macos.txt index 82543b28f..1fd4544b3 100644 --- a/assets/resources/badusb/demo_macos.txt +++ b/assets/resources/badkb/demo_macos.txt @@ -2,7 +2,7 @@ ID 1234:5678 Apple:Keyboard REM You can change these values to VID/PID of original Apple keyboard REM to bypass Keyboard Setup Assistant -REM This is BadUSB demo script for macOS +REM This is BadKB demo script for macOS REM Open terminal window DELAY 1000 @@ -75,7 +75,7 @@ ENTER HOME ENTER -STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format +STRING Flipper Zero BadKB feature is compatible with USB Rubber Ducky script format ENTER STRING More information about script syntax can be found here: ENTER diff --git a/assets/resources/badusb/demo_windows.txt b/assets/resources/badkb/demo_windows.txt similarity index 92% rename from assets/resources/badusb/demo_windows.txt rename to assets/resources/badkb/demo_windows.txt index 2ed33b3c0..f3b1309d1 100644 --- a/assets/resources/badusb/demo_windows.txt +++ b/assets/resources/badkb/demo_windows.txt @@ -1,4 +1,4 @@ -REM This is BadUSB demo script for windows +REM This is BadKB demo script for windows REM Open windows notepad DELAY 1000 @@ -76,7 +76,7 @@ ENTER HOME ENTER -STRING Flipper Zero BadUSB feature is compatible with USB Rubber Ducky script format +STRING Flipper Zero BadKB feature is compatible with USB Rubber Ducky script format ENTER STRING More information about script syntax can be found here: ENTER diff --git a/assets/resources/badusb/layouts/ba-BA.kl b/assets/resources/badkb/layouts/ba-BA.kl similarity index 100% rename from assets/resources/badusb/layouts/ba-BA.kl rename to assets/resources/badkb/layouts/ba-BA.kl diff --git a/assets/resources/badusb/layouts/cz_CS.kl b/assets/resources/badkb/layouts/cz_CS.kl similarity index 100% rename from assets/resources/badusb/layouts/cz_CS.kl rename to assets/resources/badkb/layouts/cz_CS.kl diff --git a/assets/resources/badusb/layouts/da-DA.kl b/assets/resources/badkb/layouts/da-DA.kl similarity index 100% rename from assets/resources/badusb/layouts/da-DA.kl rename to assets/resources/badkb/layouts/da-DA.kl diff --git a/assets/resources/badusb/layouts/de-CH.kl b/assets/resources/badkb/layouts/de-CH.kl similarity index 100% rename from assets/resources/badusb/layouts/de-CH.kl rename to assets/resources/badkb/layouts/de-CH.kl diff --git a/assets/resources/badusb/layouts/de-DE.kl b/assets/resources/badkb/layouts/de-DE.kl similarity index 100% rename from assets/resources/badusb/layouts/de-DE.kl rename to assets/resources/badkb/layouts/de-DE.kl diff --git a/assets/resources/badusb/layouts/dvorak.kl b/assets/resources/badkb/layouts/dvorak.kl similarity index 100% rename from assets/resources/badusb/layouts/dvorak.kl rename to assets/resources/badkb/layouts/dvorak.kl diff --git a/assets/resources/badusb/layouts/en-UK.kl b/assets/resources/badkb/layouts/en-UK.kl similarity index 100% rename from assets/resources/badusb/layouts/en-UK.kl rename to assets/resources/badkb/layouts/en-UK.kl diff --git a/assets/resources/badusb/layouts/en-US.kl b/assets/resources/badkb/layouts/en-US.kl similarity index 100% rename from assets/resources/badusb/layouts/en-US.kl rename to assets/resources/badkb/layouts/en-US.kl diff --git a/assets/resources/badusb/layouts/es-ES.kl b/assets/resources/badkb/layouts/es-ES.kl similarity index 100% rename from assets/resources/badusb/layouts/es-ES.kl rename to assets/resources/badkb/layouts/es-ES.kl diff --git a/assets/resources/badusb/layouts/fr-BE.kl b/assets/resources/badkb/layouts/fr-BE.kl similarity index 100% rename from assets/resources/badusb/layouts/fr-BE.kl rename to assets/resources/badkb/layouts/fr-BE.kl diff --git a/assets/resources/badusb/layouts/fr-CH.kl b/assets/resources/badkb/layouts/fr-CH.kl similarity index 100% rename from assets/resources/badusb/layouts/fr-CH.kl rename to assets/resources/badkb/layouts/fr-CH.kl diff --git a/assets/resources/badusb/layouts/fr-FR.kl b/assets/resources/badkb/layouts/fr-FR.kl similarity index 100% rename from assets/resources/badusb/layouts/fr-FR.kl rename to assets/resources/badkb/layouts/fr-FR.kl diff --git a/assets/resources/badusb/layouts/hr-HR.kl b/assets/resources/badkb/layouts/hr-HR.kl similarity index 100% rename from assets/resources/badusb/layouts/hr-HR.kl rename to assets/resources/badkb/layouts/hr-HR.kl diff --git a/assets/resources/badusb/layouts/hu-HU.kl b/assets/resources/badkb/layouts/hu-HU.kl similarity index 100% rename from assets/resources/badusb/layouts/hu-HU.kl rename to assets/resources/badkb/layouts/hu-HU.kl diff --git a/assets/resources/badusb/layouts/it-IT.kl b/assets/resources/badkb/layouts/it-IT.kl similarity index 100% rename from assets/resources/badusb/layouts/it-IT.kl rename to assets/resources/badkb/layouts/it-IT.kl diff --git a/assets/resources/badusb/layouts/nb-NO.kl b/assets/resources/badkb/layouts/nb-NO.kl similarity index 100% rename from assets/resources/badusb/layouts/nb-NO.kl rename to assets/resources/badkb/layouts/nb-NO.kl diff --git a/assets/resources/badusb/layouts/nl-NL.kl b/assets/resources/badkb/layouts/nl-NL.kl similarity index 100% rename from assets/resources/badusb/layouts/nl-NL.kl rename to assets/resources/badkb/layouts/nl-NL.kl diff --git a/assets/resources/badusb/layouts/pt-BR.kl b/assets/resources/badkb/layouts/pt-BR.kl similarity index 100% rename from assets/resources/badusb/layouts/pt-BR.kl rename to assets/resources/badkb/layouts/pt-BR.kl diff --git a/assets/resources/badusb/layouts/pt-PT.kl b/assets/resources/badkb/layouts/pt-PT.kl similarity index 100% rename from assets/resources/badusb/layouts/pt-PT.kl rename to assets/resources/badkb/layouts/pt-PT.kl diff --git a/assets/resources/badusb/layouts/si-SI.kl b/assets/resources/badkb/layouts/si-SI.kl similarity index 100% rename from assets/resources/badusb/layouts/si-SI.kl rename to assets/resources/badkb/layouts/si-SI.kl diff --git a/assets/resources/badusb/layouts/sk-SK.kl b/assets/resources/badkb/layouts/sk-SK.kl similarity index 100% rename from assets/resources/badusb/layouts/sk-SK.kl rename to assets/resources/badkb/layouts/sk-SK.kl diff --git a/assets/resources/badusb/layouts/sv-SE.kl b/assets/resources/badkb/layouts/sv-SE.kl similarity index 100% rename from assets/resources/badusb/layouts/sv-SE.kl rename to assets/resources/badkb/layouts/sv-SE.kl diff --git a/assets/resources/badusb/layouts/tr-TR.kl b/assets/resources/badkb/layouts/tr-TR.kl similarity index 100% rename from assets/resources/badusb/layouts/tr-TR.kl rename to assets/resources/badkb/layouts/tr-TR.kl diff --git a/assets/resources/badusb/.badusb.settings b/assets/resources/badusb/.badusb.settings deleted file mode 100644 index 34330a3c0..000000000 --- a/assets/resources/badusb/.badusb.settings +++ /dev/null @@ -1 +0,0 @@ -/any/badusb/layouts/en-US.kl From 8a3bd796d4721f6ee91567e92a7e095dfdd21cc1 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 17:44:22 +0000 Subject: [PATCH 18/36] Generic bad kb comments --- applications/main/bad_kb/bad_kb_script.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index e63a39c05..80d203db6 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -680,7 +680,7 @@ static int32_t bad_kb_worker(void* context) { if(furi_hal_hid_is_connected()) { worker_state = BadKbStateIdle; // Ready to run } else { - worker_state = BadKbStateNotConnected; // USB not connected + worker_state = BadKbStateNotConnected; // Not connected } } } else { @@ -692,7 +692,7 @@ static int32_t bad_kb_worker(void* context) { } bad_kb->st.state = worker_state; - } else if(worker_state == BadKbStateNotConnected) { // State: USB not connected + } else if(worker_state == BadKbStateNotConnected) { // State: Not connected uint32_t flags = furi_thread_flags_wait( WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, FuriFlagWaitAny, @@ -703,7 +703,7 @@ static int32_t bad_kb_worker(void* context) { } else if(flags & WorkerEvtConnect) { worker_state = BadKbStateIdle; // Ready to run } else if(flags & WorkerEvtToggle) { - worker_state = BadKbStateWillRun; // Will run when USB is connected + worker_state = BadKbStateWillRun; // Will run when connected } bad_kb->st.state = worker_state; @@ -727,7 +727,7 @@ static int32_t bad_kb_worker(void* context) { bad_kb_script_set_keyboard_layout(bad_kb, bad_kb->keyboard_layout); worker_state = BadKbStateRunning; } else if(flags & WorkerEvtDisconnect) { - worker_state = BadKbStateNotConnected; // USB disconnected + worker_state = BadKbStateNotConnected; // Disconnected } bad_kb->st.state = worker_state; @@ -777,7 +777,7 @@ static int32_t bad_kb_worker(void* context) { furi_hal_hid_kb_release_all(); } } else if(flags & WorkerEvtDisconnect) { - worker_state = BadKbStateNotConnected; // USB disconnected + worker_state = BadKbStateNotConnected; // Disconnected if (bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { From 72935579e6c4863a4eb95072836dc1a6d60bb3ed Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 17:46:32 +0000 Subject: [PATCH 19/36] Format --- .../main/archive/helpers/archive_files.c | 4 +-- applications/main/bad_kb/bad_kb_app.c | 15 ++++---- applications/main/bad_kb/bad_kb_script.c | 36 +++++++++---------- .../bad_kb/scenes/bad_kb_scene_config_bt.c | 21 ++++++----- .../bad_kb/scenes/bad_kb_scene_config_name.c | 3 +- .../bad_kb/scenes/bad_kb_scene_config_usb.c | 15 ++++---- .../bad_kb/scenes/bad_kb_scene_file_select.c | 3 +- .../main/bad_kb/scenes/bad_kb_scene_work.c | 2 +- applications/main/bad_kb/views/bad_kb_view.c | 14 +++----- applications/services/bt/bt_service/bt.c | 7 ++-- firmware/targets/f7/ble_glue/gap.c | 4 +-- 11 files changed, 59 insertions(+), 65 deletions(-) diff --git a/applications/main/archive/helpers/archive_files.c b/applications/main/archive/helpers/archive_files.c index 7e7ab1774..83eb2a845 100644 --- a/applications/main/archive/helpers/archive_files.c +++ b/applications/main/archive/helpers/archive_files.c @@ -17,8 +17,8 @@ void archive_set_file_type(ArchiveFile_t* file, const char* path, bool is_folder if((known_ext[i][0] == '?') || (known_ext[i][0] == '*')) continue; if(furi_string_search(file->path, known_ext[i], 0) != FURI_STRING_FAILURE) { if(i == ArchiveFileTypeBadKb) { - if(furi_string_search( - file->path, archive_get_default_path(ArchiveTabBadKb)) == 0) { + if(furi_string_search(file->path, archive_get_default_path(ArchiveTabBadKb)) == + 0) { file->type = i; return; // *.txt file is a BadKB script only if it is in BadKB folder } diff --git a/applications/main/bad_kb/bad_kb_app.c b/applications/main/bad_kb/bad_kb_app.c index c62af4733..4181b08d4 100644 --- a/applications/main/bad_kb/bad_kb_app.c +++ b/applications/main/bad_kb/bad_kb_app.c @@ -112,10 +112,14 @@ BadKbApp* bad_kb_app_alloc(char* arg) { app->var_item_list_bt = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadKbAppViewConfigBt, variable_item_list_get_view(app->var_item_list_bt)); + app->view_dispatcher, + BadKbAppViewConfigBt, + variable_item_list_get_view(app->var_item_list_bt)); app->var_item_list_usb = variable_item_list_alloc(); view_dispatcher_add_view( - app->view_dispatcher, BadKbAppViewConfigUsb, variable_item_list_get_view(app->var_item_list_usb)); + app->view_dispatcher, + BadKbAppViewConfigUsb, + variable_item_list_get_view(app->var_item_list_usb)); app->bad_kb_view = bad_kb_alloc(); view_dispatcher_add_view( @@ -184,15 +188,14 @@ void bad_kb_app_free(BadKbApp* app) { // restores bt config // BtProfile have already been switched to the previous one - // so we directly modify the right profile - if (strcmp(app->bt_old_config.name, app->name) != 0) { + // so we directly modify the right profile + if(strcmp(app->bt_old_config.name, app->name) != 0) { furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->bt_old_config.name); } - if (memcmp(app->bt_old_config.mac, app->mac, BAD_KB_MAC_ADDRESS_LEN) != 0) { + if(memcmp(app->bt_old_config.mac, app->mac, BAD_KB_MAC_ADDRESS_LEN) != 0) { furi_hal_bt_set_profile_mac_addr(FuriHalBtProfileHidKeyboard, app->bt_old_config.mac); } - // Close records furi_record_close(RECORD_GUI); furi_record_close(RECORD_NOTIFICATION); diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index 80d203db6..18aabe860 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -231,8 +231,8 @@ static bool ducky_is_line_end(const char chr) { } static void ducky_numlock_on(BadKbScript* bad_kb) { - if (bad_kb->bt) { - if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME + if(bad_kb->bt) { + if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); furi_delay_ms(bt_timeout); @@ -251,7 +251,7 @@ static bool ducky_numpad_press(BadKbScript* bad_kb, const char num) { uint16_t key = numpad_keys[num - '0']; FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); - if (bad_kb->bt) { + if(bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); @@ -270,7 +270,7 @@ static bool ducky_altchar(BadKbScript* bad_kb, const char* charcode) { FURI_LOG_I(WORKER_TAG, "char %s", charcode); - if (bad_kb->bt) { + if(bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); } else { @@ -283,7 +283,7 @@ static bool ducky_altchar(BadKbScript* bad_kb, const char* charcode) { i++; } - if (bad_kb->bt) { + if(bad_kb->bt) { furi_hal_bt_hid_kb_release(KEY_MOD_LEFT_ALT); } else { furi_hal_hid_kb_release(KEY_MOD_LEFT_ALT); @@ -316,7 +316,7 @@ static bool ducky_string(BadKbScript* bad_kb, const char* param) { while(param[i] != '\0') { uint16_t keycode = BADKB_ASCII_TO_KEY(bad_kb, param[i]); if(keycode != HID_KEYBOARD_NONE) { - if (bad_kb->bt) { + if(bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(keycode); furi_delay_ms(bt_timeout); @@ -429,7 +429,7 @@ static int32_t // SYSRQ line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; uint16_t key = ducky_get_keycode(bad_kb, line_tmp, true); - if (bad_kb->bt) { + if(bad_kb->bt) { bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); furi_hal_bt_hid_kb_press(key); @@ -456,7 +456,7 @@ static int32_t line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; key |= ducky_get_keycode(bad_kb, line_tmp, true); } - if (bad_kb->bt) { + if(bad_kb->bt) { furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); @@ -520,7 +520,7 @@ static bool ducky_script_preload(BadKbScript* bad_kb, File* script_file) { } } while(ret > 0); - if (!bad_kb->bt) { + if(!bad_kb->bt) { const char* line_tmp = furi_string_get_cstr(bad_kb->line); bool id_set = false; // Looking for ID command at first line if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) { @@ -643,12 +643,12 @@ static int32_t bad_kb_worker(void* context) { FuriHalUsbInterface* usb_mode_prev = NULL; GapPairing old_pairing_method = GapPairingNone; - if (bad_kb->bt) { + if(bad_kb->bt) { bt_timeout = bt_hid_delays[LevelRssi39_0]; bt_disconnect(bad_kb->bt); furi_delay_ms(200); bt_keys_storage_set_storage_path(bad_kb->bt, HID_BT_KEYS_STORAGE_PATH); - if (!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { + if(!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { FURI_LOG_E(TAG, "Failed to switch to HID profile"); return -1; } @@ -674,7 +674,7 @@ static int32_t bad_kb_worker(void* context) { FSAM_READ, FSOM_OPEN_EXISTING)) { if((ducky_script_preload(bad_kb, script_file)) && (bad_kb->st.line_nb > 0)) { - if (bad_kb->bt) { + if(bad_kb->bt) { worker_state = BadKbStateNotConnected; // Ready to run } else { if(furi_hal_hid_is_connected()) { @@ -750,7 +750,7 @@ static int32_t bad_kb_worker(void* context) { storage_file_seek(script_file, 0, true); // extra time for PC to recognize Flipper as keyboard furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); - if (bad_kb->bt) { + if(bad_kb->bt) { update_bt_timeout(bad_kb->bt); FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } @@ -771,14 +771,14 @@ static int32_t bad_kb_worker(void* context) { break; } else if(flags & WorkerEvtToggle) { worker_state = BadKbStateIdle; // Stop executing script - if (bad_kb->bt) { + if(bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); } } else if(flags & WorkerEvtDisconnect) { worker_state = BadKbStateNotConnected; // Disconnected - if (bad_kb->bt) { + if(bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); @@ -803,7 +803,7 @@ static int32_t bad_kb_worker(void* context) { delay_val = 0; worker_state = BadKbStateIdle; bad_kb->st.state = BadKbStateDone; - if (bad_kb->bt) { + if(bad_kb->bt) { furi_hal_bt_hid_kb_release_all(); } else { furi_hal_hid_kb_release_all(); @@ -827,13 +827,13 @@ static int32_t bad_kb_worker(void* context) { break; } } - if (bad_kb->bt) { + if(bad_kb->bt) { update_bt_timeout(bad_kb->bt); FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } } - if (bad_kb->bt) { + if(bad_kb->bt) { // release all keys bt_hid_hold_while_keyboard_buffer_full(6, 3000); diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c index fc1d19e76..6d01f1df1 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c @@ -31,16 +31,14 @@ void bad_kb_scene_config_bt_on_enter(void* context) { variable_item_set_current_value_index(item, bad_kb->is_bt); variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); - item = variable_item_list_add( - var_item_list, "Keyboard layout", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "Keyboard layout", 0, NULL, bad_kb); - item = variable_item_list_add( - var_item_list, "Change adv name", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "Change adv name", 0, NULL, bad_kb); - item = variable_item_list_add( - var_item_list, "Change MAC address", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "Change MAC address", 0, NULL, bad_kb); - variable_item_list_set_enter_callback(var_item_list, bad_kb_scene_config_bt_var_item_list_callback, bad_kb); + variable_item_list_set_enter_callback( + var_item_list, bad_kb_scene_config_bt_var_item_list_callback, bad_kb); view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigBt); } @@ -56,10 +54,11 @@ bool bad_kb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { bad_kb_script_close(bad_kb->bad_kb_script); - bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb->bad_kb_script = + bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); scene_manager_previous_scene(bad_kb->scene_manager); - if (bad_kb->is_bt) { + if(bad_kb->is_bt) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigBt); } else { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigUsb); @@ -68,8 +67,8 @@ bool bad_kb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigName); } else if(event.event == VarItemListIndexMacAddress) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigMac); - // } else { - // furi_crash("Unknown key type"); + // } else { + // furi_crash("Unknown key type"); } } diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c index d3d7628b1..82dd7a850 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_name.c @@ -3,8 +3,7 @@ static void bad_kb_scene_config_name_text_input_callback(void* context) { BadKbApp* bad_kb = context; - view_dispatcher_send_custom_event( - bad_kb->view_dispatcher, BadKbAppCustomEventTextEditResult); + view_dispatcher_send_custom_event(bad_kb->view_dispatcher, BadKbAppCustomEventTextEditResult); } void bad_kb_scene_config_name_on_enter(void* context) { diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c index 35c5ab8d2..27457e5f2 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c @@ -29,10 +29,10 @@ void bad_kb_scene_config_usb_on_enter(void* context) { variable_item_set_current_value_index(item, bad_kb->is_bt); variable_item_set_current_value_text(item, bad_kb->is_bt ? "BT" : "USB"); - item = variable_item_list_add( - var_item_list, "Keyboard layout", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "Keyboard layout", 0, NULL, bad_kb); - variable_item_list_set_enter_callback(var_item_list, bad_kb_scene_config_usb_var_item_list_callback, bad_kb); + variable_item_list_set_enter_callback( + var_item_list, bad_kb_scene_config_usb_var_item_list_callback, bad_kb); view_dispatcher_switch_to_view(bad_kb->view_dispatcher, BadKbAppViewConfigUsb); } @@ -48,16 +48,17 @@ bool bad_kb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { bad_kb_script_close(bad_kb->bad_kb_script); - bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb->bad_kb_script = + bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); scene_manager_previous_scene(bad_kb->scene_manager); - if (bad_kb->is_bt) { + if(bad_kb->is_bt) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigBt); } else { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigUsb); } - // } else { - // furi_crash("Unknown key type"); + // } else { + // furi_crash("Unknown key type"); } } diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c b/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c index 44012f68d..df1c93feb 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_file_select.c @@ -29,7 +29,8 @@ void bad_kb_scene_file_select_on_enter(void* context) { } if(bad_kb_file_select(bad_kb)) { - bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); + bad_kb->bad_kb_script = + bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneWork); diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_work.c b/applications/main/bad_kb/scenes/bad_kb_scene_work.c index a7eac1786..2f6ae6057 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_work.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_work.c @@ -16,7 +16,7 @@ bool bad_kb_scene_work_on_event(void* context, SceneManagerEvent event) { if(event.type == SceneManagerEventTypeCustom) { if(event.event == InputKeyLeft) { - if (app->is_bt) { + if(app->is_bt) { scene_manager_next_scene(app->scene_manager, BadKbSceneConfigBt); } else { scene_manager_next_scene(app->scene_manager, BadKbSceneConfigUsb); diff --git a/applications/main/bad_kb/views/bad_kb_view.c b/applications/main/bad_kb/views/bad_kb_view.c index a0fb39f88..581a703b9 100644 --- a/applications/main/bad_kb/views/bad_kb_view.c +++ b/applications/main/bad_kb/views/bad_kb_view.c @@ -60,8 +60,8 @@ static void bad_kb_draw_callback(Canvas* canvas, void* _model) { elements_button_center(canvas, "Cancel"); } - if((model->state.state == BadKbStateNotConnected) || - (model->state.state == BadKbStateIdle) || (model->state.state == BadKbStateDone)) { + if((model->state.state == BadKbStateNotConnected) || (model->state.state == BadKbStateIdle) || + (model->state.state == BadKbStateDone)) { elements_button_left(canvas, "Config"); } @@ -204,19 +204,13 @@ void bad_kb_set_button_callback(BadKb* bad_kb, BadKbButtonCallback callback, voi void bad_kb_set_file_name(BadKb* bad_kb, const char* name) { furi_assert(name); with_view_model( - bad_kb->view, - BadKbModel * model, - { strlcpy(model->file_name, name, MAX_NAME_LEN); }, - true); + bad_kb->view, BadKbModel * model, { strlcpy(model->file_name, name, MAX_NAME_LEN); }, true); } void bad_kb_set_layout(BadKb* bad_kb, const char* layout) { furi_assert(layout); with_view_model( - bad_kb->view, - BadKbModel * model, - { strlcpy(model->layout, layout, MAX_NAME_LEN); }, - true); + bad_kb->view, BadKbModel * model, { strlcpy(model->layout, layout, MAX_NAME_LEN); }, true); } void bad_kb_set_state(BadKb* bad_kb, BadKbState* st) { diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index 6108a7790..6c2fb9307 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -76,10 +76,9 @@ static void bt_pin_code_hide(Bt* bt) { static bool bt_pin_code_verify_event_handler(Bt* bt, uint32_t pin) { furi_assert(bt); - - if (bt_get_profile_pairing_method(bt) == GapPairingNone) - return true; - + + if(bt_get_profile_pairing_method(bt) == GapPairingNone) return true; + notification_message(bt->notification, &sequence_display_backlight_on); FuriString* pin_str; dialog_message_set_icon(bt->dialog_message, XTREME_ASSETS()->I_BLE_Pairing_128x64, 0, 0); diff --git a/firmware/targets/f7/ble_glue/gap.c b/firmware/targets/f7/ble_glue/gap.c index 892fbd2a9..83944b4b5 100644 --- a/firmware/targets/f7/ble_glue/gap.c +++ b/firmware/targets/f7/ble_glue/gap.c @@ -378,7 +378,7 @@ static void gap_init_svc(Gap* gap) { } else if(gap->config->pairing_method == GapPairingPinCodeVerifyYesNo) { aci_gap_set_io_capability(IO_CAP_DISPLAY_YES_NO); keypress_supported = true; - } else if (gap->config->pairing_method == GapPairingNone) { + } else if(gap->config->pairing_method == GapPairingNone) { // Just works pairing method (IOS accept it, it seems android and linux doesn't) conf_mitm = 0; conf_used_fixed_pin = 0; @@ -387,8 +387,6 @@ static void gap_init_svc(Gap* gap) { keypress_supported = true; } - - // Setup authentication aci_gap_set_authentication_requirement( gap->config->bonding_mode, From 6603bc119c434537438577f730ea4aca1f9e04cc Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 3 Feb 2023 19:39:30 +0100 Subject: [PATCH 20/36] Removes storing of bt peer key in internal flash for bad usb BLE --- applications/main/bad_usb/bad_usb_script.c | 6 +++++- applications/services/bt/bt_service/bt.c | 9 +++++++++ applications/services/bt/bt_service/bt.h | 11 +++++++++++ firmware/targets/f7/api_symbols.csv | 4 +++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_usb/bad_usb_script.c b/applications/main/bad_usb/bad_usb_script.c index 51ce49df9..49e5329f0 100644 --- a/applications/main/bad_usb/bad_usb_script.c +++ b/applications/main/bad_usb/bad_usb_script.c @@ -655,6 +655,8 @@ static int32_t bad_usb_worker(void* context) { old_pairing_method = bt_get_profile_pairing_method(bad_usb->bt); bt_set_profile_pairing_method(bad_usb->bt, GapPairingNone); furi_hal_bt_start_advertising(); + // disable peer key adding to bt SRAM storage + bt_disable_peer_key_update(bad_usb->bt); bt_set_status_changed_callback(bad_usb->bt, bad_usb_bt_hid_state_callback, bad_usb); } else { usb_mode_prev = furi_hal_usb_get_config(); @@ -752,7 +754,6 @@ static int32_t bad_usb_worker(void* context) { furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); if (bad_usb->bt) { update_bt_timeout(bad_usb->bt); - FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } bad_usb_script_set_keyboard_layout(bad_usb, bad_usb->keyboard_layout); worker_state = BadUsbStateRunning; @@ -852,6 +853,9 @@ static int32_t bad_usb_worker(void* context) { // fails if ble radio stack isn't ready when switching profile // if it happens, maybe we should increase the delay after bt_disconnect bt_set_profile(bad_usb->bt, BtProfileSerial); + + // starts saving peer keys (bounded devices) + bt_enable_peer_key_update(bad_usb->bt); } else { furi_hal_hid_set_state_callback(NULL, NULL); diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index 6108a7790..b002254f0 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -446,6 +446,15 @@ GapPairing bt_get_profile_pairing_method(Bt* bt) { return furi_hal_bt_get_profile_pairing_method(get_hal_bt_profile(bt->profile)); } +void bt_disable_peer_key_update(Bt *bt) { + UNUSED(bt); + furi_hal_bt_set_key_storage_change_callback(NULL, NULL); +} + +void bt_enable_peer_key_update(Bt *bt) { + furi_hal_bt_set_key_storage_change_callback(bt_on_key_storage_change_callback, bt); +} + int32_t bt_srv(void* p) { UNUSED(p); Bt* bt = bt_alloc(); diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index 046887a2c..ddf9382e8 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -52,6 +52,17 @@ bool bt_remote_rssi(Bt* bt, BtRssi* rssi); void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method); GapPairing bt_get_profile_pairing_method(Bt* bt); +/** Stop saving new peer key to flash (in .bt.keys file) + * +*/ +void bt_disable_peer_key_update(Bt *bt); + +/** Enable saving peer key to internal flash (enable by default) + * + * @note This function should be called if bt_disable_peer_key_update was called before +*/ +void bt_enable_peer_key_update(Bt *bt); + /** Disconnect from Central * * @param bt Bt instance diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 2129d0530..8cea0cdd3 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,13.2,, +Version,v,13.4,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -569,7 +569,9 @@ Function,+,ble_glue_start,_Bool, Function,+,ble_glue_thread_stop,void, Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t" +Function,+,bt_disable_peer_key_update,void,Bt* Function,+,bt_disconnect,void,Bt* +Function,+,bt_enable_peer_key_update,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_get_profile_adv_name,const char*,Bt* Function,+,bt_get_profile_mac_address,const uint8_t*,Bt* From 935aee90ef91ca3dcc7c3adb2cd97f7d0463877b Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 3 Feb 2023 21:06:55 +0100 Subject: [PATCH 21/36] Bad-KB: allows to go back to script selection and stay connected to the client when using BLE connection mode --- applications/main/bad_kb/bad_kb_app.c | 5 + applications/main/bad_kb/bad_kb_script.c | 108 ++++++++++-------- applications/main/bad_kb/bad_kb_script.h | 1 + firmware/targets/f7/api_symbols.csv | 3 +- firmware/targets/f7/furi_hal/furi_hal_bt.c | 4 + .../targets/furi_hal_include/furi_hal_bt.h | 2 + 6 files changed, 77 insertions(+), 46 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_app.c b/applications/main/bad_kb/bad_kb_app.c index 4181b08d4..a449edf89 100644 --- a/applications/main/bad_kb/bad_kb_app.c +++ b/applications/main/bad_kb/bad_kb_app.c @@ -186,6 +186,11 @@ void bad_kb_app_free(BadKbApp* app) { view_dispatcher_free(app->view_dispatcher); scene_manager_free(app->scene_manager); + // disconnect victim and reset bt config + if (furi_hal_bt_is_connected()) { + bad_kb_script_bt_disconnect_and_reset_config(app->bt, GapPairingPinCodeVerifyYesNo); + } + // restores bt config // BtProfile have already been switched to the previous one // so we directly modify the right profile diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index eb671724d..a34b7e4c3 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -625,6 +625,22 @@ static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) { furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); } +static inline BadKbWorkerState bad_kb_hid_get_initial_state(BadKbScript* bad_kb) { + if(bad_kb->bt) { + if(furi_hal_usb_is_connected(&usb_hid)) { + return BadKbStateIdle; + } else { + return BadKbStateNotConnected; + } + } else { + if(bt_get_status(bad_kb->bt) == BtStatusConnected) { + return BadKbStateIdle; + } else { + return BadKbStateNotConnected; + } + } +} + static void bad_kb_usb_hid_state_callback(bool state, void* context) { furi_assert(context); BadKbScript* bad_kb = context; @@ -635,6 +651,32 @@ static void bad_kb_usb_hid_state_callback(bool state, void* context) { furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); } +void bad_kb_script_bt_disconnect_and_reset_config(Bt* bt, GapPairing old_pairing_method) { + if(bt) { + // release all keys + bt_hid_hold_while_keyboard_buffer_full(6, 3000); + + // stop ble + bt_set_status_changed_callback(bt, NULL, NULL); + + bt_disconnect(bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_default_path(bt); + + bt_set_profile_pairing_method(bt, old_pairing_method); + + // starts saving peer keys (bounded devices) + bt_enable_peer_key_update(bt); + + // fails if ble radio stack isn't ready when switching profile + // if it happens, maybe we should increase the delay after bt_disconnect + bt_set_profile(bt, BtProfileSerial); + } +} + static int32_t bad_kb_worker(void* context) { BadKbScript* bad_kb = context; @@ -642,22 +684,24 @@ static int32_t bad_kb_worker(void* context) { int32_t delay_val = 0; FuriHalUsbInterface* usb_mode_prev = NULL; - GapPairing old_pairing_method = GapPairingNone; + GapPairing old_pairing_method = GapPairingPinCodeVerifyYesNo; if(bad_kb->bt) { bt_timeout = bt_hid_delays[LevelRssi39_0]; - bt_disconnect(bad_kb->bt); - furi_delay_ms(200); - bt_keys_storage_set_storage_path(bad_kb->bt, HID_BT_KEYS_STORAGE_PATH); - if(!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { - FURI_LOG_E(TAG, "Failed to switch to HID profile"); - return -1; + if (!furi_hal_bt_is_connected()) { + bt_disconnect(bad_kb->bt); + furi_delay_ms(200); + bt_keys_storage_set_storage_path(bad_kb->bt, HID_BT_KEYS_STORAGE_PATH); + if(!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { + FURI_LOG_E(TAG, "Failed to switch to HID profile"); + return -1; + } + old_pairing_method = bt_get_profile_pairing_method(bad_kb->bt); + bt_set_profile_pairing_method(bad_kb->bt, GapPairingNone); + furi_hal_bt_start_advertising(); + // disable peer key adding to bt SRAM storage + bt_disable_peer_key_update(bad_kb->bt); + bt_set_status_changed_callback(bad_kb->bt, bad_kb_bt_hid_state_callback, bad_kb); } - old_pairing_method = bt_get_profile_pairing_method(bad_kb->bt); - bt_set_profile_pairing_method(bad_kb->bt, GapPairingNone); - furi_hal_bt_start_advertising(); - // disable peer key adding to bt SRAM storage - bt_disable_peer_key_update(bad_usb->bt); - bt_set_status_changed_callback(bad_usb->bt, bad_usb_bt_hid_state_callback, bad_usb); } else { usb_mode_prev = furi_hal_usb_get_config(); furi_hal_hid_set_state_callback(bad_kb_usb_hid_state_callback, bad_kb); @@ -676,15 +720,7 @@ static int32_t bad_kb_worker(void* context) { FSAM_READ, FSOM_OPEN_EXISTING)) { if((ducky_script_preload(bad_kb, script_file)) && (bad_kb->st.line_nb > 0)) { - if(bad_kb->bt) { - worker_state = BadKbStateNotConnected; // Ready to run - } else { - if(furi_hal_hid_is_connected()) { - worker_state = BadKbStateIdle; // Ready to run - } else { - worker_state = BadKbStateNotConnected; // Not connected - } - } + worker_state = bad_kb_hid_get_initial_state(bad_kb); } else { worker_state = BadKbStateScriptError; // Script preload error } @@ -752,8 +788,8 @@ static int32_t bad_kb_worker(void* context) { storage_file_seek(script_file, 0, true); // extra time for PC to recognize Flipper as keyboard furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); - if(bad_usb->bt) { - update_bt_timeout(bad_usb->bt); + if(bad_kb->bt) { + update_bt_timeout(bad_kb->bt); } bad_kb_script_set_keyboard_layout(bad_kb, bad_kb->keyboard_layout); worker_state = BadKbStateRunning; @@ -835,27 +871,9 @@ static int32_t bad_kb_worker(void* context) { } if(bad_kb->bt) { - // release all keys - bt_hid_hold_while_keyboard_buffer_full(6, 3000); - - // stop ble - bt_set_status_changed_callback(bad_kb->bt, NULL, NULL); - - bt_disconnect(bad_kb->bt); - - // Wait 2nd core to update nvm storage - furi_delay_ms(200); - - bt_keys_storage_set_default_path(bad_kb->bt); - - bt_set_profile_pairing_method(bad_kb->bt, old_pairing_method); - - // fails if ble radio stack isn't ready when switching profile - // if it happens, maybe we should increase the delay after bt_disconnect - bt_set_profile(bad_usb->bt, BtProfileSerial); - - // starts saving peer keys (bounded devices) - bt_enable_peer_key_update(bad_usb->bt); + if (!furi_hal_bt_is_connected()) { + bad_kb_script_bt_disconnect_and_reset_config(bad_kb->bt, old_pairing_method); + } } else { furi_hal_hid_set_state_callback(NULL, NULL); diff --git a/applications/main/bad_kb/bad_kb_script.h b/applications/main/bad_kb/bad_kb_script.h index 35c57c112..aa18dbe9e 100644 --- a/applications/main/bad_kb/bad_kb_script.h +++ b/applications/main/bad_kb/bad_kb_script.h @@ -44,6 +44,7 @@ void bad_kb_script_toggle(BadKbScript* bad_kb); BadKbState* bad_kb_script_get_state(BadKbScript* bad_kb); +void bad_kb_script_bt_disconnect_and_reset_config(Bt *bt, GapPairing old_pairing_method); #ifdef __cplusplus } #endif diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 8cea0cdd3..32ec5f4ed 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,v,13.4,, +Version,v,13.5,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1030,6 +1030,7 @@ Function,-,furi_hal_bt_init,void, Function,+,furi_hal_bt_is_active,_Bool, Function,+,furi_hal_bt_is_alive,_Bool, Function,+,furi_hal_bt_is_ble_gatt_gap_supported,_Bool, +Function,+,furi_hal_bt_is_connected,_Bool, Function,+,furi_hal_bt_is_testing_supported,_Bool, Function,+,furi_hal_bt_lock_core2,void, Function,+,furi_hal_bt_nvm_sram_sem_acquire,void, diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index f33c92c62..e01669eb8 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -287,6 +287,10 @@ bool furi_hal_bt_is_active() { return gap_get_state() > GapStateIdle; } +bool furi_hal_bt_is_connected() { + return gap_get_state() == GapStateConnected; +} + void furi_hal_bt_start_advertising() { if(gap_get_state() == GapStateIdle) { gap_start_advertising(); diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index 3e554bb4f..03b9eb863 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -250,6 +250,8 @@ void furi_hal_bt_set_profile_pairing_method(FuriHalBtProfile profile, GapPairing GapPairing furi_hal_bt_get_profile_pairing_method(FuriHalBtProfile profile); +bool furi_hal_bt_is_connected(void); + #ifdef __cplusplus } #endif From dc38d57d6e31a9acc02cead314e6b704459ae8ed Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 3 Feb 2023 21:20:44 +0100 Subject: [PATCH 22/36] Fix: vs-code and copilot mistakes (oups) --- applications/main/bad_kb/bad_kb_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index a34b7e4c3..6d5c7478c 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -627,13 +627,13 @@ static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) { static inline BadKbWorkerState bad_kb_hid_get_initial_state(BadKbScript* bad_kb) { if(bad_kb->bt) { - if(furi_hal_usb_is_connected(&usb_hid)) { + if(furi_hal_bt_is_connected()) { return BadKbStateIdle; } else { return BadKbStateNotConnected; } } else { - if(bt_get_status(bad_kb->bt) == BtStatusConnected) { + if(furi_hal_hid_is_connected()) { return BadKbStateIdle; } else { return BadKbStateNotConnected; From 82f4a287cbce1c48d6fe10827bb8cabfb6a2a447 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 22:19:04 +0000 Subject: [PATCH 23/36] Stay connected in bad kb --- applications/main/bad_kb/bad_kb_app.c | 1 + applications/main/bad_kb/bad_kb_script.c | 148 ++++++++++++------ applications/main/bad_kb/bad_kb_script.h | 4 + .../bad_kb/scenes/bad_kb_scene_config_bt.c | 1 + .../bad_kb/scenes/bad_kb_scene_config_usb.c | 1 + 5 files changed, 109 insertions(+), 46 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_app.c b/applications/main/bad_kb/bad_kb_app.c index 4181b08d4..09b7d41a4 100644 --- a/applications/main/bad_kb/bad_kb_app.c +++ b/applications/main/bad_kb/bad_kb_app.c @@ -155,6 +155,7 @@ BadKbApp* bad_kb_app_alloc(char* arg) { void bad_kb_app_free(BadKbApp* app) { furi_assert(app); + bad_kb_connection_deinit(app->bt); if(app->bad_kb_script) { bad_kb_script_close(app->bad_kb_script); app->bad_kb_script = NULL; diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index 18aabe860..3bfbb158c 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -41,6 +41,12 @@ typedef enum { LevelRssiError = 0xFF, } LevelRssiRange; +typedef enum { + BadKbConnectionModeNone, + BadKbConnectionModeUsb, + BadKbConnectionModeBt, +} BadKbConnectionMode; + /** * Delays for waiting between HID key press and key release */ @@ -164,6 +170,11 @@ static const uint8_t numpad_keys[10] = { HID_KEYPAD_9, }; +BadKbConnectionMode connection_mode = BadKbConnectionModeNone; +FuriHalUsbInterface* usb_mode_prev = NULL; +GapPairing bt_mode_prev = GapPairingNone; +bool bt_connected = false; +bool usb_connected = false; uint8_t bt_timeout = 0; static LevelRssiRange bt_remote_rssi_range(Bt* bt) { @@ -620,19 +631,91 @@ static void bad_kb_bt_hid_state_callback(BtStatus status, void* context) { if(r != LevelRssiError) { bt_timeout = bt_hid_delays[r]; } + bt_connected = true; furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtConnect); - } else + } else { + bt_connected = false; furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); + } } static void bad_kb_usb_hid_state_callback(bool state, void* context) { furi_assert(context); BadKbScript* bad_kb = context; - if(state == true) + if(state == true) { + usb_connected = true; furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtConnect); - else + } else { + usb_connected = false; furi_thread_flags_set(furi_thread_get_id(bad_kb->thread), WorkerEvtDisconnect); + } +} + +void bad_kb_bt_init(Bt* bt) { + bt_timeout = bt_hid_delays[LevelRssi39_0]; + bt_disconnect(bt); + furi_delay_ms(200); + bt_keys_storage_set_storage_path(bt, HID_BT_KEYS_STORAGE_PATH); + furi_assert(bt_set_profile(bt, BtProfileHidKeyboard)); + bt_mode_prev = bt_get_profile_pairing_method(bt); + bt_set_profile_pairing_method(bt, GapPairingNone); + furi_hal_bt_start_advertising(); + + connection_mode = BadKbConnectionModeBt; +} + +void bad_kb_bt_deinit(Bt* bt) { + // release all keys + bt_hid_hold_while_keyboard_buffer_full(6, 3000); + + // stop ble + bt_disconnect(bt); + + // Wait 2nd core to update nvm storage + furi_delay_ms(200); + + bt_keys_storage_set_default_path(bt); + + bt_set_profile_pairing_method(bt, bt_mode_prev); + + // fails if ble radio stack isn't ready when switching profile + // if it happens, maybe we should increase the delay after bt_disconnect + bt_set_profile(bt, BtProfileSerial); + + connection_mode = BadKbConnectionModeNone; +} + +void bad_kb_usb_init() { + usb_mode_prev = furi_hal_usb_get_config(); + + connection_mode = BadKbConnectionModeUsb; +} + +void bad_kb_usb_deinit() { + furi_hal_usb_set_config(usb_mode_prev, NULL); + + connection_mode = BadKbConnectionModeNone; +} + +void bad_kb_connection_init(Bt* bt) { + if(connection_mode != BadKbConnectionModeNone) return; + + if(bt) { + bad_kb_bt_init(bt); + } else { + bad_kb_usb_init(); + } +} + +void bad_kb_connection_deinit(Bt* bt) { + if(connection_mode == BadKbConnectionModeNone) return; + + if(connection_mode == BadKbConnectionModeBt) { + bad_kb_bt_deinit(bt); + } else { + bad_kb_usb_deinit(); + } } static int32_t bad_kb_worker(void* context) { @@ -641,23 +724,11 @@ static int32_t bad_kb_worker(void* context) { BadKbWorkerState worker_state = BadKbStateInit; int32_t delay_val = 0; - FuriHalUsbInterface* usb_mode_prev = NULL; - GapPairing old_pairing_method = GapPairingNone; + bad_kb_connection_init(bad_kb->bt); + if(bad_kb->bt) { - bt_timeout = bt_hid_delays[LevelRssi39_0]; - bt_disconnect(bad_kb->bt); - furi_delay_ms(200); - bt_keys_storage_set_storage_path(bad_kb->bt, HID_BT_KEYS_STORAGE_PATH); - if(!bt_set_profile(bad_kb->bt, BtProfileHidKeyboard)) { - FURI_LOG_E(TAG, "Failed to switch to HID profile"); - return -1; - } - old_pairing_method = bt_get_profile_pairing_method(bad_kb->bt); - bt_set_profile_pairing_method(bad_kb->bt, GapPairingNone); - furi_hal_bt_start_advertising(); bt_set_status_changed_callback(bad_kb->bt, bad_kb_bt_hid_state_callback, bad_kb); } else { - usb_mode_prev = furi_hal_usb_get_config(); furi_hal_hid_set_state_callback(bad_kb_usb_hid_state_callback, bad_kb); } @@ -693,17 +764,21 @@ static int32_t bad_kb_worker(void* context) { bad_kb->st.state = worker_state; } else if(worker_state == BadKbStateNotConnected) { // State: Not connected - uint32_t flags = furi_thread_flags_wait( - WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, - FuriFlagWaitAny, - FuriWaitForever); - furi_check((flags & FuriFlagError) == 0); - if(flags & WorkerEvtEnd) { - break; - } else if(flags & WorkerEvtConnect) { + if((bad_kb->bt && bt_connected) || (!bad_kb->bt && usb_connected)) { worker_state = BadKbStateIdle; // Ready to run - } else if(flags & WorkerEvtToggle) { - worker_state = BadKbStateWillRun; // Will run when connected + } else { + uint32_t flags = furi_thread_flags_wait( + WorkerEvtEnd | WorkerEvtConnect | WorkerEvtToggle, + FuriFlagWaitAny, + FuriWaitForever); + furi_check((flags & FuriFlagError) == 0); + if(flags & WorkerEvtEnd) { + break; + } else if(flags & WorkerEvtConnect) { + worker_state = BadKbStateIdle; // Ready to run + } else if(flags & WorkerEvtToggle) { + worker_state = BadKbStateWillRun; // Will run when connected + } } bad_kb->st.state = worker_state; @@ -834,28 +909,9 @@ static int32_t bad_kb_worker(void* context) { } if(bad_kb->bt) { - // release all keys - bt_hid_hold_while_keyboard_buffer_full(6, 3000); - - // stop ble bt_set_status_changed_callback(bad_kb->bt, NULL, NULL); - - bt_disconnect(bad_kb->bt); - - // Wait 2nd core to update nvm storage - furi_delay_ms(200); - - bt_keys_storage_set_default_path(bad_kb->bt); - - bt_set_profile_pairing_method(bad_kb->bt, old_pairing_method); - - // fails if ble radio stack isn't ready when switching profile - // if it happens, maybe we should increase the delay after bt_disconnect - bt_set_profile(bad_kb->bt, BtProfileSerial); } else { furi_hal_hid_set_state_callback(NULL, NULL); - - furi_hal_usb_set_config(usb_mode_prev, NULL); } storage_file_close(script_file); diff --git a/applications/main/bad_kb/bad_kb_script.h b/applications/main/bad_kb/bad_kb_script.h index 35c57c112..0ea701eb8 100644 --- a/applications/main/bad_kb/bad_kb_script.h +++ b/applications/main/bad_kb/bad_kb_script.h @@ -30,6 +30,10 @@ typedef struct { char error[64]; } BadKbState; +void bad_kb_connection_init(Bt* bt); + +void bad_kb_connection_deinit(Bt* bt); + BadKbScript* bad_kb_script_open(FuriString* file_path, Bt* bt); void bad_kb_script_close(BadKbScript* bad_kb); diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c index 6d01f1df1..9b4d8041e 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c @@ -54,6 +54,7 @@ bool bad_kb_scene_config_bt_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { bad_kb_script_close(bad_kb->bad_kb_script); + bad_kb_connection_deinit(bad_kb->bt); bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c index 27457e5f2..fc265b64e 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_usb.c @@ -48,6 +48,7 @@ bool bad_kb_scene_config_usb_on_event(void* context, SceneManagerEvent event) { scene_manager_next_scene(bad_kb->scene_manager, BadKbSceneConfigLayout); } else if(event.event == VarItemListIndexConnection) { bad_kb_script_close(bad_kb->bad_kb_script); + bad_kb_connection_deinit(bad_kb->bt); bad_kb->bad_kb_script = bad_kb_script_open(bad_kb->file_path, bad_kb->is_bt ? bad_kb->bt : NULL); bad_kb_script_set_keyboard_layout(bad_kb->bad_kb_script, bad_kb->keyboard_layout); From d6a1dc2e1f986265cfc6c8b30c35fbdfb01abb40 Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 3 Feb 2023 19:39:30 +0100 Subject: [PATCH 24/36] Removes storing of bt peer key in internal flash for bad usb BLE Co-authored-by: yocvito --- applications/main/bad_kb/bad_kb_script.c | 6 +++++- applications/services/bt/bt_service/bt.c | 9 +++++++++ applications/services/bt/bt_service/bt.h | 11 +++++++++++ firmware/targets/f7/api_symbols.csv | 4 +++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index 3bfbb158c..cc548ae27 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -661,6 +661,8 @@ void bad_kb_bt_init(Bt* bt) { bt_mode_prev = bt_get_profile_pairing_method(bt); bt_set_profile_pairing_method(bt, GapPairingNone); furi_hal_bt_start_advertising(); + // disable peer key adding to bt SRAM storage + bt_disable_peer_key_update(bad_usb->bt); connection_mode = BadKbConnectionModeBt; } @@ -683,6 +685,9 @@ void bad_kb_bt_deinit(Bt* bt) { // if it happens, maybe we should increase the delay after bt_disconnect bt_set_profile(bt, BtProfileSerial); + // starts saving peer keys (bounded devices) + bt_enable_peer_key_update(bad_usb->bt); + connection_mode = BadKbConnectionModeNone; } @@ -827,7 +832,6 @@ static int32_t bad_kb_worker(void* context) { furi_thread_flags_wait(0, FuriFlagWaitAny, 1500); if(bad_kb->bt) { update_bt_timeout(bad_kb->bt); - FURI_LOG_I(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } bad_kb_script_set_keyboard_layout(bad_kb, bad_kb->keyboard_layout); worker_state = BadKbStateRunning; diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index 6c2fb9307..cc5e8f33e 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -445,6 +445,15 @@ GapPairing bt_get_profile_pairing_method(Bt* bt) { return furi_hal_bt_get_profile_pairing_method(get_hal_bt_profile(bt->profile)); } +void bt_disable_peer_key_update(Bt *bt) { + UNUSED(bt); + furi_hal_bt_set_key_storage_change_callback(NULL, NULL); +} + +void bt_enable_peer_key_update(Bt *bt) { + furi_hal_bt_set_key_storage_change_callback(bt_on_key_storage_change_callback, bt); +} + int32_t bt_srv(void* p) { UNUSED(p); Bt* bt = bt_alloc(); diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index 046887a2c..ddf9382e8 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -52,6 +52,17 @@ bool bt_remote_rssi(Bt* bt, BtRssi* rssi); void bt_set_profile_pairing_method(Bt* bt, GapPairing pairing_method); GapPairing bt_get_profile_pairing_method(Bt* bt); +/** Stop saving new peer key to flash (in .bt.keys file) + * +*/ +void bt_disable_peer_key_update(Bt *bt); + +/** Enable saving peer key to internal flash (enable by default) + * + * @note This function should be called if bt_disable_peer_key_update was called before +*/ +void bt_enable_peer_key_update(Bt *bt); + /** Disconnect from Central * * @param bt Bt instance diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 2129d0530..8cea0cdd3 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,13.2,, +Version,v,13.4,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -569,7 +569,9 @@ Function,+,ble_glue_start,_Bool, Function,+,ble_glue_thread_stop,void, Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t" +Function,+,bt_disable_peer_key_update,void,Bt* Function,+,bt_disconnect,void,Bt* +Function,+,bt_enable_peer_key_update,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_get_profile_adv_name,const char*,Bt* Function,+,bt_get_profile_mac_address,const uint8_t*,Bt* From 08475ff579d633d94fffda4494f12b7c872075b0 Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 3 Feb 2023 21:06:55 +0100 Subject: [PATCH 25/36] Add bt is connected check --- firmware/targets/f7/api_symbols.csv | 3 ++- firmware/targets/f7/furi_hal/furi_hal_bt.c | 4 ++++ firmware/targets/furi_hal_include/furi_hal_bt.h | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 8cea0cdd3..95bcce708 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,v,13.4,, +Version,+,13.5,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1030,6 +1030,7 @@ Function,-,furi_hal_bt_init,void, Function,+,furi_hal_bt_is_active,_Bool, Function,+,furi_hal_bt_is_alive,_Bool, Function,+,furi_hal_bt_is_ble_gatt_gap_supported,_Bool, +Function,+,furi_hal_bt_is_connected,_Bool, Function,+,furi_hal_bt_is_testing_supported,_Bool, Function,+,furi_hal_bt_lock_core2,void, Function,+,furi_hal_bt_nvm_sram_sem_acquire,void, diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index f33c92c62..e01669eb8 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -287,6 +287,10 @@ bool furi_hal_bt_is_active() { return gap_get_state() > GapStateIdle; } +bool furi_hal_bt_is_connected() { + return gap_get_state() == GapStateConnected; +} + void furi_hal_bt_start_advertising() { if(gap_get_state() == GapStateIdle) { gap_start_advertising(); diff --git a/firmware/targets/furi_hal_include/furi_hal_bt.h b/firmware/targets/furi_hal_include/furi_hal_bt.h index 3e554bb4f..03b9eb863 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt.h @@ -250,6 +250,8 @@ void furi_hal_bt_set_profile_pairing_method(FuriHalBtProfile profile, GapPairing GapPairing furi_hal_bt_get_profile_pairing_method(FuriHalBtProfile profile); +bool furi_hal_bt_is_connected(void); + #ifdef __cplusplus } #endif From 92c83cfb798f6b95e7deaa4cec5f88b29f774203 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 22:40:29 +0000 Subject: [PATCH 26/36] Fix typo --- applications/main/bad_kb/bad_kb_script.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index cc548ae27..f27e1a268 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -662,7 +662,7 @@ void bad_kb_bt_init(Bt* bt) { bt_set_profile_pairing_method(bt, GapPairingNone); furi_hal_bt_start_advertising(); // disable peer key adding to bt SRAM storage - bt_disable_peer_key_update(bad_usb->bt); + bt_disable_peer_key_update(bt); connection_mode = BadKbConnectionModeBt; } @@ -686,7 +686,7 @@ void bad_kb_bt_deinit(Bt* bt) { bt_set_profile(bt, BtProfileSerial); // starts saving peer keys (bounded devices) - bt_enable_peer_key_update(bad_usb->bt); + bt_enable_peer_key_update(bt); connection_mode = BadKbConnectionModeNone; } From e97659819d64c0b5c833bde3d127b07e277f4664 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 23:10:50 +0000 Subject: [PATCH 27/36] Change bad bt config options names --- applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c index 9b4d8041e..394783828 100644 --- a/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c +++ b/applications/main/bad_kb/scenes/bad_kb_scene_config_bt.c @@ -33,9 +33,9 @@ void bad_kb_scene_config_bt_on_enter(void* context) { item = variable_item_list_add(var_item_list, "Keyboard layout", 0, NULL, bad_kb); - item = variable_item_list_add(var_item_list, "Change adv name", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "BT device name", 0, NULL, bad_kb); - item = variable_item_list_add(var_item_list, "Change MAC address", 0, NULL, bad_kb); + item = variable_item_list_add(var_item_list, "BT MAC address", 0, NULL, bad_kb); variable_item_list_set_enter_callback( var_item_list, bad_kb_scene_config_bt_var_item_list_callback, bad_kb); From 9a02a87e829421443b12918b34d7f8f2fb49ca51 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Fri, 3 Feb 2023 23:37:44 +0000 Subject: [PATCH 28/36] Fix worker interface bug on bad kb quit --- applications/main/bad_kb/bad_kb_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/main/bad_kb/bad_kb_app.c b/applications/main/bad_kb/bad_kb_app.c index 09b7d41a4..0a47b7492 100644 --- a/applications/main/bad_kb/bad_kb_app.c +++ b/applications/main/bad_kb/bad_kb_app.c @@ -155,7 +155,6 @@ BadKbApp* bad_kb_app_alloc(char* arg) { void bad_kb_app_free(BadKbApp* app) { furi_assert(app); - bad_kb_connection_deinit(app->bt); if(app->bad_kb_script) { bad_kb_script_close(app->bad_kb_script); app->bad_kb_script = NULL; @@ -190,6 +189,7 @@ void bad_kb_app_free(BadKbApp* app) { // restores bt config // BtProfile have already been switched to the previous one // so we directly modify the right profile + bad_kb_connection_deinit(app->bt); if(strcmp(app->bt_old_config.name, app->name) != 0) { furi_hal_bt_set_profile_adv_name(FuriHalBtProfileHidKeyboard, app->bt_old_config.name); } From 3acfe5b2153914c35f74c8d906059d26e426817c Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Mon, 6 Feb 2023 14:16:03 +0000 Subject: [PATCH 29/36] Format --- applications/services/bt/bt_service/bt.c | 4 ++-- applications/services/bt/bt_service/bt.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/applications/services/bt/bt_service/bt.c b/applications/services/bt/bt_service/bt.c index cc5e8f33e..6949bbc41 100644 --- a/applications/services/bt/bt_service/bt.c +++ b/applications/services/bt/bt_service/bt.c @@ -445,12 +445,12 @@ GapPairing bt_get_profile_pairing_method(Bt* bt) { return furi_hal_bt_get_profile_pairing_method(get_hal_bt_profile(bt->profile)); } -void bt_disable_peer_key_update(Bt *bt) { +void bt_disable_peer_key_update(Bt* bt) { UNUSED(bt); furi_hal_bt_set_key_storage_change_callback(NULL, NULL); } -void bt_enable_peer_key_update(Bt *bt) { +void bt_enable_peer_key_update(Bt* bt) { furi_hal_bt_set_key_storage_change_callback(bt_on_key_storage_change_callback, bt); } diff --git a/applications/services/bt/bt_service/bt.h b/applications/services/bt/bt_service/bt.h index ddf9382e8..a79c227f7 100644 --- a/applications/services/bt/bt_service/bt.h +++ b/applications/services/bt/bt_service/bt.h @@ -55,13 +55,13 @@ GapPairing bt_get_profile_pairing_method(Bt* bt); /** Stop saving new peer key to flash (in .bt.keys file) * */ -void bt_disable_peer_key_update(Bt *bt); +void bt_disable_peer_key_update(Bt* bt); /** Enable saving peer key to internal flash (enable by default) * * @note This function should be called if bt_disable_peer_key_update was called before */ -void bt_enable_peer_key_update(Bt *bt); +void bt_enable_peer_key_update(Bt* bt); /** Disconnect from Central * From f5219db3fc2360b2a155464a57b90c210d036221 Mon Sep 17 00:00:00 2001 From: yocvito Date: Fri, 10 Feb 2023 20:04:45 +0100 Subject: [PATCH 30/36] Adds LED state report characteristic into bt GATT hid service (for now writing by host isn't working) --- applications/main/bad_kb/bad_kb_script.c | 2 +- firmware/targets/f7/api_symbols.csv | 3 +- firmware/targets/f7/ble_glue/hid_service.c | 105 +++++++++++++++++- firmware/targets/f7/ble_glue/hid_service.h | 4 + .../targets/f7/furi_hal/furi_hal_bt_hid.c | 75 ++++++++++++- .../furi_hal_include/furi_hal_bt_hid.h | 6 + 6 files changed, 185 insertions(+), 10 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index f27e1a268..9cf989eb8 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -243,7 +243,7 @@ static bool ducky_is_line_end(const char chr) { static void ducky_numlock_on(BadKbScript* bad_kb) { if(bad_kb->bt) { - if((furi_hal_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME + if((furi_hal_bt_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); furi_delay_ms(bt_timeout); diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index 95bcce708..a8180d19e 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,13.5,, +Version,v,13.9,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1015,6 +1015,7 @@ Function,+,furi_hal_bt_get_transmitted_packets,uint32_t, Function,+,furi_hal_bt_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release_all,_Bool, +Function,+,furi_hal_bt_hid_get_led_state,uint8_t, Function,+,furi_hal_bt_hid_kb_free_slots,_Bool,uint8_t Function,+,furi_hal_bt_hid_kb_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release,_Bool,uint16_t diff --git a/firmware/targets/f7/ble_glue/hid_service.c b/firmware/targets/f7/ble_glue/hid_service.c index 47d242d4d..31eeb03da 100644 --- a/firmware/targets/f7/ble_glue/hid_service.c +++ b/firmware/targets/f7/ble_glue/hid_service.c @@ -14,10 +14,36 @@ typedef struct { uint16_t report_map_char_handle; uint16_t info_char_handle; uint16_t ctrl_point_char_handle; + // led state + uint16_t led_state_char_handle; + uint16_t led_state_desc_handle; + HidLedStateEventCallback led_state_event_callback; + void* led_state_ctx; } HIDSvc; static HIDSvc* hid_svc = NULL; +// #define N_BYTE_PER_LINE 16 +// static void hexdump(uint8_t* data, uint32_t len) { +// uint32_t n_line = len / N_BYTE_PER_LINE + 1; +// char line[len * 3 + n_line + 1]; +// memset(line, 0, sizeof(line)); +// uint32_t i; +// for(i = 0; i < len; i++) { +// if(i % N_BYTE_PER_LINE == 0) { +// if(i != 0) { +// FURI_LOG_D(TAG, "%s", line); +// } +// memset(line, 0, sizeof(line)); +// } +// uint32_t line_len = strlen(line); +// snprintf(line + line_len, sizeof(line) - line_len, "%02X ", data[i]); +// } +// if(strlen(line) > 0) { +// FURI_LOG_D(TAG, "%s", line); +// } +// } + static SVCCTL_EvtAckStatus_t hid_svc_event_handler(void* event) { SVCCTL_EvtAckStatus_t ret = SVCCTL_EvtNotAck; hci_event_pckt* event_pckt = (hci_event_pckt*)(((hci_uart_pckt*)event)->data); @@ -30,6 +56,27 @@ static SVCCTL_EvtAckStatus_t hid_svc_event_handler(void* event) { } else if(blecore_evt->ecode == ACI_GATT_SERVER_CONFIRMATION_VSEVT_CODE) { // Process notification confirmation ret = SVCCTL_EvtAckFlowEnable; + } else if(blecore_evt->ecode == ACI_GATT_WRITE_PERMIT_REQ_VSEVT_CODE) { + // Process write request + aci_gatt_write_permit_req_event_rp0* req = + (aci_gatt_write_permit_req_event_rp0*)blecore_evt->data; + + // FURI_LOG_I(TAG, "GATT write request"); + // size_t len = 2 + event_pckt->plen; + // hexdump((uint8_t*)event_pckt, len); + // FURI_LOG_D(TAG, "conn_handle = %04x", req->Connection_Handle); + // FURI_LOG_D(TAG, "attr handle = %04x", req->Attribute_Handle); + // FURI_LOG_D(TAG, "led char handle = %04x", hid_svc->led_state_char_handle); + // FURI_LOG_D(TAG, "led state = %02x", req->Data[0]); + + furi_check(hid_svc->led_state_event_callback && hid_svc->led_state_ctx); + + // this check is likely to be incorrect, it will actually work in our case + // but we need to investigate gatt api to see what is the rules + // that specify attibute handle value from char handle (or the reverse) + if(req->Attribute_Handle == (hid_svc->led_state_char_handle + 1)) { + hid_svc->led_state_event_callback(req->Data[0], hid_svc->led_state_ctx); + } } } return ret; @@ -55,8 +102,8 @@ void hid_svc_start() { PRIMARY_SERVICE, 2 + /* protocol mode */ (4 * HID_SVC_INPUT_REPORT_COUNT) + (3 * HID_SVC_OUTPUT_REPORT_COUNT) + - (3 * HID_SVC_FEATURE_REPORT_COUNT) + 1 + 2 + 2 + - 2, /* Service + Report Map + HID Information + HID Control Point */ + (3 * HID_SVC_FEATURE_REPORT_COUNT) + 1 + 2 + 2 + 2 + + 4, /* Service + Report Map + HID Information + HID Control Point + LED state */ &hid_svc->svc_handle); if(status) { FURI_LOG_E(TAG, "Failed to add HID service: %d", status); @@ -198,6 +245,44 @@ void hid_svc_start() { } } #endif + // add led state output report + char_uuid.Char_UUID_16 = REPORT_CHAR_UUID; + status = aci_gatt_add_char( + hid_svc->svc_handle, + UUID_TYPE_16, + &char_uuid, + 1, + CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP, + ATTR_PERMISSION_NONE, + GATT_NOTIFY_ATTRIBUTE_WRITE | GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP, + 10, + CHAR_VALUE_LEN_CONSTANT, + &(hid_svc->led_state_char_handle)); + if(status) { + FURI_LOG_E(TAG, "Failed to add led state characteristic: %d", status); + } + + // add led state char descriptor specifying it is an output report + uint8_t buf[2] = {HID_SVC_REPORT_COUNT + 1, 2}; + desc_uuid.Char_UUID_16 = REPORT_REFERENCE_DESCRIPTOR_UUID; + status = aci_gatt_add_char_desc( + hid_svc->svc_handle, + hid_svc->led_state_char_handle, + UUID_TYPE_16, + &desc_uuid, + HID_SVC_REPORT_REF_LEN, + HID_SVC_REPORT_REF_LEN, + buf, + ATTR_PERMISSION_NONE, + ATTR_ACCESS_READ_WRITE, + GATT_DONT_NOTIFY_EVENTS, + MIN_ENCRY_KEY_SIZE, + CHAR_VALUE_LEN_CONSTANT, + &(hid_svc->led_state_desc_handle)); + if(status) { + FURI_LOG_E(TAG, "Failed to add led state descriptor: %d", status); + } + // Add Report Map characteristic char_uuid.Char_UUID_16 = REPORT_MAP_CHAR_UUID; status = aci_gatt_add_char( @@ -247,6 +332,9 @@ void hid_svc_start() { if(status) { FURI_LOG_E(TAG, "Failed to add control point characteristic: %d", status); } + + hid_svc->led_state_event_callback = NULL; + hid_svc->led_state_ctx = NULL; } bool hid_svc_update_report_map(const uint8_t* data, uint16_t len) { @@ -288,6 +376,15 @@ bool hid_svc_update_info(uint8_t* data, uint16_t len) { return true; } +void hid_svc_register_led_state_callback(HidLedStateEventCallback callback, void* context) { + furi_assert(hid_svc); + furi_assert(callback); + furi_assert(context); + + hid_svc->led_state_event_callback = callback; + hid_svc->led_state_ctx = context; +} + bool hid_svc_is_started() { return hid_svc != NULL; } @@ -320,6 +417,10 @@ void hid_svc_stop() { if(status) { FURI_LOG_E(TAG, "Failed to delete Control Point characteristic: %d", status); } + status = aci_gatt_del_char(hid_svc->svc_handle, hid_svc->led_state_char_handle); + if(status) { + FURI_LOG_E(TAG, "Failed to delete led state characteristic: %d", status); + } // Delete service status = aci_gatt_del_service(hid_svc->svc_handle); if(status) { diff --git a/firmware/targets/f7/ble_glue/hid_service.h b/firmware/targets/f7/ble_glue/hid_service.h index 723460d49..40d973340 100644 --- a/firmware/targets/f7/ble_glue/hid_service.h +++ b/firmware/targets/f7/ble_glue/hid_service.h @@ -15,6 +15,8 @@ #define HID_SVC_REPORT_COUNT \ (HID_SVC_INPUT_REPORT_COUNT + HID_SVC_OUTPUT_REPORT_COUNT + HID_SVC_FEATURE_REPORT_COUNT) +typedef uint16_t (*HidLedStateEventCallback)(uint8_t state, void* ctx); + void hid_svc_start(); void hid_svc_stop(); @@ -26,3 +28,5 @@ bool hid_svc_update_report_map(const uint8_t* data, uint16_t len); bool hid_svc_update_input_report(uint8_t input_report_num, uint8_t* data, uint16_t len); bool hid_svc_update_info(uint8_t* data, uint16_t len); + +void hid_svc_register_led_state_callback(HidLedStateEventCallback callback, void* context); \ No newline at end of file diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c index 424999fc0..307b0ac83 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c @@ -20,6 +20,7 @@ enum HidReportId { ReportIdKeyboard = 1, ReportIdMouse = 2, ReportIdConsumer = 3, + ReportIdLEDState = 4, }; // Report numbers corresponded to the report id with an offset of 1 enum HidInputNumber { @@ -63,12 +64,6 @@ static const uint8_t furi_hal_bt_hid_report_map_data[] = { HID_REPORT_COUNT(1), HID_REPORT_SIZE(8), HID_INPUT(HID_IOF_CONSTANT | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), - HID_USAGE_PAGE(HID_PAGE_LED), - HID_REPORT_COUNT(8), - HID_REPORT_SIZE(1), - HID_USAGE_MINIMUM(1), - HID_USAGE_MAXIMUM(8), - HID_OUTPUT(HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), HID_REPORT_COUNT(FURI_HAL_BT_HID_KB_MAX_KEYS), HID_REPORT_SIZE(8), HID_LOGICAL_MINIMUM(0), @@ -77,6 +72,13 @@ static const uint8_t furi_hal_bt_hid_report_map_data[] = { HID_USAGE_MINIMUM(0), HID_USAGE_MAXIMUM(101), HID_INPUT(HID_IOF_DATA | HID_IOF_ARRAY | HID_IOF_ABSOLUTE), + HID_REPORT_ID(ReportIdLEDState), + HID_USAGE_PAGE(HID_PAGE_LED), + HID_REPORT_COUNT(8), + HID_REPORT_SIZE(1), + HID_USAGE_MINIMUM(1), + HID_USAGE_MAXIMUM(8), + HID_OUTPUT(HID_IOF_DATA | HID_IOF_VARIABLE | HID_IOF_ABSOLUTE), HID_END_COLLECTION, // Mouse Report HID_USAGE_PAGE(HID_PAGE_DESKTOP), @@ -125,6 +127,62 @@ FuriHalBtHidKbReport* kb_report = NULL; FuriHalBtHidMouseReport* mouse_report = NULL; FuriHalBtHidConsumerReport* consumer_report = NULL; +typedef struct { +// shortcuts +#define s_undefined data.bits.b_undefined +#define s_num_lock data.bits.b_num_lock +#define s_caps_lock data.bits.b_caps_lock +#define s_scroll_lock data.bits.b_scroll_lock +#define s_compose data.bits.b_compose +#define s_kana data.bits.b_kana +#define s_power data.bits.b_power +#define s_shift data.bits.b_shift +#define s_value data.value + union { + struct { + uint8_t b_undefined : 1; + uint8_t b_num_lock : 1; + uint8_t b_caps_lock : 1; + uint8_t b_scroll_lock : 1; + uint8_t b_compose : 1; + uint8_t b_kana : 1; + uint8_t b_power : 1; + uint8_t b_shift : 1; + } bits; + uint8_t value; + } data; +} __attribute__((__packed__)) FuriHalBtHidLedState; + +FuriHalBtHidLedState hid_host_led_state = {.s_value = 0}; + +uint16_t furi_hal_bt_hid_led_state_cb(uint8_t state, void* ctx) { + FuriHalBtHidLedState* led_state = (FuriHalBtHidLedState*)ctx; + + FURI_LOG_D("HalBtHid", "LED state updated !"); + + led_state->s_value = state; + + return 0; +} + +uint8_t furi_hal_bt_hid_get_led_state(void) { + FURI_LOG_D( + "HalBtHid", + "LED state: RFU=%d NUMLOCK=%d CAPSLOCK=%d SCROLLLOCK=%d COMPOSE=%d KANA=%d POWER=%d SHIFT=%d", + hid_host_led_state.s_undefined, + hid_host_led_state.s_num_lock, + hid_host_led_state.s_caps_lock, + hid_host_led_state.s_scroll_lock, + hid_host_led_state.s_compose, + hid_host_led_state.s_kana, + hid_host_led_state.s_power, + hid_host_led_state.s_shift); + + return (hid_host_led_state.s_value >> 1); // bit 0 is undefined (after shift bit location + // match with HID led state bits defines) + // see bad_kb_script.c (ducky_numlock_on function) +} + void furi_hal_bt_hid_start() { // Start device info if(!dev_info_svc_is_started()) { @@ -139,6 +197,8 @@ void furi_hal_bt_hid_start() { hid_svc_start(); } + hid_svc_register_led_state_callback(furi_hal_bt_hid_led_state_cb, &hid_host_led_state); + kb_report = malloc(sizeof(FuriHalBtHidKbReport)); mouse_report = malloc(sizeof(FuriHalBtHidMouseReport)); consumer_report = malloc(sizeof(FuriHalBtHidConsumerReport)); @@ -161,6 +221,9 @@ void furi_hal_bt_hid_stop() { furi_assert(kb_report); furi_assert(mouse_report); furi_assert(consumer_report); + + hid_svc_register_led_state_callback(NULL, NULL); + // Stop all services if(dev_info_svc_is_started()) { dev_info_svc_stop(); diff --git a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h index e7b40f079..b787c7c3e 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h @@ -95,6 +95,12 @@ bool furi_hal_bt_hid_consumer_key_release_all(); */ bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots); +/** Retrieves LED state from remote BT HID host + * + * (look at HID usage page to know what each bit of the returned byte means) +*/ +uint8_t furi_hal_bt_hid_get_led_state(void); + #ifdef __cplusplus } #endif From 999c609773b3fe638cbbd2d60f2673b46c06e048 Mon Sep 17 00:00:00 2001 From: yocvito Date: Sat, 11 Feb 2023 22:01:02 +0100 Subject: [PATCH 31/36] Handle write request on HID keyboard led state characteristic and respond to it (should fix numlock issue) --- firmware/targets/f7/ble_glue/hid_service.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/firmware/targets/f7/ble_glue/hid_service.c b/firmware/targets/f7/ble_glue/hid_service.c index 31eeb03da..c04656688 100644 --- a/firmware/targets/f7/ble_glue/hid_service.c +++ b/firmware/targets/f7/ble_glue/hid_service.c @@ -61,14 +61,6 @@ static SVCCTL_EvtAckStatus_t hid_svc_event_handler(void* event) { aci_gatt_write_permit_req_event_rp0* req = (aci_gatt_write_permit_req_event_rp0*)blecore_evt->data; - // FURI_LOG_I(TAG, "GATT write request"); - // size_t len = 2 + event_pckt->plen; - // hexdump((uint8_t*)event_pckt, len); - // FURI_LOG_D(TAG, "conn_handle = %04x", req->Connection_Handle); - // FURI_LOG_D(TAG, "attr handle = %04x", req->Attribute_Handle); - // FURI_LOG_D(TAG, "led char handle = %04x", hid_svc->led_state_char_handle); - // FURI_LOG_D(TAG, "led state = %02x", req->Data[0]); - furi_check(hid_svc->led_state_event_callback && hid_svc->led_state_ctx); // this check is likely to be incorrect, it will actually work in our case @@ -76,6 +68,12 @@ static SVCCTL_EvtAckStatus_t hid_svc_event_handler(void* event) { // that specify attibute handle value from char handle (or the reverse) if(req->Attribute_Handle == (hid_svc->led_state_char_handle + 1)) { hid_svc->led_state_event_callback(req->Data[0], hid_svc->led_state_ctx); + aci_gatt_write_resp(req->Connection_Handle, req->Attribute_Handle, + 0x00, /* write_status = 0 (no error))*/ + 0x00, /* err_code */ + req->Data_Length, req->Data); + aci_gatt_write_char_value(req->Connection_Handle, hid_svc->led_state_char_handle, req->Data_Length, req->Data); + ret = SVCCTL_EvtAckFlowEnable; } } } @@ -252,7 +250,7 @@ void hid_svc_start() { UUID_TYPE_16, &char_uuid, 1, - CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP, + CHAR_PROP_READ | CHAR_PROP_WRITE_WITHOUT_RESP | CHAR_PROP_WRITE, ATTR_PERMISSION_NONE, GATT_NOTIFY_ATTRIBUTE_WRITE | GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP, 10, From c9941d44a77e5cb00bbcbc40c751898a5aefda2b Mon Sep 17 00:00:00 2001 From: yocvito Date: Sat, 11 Feb 2023 22:14:11 +0100 Subject: [PATCH 32/36] removes useless commented function --- firmware/targets/f7/ble_glue/hid_service.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/firmware/targets/f7/ble_glue/hid_service.c b/firmware/targets/f7/ble_glue/hid_service.c index c04656688..f983ec13b 100644 --- a/firmware/targets/f7/ble_glue/hid_service.c +++ b/firmware/targets/f7/ble_glue/hid_service.c @@ -23,27 +23,6 @@ typedef struct { static HIDSvc* hid_svc = NULL; -// #define N_BYTE_PER_LINE 16 -// static void hexdump(uint8_t* data, uint32_t len) { -// uint32_t n_line = len / N_BYTE_PER_LINE + 1; -// char line[len * 3 + n_line + 1]; -// memset(line, 0, sizeof(line)); -// uint32_t i; -// for(i = 0; i < len; i++) { -// if(i % N_BYTE_PER_LINE == 0) { -// if(i != 0) { -// FURI_LOG_D(TAG, "%s", line); -// } -// memset(line, 0, sizeof(line)); -// } -// uint32_t line_len = strlen(line); -// snprintf(line + line_len, sizeof(line) - line_len, "%02X ", data[i]); -// } -// if(strlen(line) > 0) { -// FURI_LOG_D(TAG, "%s", line); -// } -// } - static SVCCTL_EvtAckStatus_t hid_svc_event_handler(void* event) { SVCCTL_EvtAckStatus_t ret = SVCCTL_EvtNotAck; hci_event_pckt* event_pckt = (hci_event_pckt*)(((hci_uart_pckt*)event)->data); From 796930b12cc26d64b6df10e5d5b79101416763ce Mon Sep 17 00:00:00 2001 From: yocvito Date: Sun, 12 Feb 2023 00:28:03 +0100 Subject: [PATCH 33/36] remove useless func --- applications/main/bad_kb/bad_kb_script.c | 27 ++----------------- firmware/targets/f7/furi_hal/furi_hal_bt.c | 11 ++------ .../targets/f7/furi_hal/furi_hal_bt_hid.c | 8 ------ .../furi_hal_include/furi_hal_bt_hid.h | 12 ++------- 4 files changed, 6 insertions(+), 52 deletions(-) diff --git a/applications/main/bad_kb/bad_kb_script.c b/applications/main/bad_kb/bad_kb_script.c index 9cf989eb8..98177209e 100644 --- a/applications/main/bad_kb/bad_kb_script.c +++ b/applications/main/bad_kb/bad_kb_script.c @@ -200,23 +200,7 @@ static inline void update_bt_timeout(Bt* bt) { LevelRssiRange r = bt_remote_rssi_range(bt); if(r < LevelRssiNum) { bt_timeout = bt_hid_delays[r]; - } -} - -/** - * @brief Wait until there are enough free slots in the keyboard buffer - * - * @param n_free_chars Number of free slots to wait for (and consider the buffer not full) -*/ -static void bt_hid_hold_while_keyboard_buffer_full(uint8_t n_free_chars, int32_t timeout) { - uint32_t start = furi_get_tick(); - uint32_t timeout_ms = timeout <= -1 ? 0 : timeout; - while(furi_hal_bt_hid_kb_free_slots(n_free_chars) == false) { - furi_delay_ms(100); - - if(timeout != -1 && (furi_get_tick() - start) > timeout_ms) { - break; - } + FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } } @@ -244,7 +228,6 @@ static bool ducky_is_line_end(const char chr) { static void ducky_numlock_on(BadKbScript* bad_kb) { if(bad_kb->bt) { if((furi_hal_bt_hid_get_led_state() & HID_KB_LED_NUM) == 0) { // FIXME - bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(HID_KEYBOARD_LOCK_NUM_LOCK); furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(HID_KEYBOARD_LOCK_NUM_LOCK); @@ -261,9 +244,7 @@ static bool ducky_numpad_press(BadKbScript* bad_kb, const char num) { if((num < '0') || (num > '9')) return false; uint16_t key = numpad_keys[num - '0']; - FURI_LOG_I(WORKER_TAG, "Pressing %c\r\n", num); if(bad_kb->bt) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(key); @@ -282,7 +263,6 @@ static bool ducky_altchar(BadKbScript* bad_kb, const char* charcode) { FURI_LOG_I(WORKER_TAG, "char %s", charcode); if(bad_kb->bt) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT); } else { furi_hal_hid_kb_press(KEY_MOD_LEFT_ALT); @@ -328,7 +308,6 @@ static bool ducky_string(BadKbScript* bad_kb, const char* param) { uint16_t keycode = BADKB_ASCII_TO_KEY(bad_kb, param[i]); if(keycode != HID_KEYBOARD_NONE) { if(bad_kb->bt) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(keycode); furi_delay_ms(bt_timeout); furi_hal_bt_hid_kb_release(keycode); @@ -441,7 +420,6 @@ static int32_t line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1]; uint16_t key = ducky_get_keycode(bad_kb, line_tmp, true); if(bad_kb->bt) { - bt_hid_hold_while_keyboard_buffer_full(1, -1); furi_hal_bt_hid_kb_press(KEY_MOD_LEFT_ALT | HID_KEYBOARD_PRINT_SCREEN); furi_hal_bt_hid_kb_press(key); furi_delay_ms(bt_timeout); @@ -669,7 +647,7 @@ void bad_kb_bt_init(Bt* bt) { void bad_kb_bt_deinit(Bt* bt) { // release all keys - bt_hid_hold_while_keyboard_buffer_full(6, 3000); + // bt_hid_hold_while_keyboard_buffer_full(6, 3000); // stop ble bt_disconnect(bt); @@ -908,7 +886,6 @@ static int32_t bad_kb_worker(void* context) { } if(bad_kb->bt) { update_bt_timeout(bad_kb->bt); - FURI_LOG_D(WORKER_TAG, "BLE Key timeout : %u", bt_timeout); } } diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index e01669eb8..f8b7077f1 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -200,13 +200,6 @@ bool furi_hal_bt_start_app(FuriHalBtProfile profile, GapEventCallback event_cb, break; } GapConfig* config = &profile_config[profile].config; - if(strlen(&(profile_config[profile].config.adv_name[1])) == 0) { - // Set advertise name - strlcpy( - profile_config[profile].config.adv_name, - furi_hal_version_get_ble_local_device_name_ptr(), - FURI_HAL_VERSION_DEVICE_NAME_LENGTH); - } // Configure GAP if(profile == FuriHalBtProfileSerial) { // Set mac address @@ -429,8 +422,8 @@ float furi_hal_bt_get_rssi() { return val; } -/** fill the RSSI of the remote host of the bt connection and returns the time since - * the beginning of the connection +/** fill the RSSI of the remote host of the bt connection and returns the last + * time the RSSI was updated * */ uint32_t furi_hal_bt_get_conn_rssi(uint8_t* rssi) { diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c index 7623cf334..6921fbbc5 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt_hid.c @@ -259,14 +259,6 @@ bool furi_hal_bt_hid_kb_press(uint16_t button) { ReportNumberKeyboard, (uint8_t*)kb_report, sizeof(FuriHalBtHidKbReport)); } -bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots) { - furi_assert(kb_report); - for(uint8_t i = 0; n_empty_slots > 0 && i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { - if(kb_report->key[i] == 0) n_empty_slots--; - } - return (n_empty_slots == 0); -} - bool furi_hal_bt_hid_kb_release(uint16_t button) { furi_assert(kb_report); for(uint8_t i = 0; i < FURI_HAL_BT_HID_KB_MAX_KEYS; i++) { diff --git a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h index b787c7c3e..56a8b4e48 100644 --- a/firmware/targets/furi_hal_include/furi_hal_bt_hid.h +++ b/firmware/targets/furi_hal_include/furi_hal_bt_hid.h @@ -86,18 +86,10 @@ bool furi_hal_bt_hid_consumer_key_release(uint16_t button); */ bool furi_hal_bt_hid_consumer_key_release_all(); -/** - * @brief Check if keyboard buffer has free slots - * - * @param n_emptry_slots number of empty slots in buffer to consider buffer is not full - * - * @return true if there is enough free slots in buffer -*/ -bool furi_hal_bt_hid_kb_free_slots(uint8_t n_empty_slots); - /** Retrieves LED state from remote BT HID host * - * (look at HID usage page to know what each bit of the returned byte means) + * @return (look at HID usage page to know what each bit of the returned byte means) + * NB: RFU bit has been shifted out in the returned octet so USB defines should work */ uint8_t furi_hal_bt_hid_get_led_state(void); From 9132fa2961bceac02a0e5d77e05e6d485279c830 Mon Sep 17 00:00:00 2001 From: yocvito Date: Sun, 12 Feb 2023 01:06:41 +0100 Subject: [PATCH 34/36] fix adv name length bug & finalize merge --- applications/services/gui/modules/file_browser_worker.c | 4 ---- firmware/targets/f7/api_symbols.csv | 7 +++---- firmware/targets/f7/furi_hal/furi_hal_bt.c | 1 + firmware/targets/furi_hal_include/furi_hal_version.h | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index b29205116..216450295 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -92,13 +92,9 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo if(is_folder) { // Skip assets folders (if enabled) if(browser->skip_assets) { -<<<<<<< HEAD return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)) && ((furi_string_cmp_str(name, BADKB_LAYOUTS_DIR) == 0) ? (false) : (true)) && ((furi_string_cmp_str(name, SUBGHZ_TEMP_DIR) == 0) ? (false) : (true)); -======= - return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)); ->>>>>>> upstream/dev } else { return true; } diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index d114736bc..a7f0f4790 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,15.1,, +Version,v,17.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1028,7 +1028,6 @@ Function,+,furi_hal_bt_hid_consumer_key_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_consumer_key_release_all,_Bool, Function,+,furi_hal_bt_hid_get_led_state,uint8_t, -Function,+,furi_hal_bt_hid_kb_free_slots,_Bool,uint8_t Function,+,furi_hal_bt_hid_kb_press,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release,_Bool,uint16_t Function,+,furi_hal_bt_hid_kb_release_all,_Bool, @@ -1056,7 +1055,7 @@ Function,+,furi_hal_bt_serial_start,void, Function,+,furi_hal_bt_serial_stop,void, Function,+,furi_hal_bt_serial_tx,_Bool,"uint8_t*, uint16_t" Function,+,furi_hal_bt_set_key_storage_change_callback,void,"BleGlueKeyStorageChangedCallback, void*" -Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) - 1]" +Function,+,furi_hal_bt_set_profile_adv_name,void,"FuriHalBtProfile, const char[( 1 + ( 8 + 1 ) ) + 9 - 1]" Function,+,furi_hal_bt_set_profile_mac_addr,void,"FuriHalBtProfile, const uint8_t[( 6 )]" Function,+,furi_hal_bt_set_profile_pairing_method,void,"FuriHalBtProfile, GapPairing" Function,+,furi_hal_bt_start_advertising,void, @@ -3060,12 +3059,12 @@ Function,-,subghz_protocol_decoder_star_line_free,void,void* Function,-,subghz_protocol_decoder_star_line_get_hash_data,uint8_t,void* Function,-,subghz_protocol_decoder_star_line_get_string,void,"void*, FuriString*" Function,-,subghz_protocol_decoder_star_line_reset,void,void* +Function,-,subghz_protocol_decoder_star_line_serialize,_Bool,"void*, FlipperFormat*, SubGhzRadioPreset*" Function,-,subghz_protocol_encoder_alutech_at_4n_alloc,void*,SubGhzEnvironment* Function,-,subghz_protocol_encoder_alutech_at_4n_deserialize,_Bool,"void*, FlipperFormat*" Function,-,subghz_protocol_encoder_alutech_at_4n_free,void,void* Function,-,subghz_protocol_encoder_alutech_at_4n_stop,void,void* Function,-,subghz_protocol_encoder_alutech_at_4n_yield,LevelDuration,void* -Function,-,subghz_protocol_decoder_star_line_serialize,_Bool,"void*, FlipperFormat*, SubGhzRadioPreset*" Function,-,subghz_protocol_encoder_ansonic_alloc,void*,SubGhzEnvironment* Function,-,subghz_protocol_encoder_ansonic_deserialize,_Bool,"void*, FlipperFormat*" Function,-,subghz_protocol_encoder_ansonic_free,void,void* diff --git a/firmware/targets/f7/furi_hal/furi_hal_bt.c b/firmware/targets/f7/furi_hal/furi_hal_bt.c index f8b7077f1..79fbc693f 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_bt.c +++ b/firmware/targets/f7/furi_hal/furi_hal_bt.c @@ -468,6 +468,7 @@ void furi_hal_bt_set_profile_adv_name( furi_assert(profile < FuriHalBtProfileNumber); furi_assert(name); + profile_config[profile].config.adv_name[0] = 0x09; memcpy( &(profile_config[profile].config.adv_name[1]), name, diff --git a/firmware/targets/furi_hal_include/furi_hal_version.h b/firmware/targets/furi_hal_include/furi_hal_version.h index a9865f500..63cb948db 100644 --- a/firmware/targets/furi_hal_include/furi_hal_version.h +++ b/firmware/targets/furi_hal_include/furi_hal_version.h @@ -17,7 +17,7 @@ extern "C" { #define FURI_HAL_VERSION_NAME_LENGTH 8 #define FURI_HAL_VERSION_ARRAY_NAME_LENGTH (FURI_HAL_VERSION_NAME_LENGTH + 1) /** BLE symbol + name */ -#define FURI_HAL_VERSION_DEVICE_NAME_LENGTH (1 + FURI_HAL_VERSION_ARRAY_NAME_LENGTH) +#define FURI_HAL_VERSION_DEVICE_NAME_LENGTH (1 + FURI_HAL_VERSION_ARRAY_NAME_LENGTH) + 9 // for bad kb custom name /** OTP Versions enum */ typedef enum { From 631625d6c226ae1d3a8037d2012bac03f39dd184 Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 00:21:56 +0000 Subject: [PATCH 35/36] Fix bad merge --- applications/services/gui/modules/file_browser_worker.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/applications/services/gui/modules/file_browser_worker.c b/applications/services/gui/modules/file_browser_worker.c index 216450295..4b7be70a1 100644 --- a/applications/services/gui/modules/file_browser_worker.c +++ b/applications/services/gui/modules/file_browser_worker.c @@ -15,8 +15,6 @@ #define TAG "BrowserWorker" #define ASSETS_DIR "assets" -#define BADKB_LAYOUTS_DIR "layouts" -#define SUBGHZ_TEMP_DIR "tmp_history" #define BROWSER_ROOT STORAGE_ANY_PATH_PREFIX #define FILE_NAME_LEN_MAX 256 #define LONG_LOAD_THRESHOLD 100 @@ -92,9 +90,7 @@ static bool browser_filter_by_name(BrowserWorker* browser, FuriString* name, boo if(is_folder) { // Skip assets folders (if enabled) if(browser->skip_assets) { - return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)) && - ((furi_string_cmp_str(name, BADKB_LAYOUTS_DIR) == 0) ? (false) : (true)) && - ((furi_string_cmp_str(name, SUBGHZ_TEMP_DIR) == 0) ? (false) : (true)); + return ((furi_string_cmp_str(name, ASSETS_DIR) == 0) ? (false) : (true)); } else { return true; } From d7e454a627696e98b9a88246366a331c3b10df8f Mon Sep 17 00:00:00 2001 From: Willy-JL Date: Sun, 12 Feb 2023 01:19:33 +0000 Subject: [PATCH 36/36] Fix api version tag --- firmware/targets/f7/api_symbols.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index a7f0f4790..55773064f 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,v,17.0,, +Version,+,17.0,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,,