mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-23 19:00:43 +03:00
[FL-2374] USB mode lock, USB stack update (#1051)
* Switch to CMSIS semaphores * USB stack: HID consumer usage table Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
parent
38e92cf789
commit
3615ffecbe
@ -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);
|
||||
|
@ -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
|
||||
@ -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) {
|
||||
@ -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);
|
||||
@ -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();
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 8a7846d0213c51aa4167e7fbe3118e33848e79b7
|
||||
Subproject commit fd58c2b04710554626ac69d9fb5fa1211d1bcaf0
|
Loading…
Reference in New Issue
Block a user