[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:
Nikolay Minaylov
2022-03-24 18:45:03 +03:00
committed by GitHub
parent eafeefb843
commit 38e92cf789
20 changed files with 216 additions and 43 deletions

View File

@@ -48,10 +48,16 @@ U2fApp* u2f_app_alloc() {
view_dispatcher_add_view(
app->view_dispatcher, U2fAppViewMain, u2f_view_get_view(app->u2f_view));
if(u2f_data_check(true)) {
scene_manager_next_scene(app->scene_manager, U2fSceneMain);
} else {
if(furi_hal_usb_is_locked()) {
app->error = U2fAppErrorCloseRpc;
scene_manager_next_scene(app->scene_manager, U2fSceneError);
} else {
if(u2f_data_check(true)) {
scene_manager_next_scene(app->scene_manager, U2fSceneMain);
} else {
app->error = U2fAppErrorNoFiles;
scene_manager_next_scene(app->scene_manager, U2fSceneError);
}
}
return app;