2021-11-26 16:53:51 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <furi.h>
|
2023-03-09 20:42:34 +03:00
|
|
|
#include <furi_hal.h>
|
2024-03-25 11:39:33 +03:00
|
|
|
#include "bad_usb_hid.h"
|
2021-11-26 16:53:51 +03:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
BadUsbStateInit,
|
|
|
|
BadUsbStateNotConnected,
|
|
|
|
BadUsbStateIdle,
|
2022-11-03 08:21:44 +03:00
|
|
|
BadUsbStateWillRun,
|
2021-11-26 16:53:51 +03:00
|
|
|
BadUsbStateRunning,
|
|
|
|
BadUsbStateDelay,
|
2023-03-20 20:22:03 +03:00
|
|
|
BadUsbStateStringDelay,
|
2023-04-04 06:40:19 +03:00
|
|
|
BadUsbStateWaitForBtn,
|
2023-05-29 12:21:18 +03:00
|
|
|
BadUsbStatePaused,
|
2021-11-26 16:53:51 +03:00
|
|
|
BadUsbStateDone,
|
|
|
|
BadUsbStateScriptError,
|
|
|
|
BadUsbStateFileError,
|
|
|
|
} BadUsbWorkerState;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BadUsbWorkerState state;
|
2023-10-12 19:34:30 +03:00
|
|
|
size_t line_cur;
|
|
|
|
size_t line_nb;
|
2021-11-26 16:53:51 +03:00
|
|
|
uint32_t delay_remain;
|
2023-10-12 19:34:30 +03:00
|
|
|
size_t error_line;
|
2022-10-12 19:21:54 +03:00
|
|
|
char error[64];
|
2021-11-26 16:53:51 +03:00
|
|
|
} BadUsbState;
|
|
|
|
|
2023-03-20 20:22:03 +03:00
|
|
|
typedef struct BadUsbScript BadUsbScript;
|
2023-03-09 20:42:34 +03:00
|
|
|
|
2024-03-25 11:39:33 +03:00
|
|
|
BadUsbScript* bad_usb_script_open(FuriString* file_path, BadUsbHidInterface interface);
|
2021-11-26 16:53:51 +03:00
|
|
|
|
|
|
|
void bad_usb_script_close(BadUsbScript* bad_usb);
|
|
|
|
|
2023-02-08 18:01:00 +03:00
|
|
|
void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, FuriString* layout_path);
|
|
|
|
|
2021-11-26 16:53:51 +03:00
|
|
|
void bad_usb_script_start(BadUsbScript* bad_usb);
|
|
|
|
|
|
|
|
void bad_usb_script_stop(BadUsbScript* bad_usb);
|
|
|
|
|
2023-05-29 12:21:18 +03:00
|
|
|
void bad_usb_script_start_stop(BadUsbScript* bad_usb);
|
|
|
|
|
|
|
|
void bad_usb_script_pause_resume(BadUsbScript* bad_usb);
|
2021-11-26 16:53:51 +03:00
|
|
|
|
|
|
|
BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|