2021-11-26 13:53:51 +00:00
|
|
|
#include "../bad_usb_app_i.h"
|
2022-01-05 16:10:18 +00:00
|
|
|
#include "furi_hal_power.h"
|
2022-03-25 16:07:37 +00:00
|
|
|
#include "furi_hal_usb.h"
|
2021-11-26 13:53:51 +00:00
|
|
|
|
|
|
|
static bool bad_usb_file_select(BadUsbApp* bad_usb) {
|
|
|
|
furi_assert(bad_usb);
|
|
|
|
|
2022-05-27 11:19:21 +00:00
|
|
|
// Input events and views are managed by file_browser
|
|
|
|
bool res = dialog_file_browser_show(
|
2021-11-26 13:53:51 +00:00
|
|
|
bad_usb->dialogs,
|
2022-05-27 11:19:21 +00:00
|
|
|
bad_usb->file_path,
|
|
|
|
bad_usb->file_path,
|
2021-11-26 13:53:51 +00:00
|
|
|
BAD_USB_APP_EXTENSION,
|
2022-05-27 11:19:21 +00:00
|
|
|
true,
|
|
|
|
&I_badusb_10px,
|
|
|
|
true);
|
|
|
|
|
2021-11-26 13:53:51 +00:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
void bad_usb_scene_file_select_on_enter(void* context) {
|
|
|
|
BadUsbApp* bad_usb = context;
|
|
|
|
|
2022-03-25 16:07:37 +00:00
|
|
|
furi_hal_usb_disable();
|
|
|
|
|
2021-11-26 13:53:51 +00:00
|
|
|
if(bad_usb_file_select(bad_usb)) {
|
2022-02-02 15:58:52 +00:00
|
|
|
scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork);
|
2021-11-26 13:53:51 +00:00
|
|
|
} else {
|
2022-03-25 16:07:37 +00:00
|
|
|
furi_hal_usb_enable();
|
2021-11-26 13:53:51 +00:00
|
|
|
//scene_manager_previous_scene(bad_usb->scene_manager);
|
|
|
|
view_dispatcher_stop(bad_usb->view_dispatcher);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool bad_usb_scene_file_select_on_event(void* context, SceneManagerEvent event) {
|
2022-05-06 13:37:10 +00:00
|
|
|
UNUSED(context);
|
|
|
|
UNUSED(event);
|
2021-11-26 13:53:51 +00:00
|
|
|
// BadUsbApp* bad_usb = context;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void bad_usb_scene_file_select_on_exit(void* context) {
|
2022-05-06 13:37:10 +00:00
|
|
|
UNUSED(context);
|
2021-11-26 13:53:51 +00:00
|
|
|
// BadUsbApp* bad_usb = context;
|
|
|
|
}
|