[FL-2315] USB Mode switch lock (#1036)
* usb mode switch lock * lock_mutex removed * Wait for session termination in rpc_cli, lock badusb and u2f if rpc session is opened Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "../bad_usb_app_i.h"
|
||||
|
||||
typedef enum {
|
||||
SubghzCustomEventErrorBack,
|
||||
BadUsbCustomEventErrorBack,
|
||||
} BadUsbCustomEvent;
|
||||
|
||||
static void
|
||||
@@ -10,23 +10,33 @@ static void
|
||||
BadUsbApp* app = context;
|
||||
|
||||
if((result == GuiButtonTypeLeft) && (type == InputTypeShort)) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, SubghzCustomEventErrorBack);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, BadUsbCustomEventErrorBack);
|
||||
}
|
||||
}
|
||||
|
||||
void bad_usb_scene_error_on_enter(void* context) {
|
||||
BadUsbApp* app = context;
|
||||
|
||||
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.");
|
||||
if(app->error == BadUsbAppErrorNoFiles) {
|
||||
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.");
|
||||
} else if(app->error == BadUsbAppErrorCloseRpc) {
|
||||
widget_add_string_multiline_element(
|
||||
app->widget,
|
||||
63,
|
||||
10,
|
||||
AlignCenter,
|
||||
AlignTop,
|
||||
FontSecondary,
|
||||
"Disconnect from\ncompanion app\nto use this function");
|
||||
}
|
||||
|
||||
widget_add_button_element(
|
||||
app->widget, GuiButtonTypeLeft, "Back", bad_usb_scene_error_event_callback, app);
|
||||
@@ -39,7 +49,7 @@ bool bad_usb_scene_error_on_event(void* context, SceneManagerEvent event) {
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubghzCustomEventErrorBack) {
|
||||
if(event.event == BadUsbCustomEventErrorBack) {
|
||||
view_dispatcher_stop(app->view_dispatcher);
|
||||
consumed = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user