mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2025-12-12 12:42:30 +04:00
BadUSB: Mouse control (#4004)
* add usb hid mouse functions, add mouse functions to BadUsbHidApi * add ble mouse functionality * add hid_usb_mouse_release_all * ducky mouse command skeleton * implement mouse click functions * corrected missing semicolon * added mouse functionality * corrected mouse scroll functionality * mouse key functionality, removed mouse commands, supporting get_mouse_keycode function, added mouse buttons as Keys for HOLD function * add mouse commands * removed mouse middle click * Format sources and fix bunch of mistakes in nfc and subghz * added HID_MOUSE_NONE: added to help with better readability * added script for mouse movement test * Fix: hold and release, imrpove readability * simplified the mouse demo/test * Format sources Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -108,6 +108,17 @@ static const DuckyKey ducky_media_keys[] = {
|
||||
{"BRIGHT_DOWN", HID_CONSUMER_BRIGHTNESS_DECREMENT},
|
||||
};
|
||||
|
||||
static const DuckyKey ducky_mouse_keys[] = {
|
||||
{"LEFTCLICK", HID_MOUSE_BTN_LEFT},
|
||||
{"LEFT_CLICK", HID_MOUSE_BTN_LEFT},
|
||||
{"RIGHTCLICK", HID_MOUSE_BTN_RIGHT},
|
||||
{"RIGHT_CLICK", HID_MOUSE_BTN_RIGHT},
|
||||
{"MIDDLECLICK", HID_MOUSE_BTN_WHEEL},
|
||||
{"MIDDLE_CLICK", HID_MOUSE_BTN_WHEEL},
|
||||
{"WHEELCLICK", HID_MOUSE_BTN_WHEEL},
|
||||
{"WHEEL_CLICK", HID_MOUSE_BTN_WHEEL},
|
||||
};
|
||||
|
||||
uint16_t ducky_get_keycode_by_name(const char* param) {
|
||||
for(size_t i = 0; i < COUNT_OF(ducky_keys); i++) {
|
||||
size_t key_cmd_len = strlen(ducky_keys[i].name);
|
||||
@@ -131,3 +142,15 @@ uint16_t ducky_get_media_keycode_by_name(const char* param) {
|
||||
|
||||
return HID_CONSUMER_UNASSIGNED;
|
||||
}
|
||||
|
||||
uint8_t ducky_get_mouse_keycode_by_name(const char* param) {
|
||||
for(size_t i = 0; i < COUNT_OF(ducky_mouse_keys); i++) {
|
||||
size_t key_cmd_len = strlen(ducky_mouse_keys[i].name);
|
||||
if((strncmp(param, ducky_mouse_keys[i].name, key_cmd_len) == 0) &&
|
||||
(ducky_is_line_end(param[key_cmd_len]))) {
|
||||
return ducky_mouse_keys[i].keycode;
|
||||
}
|
||||
}
|
||||
|
||||
return HID_MOUSE_INVALID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user