mirror of
https://github.com/DarkFlippers/unleashed-firmware
synced 2024-11-10 06:54:19 +00:00
new badusb layout loading from microsd
by rien > dummy-decoy
This commit is contained in:
parent
6c4974f184
commit
14f2b4f2f0
37 changed files with 285 additions and 801 deletions
|
@ -64,7 +64,7 @@ See changelog in releases for latest updates!
|
|||
|
||||
### Other changes
|
||||
|
||||
- BadUSB Keyboard layouts [(By v1nc)](https://github.com/v1nc/flipperzero-firmware)
|
||||
- BadUSB Keyboard layouts [(By rien > dummy-decoy)](https://github.com/dummy-decoy/flipperzero-firmware/tree/dummy_decoy/bad_usb_keyboard_layout)
|
||||
|
||||
## Support us so we can buy equipment and develop new features
|
||||
* ETH/BSC/ERC20-Tokens: `0xFebF1bBc8229418FF2408C07AF6Afa49152fEc6a`
|
||||
|
@ -79,7 +79,7 @@ See changelog in releases for latest updates!
|
|||
|
||||
## [- How to build firmware](https://github.com/Eng1n33r/flipperzero-firmware/blob/dev/documentation/HowToBuild.md)
|
||||
|
||||
## [- BadUSB: how to use different keyboard layouts](https://github.com/Eng1n33r/flipperzero-firmware/blob/dev/documentation/BadUSBLayouts.md)
|
||||
## [- BadUSB: how to add new keyboard layouts](https://github.com/dummy-decoy/flipperzero_badusb_kl)
|
||||
|
||||
### **Plugins**
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ static const char* known_ext[] = {
|
|||
[ArchiveFileTypeLFRFID] = ".rfid",
|
||||
[ArchiveFileTypeInfrared] = ".ir",
|
||||
[ArchiveFileTypeBadUsb] = ".txt",
|
||||
[ArchiveFileTypeKeyboard] = ".kl",
|
||||
[ArchiveFileTypeU2f] = "?",
|
||||
[ArchiveFileTypeUpdateManifest] = ".fuf",
|
||||
[ArchiveFileTypeFolder] = "?",
|
||||
|
|
|
@ -16,6 +16,7 @@ typedef enum {
|
|||
ArchiveFileTypeFolder,
|
||||
ArchiveFileTypeUnknown,
|
||||
ArchiveFileTypeLoading,
|
||||
ArchiveFileTypeKeyboard,
|
||||
} ArchiveFileTypeEnum;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
@ -29,6 +29,7 @@ static const Icon* ArchiveItemIcons[] = {
|
|||
[ArchiveFileTypeFolder] = &I_dir_10px,
|
||||
[ArchiveFileTypeUnknown] = &I_unknown_10px,
|
||||
[ArchiveFileTypeLoading] = &I_loading_10px,
|
||||
[ArchiveFileTypeKeyboard] = &I_keyboard_10px,
|
||||
};
|
||||
|
||||
void archive_browser_set_callback(
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
#include "bad_usb_app_i.h"
|
||||
#include "bad_usb_settings_filename.h"
|
||||
#include "m-string.h"
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <storage/storage.h>
|
||||
#include <lib/toolbox/path.h>
|
||||
|
||||
#define BAD_USB_SETTINGS_PATH BAD_USB_APP_BASE_FOLDER "/" BAD_USB_SETTINGS_FILE_NAME
|
||||
|
||||
static bool bad_usb_app_custom_event_callback(void* context, uint32_t event) {
|
||||
furi_assert(context);
|
||||
BadUsbApp* app = context;
|
||||
|
@ -23,15 +26,45 @@ static void bad_usb_app_tick_event_callback(void* context) {
|
|||
scene_manager_handle_tick_event(app->scene_manager);
|
||||
}
|
||||
|
||||
static void bad_usb_load_settings(BadUsbApp* app) {
|
||||
File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
char chr;
|
||||
while((storage_file_read(settings_file, &chr, 1) == 1) &&
|
||||
!storage_file_eof(settings_file) && !isspace(chr)) {
|
||||
string_push_back(app->keyboard_layout, chr);
|
||||
}
|
||||
}
|
||||
storage_file_close(settings_file);
|
||||
storage_file_free(settings_file);
|
||||
}
|
||||
|
||||
static void bad_usb_save_settings(BadUsbApp* app) {
|
||||
File* settings_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
if(storage_file_open(settings_file, BAD_USB_SETTINGS_PATH, FSAM_WRITE, FSOM_OPEN_ALWAYS)) {
|
||||
storage_file_write(
|
||||
settings_file,
|
||||
string_get_cstr(app->keyboard_layout),
|
||||
string_size(app->keyboard_layout));
|
||||
storage_file_write(settings_file, "\n", 1);
|
||||
}
|
||||
storage_file_close(settings_file);
|
||||
storage_file_free(settings_file);
|
||||
}
|
||||
|
||||
BadUsbApp* bad_usb_app_alloc(char* arg) {
|
||||
BadUsbApp* app = malloc(sizeof(BadUsbApp));
|
||||
|
||||
string_init(app->file_path);
|
||||
app->bad_usb_script = NULL;
|
||||
|
||||
string_init(app->file_path);
|
||||
string_init(app->keyboard_layout);
|
||||
if(arg != NULL) {
|
||||
string_set_str(app->file_path, arg);
|
||||
}
|
||||
|
||||
bad_usb_load_settings(app);
|
||||
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
app->notifications = furi_record_open(RECORD_NOTIFICATION);
|
||||
app->dialogs = furi_record_open(RECORD_DIALOGS);
|
||||
|
@ -54,6 +87,10 @@ BadUsbApp* bad_usb_app_alloc(char* arg) {
|
|||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, BadUsbAppViewError, widget_get_view(app->widget));
|
||||
|
||||
app->submenu = submenu_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, BadUsbAppViewConfig, submenu_get_view(app->submenu));
|
||||
|
||||
app->bad_usb_view = bad_usb_alloc();
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, BadUsbAppViewWork, bad_usb_get_view(app->bad_usb_view));
|
||||
|
@ -67,7 +104,7 @@ BadUsbApp* bad_usb_app_alloc(char* arg) {
|
|||
if(!string_empty_p(app->file_path)) {
|
||||
scene_manager_next_scene(app->scene_manager, BadUsbSceneWork);
|
||||
} else {
|
||||
string_set_str(app->file_path, BAD_USB_APP_PATH_FOLDER);
|
||||
string_set_str(app->file_path, BAD_USB_APP_PATH_SCRIPT_FOLDER);
|
||||
scene_manager_next_scene(app->scene_manager, BadUsbSceneFileSelect);
|
||||
}
|
||||
}
|
||||
|
@ -78,15 +115,25 @@ BadUsbApp* bad_usb_app_alloc(char* arg) {
|
|||
void bad_usb_app_free(BadUsbApp* app) {
|
||||
furi_assert(app);
|
||||
|
||||
if(app->bad_usb_script) {
|
||||
bad_usb_script_close(app->bad_usb_script);
|
||||
app->bad_usb_script = NULL;
|
||||
}
|
||||
|
||||
// Views
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewFileSelect);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewWork);
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfigLayout);
|
||||
bad_usb_free(app->bad_usb_view);
|
||||
|
||||
// Custom Widget
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewError);
|
||||
widget_free(app->widget);
|
||||
|
||||
// Submenu
|
||||
view_dispatcher_remove_view(app->view_dispatcher, BadUsbAppViewConfig);
|
||||
submenu_free(app->submenu);
|
||||
|
||||
// View dispatcher
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
scene_manager_free(app->scene_manager);
|
||||
|
@ -96,7 +143,10 @@ void bad_usb_app_free(BadUsbApp* app) {
|
|||
furi_record_close(RECORD_NOTIFICATION);
|
||||
furi_record_close(RECORD_DIALOGS);
|
||||
|
||||
bad_usb_save_settings(app);
|
||||
|
||||
string_clear(app->file_path);
|
||||
string_clear(app->keyboard_layout);
|
||||
|
||||
free(app);
|
||||
}
|
||||
|
@ -108,4 +158,4 @@ int32_t bad_usb_app(void* p) {
|
|||
|
||||
bad_usb_app_free(bad_usb_app);
|
||||
return 0;
|
||||
}
|
||||
}
|
|
@ -14,8 +14,11 @@
|
|||
#include <gui/modules/widget.h>
|
||||
#include "views/bad_usb_view.h"
|
||||
|
||||
#define BAD_USB_APP_PATH_FOLDER ANY_PATH("badusb")
|
||||
#define BAD_USB_APP_EXTENSION ".txt"
|
||||
#define BAD_USB_APP_BASE_FOLDER ANY_PATH("badusb")
|
||||
#define BAD_USB_APP_PATH_SCRIPT_FOLDER BAD_USB_APP_BASE_FOLDER "/scripts"
|
||||
#define BAD_USB_APP_PATH_LAYOUT_FOLDER BAD_USB_APP_BASE_FOLDER "/layouts"
|
||||
#define BAD_USB_APP_SCRIPT_EXTENSION ".txt"
|
||||
#define BAD_USB_APP_LAYOUT_EXTENSION ".kl"
|
||||
|
||||
typedef enum {
|
||||
BadUsbAppErrorNoFiles,
|
||||
|
@ -29,9 +32,11 @@ struct BadUsbApp {
|
|||
NotificationApp* notifications;
|
||||
DialogsApp* dialogs;
|
||||
Widget* widget;
|
||||
Submenu* submenu;
|
||||
|
||||
BadUsbAppError error;
|
||||
string_t file_path;
|
||||
string_t keyboard_layout;
|
||||
BadUsb* bad_usb_view;
|
||||
BadUsbScript* bad_usb_script;
|
||||
};
|
||||
|
@ -40,4 +45,6 @@ typedef enum {
|
|||
BadUsbAppViewError,
|
||||
BadUsbAppViewFileSelect,
|
||||
BadUsbAppViewWork,
|
||||
} BadUsbAppView;
|
||||
BadUsbAppViewConfig,
|
||||
BadUsbAppViewConfigLayout,
|
||||
} BadUsbAppView;
|
|
@ -16,6 +16,9 @@
|
|||
#define SCRIPT_STATE_END (-2)
|
||||
#define SCRIPT_STATE_NEXT_LINE (-3)
|
||||
|
||||
#define BADUSB_ASCII_TO_KEY(script, x) \
|
||||
(((uint8_t)x < 128) ? (script->layout[(uint8_t)x]) : HID_KEYBOARD_NONE)
|
||||
|
||||
typedef enum {
|
||||
WorkerEvtToggle = (1 << 0),
|
||||
WorkerEvtEnd = (1 << 1),
|
||||
|
@ -28,6 +31,7 @@ struct BadUsbScript {
|
|||
BadUsbState st;
|
||||
string_t file_path;
|
||||
uint32_t defdelay;
|
||||
uint16_t layout[128];
|
||||
FuriThread* thread;
|
||||
uint8_t file_buf[FILE_BUFFER_LEN + 1];
|
||||
uint8_t buf_start;
|
||||
|
@ -114,7 +118,7 @@ static const char ducky_cmd_altchar[] = {"ALTCHAR "};
|
|||
static const char ducky_cmd_altstr_1[] = {"ALTSTRING "};
|
||||
static const char ducky_cmd_altstr_2[] = {"ALTCODE "};
|
||||
|
||||
static const char ducky_cmd_layout[] = {"DUCKY_LANG"};
|
||||
static const char ducky_cmd_lang[] = {"DUCKY_LANG"};
|
||||
|
||||
static const uint8_t numpad_keys[10] = {
|
||||
HID_KEYPAD_0,
|
||||
|
@ -205,10 +209,10 @@ static bool ducky_altstring(const char* param) {
|
|||
return state;
|
||||
}
|
||||
|
||||
static bool ducky_string(const char* param, const uint16_t layout) {
|
||||
static bool ducky_string(BadUsbScript* bad_usb, const char* param) {
|
||||
uint32_t i = 0;
|
||||
while(param[i] != '\0') {
|
||||
uint16_t keycode = HID_ASCII_TO_KEY(layout, param[i]);
|
||||
uint16_t keycode = BADUSB_ASCII_TO_KEY(bad_usb, param[i]);
|
||||
if(keycode != HID_KEYBOARD_NONE) {
|
||||
furi_hal_hid_kb_press(keycode);
|
||||
furi_hal_hid_kb_release(keycode);
|
||||
|
@ -218,7 +222,7 @@ static bool ducky_string(const char* param, const uint16_t layout) {
|
|||
return true;
|
||||
}
|
||||
|
||||
static uint16_t ducky_get_keycode(const char* param, bool accept_chars, const uint16_t layout) {
|
||||
static uint16_t ducky_get_keycode(BadUsbScript* bad_usb, const char* param, bool accept_chars) {
|
||||
for(uint8_t i = 0; i < (sizeof(ducky_keys) / sizeof(ducky_keys[0])); i++) {
|
||||
uint8_t key_cmd_len = strlen(ducky_keys[i].name);
|
||||
if((strncmp(param, ducky_keys[i].name, key_cmd_len) == 0) &&
|
||||
|
@ -227,12 +231,12 @@ static uint16_t ducky_get_keycode(const char* param, bool accept_chars, const ui
|
|||
}
|
||||
}
|
||||
if((accept_chars) && (strlen(param) > 0)) {
|
||||
return (HID_ASCII_TO_KEY(layout, param[0]) & 0xFF);
|
||||
return (BADUSB_ASCII_TO_KEY(bad_usb, param[0]) & 0xFF);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line, const uint16_t layout) {
|
||||
static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line) {
|
||||
uint32_t line_len = string_size(line);
|
||||
const char* line_tmp = string_get_cstr(line);
|
||||
bool state = false;
|
||||
|
@ -254,8 +258,8 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line, const uint
|
|||
} else if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) {
|
||||
// ID - executed in ducky_script_preload
|
||||
return (0);
|
||||
} else if(strncmp(line_tmp, ducky_cmd_layout, strlen(ducky_cmd_layout)) == 0) {
|
||||
// DUCKY_LANG - executed in ducky_script_preload
|
||||
} else if(strncmp(line_tmp, ducky_cmd_lang, strlen(ducky_cmd_lang)) == 0) {
|
||||
// DUCKY_LANG - ignore command to retain compatibility with existing scripts
|
||||
return (0);
|
||||
} else if(strncmp(line_tmp, ducky_cmd_delay, strlen(ducky_cmd_delay)) == 0) {
|
||||
// DELAY
|
||||
|
@ -276,7 +280,7 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line, const uint
|
|||
} else if(strncmp(line_tmp, ducky_cmd_string, strlen(ducky_cmd_string)) == 0) {
|
||||
// STRING
|
||||
line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1];
|
||||
state = ducky_string(line_tmp, layout);
|
||||
state = ducky_string(bad_usb, line_tmp);
|
||||
return (state) ? (0) : SCRIPT_STATE_ERROR;
|
||||
} else if(strncmp(line_tmp, ducky_cmd_altchar, strlen(ducky_cmd_altchar)) == 0) {
|
||||
// ALTCHAR
|
||||
|
@ -299,12 +303,12 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line, const uint
|
|||
return (state) ? (0) : SCRIPT_STATE_ERROR;
|
||||
} else {
|
||||
// Special keys + modifiers
|
||||
uint16_t key = ducky_get_keycode(line_tmp, false, layout);
|
||||
uint16_t key = ducky_get_keycode(bad_usb, line_tmp, false);
|
||||
if(key == HID_KEYBOARD_NONE) return SCRIPT_STATE_ERROR;
|
||||
if((key & 0xFF00) != 0) {
|
||||
// It's a modifier key
|
||||
line_tmp = &line_tmp[ducky_get_command_len(line_tmp) + 1];
|
||||
key |= ducky_get_keycode(line_tmp, true, layout);
|
||||
key |= ducky_get_keycode(bad_usb, line_tmp, true);
|
||||
}
|
||||
furi_hal_hid_kb_press(key);
|
||||
furi_hal_hid_kb_release(key);
|
||||
|
@ -313,21 +317,6 @@ static int32_t ducky_parse_line(BadUsbScript* bad_usb, string_t line, const uint
|
|||
return SCRIPT_STATE_ERROR;
|
||||
}
|
||||
|
||||
static uint16_t ducky_get_layout(const char* line) {
|
||||
uint16_t layout = 0;
|
||||
if(strcmp(line, "US") == 0) {
|
||||
layout = 0;
|
||||
} else if(strcmp(line, "DE") == 0) {
|
||||
layout = 1;
|
||||
} else if(strcmp(line, "FR") == 0) {
|
||||
layout = 2;
|
||||
} else if(strcmp(line, "HU") == 0) {
|
||||
layout = 3;
|
||||
}
|
||||
FURI_LOG_D(WORKER_TAG, "keyboard layout set: %hu", layout);
|
||||
return layout;
|
||||
}
|
||||
|
||||
static bool ducky_set_usb_id(BadUsbScript* bad_usb, const char* line) {
|
||||
if(sscanf(line, "%lX:%lX", &bad_usb->hid_cfg.vid, &bad_usb->hid_cfg.pid) == 2) {
|
||||
bad_usb->hid_cfg.manuf[0] = '\0';
|
||||
|
@ -353,12 +342,10 @@ static bool ducky_set_usb_id(BadUsbScript* bad_usb, const char* line) {
|
|||
return false;
|
||||
}
|
||||
|
||||
static uint16_t ducky_script_preload(BadUsbScript* bad_usb, File* script_file) {
|
||||
static bool ducky_script_preload(BadUsbScript* bad_usb, File* script_file) {
|
||||
uint8_t ret = 0;
|
||||
uint32_t line_len = 0;
|
||||
|
||||
uint16_t layout = 0;
|
||||
|
||||
string_reset(bad_usb->line);
|
||||
|
||||
do {
|
||||
|
@ -383,11 +370,9 @@ static uint16_t ducky_script_preload(BadUsbScript* bad_usb, File* script_file) {
|
|||
} while(ret > 0);
|
||||
|
||||
const char* line_tmp = string_get_cstr(bad_usb->line);
|
||||
bool id_set = false; // Looking for ID or DUCKY_LANG command at first line
|
||||
bool id_set = false; // Looking for ID command at first line
|
||||
if(strncmp(line_tmp, ducky_cmd_id, strlen(ducky_cmd_id)) == 0) {
|
||||
id_set = ducky_set_usb_id(bad_usb, &line_tmp[strlen(ducky_cmd_id) + 1]);
|
||||
} else if(strncmp(line_tmp, ducky_cmd_layout, strlen(ducky_cmd_layout)) == 0) {
|
||||
layout = ducky_get_layout(&line_tmp[strlen(ducky_cmd_layout) + 1]);
|
||||
}
|
||||
|
||||
if(id_set) {
|
||||
|
@ -399,16 +384,15 @@ static uint16_t ducky_script_preload(BadUsbScript* bad_usb, File* script_file) {
|
|||
storage_file_seek(script_file, 0, true);
|
||||
string_reset(bad_usb->line);
|
||||
|
||||
return layout;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int32_t
|
||||
ducky_script_execute_next(BadUsbScript* bad_usb, File* script_file, const uint16_t layout) {
|
||||
static int32_t ducky_script_execute_next(BadUsbScript* bad_usb, File* script_file) {
|
||||
int32_t delay_val = 0;
|
||||
|
||||
if(bad_usb->repeat_cnt > 0) {
|
||||
bad_usb->repeat_cnt--;
|
||||
delay_val = ducky_parse_line(bad_usb, bad_usb->line_prev, layout);
|
||||
delay_val = ducky_parse_line(bad_usb, bad_usb->line_prev);
|
||||
if(delay_val == SCRIPT_STATE_NEXT_LINE) { // Empty line
|
||||
return 0;
|
||||
} else if(delay_val < 0) { // Script error
|
||||
|
@ -442,7 +426,7 @@ static int32_t
|
|||
bad_usb->st.line_cur++;
|
||||
bad_usb->buf_len = bad_usb->buf_len + bad_usb->buf_start - (i + 1);
|
||||
bad_usb->buf_start = i + 1;
|
||||
delay_val = ducky_parse_line(bad_usb, bad_usb->line, layout);
|
||||
delay_val = ducky_parse_line(bad_usb, bad_usb->line);
|
||||
if(delay_val < 0) {
|
||||
bad_usb->st.error_line = bad_usb->st.line_cur;
|
||||
FURI_LOG_E(WORKER_TAG, "Unknown command at line %lu", bad_usb->st.line_cur);
|
||||
|
@ -477,8 +461,6 @@ static int32_t bad_usb_worker(void* context) {
|
|||
BadUsbWorkerState worker_state = BadUsbStateInit;
|
||||
int32_t delay_val = 0;
|
||||
|
||||
uint16_t layout = 0;
|
||||
|
||||
FuriHalUsbInterface* usb_mode_prev = furi_hal_usb_get_config();
|
||||
|
||||
FURI_LOG_I(WORKER_TAG, "Init");
|
||||
|
@ -495,8 +477,7 @@ static int32_t bad_usb_worker(void* context) {
|
|||
string_get_cstr(bad_usb->file_path),
|
||||
FSAM_READ,
|
||||
FSOM_OPEN_EXISTING)) {
|
||||
layout = ducky_script_preload(bad_usb, script_file);
|
||||
if(bad_usb->st.line_nb > 0) {
|
||||
if((ducky_script_preload(bad_usb, script_file)) && (bad_usb->st.line_nb > 0)) {
|
||||
if(furi_hal_hid_is_connected()) {
|
||||
worker_state = BadUsbStateIdle; // Ready to run
|
||||
} else {
|
||||
|
@ -568,7 +549,7 @@ static int32_t bad_usb_worker(void* context) {
|
|||
continue;
|
||||
}
|
||||
bad_usb->st.state = BadUsbStateRunning;
|
||||
delay_val = ducky_script_execute_next(bad_usb, script_file, layout);
|
||||
delay_val = ducky_script_execute_next(bad_usb, script_file);
|
||||
if(delay_val == SCRIPT_STATE_ERROR) { // Script error
|
||||
delay_val = 0;
|
||||
worker_state = BadUsbStateScriptError;
|
||||
|
@ -613,12 +594,19 @@ static int32_t bad_usb_worker(void* context) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void bad_usb_script_set_default_keyboard_layout(BadUsbScript* bad_usb) {
|
||||
furi_assert(bad_usb);
|
||||
memset(bad_usb->layout, HID_KEYBOARD_NONE, sizeof(bad_usb->layout));
|
||||
memcpy(bad_usb->layout, hid_asciimap, MIN(sizeof(hid_asciimap), sizeof(bad_usb->layout)));
|
||||
}
|
||||
|
||||
BadUsbScript* bad_usb_script_open(string_t file_path) {
|
||||
furi_assert(file_path);
|
||||
|
||||
BadUsbScript* bad_usb = malloc(sizeof(BadUsbScript));
|
||||
string_init(bad_usb->file_path);
|
||||
string_set(bad_usb->file_path, file_path);
|
||||
bad_usb_script_set_default_keyboard_layout(bad_usb);
|
||||
|
||||
bad_usb->st.state = BadUsbStateInit;
|
||||
|
||||
|
@ -641,6 +629,30 @@ void bad_usb_script_close(BadUsbScript* bad_usb) {
|
|||
free(bad_usb);
|
||||
}
|
||||
|
||||
void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, string_t layout_path) {
|
||||
furi_assert(bad_usb);
|
||||
|
||||
if((bad_usb->st.state == BadUsbStateRunning) || (bad_usb->st.state == BadUsbStateDelay)) {
|
||||
// do not update keyboard layout while a script is running
|
||||
return;
|
||||
}
|
||||
|
||||
File* layout_file = storage_file_alloc(furi_record_open(RECORD_STORAGE));
|
||||
if(!string_empty_p(layout_path)) {
|
||||
if(storage_file_open(
|
||||
layout_file, string_get_cstr(layout_path), FSAM_READ, FSOM_OPEN_EXISTING)) {
|
||||
uint16_t layout[128];
|
||||
if(storage_file_read(layout_file, layout, sizeof(layout)) == sizeof(layout)) {
|
||||
memcpy(bad_usb->layout, layout, sizeof(layout));
|
||||
}
|
||||
}
|
||||
storage_file_close(layout_file);
|
||||
} else {
|
||||
bad_usb_script_set_default_keyboard_layout(bad_usb);
|
||||
}
|
||||
storage_file_free(layout_file);
|
||||
}
|
||||
|
||||
void bad_usb_script_toggle(BadUsbScript* bad_usb) {
|
||||
furi_assert(bad_usb);
|
||||
furi_thread_flags_set(furi_thread_get_id(bad_usb->thread), WorkerEvtToggle);
|
||||
|
@ -649,4 +661,4 @@ void bad_usb_script_toggle(BadUsbScript* bad_usb) {
|
|||
BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb) {
|
||||
furi_assert(bad_usb);
|
||||
return &(bad_usb->st);
|
||||
}
|
||||
}
|
|
@ -32,6 +32,8 @@ BadUsbScript* bad_usb_script_open(string_t file_path);
|
|||
|
||||
void bad_usb_script_close(BadUsbScript* bad_usb);
|
||||
|
||||
void bad_usb_script_set_keyboard_layout(BadUsbScript* bad_usb, string_t layout_path);
|
||||
|
||||
void bad_usb_script_start(BadUsbScript* bad_usb);
|
||||
|
||||
void bad_usb_script_stop(BadUsbScript* bad_usb);
|
||||
|
@ -42,4 +44,4 @@ BadUsbState* bad_usb_script_get_state(BadUsbScript* bad_usb);
|
|||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
3
applications/bad_usb/bad_usb_settings_filename.h
Normal file
3
applications/bad_usb/bad_usb_settings_filename.h
Normal file
|
@ -0,0 +1,3 @@
|
|||
#pragma once
|
||||
|
||||
#define BAD_USB_SETTINGS_FILE_NAME ".badusb.settings"
|
53
applications/bad_usb/scenes/bad_usb_scene_config.c
Normal file
53
applications/bad_usb/scenes/bad_usb_scene_config.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
#include "../bad_usb_app_i.h"
|
||||
#include "furi_hal_power.h"
|
||||
#include "furi_hal_usb.h"
|
||||
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexKeyboardLayout,
|
||||
};
|
||||
|
||||
void bad_usb_scene_config_submenu_callback(void* context, uint32_t index) {
|
||||
BadUsbApp* bad_usb = context;
|
||||
view_dispatcher_send_custom_event(bad_usb->view_dispatcher, index);
|
||||
}
|
||||
|
||||
void bad_usb_scene_config_on_enter(void* context) {
|
||||
BadUsbApp* bad_usb = context;
|
||||
Submenu* submenu = bad_usb->submenu;
|
||||
|
||||
submenu_add_item(
|
||||
submenu,
|
||||
"Keyboard layout",
|
||||
SubmenuIndexKeyboardLayout,
|
||||
bad_usb_scene_config_submenu_callback,
|
||||
bad_usb);
|
||||
|
||||
submenu_set_selected_item(
|
||||
submenu, scene_manager_get_scene_state(bad_usb->scene_manager, BadUsbSceneConfig));
|
||||
|
||||
view_dispatcher_switch_to_view(bad_usb->view_dispatcher, BadUsbAppViewConfig);
|
||||
}
|
||||
|
||||
bool bad_usb_scene_config_on_event(void* context, SceneManagerEvent event) {
|
||||
BadUsbApp* bad_usb = context;
|
||||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
scene_manager_set_scene_state(bad_usb->scene_manager, BadUsbSceneConfig, event.event);
|
||||
consumed = true;
|
||||
if(event.event == SubmenuIndexKeyboardLayout) {
|
||||
scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneConfigLayout);
|
||||
} else {
|
||||
furi_crash("Unknown key type");
|
||||
}
|
||||
}
|
||||
|
||||
return consumed;
|
||||
}
|
||||
|
||||
void bad_usb_scene_config_on_exit(void* context) {
|
||||
BadUsbApp* bad_usb = context;
|
||||
Submenu* submenu = bad_usb->submenu;
|
||||
|
||||
submenu_reset(submenu);
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
ADD_SCENE(bad_usb, file_select, FileSelect)
|
||||
ADD_SCENE(bad_usb, work, Work)
|
||||
ADD_SCENE(bad_usb, error, Error)
|
||||
ADD_SCENE(bad_usb, config, Config)
|
||||
ADD_SCENE(bad_usb, config_layout, ConfigLayout)
|
||||
|
|
50
applications/bad_usb/scenes/bad_usb_scene_config_layout.c
Normal file
50
applications/bad_usb/scenes/bad_usb_scene_config_layout.c
Normal file
|
@ -0,0 +1,50 @@
|
|||
#include "../bad_usb_app_i.h"
|
||||
#include "furi_hal_power.h"
|
||||
#include "furi_hal_usb.h"
|
||||
#include <storage/storage.h>
|
||||
|
||||
static bool bad_usb_layout_select(BadUsbApp* bad_usb) {
|
||||
furi_assert(bad_usb);
|
||||
|
||||
string_t predefined_path;
|
||||
string_init(predefined_path);
|
||||
if(!string_empty_p(bad_usb->keyboard_layout)) {
|
||||
string_set(predefined_path, bad_usb->keyboard_layout);
|
||||
} else {
|
||||
string_set_str(predefined_path, BAD_USB_APP_PATH_LAYOUT_FOLDER);
|
||||
}
|
||||
|
||||
// Input events and views are managed by file_browser
|
||||
bool res = dialog_file_browser_show(
|
||||
bad_usb->dialogs,
|
||||
bad_usb->keyboard_layout,
|
||||
predefined_path,
|
||||
BAD_USB_APP_LAYOUT_EXTENSION,
|
||||
true,
|
||||
&I_keyboard_10px,
|
||||
true);
|
||||
|
||||
string_clear(predefined_path);
|
||||
return res;
|
||||
}
|
||||
|
||||
void bad_usb_scene_config_layout_on_enter(void* context) {
|
||||
BadUsbApp* bad_usb = context;
|
||||
|
||||
if(bad_usb_layout_select(bad_usb)) {
|
||||
bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout);
|
||||
}
|
||||
scene_manager_previous_scene(bad_usb->scene_manager);
|
||||
}
|
||||
|
||||
bool bad_usb_scene_config_layout_on_event(void* context, SceneManagerEvent event) {
|
||||
UNUSED(context);
|
||||
UNUSED(event);
|
||||
// BadUsbApp* bad_usb = context;
|
||||
return false;
|
||||
}
|
||||
|
||||
void bad_usb_scene_config_layout_on_exit(void* context) {
|
||||
UNUSED(context);
|
||||
// BadUsbApp* bad_usb = context;
|
||||
}
|
|
@ -10,7 +10,7 @@ static bool bad_usb_file_select(BadUsbApp* bad_usb) {
|
|||
bad_usb->dialogs,
|
||||
bad_usb->file_path,
|
||||
bad_usb->file_path,
|
||||
BAD_USB_APP_EXTENSION,
|
||||
BAD_USB_APP_SCRIPT_EXTENSION,
|
||||
true,
|
||||
&I_badusb_10px,
|
||||
true);
|
||||
|
@ -22,12 +22,18 @@ void bad_usb_scene_file_select_on_enter(void* context) {
|
|||
BadUsbApp* bad_usb = context;
|
||||
|
||||
furi_hal_usb_disable();
|
||||
if(bad_usb->bad_usb_script) {
|
||||
bad_usb_script_close(bad_usb->bad_usb_script);
|
||||
bad_usb->bad_usb_script = NULL;
|
||||
}
|
||||
|
||||
if(bad_usb_file_select(bad_usb)) {
|
||||
bad_usb->bad_usb_script = bad_usb_script_open(bad_usb->file_path);
|
||||
bad_usb_script_set_keyboard_layout(bad_usb->bad_usb_script, bad_usb->keyboard_layout);
|
||||
|
||||
scene_manager_next_scene(bad_usb->scene_manager, BadUsbSceneWork);
|
||||
} else {
|
||||
furi_hal_usb_enable();
|
||||
//scene_manager_previous_scene(bad_usb->scene_manager);
|
||||
view_dispatcher_stop(bad_usb->view_dispatcher);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
#include "m-string.h"
|
||||
#include "toolbox/path.h"
|
||||
|
||||
void bad_usb_scene_work_ok_callback(InputType type, void* context) {
|
||||
void bad_usb_scene_work_button_callback(InputKey key, void* context) {
|
||||
furi_assert(context);
|
||||
BadUsbApp* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, type);
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, key);
|
||||
}
|
||||
|
||||
bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) {
|
||||
|
@ -16,8 +16,13 @@ bool bad_usb_scene_work_on_event(void* context, SceneManagerEvent event) {
|
|||
bool consumed = false;
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
bad_usb_script_toggle(app->bad_usb_script);
|
||||
consumed = true;
|
||||
if(event.event == InputKeyLeft) {
|
||||
scene_manager_next_scene(app->scene_manager, BadUsbSceneConfig);
|
||||
consumed = true;
|
||||
} else if(event.event == InputKeyOk) {
|
||||
bad_usb_script_toggle(app->bad_usb_script);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeTick) {
|
||||
bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script));
|
||||
}
|
||||
|
@ -29,20 +34,16 @@ void bad_usb_scene_work_on_enter(void* context) {
|
|||
|
||||
string_t file_name;
|
||||
string_init(file_name);
|
||||
|
||||
path_extract_filename(app->file_path, file_name, true);
|
||||
bad_usb_set_file_name(app->bad_usb_view, string_get_cstr(file_name));
|
||||
app->bad_usb_script = bad_usb_script_open(app->file_path);
|
||||
|
||||
string_clear(file_name);
|
||||
|
||||
bad_usb_set_state(app->bad_usb_view, bad_usb_script_get_state(app->bad_usb_script));
|
||||
|
||||
bad_usb_set_ok_callback(app->bad_usb_view, bad_usb_scene_work_ok_callback, app);
|
||||
bad_usb_set_button_callback(app->bad_usb_view, bad_usb_scene_work_button_callback, app);
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, BadUsbAppViewWork);
|
||||
}
|
||||
|
||||
void bad_usb_scene_work_on_exit(void* context) {
|
||||
BadUsbApp* app = context;
|
||||
bad_usb_script_close(app->bad_usb_script);
|
||||
UNUSED(context);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
struct BadUsb {
|
||||
View* view;
|
||||
BadUsbOkCallback callback;
|
||||
BadUsbButtonCallback callback;
|
||||
void* context;
|
||||
};
|
||||
|
||||
|
@ -34,6 +34,10 @@ static void bad_usb_draw_callback(Canvas* canvas, void* _model) {
|
|||
elements_button_center(canvas, "Stop");
|
||||
}
|
||||
|
||||
if((model->state.state == BadUsbStateNotConnected) || (model->state.state == BadUsbStateIdle) || (model->state.state == BadUsbStateDone)) {
|
||||
elements_button_left(canvas, "Config");
|
||||
}
|
||||
|
||||
if(model->state.state == BadUsbStateNotConnected) {
|
||||
canvas_draw_icon(canvas, 4, 22, &I_Clock_18x18);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
|
@ -106,10 +110,10 @@ static bool bad_usb_input_callback(InputEvent* event, void* context) {
|
|||
bool consumed = false;
|
||||
|
||||
if(event->type == InputTypeShort) {
|
||||
if(event->key == InputKeyOk) {
|
||||
if((event->key == InputKeyLeft) || (event->key == InputKeyOk)) {
|
||||
consumed = true;
|
||||
furi_assert(bad_usb->callback);
|
||||
bad_usb->callback(InputTypeShort, bad_usb->context);
|
||||
bad_usb->callback(event->key, bad_usb->context);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +143,7 @@ View* bad_usb_get_view(BadUsb* bad_usb) {
|
|||
return bad_usb->view;
|
||||
}
|
||||
|
||||
void bad_usb_set_ok_callback(BadUsb* bad_usb, BadUsbOkCallback callback, void* context) {
|
||||
void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context) {
|
||||
furi_assert(bad_usb);
|
||||
furi_assert(callback);
|
||||
with_view_model(
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "../bad_usb_script.h"
|
||||
|
||||
typedef struct BadUsb BadUsb;
|
||||
typedef void (*BadUsbOkCallback)(InputType type, void* context);
|
||||
typedef void (*BadUsbButtonCallback)(InputKey key, void* context);
|
||||
|
||||
BadUsb* bad_usb_alloc();
|
||||
|
||||
|
@ -12,7 +12,7 @@ void bad_usb_free(BadUsb* bad_usb);
|
|||
|
||||
View* bad_usb_get_view(BadUsb* bad_usb);
|
||||
|
||||
void bad_usb_set_ok_callback(BadUsb* bad_usb, BadUsbOkCallback callback, void* context);
|
||||
void bad_usb_set_button_callback(BadUsb* bad_usb, BadUsbButtonCallback callback, void* context);
|
||||
|
||||
void bad_usb_set_file_name(BadUsb* bad_usb, const char* name);
|
||||
|
||||
|
|
BIN
assets/icons/Archive/keyboard_10px.png
Normal file
BIN
assets/icons/Archive/keyboard_10px.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 147 B |
|
@ -1,5 +1,5 @@
|
|||
V:0
|
||||
T:1659115697
|
||||
T:1659542137
|
||||
D:badusb
|
||||
D:dolphin
|
||||
D:infrared
|
||||
|
@ -8,8 +8,25 @@ D:nfc
|
|||
D:subghz
|
||||
D:u2f
|
||||
D:unirf
|
||||
F:0e41ba26498b7511d7c9e6e6b5e3b149:1592:badusb/demo_macos.txt
|
||||
F:e538ad2ce5a06ec45e1b5b24824901b1:1552:badusb/demo_windows.txt
|
||||
D:badusb/layouts
|
||||
D:badusb/scripts
|
||||
F:1139810f61ec7f8c8fe0398d92578b31:256:badusb/layouts/da-DA.kl
|
||||
F:13504463372b269bd102c68725921d90:256:badusb/layouts/de-CH.kl
|
||||
F:f392e25a23f50691b5a37e67845dec76:256:badusb/layouts/de-DE.kl
|
||||
F:3ebf32c26e9fc2fea04e54e0a871a04d:256:badusb/layouts/dvorak.kl
|
||||
F:f81bb6483d684619dcfca99b3a876a8b:256:badusb/layouts/en-UK.kl
|
||||
F:19885317532889775ea80dbd9da7ae28:256:badusb/layouts/en-US.kl
|
||||
F:0dc2c0ddd692efb3a319d430206daac6:256:badusb/layouts/es-ES.kl
|
||||
F:d301c08df0fc3e1ddc0e015cff6066ee:256:badusb/layouts/fr-BE.kl
|
||||
F:13504463372b269bd102c68725921d90:256:badusb/layouts/fr-CH.kl
|
||||
F:4535dd8ef77ff9fc03f1d669af68fa5d:256:badusb/layouts/fr-FR.kl
|
||||
F:0d971f10fc8f3d373604f3b19ebf9251:256:badusb/layouts/hu-HU.kl
|
||||
F:66564950e0bbfb4cc1d847ce3ab28b24:256:badusb/layouts/it-IT.kl
|
||||
F:fe381203fa06318e0dc05c8c2efdc609:256:badusb/layouts/nl-NL.kl
|
||||
F:d939c563da44f227786350b6e467c155:256:badusb/layouts/pt-PT.kl
|
||||
F:b62d559209e0d450b4d77f76e29ec1be:256:badusb/layouts/sv-SE.kl
|
||||
F:0e41ba26498b7511d7c9e6e6b5e3b149:1592:badusb/scripts/demo_macos.txt
|
||||
F:e538ad2ce5a06ec45e1b5b24824901b1:1552:badusb/scripts/demo_windows.txt
|
||||
D:dolphin/L1_Boxing_128x64
|
||||
D:dolphin/L1_Cry_128x64
|
||||
D:dolphin/L1_Furippa1_128x64
|
||||
|
|
BIN
assets/resources/badusb/layouts/da-DA.kl
Normal file
BIN
assets/resources/badusb/layouts/da-DA.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/de-CH.kl
Normal file
BIN
assets/resources/badusb/layouts/de-CH.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/de-DE.kl
Normal file
BIN
assets/resources/badusb/layouts/de-DE.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/dvorak.kl
Normal file
BIN
assets/resources/badusb/layouts/dvorak.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/en-UK.kl
Normal file
BIN
assets/resources/badusb/layouts/en-UK.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/en-US.kl
Normal file
BIN
assets/resources/badusb/layouts/en-US.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/es-ES.kl
Normal file
BIN
assets/resources/badusb/layouts/es-ES.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/fr-BE.kl
Normal file
BIN
assets/resources/badusb/layouts/fr-BE.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/fr-CH.kl
Normal file
BIN
assets/resources/badusb/layouts/fr-CH.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/fr-FR.kl
Normal file
BIN
assets/resources/badusb/layouts/fr-FR.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/hu-HU.kl
Normal file
BIN
assets/resources/badusb/layouts/hu-HU.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/it-IT.kl
Normal file
BIN
assets/resources/badusb/layouts/it-IT.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/nl-NL.kl
Normal file
BIN
assets/resources/badusb/layouts/nl-NL.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/pt-PT.kl
Normal file
BIN
assets/resources/badusb/layouts/pt-PT.kl
Normal file
Binary file not shown.
BIN
assets/resources/badusb/layouts/sv-SE.kl
Normal file
BIN
assets/resources/badusb/layouts/sv-SE.kl
Normal file
Binary file not shown.
|
@ -1,17 +0,0 @@
|
|||
|
||||
# BadUSB support for different layouts:
|
||||
|
||||
## Author: [v1nc](https://github.com/v1nc/flipperzero-firmware)
|
||||
|
||||
This firmware supports the `DUCKY_LANG` keyword to change the keyboard layout.
|
||||
|
||||
Add `DUCKY_LANG DE` to the first(!!!) line of the script to choose the layout.
|
||||
Currently implemented:
|
||||
* `US` = US (default)
|
||||
* `DE` = German QWERTZ
|
||||
* `FR` = AZERTY (based on [this](https://github.com/ikazeer/flipperzero-AZERTY))
|
||||
* `HU` = Hungarian QWERTZ
|
||||
|
||||
**If you are writing payloads on windows you need to make sure EOL Conversion is set to LF Unix in your text editor and not windows CR LF. If you do not it will fail to run the payload.**
|
||||
|
||||
## How to add your own layout: [instruction](https://github.com/v1nc/flipperzero-firmware/blob/dev/documentation/HowToAddLayout.md)
|
|
@ -21,7 +21,7 @@ enum HidKeyboardMods {
|
|||
KEY_MOD_RIGHT_GUI = (1 << 15),
|
||||
};
|
||||
|
||||
/** ASCII to keycode conversion table US */
|
||||
/** ASCII to keycode conversion table */
|
||||
static const uint16_t hid_asciimap[] = {
|
||||
HID_KEYBOARD_NONE, // NUL
|
||||
HID_KEYBOARD_NONE, // SOH
|
||||
|
@ -153,714 +153,6 @@ static const uint16_t hid_asciimap[] = {
|
|||
HID_KEYBOARD_NONE, // DEL
|
||||
};
|
||||
|
||||
/** HID keyboard key codes DE */
|
||||
enum HidKeyboardKeysDE {
|
||||
HID_KEYBOARD_DE_ERROR_ROLLOVER = 0x01,
|
||||
HID_KEYBOARD_DE_POST_FAIL = 0x02,
|
||||
HID_KEYBOARD_DE_ERROR_UNDEFINED = 0x03,
|
||||
|
||||
HID_KEYBOARD_DE_ENTER = 0x28,
|
||||
HID_KEYBOARD_DE_ESC = 0x29,
|
||||
HID_KEYBOARD_DE_BACKSPACE = 0x2A,
|
||||
HID_KEYBOARD_DE_TAB = 0x2B,
|
||||
HID_KEYBOARD_DE_SPACE = 0x2C,
|
||||
|
||||
HID_KEYBOARD_DE_A = 0x04,
|
||||
HID_KEYBOARD_DE_B = 0x05,
|
||||
HID_KEYBOARD_DE_C = 0x06,
|
||||
HID_KEYBOARD_DE_D = 0x07,
|
||||
HID_KEYBOARD_DE_E = 0x08,
|
||||
HID_KEYBOARD_DE_F = 0x09,
|
||||
HID_KEYBOARD_DE_G = 0x0A,
|
||||
HID_KEYBOARD_DE_H = 0x0B,
|
||||
HID_KEYBOARD_DE_I = 0x0C,
|
||||
HID_KEYBOARD_DE_J = 0x0D,
|
||||
HID_KEYBOARD_DE_K = 0x0E,
|
||||
HID_KEYBOARD_DE_L = 0x0F,
|
||||
HID_KEYBOARD_DE_M = 0x10,
|
||||
HID_KEYBOARD_DE_N = 0x11,
|
||||
HID_KEYBOARD_DE_O = 0x12,
|
||||
HID_KEYBOARD_DE_P = 0x13,
|
||||
HID_KEYBOARD_DE_Q = 0x14,
|
||||
HID_KEYBOARD_DE_R = 0x15,
|
||||
HID_KEYBOARD_DE_S = 0x16,
|
||||
HID_KEYBOARD_DE_T = 0x17,
|
||||
HID_KEYBOARD_DE_U = 0x18,
|
||||
HID_KEYBOARD_DE_V = 0x19,
|
||||
HID_KEYBOARD_DE_W = 0x1A,
|
||||
HID_KEYBOARD_DE_X = 0x1B,
|
||||
HID_KEYBOARD_DE_Y = 0x1D,
|
||||
HID_KEYBOARD_DE_Z = 0x1C,
|
||||
|
||||
HID_KEYBOARD_DE_1 = 0x1E,
|
||||
HID_KEYBOARD_DE_2 = 0x1F,
|
||||
HID_KEYBOARD_DE_3 = 0x20,
|
||||
HID_KEYBOARD_DE_4 = 0x21,
|
||||
HID_KEYBOARD_DE_5 = 0x22,
|
||||
HID_KEYBOARD_DE_6 = 0x23,
|
||||
HID_KEYBOARD_DE_7 = 0x24,
|
||||
HID_KEYBOARD_DE_8 = 0x25,
|
||||
HID_KEYBOARD_DE_9 = 0x26,
|
||||
HID_KEYBOARD_DE_0 = 0x27,
|
||||
|
||||
HID_KEYBOARD_DE_EXCLAMATION = 0x1E,
|
||||
HID_KEYBOARD_DE_DOUBLE_QUOTE = 0x1F,
|
||||
HID_KEYBOARD_DE_DOLLAR = 0x21,
|
||||
HID_KEYBOARD_DE_PERCENT = 0x22,
|
||||
HID_KEYBOARD_DE_AND = 0x23,
|
||||
HID_KEYBOARD_DE_SINGLE_QUOTE = 0x31, //tocheck
|
||||
HID_KEYBOARD_DE_LEFT_PARENTHESIS = 0x25,
|
||||
HID_KEYBOARD_DE_RIGHT_PARENTHESIS = 0x26,
|
||||
HID_KEYBOARD_DE_STAR = 0x30,
|
||||
HID_KEYBOARD_DE_EQUAL = 0x27,
|
||||
HID_KEYBOARD_DE_COMMA = 0x36,
|
||||
HID_KEYBOARD_DE_DASH = 0x38,
|
||||
HID_KEYBOARD_DE_SEMI_COLON = 0x36,
|
||||
HID_KEYBOARD_DE_DOUBLE_POINTS = 0x37,
|
||||
HID_KEYBOARD_DE_SMALLER = 0x64, //todo
|
||||
HID_KEYBOARD_DE_UNDERSCORE = 0x38,
|
||||
HID_KEYBOARD_DE_CIRCUMFLEX = 0x35, //tocheck
|
||||
HID_KEYBOARD_DE_BACKTICK = 0x2E,
|
||||
|
||||
HID_KEYBOARD_DE_CAPS_LOCK = 0xC1,
|
||||
HID_KEYBOARD_DE_F1 = 0xC2,
|
||||
HID_KEYBOARD_DE_F2 = 0xC3,
|
||||
HID_KEYBOARD_DE_F3 = 0xC4,
|
||||
HID_KEYBOARD_DE_F4 = 0xC5,
|
||||
HID_KEYBOARD_DE_F5 = 0xC6,
|
||||
HID_KEYBOARD_DE_F6 = 0xC7,
|
||||
HID_KEYBOARD_DE_F7 = 0xC8,
|
||||
HID_KEYBOARD_DE_F8 = 0xC9,
|
||||
HID_KEYBOARD_DE_F9 = 0xCA,
|
||||
HID_KEYBOARD_DE_F10 = 0xCB,
|
||||
HID_KEYBOARD_DE_F11 = 0xCC,
|
||||
HID_KEYBOARD_DE_F12 = 0xCD,
|
||||
HID_KEYBOARD_DE_PRINT = 0x63,
|
||||
HID_KEYBOARD_DE_SCROLL_LOCK = 0x47,
|
||||
HID_KEYBOARD_DE_PAUSE = 0x48,
|
||||
HID_KEYBOARD_DE_INSERT = 0xD1,
|
||||
HID_KEYBOARD_DE_HOME = 0xD2,
|
||||
HID_KEYBOARD_DE_PAGE_UP = 0xD3,
|
||||
HID_KEYBOARD_DE_DELETE = 0xD4,
|
||||
HID_KEYBOARD_DE_END = 0xD5,
|
||||
HID_KEYBOARD_DE_PAGE_DOWN = 0xD6,
|
||||
HID_KEYBOARD_DE_RIGHT_ARROW = 0xD7,
|
||||
HID_KEYBOARD_DE_LEFT_ARROW = 0xD8,
|
||||
HID_KEYBOARD_DE_DOWN_ARROW = 0xD9,
|
||||
HID_KEYBOARD_DE_UP_ARROW = 0xDA,
|
||||
HID_KEYBOARD_DE_NUM_LOCK = 0x53,
|
||||
HID_KEYBOARD_DE_NON_US = 0x64,
|
||||
HID_KEYBOARD_DE_APPLICATION = 0x65,
|
||||
|
||||
HID_KEYBOARD_DE_SHARP_SS = 0x2D,
|
||||
};
|
||||
|
||||
/** ASCII to keycode conversion table DE */
|
||||
static const uint16_t hid_asciimap_de[] = {
|
||||
HID_KEYBOARD_NONE, // NUL
|
||||
HID_KEYBOARD_NONE, // SOH
|
||||
HID_KEYBOARD_NONE, // STX
|
||||
HID_KEYBOARD_NONE, // ETX
|
||||
HID_KEYBOARD_NONE, // EOT
|
||||
HID_KEYBOARD_NONE, // ENQ
|
||||
HID_KEYBOARD_NONE, // ACK
|
||||
HID_KEYBOARD_NONE, // BEL
|
||||
HID_KEYBOARD_DE_BACKSPACE, // BS Backspace
|
||||
HID_KEYBOARD_DE_TAB, // TAB Tab
|
||||
HID_KEYBOARD_DE_ENTER, // LF Enter
|
||||
HID_KEYBOARD_NONE, // VT
|
||||
HID_KEYBOARD_NONE, // FF
|
||||
HID_KEYBOARD_NONE, // CR
|
||||
HID_KEYBOARD_NONE, // SO
|
||||
HID_KEYBOARD_NONE, // SI
|
||||
HID_KEYBOARD_NONE, // DEL
|
||||
HID_KEYBOARD_NONE, // DC1
|
||||
HID_KEYBOARD_NONE, // DC2
|
||||
HID_KEYBOARD_NONE, // DC3
|
||||
HID_KEYBOARD_NONE, // DC4
|
||||
HID_KEYBOARD_NONE, // NAK
|
||||
HID_KEYBOARD_NONE, // SYN
|
||||
HID_KEYBOARD_NONE, // ETB
|
||||
HID_KEYBOARD_NONE, // CAN
|
||||
HID_KEYBOARD_NONE, // EM
|
||||
HID_KEYBOARD_NONE, // SUB
|
||||
HID_KEYBOARD_NONE, // ESC
|
||||
HID_KEYBOARD_NONE, // FS
|
||||
HID_KEYBOARD_NONE, // GS
|
||||
HID_KEYBOARD_NONE, // RS
|
||||
HID_KEYBOARD_NONE, // US
|
||||
HID_KEYBOARD_DE_SPACE, // ' ' Space
|
||||
HID_KEYBOARD_DE_EXCLAMATION | KEY_MOD_LEFT_SHIFT, // !
|
||||
HID_KEYBOARD_DE_DOUBLE_QUOTE | KEY_MOD_LEFT_SHIFT, // "
|
||||
HID_KEYBOARD_DE_SINGLE_QUOTE, // #
|
||||
HID_KEYBOARD_DE_DOLLAR | KEY_MOD_LEFT_SHIFT, // $
|
||||
HID_KEYBOARD_DE_PERCENT | KEY_MOD_LEFT_SHIFT, // %
|
||||
HID_KEYBOARD_DE_AND | KEY_MOD_LEFT_SHIFT, // &
|
||||
HID_KEYBOARD_DE_SINGLE_QUOTE | KEY_MOD_LEFT_SHIFT, // '
|
||||
HID_KEYBOARD_DE_LEFT_PARENTHESIS | KEY_MOD_LEFT_SHIFT, // (
|
||||
HID_KEYBOARD_DE_RIGHT_PARENTHESIS | KEY_MOD_LEFT_SHIFT, // )
|
||||
HID_KEYBOARD_DE_STAR | KEY_MOD_LEFT_SHIFT, // *
|
||||
HID_KEYBOARD_DE_STAR, // +
|
||||
HID_KEYBOARD_DE_COMMA, // ,
|
||||
HID_KEYBOARD_DE_DASH, // -
|
||||
HID_KEYBOARD_DE_DOUBLE_POINTS, // .
|
||||
HID_KEYBOARD_DE_7 | KEY_MOD_LEFT_SHIFT, // /
|
||||
HID_KEYBOARD_DE_0, // 0
|
||||
HID_KEYBOARD_DE_1, // 1
|
||||
HID_KEYBOARD_DE_2, // 2
|
||||
HID_KEYBOARD_DE_3, // 3
|
||||
HID_KEYBOARD_DE_4, // 4
|
||||
HID_KEYBOARD_DE_5, // 5
|
||||
HID_KEYBOARD_DE_6, // 6
|
||||
HID_KEYBOARD_DE_7, // 7
|
||||
HID_KEYBOARD_DE_8, // 8
|
||||
HID_KEYBOARD_DE_9, // 9
|
||||
HID_KEYBOARD_DE_DOUBLE_POINTS | KEY_MOD_LEFT_SHIFT, // :
|
||||
HID_KEYBOARD_DE_SEMI_COLON | KEY_MOD_LEFT_SHIFT, // ;
|
||||
HID_KEYBOARD_DE_SMALLER, // <
|
||||
HID_KEYBOARD_DE_EQUAL | KEY_MOD_LEFT_SHIFT, // =
|
||||
HID_KEYBOARD_DE_SMALLER | KEY_MOD_LEFT_SHIFT, // >
|
||||
HID_KEYBOARD_DE_SHARP_SS | KEY_MOD_LEFT_SHIFT, // ?
|
||||
HID_KEYBOARD_DE_Q | KEY_MOD_RIGHT_ALT, // @
|
||||
HID_KEYBOARD_DE_A | KEY_MOD_LEFT_SHIFT, // A
|
||||
HID_KEYBOARD_DE_B | KEY_MOD_LEFT_SHIFT, // B
|
||||
HID_KEYBOARD_DE_C | KEY_MOD_LEFT_SHIFT, // C
|
||||
HID_KEYBOARD_DE_D | KEY_MOD_LEFT_SHIFT, // D
|
||||
HID_KEYBOARD_DE_E | KEY_MOD_LEFT_SHIFT, // E
|
||||
HID_KEYBOARD_DE_F | KEY_MOD_LEFT_SHIFT, // F
|
||||
HID_KEYBOARD_DE_G | KEY_MOD_LEFT_SHIFT, // G
|
||||
HID_KEYBOARD_DE_H | KEY_MOD_LEFT_SHIFT, // H
|
||||
HID_KEYBOARD_DE_I | KEY_MOD_LEFT_SHIFT, // I
|
||||
HID_KEYBOARD_DE_J | KEY_MOD_LEFT_SHIFT, // J
|
||||
HID_KEYBOARD_DE_K | KEY_MOD_LEFT_SHIFT, // K
|
||||
HID_KEYBOARD_DE_L | KEY_MOD_LEFT_SHIFT, // L
|
||||
HID_KEYBOARD_DE_M | KEY_MOD_LEFT_SHIFT, // M
|
||||
HID_KEYBOARD_DE_N | KEY_MOD_LEFT_SHIFT, // N
|
||||
HID_KEYBOARD_DE_O | KEY_MOD_LEFT_SHIFT, // O
|
||||
HID_KEYBOARD_DE_P | KEY_MOD_LEFT_SHIFT, // P
|
||||
HID_KEYBOARD_DE_Q | KEY_MOD_LEFT_SHIFT, // Q
|
||||
HID_KEYBOARD_DE_R | KEY_MOD_LEFT_SHIFT, // R
|
||||
HID_KEYBOARD_DE_S | KEY_MOD_LEFT_SHIFT, // S
|
||||
HID_KEYBOARD_DE_T | KEY_MOD_LEFT_SHIFT, // T
|
||||
HID_KEYBOARD_DE_U | KEY_MOD_LEFT_SHIFT, // U
|
||||
HID_KEYBOARD_DE_V | KEY_MOD_LEFT_SHIFT, // V
|
||||
HID_KEYBOARD_DE_W | KEY_MOD_LEFT_SHIFT, // W
|
||||
HID_KEYBOARD_DE_X | KEY_MOD_LEFT_SHIFT, // X
|
||||
HID_KEYBOARD_DE_Y | KEY_MOD_LEFT_SHIFT, // Y
|
||||
HID_KEYBOARD_DE_Z | KEY_MOD_LEFT_SHIFT, // Z
|
||||
HID_KEYBOARD_DE_LEFT_PARENTHESIS | KEY_MOD_RIGHT_ALT, // [
|
||||
HID_KEYBOARD_DE_SHARP_SS | KEY_MOD_RIGHT_ALT, // bslash
|
||||
HID_KEYBOARD_DE_RIGHT_PARENTHESIS | KEY_MOD_RIGHT_ALT, // ]
|
||||
HID_KEYBOARD_DE_CIRCUMFLEX, // ^
|
||||
HID_KEYBOARD_DE_UNDERSCORE | KEY_MOD_LEFT_SHIFT, // _
|
||||
HID_KEYBOARD_DE_BACKTICK | KEY_MOD_LEFT_SHIFT, // `
|
||||
HID_KEYBOARD_DE_A, // a
|
||||
HID_KEYBOARD_DE_B, // b
|
||||
HID_KEYBOARD_DE_C, // c
|
||||
HID_KEYBOARD_DE_D, // d
|
||||
HID_KEYBOARD_DE_E, // e
|
||||
HID_KEYBOARD_DE_F, // f
|
||||
HID_KEYBOARD_DE_G, // g
|
||||
HID_KEYBOARD_DE_H, // h
|
||||
HID_KEYBOARD_DE_I, // i
|
||||
HID_KEYBOARD_DE_J, // j
|
||||
HID_KEYBOARD_DE_K, // k
|
||||
HID_KEYBOARD_DE_L, // l
|
||||
HID_KEYBOARD_DE_M, // m
|
||||
HID_KEYBOARD_DE_N, // n
|
||||
HID_KEYBOARD_DE_O, // o
|
||||
HID_KEYBOARD_DE_P, // p
|
||||
HID_KEYBOARD_DE_Q, // q
|
||||
HID_KEYBOARD_DE_R, // r
|
||||
HID_KEYBOARD_DE_S, // s
|
||||
HID_KEYBOARD_DE_T, // t
|
||||
HID_KEYBOARD_DE_U, // u
|
||||
HID_KEYBOARD_DE_V, // v
|
||||
HID_KEYBOARD_DE_W, // w
|
||||
HID_KEYBOARD_DE_X, // x
|
||||
HID_KEYBOARD_DE_Y, // y
|
||||
HID_KEYBOARD_DE_Z, // z
|
||||
HID_KEYBOARD_DE_7 | KEY_MOD_RIGHT_ALT, // {
|
||||
HID_KEYBOARD_DE_SMALLER | KEY_MOD_RIGHT_ALT, // |
|
||||
HID_KEYBOARD_DE_0 | KEY_MOD_RIGHT_ALT, // }
|
||||
HID_KEYBOARD_DE_STAR | KEY_MOD_RIGHT_ALT, // ~
|
||||
HID_KEYBOARD_NONE, // DEL
|
||||
};
|
||||
|
||||
/** HID keyboard key codes FR */
|
||||
enum HidKeyboardKeysFR {
|
||||
HID_KEYBOARD_FR_ERROR_ROLLOVER = 0x01,
|
||||
HID_KEYBOARD_FR_POST_FAIL = 0x02,
|
||||
HID_KEYBOARD_FR_ERROR_UNDEFINED = 0x03,
|
||||
|
||||
HID_KEYBOARD_FR_ENTER = 0x28,
|
||||
HID_KEYBOARD_FR_ESC = 0x29,
|
||||
HID_KEYBOARD_FR_BACKSPACE = 0x2A,
|
||||
HID_KEYBOARD_FR_TAB = 0x2B,
|
||||
HID_KEYBOARD_FR_SPACE = 0x2C,
|
||||
|
||||
HID_KEYBOARD_FR_A = 0x14,
|
||||
HID_KEYBOARD_FR_B = 0x05,
|
||||
HID_KEYBOARD_FR_C = 0x06,
|
||||
HID_KEYBOARD_FR_D = 0x07,
|
||||
HID_KEYBOARD_FR_E = 0x08,
|
||||
HID_KEYBOARD_FR_F = 0x09,
|
||||
HID_KEYBOARD_FR_G = 0x0A,
|
||||
HID_KEYBOARD_FR_H = 0x0B,
|
||||
HID_KEYBOARD_FR_I = 0x0C,
|
||||
HID_KEYBOARD_FR_J = 0x0D,
|
||||
HID_KEYBOARD_FR_K = 0x0E,
|
||||
HID_KEYBOARD_FR_L = 0x0F,
|
||||
HID_KEYBOARD_FR_M = 0x33,
|
||||
HID_KEYBOARD_FR_N = 0x11,
|
||||
HID_KEYBOARD_FR_O = 0x12,
|
||||
HID_KEYBOARD_FR_P = 0x13,
|
||||
HID_KEYBOARD_FR_Q = 0x04,
|
||||
HID_KEYBOARD_FR_R = 0x15,
|
||||
HID_KEYBOARD_FR_S = 0x16,
|
||||
HID_KEYBOARD_FR_T = 0x17,
|
||||
HID_KEYBOARD_FR_U = 0x18,
|
||||
HID_KEYBOARD_FR_V = 0x19,
|
||||
HID_KEYBOARD_FR_W = 0x1D,
|
||||
HID_KEYBOARD_FR_X = 0x1B,
|
||||
HID_KEYBOARD_FR_Y = 0x1C,
|
||||
HID_KEYBOARD_FR_Z = 0x1A,
|
||||
|
||||
HID_KEYBOARD_FR_1 = 0x1E,
|
||||
HID_KEYBOARD_FR_2 = 0x1F,
|
||||
HID_KEYBOARD_FR_3 = 0x20,
|
||||
HID_KEYBOARD_FR_4 = 0x21,
|
||||
HID_KEYBOARD_FR_5 = 0x22,
|
||||
HID_KEYBOARD_FR_6 = 0x23,
|
||||
HID_KEYBOARD_FR_7 = 0x24,
|
||||
HID_KEYBOARD_FR_8 = 0x25,
|
||||
HID_KEYBOARD_FR_9 = 0x26,
|
||||
HID_KEYBOARD_FR_0 = 0x27,
|
||||
|
||||
HID_KEYBOARD_FR_EXCLAMATION = 0x38,
|
||||
HID_KEYBOARD_FR_DOUBLE_QUOTE = 0x20,
|
||||
HID_KEYBOARD_FR_DOLLAR = 0x30,
|
||||
HID_KEYBOARD_FR_U_BACKTICK = 0x34,
|
||||
HID_KEYBOARD_FR_AND = 0x1E,
|
||||
HID_KEYBOARD_FR_SINGLE_QUOTE = 0x21,
|
||||
HID_KEYBOARD_FR_LEFT_PARENTHESIS = 0x22,
|
||||
HID_KEYBOARD_FR_RIGHT_PARENTHESIS = 0x2D,
|
||||
HID_KEYBOARD_FR_STAR = 0x31,
|
||||
HID_KEYBOARD_FR_EQUAL = 0x2E,
|
||||
HID_KEYBOARD_FR_COMMA = 0x10,
|
||||
HID_KEYBOARD_FR_DASH = 0x23,
|
||||
HID_KEYBOARD_FR_SEMI_COLON = 0x36,
|
||||
HID_KEYBOARD_FR_DOUBLE_POINTS = 0x37,
|
||||
HID_KEYBOARD_FR_SMALLER = 0x64,
|
||||
HID_KEYBOARD_FR_UNDERSCORE = 0x25,
|
||||
HID_KEYBOARD_FR_CIRCUMFLEX = 0x2F,
|
||||
HID_KEYBOARD_FR_A_BACKTICK = 0x27,
|
||||
HID_KEYBOARD_FR_E_ACCENT = 0x1F,
|
||||
HID_KEYBOARD_FR_E_BACKTICK = 0x24,
|
||||
HID_KEYBOARD_FR_C_CEDILLE = 0x26,
|
||||
|
||||
HID_KEYBOARD_FR_CAPS_LOCK = 0xC1,
|
||||
HID_KEYBOARD_FR_F1 = 0xC2,
|
||||
HID_KEYBOARD_FR_F2 = 0xC3,
|
||||
HID_KEYBOARD_FR_F3 = 0xC4,
|
||||
HID_KEYBOARD_FR_F4 = 0xC5,
|
||||
HID_KEYBOARD_FR_F5 = 0xC6,
|
||||
HID_KEYBOARD_FR_F6 = 0xC7,
|
||||
HID_KEYBOARD_FR_F7 = 0xC8,
|
||||
HID_KEYBOARD_FR_F8 = 0xC9,
|
||||
HID_KEYBOARD_FR_F9 = 0xCA,
|
||||
HID_KEYBOARD_FR_F10 = 0xCB,
|
||||
HID_KEYBOARD_FR_F11 = 0xCC,
|
||||
HID_KEYBOARD_FR_F12 = 0xCD,
|
||||
HID_KEYBOARD_FR_PRINT = 0x63,
|
||||
HID_KEYBOARD_FR_SCROLL_LOCK = 0x47,
|
||||
HID_KEYBOARD_FR_PAUSE = 0x48,
|
||||
HID_KEYBOARD_FR_INSERT = 0xD1,
|
||||
HID_KEYBOARD_FR_HOME = 0xD2,
|
||||
HID_KEYBOARD_FR_PAGE_UP = 0xD3,
|
||||
HID_KEYBOARD_FR_DELETE = 0xD4,
|
||||
HID_KEYBOARD_FR_END = 0xD5,
|
||||
HID_KEYBOARD_FR_PAGE_DOWN = 0xD6,
|
||||
HID_KEYBOARD_FR_RIGHT_ARROW = 0xD7,
|
||||
HID_KEYBOARD_FR_LEFT_ARROW = 0xD8,
|
||||
HID_KEYBOARD_FR_DOWN_ARROW = 0xD9,
|
||||
HID_KEYBOARD_FR_UP_ARROW = 0xDA,
|
||||
HID_KEYBOARD_FR_NUM_LOCK = 0x53,
|
||||
HID_KEYBOARD_FR_NON_US = 0x64,
|
||||
HID_KEYBOARD_FR_APPLICATION = 0x65,
|
||||
};
|
||||
|
||||
/** ASCII to keycode conversion table FR */
|
||||
static const uint16_t hid_asciimap_fr[] = {
|
||||
HID_KEYBOARD_NONE, // NUL
|
||||
HID_KEYBOARD_NONE, // SOH
|
||||
HID_KEYBOARD_NONE, // STX
|
||||
HID_KEYBOARD_NONE, // ETX
|
||||
HID_KEYBOARD_NONE, // EOT
|
||||
HID_KEYBOARD_NONE, // ENQ
|
||||
HID_KEYBOARD_NONE, // ACK
|
||||
HID_KEYBOARD_NONE, // BEL
|
||||
HID_KEYBOARD_FR_BACKSPACE, // BS Backspace
|
||||
HID_KEYBOARD_FR_TAB, // TAB Tab
|
||||
HID_KEYBOARD_FR_ENTER, // LF Enter
|
||||
HID_KEYBOARD_NONE, // VT
|
||||
HID_KEYBOARD_NONE, // FF
|
||||
HID_KEYBOARD_NONE, // CR
|
||||
HID_KEYBOARD_NONE, // SO
|
||||
HID_KEYBOARD_NONE, // SI
|
||||
HID_KEYBOARD_NONE, // DEL
|
||||
HID_KEYBOARD_NONE, // DC1
|
||||
HID_KEYBOARD_NONE, // DC2
|
||||
HID_KEYBOARD_NONE, // DC3
|
||||
HID_KEYBOARD_NONE, // DC4
|
||||
HID_KEYBOARD_NONE, // NAK
|
||||
HID_KEYBOARD_NONE, // SYN
|
||||
HID_KEYBOARD_NONE, // ETB
|
||||
HID_KEYBOARD_NONE, // CAN
|
||||
HID_KEYBOARD_NONE, // EM
|
||||
HID_KEYBOARD_NONE, // SUB
|
||||
HID_KEYBOARD_NONE, // ESC
|
||||
HID_KEYBOARD_NONE, // FS
|
||||
HID_KEYBOARD_NONE, // GS
|
||||
HID_KEYBOARD_NONE, // RS
|
||||
HID_KEYBOARD_NONE, // US
|
||||
HID_KEYBOARD_FR_SPACE, // ' ' Space
|
||||
HID_KEYBOARD_FR_EXCLAMATION, // !
|
||||
HID_KEYBOARD_FR_DOUBLE_QUOTE, // "
|
||||
HID_KEYBOARD_FR_DOUBLE_QUOTE | KEY_MOD_RIGHT_ALT, // #
|
||||
HID_KEYBOARD_FR_DOLLAR, // $
|
||||
HID_KEYBOARD_FR_U_BACKTICK | KEY_MOD_LEFT_SHIFT, // %
|
||||
HID_KEYBOARD_FR_AND, // &
|
||||
HID_KEYBOARD_FR_SINGLE_QUOTE, // '
|
||||
HID_KEYBOARD_FR_LEFT_PARENTHESIS, // (
|
||||
HID_KEYBOARD_FR_RIGHT_PARENTHESIS, // )
|
||||
HID_KEYBOARD_FR_STAR, // *
|
||||
HID_KEYBOARD_FR_EQUAL | KEY_MOD_LEFT_SHIFT, // +
|
||||
HID_KEYBOARD_FR_COMMA, // ,
|
||||
HID_KEYBOARD_FR_DASH, // -
|
||||
HID_KEYBOARD_FR_SEMI_COLON | KEY_MOD_LEFT_SHIFT, // .
|
||||
HID_KEYBOARD_FR_DOUBLE_POINTS | KEY_MOD_LEFT_SHIFT, // /
|
||||
HID_KEYBOARD_FR_A_BACKTICK | KEY_MOD_LEFT_SHIFT, // 0
|
||||
HID_KEYBOARD_FR_AND | KEY_MOD_LEFT_SHIFT, // 1
|
||||
HID_KEYBOARD_FR_E_ACCENT | KEY_MOD_LEFT_SHIFT, // 2
|
||||
HID_KEYBOARD_FR_DOUBLE_QUOTE | KEY_MOD_LEFT_SHIFT, // 3
|
||||
HID_KEYBOARD_FR_SINGLE_QUOTE | KEY_MOD_LEFT_SHIFT, // 4
|
||||
HID_KEYBOARD_FR_LEFT_PARENTHESIS | KEY_MOD_LEFT_SHIFT, // 5
|
||||
HID_KEYBOARD_FR_DASH | KEY_MOD_LEFT_SHIFT, // 6
|
||||
HID_KEYBOARD_FR_E_BACKTICK | KEY_MOD_LEFT_SHIFT, // 7
|
||||
HID_KEYBOARD_FR_UNDERSCORE | KEY_MOD_LEFT_SHIFT, // 8
|
||||
HID_KEYBOARD_FR_C_CEDILLE | KEY_MOD_LEFT_SHIFT, // 9
|
||||
HID_KEYBOARD_FR_DOUBLE_POINTS, // :
|
||||
HID_KEYBOARD_FR_SEMI_COLON, // ;
|
||||
HID_KEYBOARD_FR_SMALLER, // <
|
||||
HID_KEYBOARD_FR_EQUAL, // =
|
||||
HID_KEYBOARD_FR_SMALLER | KEY_MOD_LEFT_SHIFT, // >
|
||||
HID_KEYBOARD_FR_COMMA | KEY_MOD_LEFT_SHIFT, // ?
|
||||
HID_KEYBOARD_FR_A_BACKTICK | KEY_MOD_RIGHT_ALT, // @
|
||||
HID_KEYBOARD_FR_A | KEY_MOD_LEFT_SHIFT, // A
|
||||
HID_KEYBOARD_FR_B | KEY_MOD_LEFT_SHIFT, // B
|
||||
HID_KEYBOARD_FR_C | KEY_MOD_LEFT_SHIFT, // C
|
||||
HID_KEYBOARD_FR_D | KEY_MOD_LEFT_SHIFT, // D
|
||||
HID_KEYBOARD_FR_E | KEY_MOD_LEFT_SHIFT, // E
|
||||
HID_KEYBOARD_FR_F | KEY_MOD_LEFT_SHIFT, // F
|
||||
HID_KEYBOARD_FR_G | KEY_MOD_LEFT_SHIFT, // G
|
||||
HID_KEYBOARD_FR_H | KEY_MOD_LEFT_SHIFT, // H
|
||||
HID_KEYBOARD_FR_I | KEY_MOD_LEFT_SHIFT, // I
|
||||
HID_KEYBOARD_FR_J | KEY_MOD_LEFT_SHIFT, // J
|
||||
HID_KEYBOARD_FR_K | KEY_MOD_LEFT_SHIFT, // K
|
||||
HID_KEYBOARD_FR_L | KEY_MOD_LEFT_SHIFT, // L
|
||||
HID_KEYBOARD_FR_M | KEY_MOD_LEFT_SHIFT, // M
|
||||
HID_KEYBOARD_FR_N | KEY_MOD_LEFT_SHIFT, // N
|
||||
HID_KEYBOARD_FR_O | KEY_MOD_LEFT_SHIFT, // O
|
||||
HID_KEYBOARD_FR_P | KEY_MOD_LEFT_SHIFT, // P
|
||||
HID_KEYBOARD_FR_Q | KEY_MOD_LEFT_SHIFT, // Q
|
||||
HID_KEYBOARD_FR_R | KEY_MOD_LEFT_SHIFT, // R
|
||||
HID_KEYBOARD_FR_S | KEY_MOD_LEFT_SHIFT, // S
|
||||
HID_KEYBOARD_FR_T | KEY_MOD_LEFT_SHIFT, // T
|
||||
HID_KEYBOARD_FR_U | KEY_MOD_LEFT_SHIFT, // U
|
||||
HID_KEYBOARD_FR_V | KEY_MOD_LEFT_SHIFT, // V
|
||||
HID_KEYBOARD_FR_W | KEY_MOD_LEFT_SHIFT, // W
|
||||
HID_KEYBOARD_FR_X | KEY_MOD_LEFT_SHIFT, // X
|
||||
HID_KEYBOARD_FR_Y | KEY_MOD_LEFT_SHIFT, // Y
|
||||
HID_KEYBOARD_FR_Z | KEY_MOD_LEFT_SHIFT, // Z
|
||||
HID_KEYBOARD_FR_LEFT_PARENTHESIS | KEY_MOD_RIGHT_ALT, // [
|
||||
HID_KEYBOARD_FR_UNDERSCORE | KEY_MOD_RIGHT_ALT, // bslash
|
||||
HID_KEYBOARD_FR_RIGHT_PARENTHESIS | KEY_MOD_RIGHT_ALT, // ]
|
||||
HID_KEYBOARD_FR_CIRCUMFLEX, // ^
|
||||
HID_KEYBOARD_FR_UNDERSCORE, // _
|
||||
HID_KEYBOARD_FR_E_BACKTICK | KEY_MOD_RIGHT_ALT, // `
|
||||
HID_KEYBOARD_FR_A, // a
|
||||
HID_KEYBOARD_FR_B, // b
|
||||
HID_KEYBOARD_FR_C, // c
|
||||
HID_KEYBOARD_FR_D, // d
|
||||
HID_KEYBOARD_FR_E, // e
|
||||
HID_KEYBOARD_FR_F, // f
|
||||
HID_KEYBOARD_FR_G, // g
|
||||
HID_KEYBOARD_FR_H, // h
|
||||
HID_KEYBOARD_FR_I, // i
|
||||
HID_KEYBOARD_FR_J, // j
|
||||
HID_KEYBOARD_FR_K, // k
|
||||
HID_KEYBOARD_FR_L, // l
|
||||
HID_KEYBOARD_FR_M, // m
|
||||
HID_KEYBOARD_FR_N, // n
|
||||
HID_KEYBOARD_FR_O, // o
|
||||
HID_KEYBOARD_FR_P, // p
|
||||
HID_KEYBOARD_FR_Q, // q
|
||||
HID_KEYBOARD_FR_R, // r
|
||||
HID_KEYBOARD_FR_S, // s
|
||||
HID_KEYBOARD_FR_T, // t
|
||||
HID_KEYBOARD_FR_U, // u
|
||||
HID_KEYBOARD_FR_V, // v
|
||||
HID_KEYBOARD_FR_W, // w
|
||||
HID_KEYBOARD_FR_X, // x
|
||||
HID_KEYBOARD_FR_Y, // y
|
||||
HID_KEYBOARD_FR_Z, // z
|
||||
HID_KEYBOARD_FR_SINGLE_QUOTE | KEY_MOD_RIGHT_ALT, // {
|
||||
HID_KEYBOARD_FR_DASH | KEY_MOD_RIGHT_ALT, // |
|
||||
HID_KEYBOARD_FR_EQUAL | KEY_MOD_RIGHT_ALT, // }
|
||||
HID_KEYBOARD_FR_E_ACCENT | KEY_MOD_RIGHT_ALT, // ~
|
||||
HID_KEYBOARD_NONE, // DEL
|
||||
};
|
||||
|
||||
/** HID keyboard key codes HU by ut1s */
|
||||
enum HidKeyboardKeysHU {
|
||||
HID_KEYBOARD_HU_ERROR_ROLLOVER = 0x01,
|
||||
HID_KEYBOARD_HU_POST_FAIL = 0x02,
|
||||
HID_KEYBOARD_HU_ERROR_UNHUFINED = 0x03,
|
||||
|
||||
HID_KEYBOARD_HU_ENTER = 0x28,
|
||||
HID_KEYBOARD_HU_ESC = 0x29,
|
||||
HID_KEYBOARD_HU_BACKSPACE = 0x2A,
|
||||
HID_KEYBOARD_HU_TAB = 0x2B,
|
||||
HID_KEYBOARD_HU_SPACE = 0x2C,
|
||||
|
||||
HID_KEYBOARD_HU_A = 0x04,
|
||||
HID_KEYBOARD_HU_B = 0x05,
|
||||
HID_KEYBOARD_HU_C = 0x06,
|
||||
HID_KEYBOARD_HU_D = 0x07,
|
||||
HID_KEYBOARD_HU_E = 0x08,
|
||||
HID_KEYBOARD_HU_F = 0x09,
|
||||
HID_KEYBOARD_HU_G = 0x0A,
|
||||
HID_KEYBOARD_HU_H = 0x0B,
|
||||
HID_KEYBOARD_HU_I = 0x0C,
|
||||
HID_KEYBOARD_HU_J = 0x0D,
|
||||
HID_KEYBOARD_HU_K = 0x0E,
|
||||
HID_KEYBOARD_HU_L = 0x0F,
|
||||
HID_KEYBOARD_HU_M = 0x10,
|
||||
HID_KEYBOARD_HU_N = 0x11,
|
||||
HID_KEYBOARD_HU_O = 0x12,
|
||||
HID_KEYBOARD_HU_P = 0x13,
|
||||
HID_KEYBOARD_HU_Q = 0x14,
|
||||
HID_KEYBOARD_HU_R = 0x15,
|
||||
HID_KEYBOARD_HU_S = 0x16,
|
||||
HID_KEYBOARD_HU_T = 0x17,
|
||||
HID_KEYBOARD_HU_U = 0x18,
|
||||
HID_KEYBOARD_HU_V = 0x19,
|
||||
HID_KEYBOARD_HU_W = 0x1A,
|
||||
HID_KEYBOARD_HU_X = 0x1B,
|
||||
HID_KEYBOARD_HU_Y = 0x1D,
|
||||
HID_KEYBOARD_HU_Z = 0x1C,
|
||||
|
||||
HID_KEYBOARD_HU_1 = 0x1E,
|
||||
HID_KEYBOARD_HU_2 = 0x1F,
|
||||
HID_KEYBOARD_HU_3 = 0x20,
|
||||
HID_KEYBOARD_HU_4 = 0x21,
|
||||
HID_KEYBOARD_HU_5 = 0x22,
|
||||
HID_KEYBOARD_HU_6 = 0x23,
|
||||
HID_KEYBOARD_HU_7 = 0x24,
|
||||
HID_KEYBOARD_HU_8 = 0x25,
|
||||
HID_KEYBOARD_HU_9 = 0x26,
|
||||
HID_KEYBOARD_HU_0 = 0x35,
|
||||
|
||||
HID_KEYBOARD_HU_EXCLAMATION = 0x21, //!
|
||||
HID_KEYBOARD_HU_DOUBLE_QUOTE = 0x1F, //"
|
||||
HID_KEYBOARD_HU_DOLLAR = 0x33, //$
|
||||
HID_KEYBOARD_HU_PERCENT = 0x22, //%
|
||||
HID_KEYBOARD_HU_AND = 0x06, //&
|
||||
HID_KEYBOARD_HU_SINGLE_QUOTE = 0x1E, //tocheck '
|
||||
HID_KEYBOARD_HU_LEFT_PARENTHESIS = 0x25, //(
|
||||
HID_KEYBOARD_HU_RIGHT_PARENTHESIS = 0x26, //)
|
||||
HID_KEYBOARD_HU_STAR = 0x38, //*
|
||||
HID_KEYBOARD_HU_EQUAL = 0x24, //=
|
||||
HID_KEYBOARD_HU_COMMA = 0x36, //,
|
||||
HID_KEYBOARD_HU_DASH = 0x38, // -
|
||||
HID_KEYBOARD_HU_SEMI_COLON = 0x36, // ;
|
||||
HID_KEYBOARD_HU_DOUBLE_POINTS = 0x37, //:
|
||||
HID_KEYBOARD_HU_SMALLER = 0x64, //todo <
|
||||
HID_KEYBOARD_HU_UNDERSCORE = 0x38, //_
|
||||
HID_KEYBOARD_HU_CIRCUMFLEX = 0x20, //tocheck ^
|
||||
HID_KEYBOARD_HU_BACKTICK = 0x24, // `
|
||||
|
||||
HID_KEYBOARD_HU_CAPS_LOCK = 0xC1,
|
||||
HID_KEYBOARD_HU_F1 = 0xC2,
|
||||
HID_KEYBOARD_HU_F2 = 0xC3,
|
||||
HID_KEYBOARD_HU_F3 = 0xC4,
|
||||
HID_KEYBOARD_HU_F4 = 0xC5,
|
||||
HID_KEYBOARD_HU_F5 = 0xC6,
|
||||
HID_KEYBOARD_HU_F6 = 0xC7,
|
||||
HID_KEYBOARD_HU_F7 = 0xC8,
|
||||
HID_KEYBOARD_HU_F8 = 0xC9,
|
||||
HID_KEYBOARD_HU_F9 = 0xCA,
|
||||
HID_KEYBOARD_HU_F10 = 0xCB,
|
||||
HID_KEYBOARD_HU_F11 = 0xCC,
|
||||
HID_KEYBOARD_HU_F12 = 0xCD,
|
||||
HID_KEYBOARD_HU_PRINT = 0x63,
|
||||
HID_KEYBOARD_HU_SCROLL_LOCK = 0x47,
|
||||
HID_KEYBOARD_HU_PAUSE = 0x48,
|
||||
HID_KEYBOARD_HU_INSERT = 0xD1,
|
||||
HID_KEYBOARD_HU_HOME = 0xD2,
|
||||
HID_KEYBOARD_HU_PAGE_UP = 0xD3,
|
||||
HID_KEYBOARD_HU_DELETE = 0xD4,
|
||||
HID_KEYBOARD_HU_END = 0xD5,
|
||||
HID_KEYBOARD_HU_PAGE_DOWN = 0xD6,
|
||||
HID_KEYBOARD_HU_RIGHT_ARROW = 0xD7,
|
||||
HID_KEYBOARD_HU_LEFT_ARROW = 0xD8,
|
||||
HID_KEYBOARD_HU_DOWN_ARROW = 0xD9,
|
||||
HID_KEYBOARD_HU_UP_ARROW = 0xDA,
|
||||
HID_KEYBOARD_HU_NUM_LOCK = 0x53,
|
||||
HID_KEYBOARD_HU_NON_US = 0x64,
|
||||
HID_KEYBOARD_HU_APPLICATION = 0x65,
|
||||
|
||||
HID_KEYBOARD_HU_SHARP_SS = 0x36,
|
||||
};
|
||||
|
||||
static const uint16_t hid_asciimap_hu[] = {
|
||||
HID_KEYBOARD_NONE, // NUL
|
||||
HID_KEYBOARD_NONE, // SOH
|
||||
HID_KEYBOARD_NONE, // STX
|
||||
HID_KEYBOARD_NONE, // ETX
|
||||
HID_KEYBOARD_NONE, // EOT
|
||||
HID_KEYBOARD_NONE, // ENQ
|
||||
HID_KEYBOARD_NONE, // ACK
|
||||
HID_KEYBOARD_NONE, // BEL
|
||||
HID_KEYBOARD_HU_BACKSPACE, // BS Backspace
|
||||
HID_KEYBOARD_HU_TAB, // TAB Tab
|
||||
HID_KEYBOARD_HU_ENTER, // LF Enter
|
||||
HID_KEYBOARD_NONE, // VT
|
||||
HID_KEYBOARD_NONE, // FF
|
||||
HID_KEYBOARD_NONE, // CR
|
||||
HID_KEYBOARD_NONE, // SO
|
||||
HID_KEYBOARD_NONE, // SI
|
||||
HID_KEYBOARD_NONE, // DEL
|
||||
HID_KEYBOARD_NONE, // DC1
|
||||
HID_KEYBOARD_NONE, // DC2
|
||||
HID_KEYBOARD_NONE, // DC3
|
||||
HID_KEYBOARD_NONE, // DC4
|
||||
HID_KEYBOARD_NONE, // NAK
|
||||
HID_KEYBOARD_NONE, // SYN
|
||||
HID_KEYBOARD_NONE, // ETB
|
||||
HID_KEYBOARD_NONE, // CAN
|
||||
HID_KEYBOARD_NONE, // EM
|
||||
HID_KEYBOARD_NONE, // SUB
|
||||
HID_KEYBOARD_NONE, // ESC
|
||||
HID_KEYBOARD_NONE, // FS
|
||||
HID_KEYBOARD_NONE, // GS
|
||||
HID_KEYBOARD_NONE, // RS
|
||||
HID_KEYBOARD_NONE, // US
|
||||
HID_KEYBOARD_HU_SPACE, // ' ' Space
|
||||
HID_KEYBOARD_HU_EXCLAMATION | KEY_MOD_LEFT_SHIFT, // !
|
||||
HID_KEYBOARD_HU_DOUBLE_QUOTE | KEY_MOD_LEFT_SHIFT, // "
|
||||
HID_KEYBOARD_HU_X | KEY_MOD_RIGHT_ALT, // #
|
||||
HID_KEYBOARD_HU_DOLLAR | KEY_MOD_RIGHT_ALT, // $
|
||||
HID_KEYBOARD_HU_PERCENT | KEY_MOD_LEFT_SHIFT, // %
|
||||
HID_KEYBOARD_HU_AND | KEY_MOD_RIGHT_ALT, // &
|
||||
HID_KEYBOARD_HU_SINGLE_QUOTE | KEY_MOD_LEFT_SHIFT, // '
|
||||
HID_KEYBOARD_HU_LEFT_PARENTHESIS | KEY_MOD_LEFT_SHIFT, // (
|
||||
HID_KEYBOARD_HU_RIGHT_PARENTHESIS | KEY_MOD_LEFT_SHIFT, // )
|
||||
HID_KEYBOARD_HU_STAR | KEY_MOD_RIGHT_ALT, // *
|
||||
HID_KEYBOARD_HU_3 | KEY_MOD_LEFT_SHIFT, // +
|
||||
HID_KEYBOARD_HU_COMMA, // ,
|
||||
HID_KEYBOARD_HU_DASH, // -
|
||||
HID_KEYBOARD_HU_DOUBLE_POINTS, // .
|
||||
HID_KEYBOARD_HU_6 | KEY_MOD_LEFT_SHIFT, // /
|
||||
HID_KEYBOARD_HU_0, // 0
|
||||
HID_KEYBOARD_HU_1, // 1
|
||||
HID_KEYBOARD_HU_2, // 2
|
||||
HID_KEYBOARD_HU_3, // 3
|
||||
HID_KEYBOARD_HU_4, // 4
|
||||
HID_KEYBOARD_HU_5, // 5
|
||||
HID_KEYBOARD_HU_6, // 6
|
||||
HID_KEYBOARD_HU_7, // 7
|
||||
HID_KEYBOARD_HU_8, // 8
|
||||
HID_KEYBOARD_HU_9, // 9
|
||||
HID_KEYBOARD_HU_DOUBLE_POINTS | KEY_MOD_LEFT_SHIFT, // :
|
||||
HID_KEYBOARD_HU_SEMI_COLON | KEY_MOD_RIGHT_ALT, // ;
|
||||
HID_KEYBOARD_HU_SMALLER | KEY_MOD_RIGHT_ALT, // <
|
||||
HID_KEYBOARD_HU_EQUAL | KEY_MOD_LEFT_SHIFT, // =
|
||||
HID_KEYBOARD_HU_Y | KEY_MOD_RIGHT_ALT, // >
|
||||
HID_KEYBOARD_HU_SHARP_SS | KEY_MOD_LEFT_SHIFT, // ?
|
||||
HID_KEYBOARD_HU_V | KEY_MOD_RIGHT_ALT, // @
|
||||
HID_KEYBOARD_HU_A | KEY_MOD_LEFT_SHIFT, // A
|
||||
HID_KEYBOARD_HU_B | KEY_MOD_LEFT_SHIFT, // B
|
||||
HID_KEYBOARD_HU_C | KEY_MOD_LEFT_SHIFT, // C
|
||||
HID_KEYBOARD_HU_D | KEY_MOD_LEFT_SHIFT, // D
|
||||
HID_KEYBOARD_HU_E | KEY_MOD_LEFT_SHIFT, // E
|
||||
HID_KEYBOARD_HU_F | KEY_MOD_LEFT_SHIFT, // F
|
||||
HID_KEYBOARD_HU_G | KEY_MOD_LEFT_SHIFT, // G
|
||||
HID_KEYBOARD_HU_H | KEY_MOD_LEFT_SHIFT, // H
|
||||
HID_KEYBOARD_HU_I | KEY_MOD_LEFT_SHIFT, // I
|
||||
HID_KEYBOARD_HU_J | KEY_MOD_LEFT_SHIFT, // J
|
||||
HID_KEYBOARD_HU_K | KEY_MOD_LEFT_SHIFT, // K
|
||||
HID_KEYBOARD_HU_L | KEY_MOD_LEFT_SHIFT, // L
|
||||
HID_KEYBOARD_HU_M | KEY_MOD_LEFT_SHIFT, // M
|
||||
HID_KEYBOARD_HU_N | KEY_MOD_LEFT_SHIFT, // N
|
||||
HID_KEYBOARD_HU_O | KEY_MOD_LEFT_SHIFT, // O
|
||||
HID_KEYBOARD_HU_P | KEY_MOD_LEFT_SHIFT, // P
|
||||
HID_KEYBOARD_HU_Q | KEY_MOD_LEFT_SHIFT, // Q
|
||||
HID_KEYBOARD_HU_R | KEY_MOD_LEFT_SHIFT, // R
|
||||
HID_KEYBOARD_HU_S | KEY_MOD_LEFT_SHIFT, // S
|
||||
HID_KEYBOARD_HU_T | KEY_MOD_LEFT_SHIFT, // T
|
||||
HID_KEYBOARD_HU_U | KEY_MOD_LEFT_SHIFT, // U
|
||||
HID_KEYBOARD_HU_V | KEY_MOD_LEFT_SHIFT, // V
|
||||
HID_KEYBOARD_HU_W | KEY_MOD_LEFT_SHIFT, // W
|
||||
HID_KEYBOARD_HU_X | KEY_MOD_LEFT_SHIFT, // X
|
||||
HID_KEYBOARD_HU_Y | KEY_MOD_LEFT_SHIFT, // Y
|
||||
HID_KEYBOARD_HU_Z | KEY_MOD_LEFT_SHIFT, // Z
|
||||
HID_KEYBOARD_HU_F | KEY_MOD_RIGHT_ALT, // [
|
||||
HID_KEYBOARD_HU_Q | KEY_MOD_RIGHT_ALT, // bslash
|
||||
HID_KEYBOARD_HU_G | KEY_MOD_RIGHT_ALT, // ]
|
||||
HID_KEYBOARD_HU_CIRCUMFLEX | KEY_MOD_RIGHT_ALT, // ^
|
||||
HID_KEYBOARD_HU_UNDERSCORE | KEY_MOD_LEFT_SHIFT, // _
|
||||
HID_KEYBOARD_HU_BACKTICK | KEY_MOD_RIGHT_ALT, // `
|
||||
HID_KEYBOARD_HU_A, // a
|
||||
HID_KEYBOARD_HU_B, // b
|
||||
HID_KEYBOARD_HU_C, // c
|
||||
HID_KEYBOARD_HU_D, // d
|
||||
HID_KEYBOARD_HU_E, // e
|
||||
HID_KEYBOARD_HU_F, // f
|
||||
HID_KEYBOARD_HU_G, // g
|
||||
HID_KEYBOARD_HU_H, // h
|
||||
HID_KEYBOARD_HU_I, // i
|
||||
HID_KEYBOARD_HU_J, // j
|
||||
HID_KEYBOARD_HU_K, // k
|
||||
HID_KEYBOARD_HU_L, // l
|
||||
HID_KEYBOARD_HU_M, // m
|
||||
HID_KEYBOARD_HU_N, // n
|
||||
HID_KEYBOARD_HU_O, // o
|
||||
HID_KEYBOARD_HU_P, // p
|
||||
HID_KEYBOARD_HU_Q, // q
|
||||
HID_KEYBOARD_HU_R, // r
|
||||
HID_KEYBOARD_HU_S, // s
|
||||
HID_KEYBOARD_HU_T, // t
|
||||
HID_KEYBOARD_HU_U, // u
|
||||
HID_KEYBOARD_HU_V, // v
|
||||
HID_KEYBOARD_HU_W, // w
|
||||
HID_KEYBOARD_HU_X, // x
|
||||
HID_KEYBOARD_HU_Y, // y
|
||||
HID_KEYBOARD_HU_Z, // z
|
||||
HID_KEYBOARD_HU_B | KEY_MOD_RIGHT_ALT, // {
|
||||
HID_KEYBOARD_HU_W | KEY_MOD_RIGHT_ALT, // |
|
||||
HID_KEYBOARD_HU_N | KEY_MOD_RIGHT_ALT, // }
|
||||
HID_KEYBOARD_HU_SINGLE_QUOTE | KEY_MOD_RIGHT_ALT, // ~
|
||||
HID_KEYBOARD_NONE, // HUL
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
static const uint16_t* hid_asciimaps[] =
|
||||
{hid_asciimap, hid_asciimap_de, hid_asciimap_fr, hid_asciimap_hu};
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
typedef struct {
|
||||
uint32_t vid;
|
||||
uint32_t pid;
|
||||
|
@ -871,8 +163,7 @@ typedef struct {
|
|||
typedef void (*HidStateCallback)(bool state, void* context);
|
||||
|
||||
/** ASCII to keycode conversion macro */
|
||||
#define HID_ASCII_TO_KEY(x, y) \
|
||||
(((uint8_t)y < 128) ? (hid_asciimaps[(uint8_t)x][(uint8_t)y]) : HID_KEYBOARD_NONE)
|
||||
#define HID_ASCII_TO_KEY(x) (((uint8_t)x < 128) ? (hid_asciimap[(uint8_t)x]) : HID_KEYBOARD_NONE)
|
||||
|
||||
/** HID keyboard leds */
|
||||
enum HidKeyboardLeds {
|
||||
|
|
Loading…
Reference in a new issue