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