Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ build_flags =
-DGIT_COMMIT_HASH='"Homebrew"'
-DFASTLED_RMT_BUILTIN_DRIVER=1 ; https://github.com/FastLED/FastLED/blob/67436be11fc3b7be611cdf9011f31c4f76817741/src/platforms/esp/32/rmt_4/idf4_clockless_rmt_esp32.h#L25-L33
; This setting let RF Spectrum to work with LED interface with FastLED on ESP32-S3

-Werror=odr ; Treats One Definition Rule violations as errors in LTO builds
-D CONFIG_ASYNC_TCP_STACK_SIZE=4096 ; Reduces stack size for Async TCP to save memory
-DCONFIG_ASYNC_TCP_RUNNING_CORE=1 ;
-DCONFIG_ASYNC_TCP_USE_WDT=0 ; Disables the Watchdog timer on Async TCP, to avoid restartings during file uploads
Expand Down
12 changes: 6 additions & 6 deletions src/modules/badusb_ble/ducky_typer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ enum DuckyCommandType {
DuckyCommandType_DefaultStringDelay
};

struct DuckyCommand {
struct DuckyCommandLookup {
const char *command;
char key;
DuckyCommandType type;
Expand Down Expand Up @@ -62,7 +62,7 @@ const DuckyCombination duckyComb[]{
{"SYSREQ", KEY_LEFT_ALT, KEY_PRINT_SCREEN, 0 }
};

const DuckyCommand duckyCmds[]{
const DuckyCommandLookup duckyCmds[]{
{"REM", 0, DuckyCommandType_Comment },
{"//", 0, DuckyCommandType_Comment },
{"STRING", 0, DuckyCommandType_Print },
Expand Down Expand Up @@ -634,8 +634,8 @@ void key_input(FS fs, String bad_script, HIDInterface *_hid) {
uint16_t i;
uint16_t repeatCount = RepeatTmp.toInt();
for (i = 0; i < repeatCount; i++) {
DuckyCommand *PriCmd = findDuckyCommand(Cmd);
DuckyCommand *ArgCmd = findDuckyCommand(Argument.c_str());
DuckyCommandLookup *PriCmd = findDuckyCommand(Cmd);
DuckyCommandLookup *ArgCmd = findDuckyCommand(Argument.c_str());

if (PriCmd != nullptr) {
// REM comment lines are processed here
Expand Down Expand Up @@ -986,9 +986,9 @@ void MediaCommands(HIDInterface *hid, bool ble) {
returnToMenu = true;
}

DuckyCommand *findDuckyCommand(const char *cmd) {
DuckyCommandLookup *findDuckyCommand(const char *cmd) {
for (auto &cmds : duckyCmds) {
if (strcmp(cmd, cmds.command) == 0) { return const_cast<DuckyCommand *>(&cmds); }
if (strcmp(cmd, cmds.command) == 0) { return const_cast<DuckyCommandLookup *>(&cmds); }
}
return nullptr;
}
Expand Down
3 changes: 2 additions & 1 deletion src/modules/badusb_ble/ducky_typer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ extern HIDInterface *hid_ble;
extern uint8_t _Ask_for_restart;

struct DuckyCommand;
struct DuckyCommandLookup;
struct DuckyCombination;

// Start badUSB or badBLE ducky runner
Expand All @@ -38,7 +39,7 @@ void ducky_keyboard(HIDInterface *&hid, bool ble = false);
// Send media commands through BLE or USB HID
void MediaCommands(HIDInterface *hid, bool ble = false);

DuckyCommand *findDuckyCommand(const char *cmd);
DuckyCommandLookup *findDuckyCommand(const char *cmd);
DuckyCombination *findDuckyCombination(const char *cmd);

void sendAltChar(HIDInterface *hid, uint8_t charCode);
Expand Down