Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FL-2374] USB mode lock, USB stack update #1051

Merged
merged 10 commits into from
Mar 24, 2022
4 changes: 2 additions & 2 deletions applications/bad_usb/bad_usb_script.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,9 +366,9 @@ static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) {
}

if(id_set) {
furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg);
furi_check(furi_hal_usb_set_config(&usb_hid, &bad_usb->hid_cfg));
} else {
furi_hal_usb_set_config(&usb_hid, NULL);
furi_check(furi_hal_usb_set_config(&usb_hid, NULL));
}

storage_file_seek(script_file, 0, true);
Expand Down
10 changes: 5 additions & 5 deletions applications/rpc/rpc_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
typedef struct {
Cli* cli;
bool session_close_request;
SemaphoreHandle_t terminate_semaphore;
osSemaphoreId_t terminate_semaphore;
} CliRpc;

#define CLI_READ_BUFFER_SIZE 64
Expand All @@ -32,7 +32,7 @@ static void rpc_session_terminated_callback(void* context) {
furi_check(context);
CliRpc* cli_rpc = context;

xSemaphoreGive(cli_rpc->terminate_semaphore);
osSemaphoreRelease(cli_rpc->terminate_semaphore);
}

void rpc_cli_command_start_session(Cli* cli, string_t args, void* context) {
Expand All @@ -47,7 +47,7 @@ void rpc_cli_command_start_session(Cli* cli, string_t args, void* context) {
}

CliRpc cli_rpc = {.cli = cli, .session_close_request = false};
cli_rpc.terminate_semaphore = xSemaphoreCreateBinary();
cli_rpc.terminate_semaphore = osSemaphoreNew(1, 0, NULL);
rpc_session_set_context(rpc_session, &cli_rpc);
rpc_session_set_send_bytes_callback(rpc_session, rpc_send_bytes_callback);
rpc_session_set_close_callback(rpc_session, rpc_session_close_callback);
Expand All @@ -71,9 +71,9 @@ void rpc_cli_command_start_session(Cli* cli, string_t args, void* context) {

rpc_session_close(rpc_session);

furi_check(xSemaphoreTake(cli_rpc.terminate_semaphore, portMAX_DELAY));
furi_check(osSemaphoreAcquire(cli_rpc.terminate_semaphore, osWaitForever) == osOK);

vSemaphoreDelete(cli_rpc.terminate_semaphore);
osSemaphoreDelete(cli_rpc.terminate_semaphore);

free(buffer);
furi_hal_usb_unlock();
Expand Down