diff --git a/cli/cli.c b/cli/cli.c index a556c31acfa..4e17abfba93 100644 --- a/cli/cli.c +++ b/cli/cli.c @@ -15,6 +15,7 @@ #include "commands/reset/reset.h" #include "commands/automation/automation.h" #include "commands/details/details.h" +#include "commands/version/version.h" struct TotpCliContext { PluginState* plugin_state; @@ -74,6 +75,8 @@ static void totp_cli_handler(Cli* cli, FuriString* args, void* context) { furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS) == 0 || furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_DETAILS_ALT) == 0) { totp_cli_command_details_handle(plugin_state, args, cli); + } else if(furi_string_cmp_str(cmd, TOTP_CLI_COMMAND_VERSION) == 0) { + totp_cli_command_version_handle(); } else { totp_cli_print_unknown_command(cmd); } diff --git a/cli/commands/automation/automation.c b/cli/commands/automation/automation.c index 113393130e5..19cf58f8ecf 100644 --- a/cli/commands/automation/automation.c +++ b/cli/commands/automation/automation.c @@ -12,6 +12,7 @@ #endif #define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY "QWERTY" #define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY "AZERTY" +#define TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ "QWERTZ" #define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT_PREFIX "-k" #define TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT "layout" @@ -44,6 +45,7 @@ void totp_cli_command_automation_docopt_options() { DOCOPT_ARGUMENT( TOTP_CLI_COMMAND_AUTOMATION_ARG_KB_LAYOUT)) " Automation keyboard layout. Must be one of: " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTY ", " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY + ", " TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ "\r\n"); } #endif @@ -83,6 +85,9 @@ static void print_kb_layout(AutomationKeyboardLayout layout, const char* color) case AutomationKeyboardLayoutAZERTY: layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY; break; + case AutomationKeyboardLayoutQWERTZ: + layoutToPrint = TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ; + break; default: furi_crash("Unknown automation keyboard layout"); break; @@ -98,6 +103,8 @@ static bool *out = AutomationKeyboardLayoutQWERTY; } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_AZERTY) == 0) { *out = AutomationKeyboardLayoutAZERTY; + } else if(furi_string_cmpi_str(str, TOTP_CLI_COMMAND_AUTOMATION_LAYOUT_QWERTZ) == 0) { + *out = AutomationKeyboardLayoutQWERTZ; } else { result = false; } diff --git a/cli/commands/help/help.c b/cli/commands/help/help.c index e5519d0436f..afb21468d74 100644 --- a/cli/commands/help/help.c +++ b/cli/commands/help/help.c @@ -11,6 +11,7 @@ #include "../reset/reset.h" #include "../automation/automation.h" #include "../details/details.h" +#include "../version/version.h" #ifdef TOTP_CLI_RICH_HELP_ENABLED void totp_cli_command_help_docopt_commands() { @@ -29,6 +30,7 @@ void totp_cli_command_help_handle() { #ifdef TOTP_CLI_RICH_HELP_ENABLED TOTP_CLI_PRINTF("Usage:\r\n"); totp_cli_command_help_docopt_usage(); + totp_cli_command_version_docopt_usage(); totp_cli_command_list_docopt_usage(); totp_cli_command_details_docopt_usage(); totp_cli_command_add_docopt_usage(); @@ -43,6 +45,7 @@ void totp_cli_command_help_handle() { cli_nl(); TOTP_CLI_PRINTF("Commands:\r\n"); totp_cli_command_help_docopt_commands(); + totp_cli_command_version_docopt_commands(); totp_cli_command_list_docopt_commands(); totp_cli_command_details_docopt_commands(); totp_cli_command_add_docopt_commands(); diff --git a/cli/commands/version/version.c b/cli/commands/version/version.c new file mode 100644 index 00000000000..341053107a5 --- /dev/null +++ b/cli/commands/version/version.c @@ -0,0 +1,20 @@ +#include "version.h" +#include "../../cli_helpers.h" +#include "../../../version.h" + +#ifdef TOTP_CLI_RICH_HELP_ENABLED +void totp_cli_command_version_docopt_commands() { + TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_VERSION " Get application version\r\n"); +} +void totp_cli_command_version_docopt_usage() { + TOTP_CLI_PRINTF(" " TOTP_CLI_COMMAND_NAME " " TOTP_CLI_COMMAND_VERSION "\r\n"); +} +#endif + +void totp_cli_command_version_handle() { + TOTP_CLI_PRINTF( + "%" PRIu8 ".%" PRIu8 ".%" PRIu8 "\r\n", + TOTP_APP_VERSION_MAJOR, + TOTP_APP_VERSION_MINOR, + TOTP_APP_VERSION_PATCH); +} \ No newline at end of file diff --git a/cli/commands/version/version.h b/cli/commands/version/version.h new file mode 100644 index 00000000000..b3a21d9767a --- /dev/null +++ b/cli/commands/version/version.h @@ -0,0 +1,11 @@ +#pragma once + +#include "../../../config/app/config.h" + +#define TOTP_CLI_COMMAND_VERSION "version" + +void totp_cli_command_version_handle(); +#ifdef TOTP_CLI_RICH_HELP_ENABLED +void totp_cli_command_version_docopt_commands(); +void totp_cli_command_version_docopt_usage(); +#endif \ No newline at end of file diff --git a/types/automation_kb_layout.h b/types/automation_kb_layout.h index 9c23e91ab44..c86569f464b 100644 --- a/types/automation_kb_layout.h +++ b/types/automation_kb_layout.h @@ -4,5 +4,6 @@ typedef uint8_t AutomationKeyboardLayout; enum AutomationKeyboardLayouts { AutomationKeyboardLayoutQWERTY = 0, - AutomationKeyboardLayoutAZERTY = 1 + AutomationKeyboardLayoutAZERTY = 1, + AutomationKeyboardLayoutQWERTZ = 2 }; \ No newline at end of file diff --git a/ui/scenes/app_settings/totp_app_settings.c b/ui/scenes/app_settings/totp_app_settings.c index 252829432f0..b0580a05f0e 100644 --- a/ui/scenes/app_settings/totp_app_settings.c +++ b/ui/scenes/app_settings/totp_app_settings.c @@ -20,7 +20,7 @@ #else #define AUTOMATION_LIST_MAX_INDEX (1) #endif -#define BAD_KB_LAYOUT_LIST_MAX_INDEX (1) +#define BAD_KB_LAYOUT_LIST_MAX_INDEX (2) #define FONT_TEST_STR_LENGTH (7) static const char* YES_NO_LIST[] = {"NO", "YES"}; @@ -33,7 +33,7 @@ static const char* AUTOMATION_LIST[] = { "BT and USB" #endif }; -static const char* BAD_KB_LAYOUT_LIST[] = {"QWERTY", "AZERTY"}; +static const char* BAD_KB_LAYOUT_LIST[] = {"QWERTY", "AZERTY", "QWERTZ"}; static const char* FONT_TEST_STR = "0123BCD"; typedef enum { diff --git a/workers/type_code_common.c b/workers/type_code_common.c index 122c0b2a513..bd454438110 100644 --- a/workers/type_code_common.c +++ b/workers/type_code_common.c @@ -25,6 +25,16 @@ static const uint8_t hid_azerty_keys_map[HID_KEYS_MAP_LENGTH] = { HID_KEYBOARD_U, HID_KEYBOARD_V, HID_KEYBOARD_Z, HID_KEYBOARD_X, HID_KEYBOARD_Y, HID_KEYBOARD_W}; +static const uint8_t hid_qwertz_keys_map[HID_KEYS_MAP_LENGTH] = { + HID_KEYBOARD_0, HID_KEYBOARD_1, HID_KEYBOARD_2, HID_KEYBOARD_3, HID_KEYBOARD_4, + HID_KEYBOARD_5, HID_KEYBOARD_6, HID_KEYBOARD_7, HID_KEYBOARD_8, HID_KEYBOARD_9, + HID_KEYBOARD_A, HID_KEYBOARD_B, HID_KEYBOARD_C, HID_KEYBOARD_D, HID_KEYBOARD_E, + HID_KEYBOARD_F, HID_KEYBOARD_G, HID_KEYBOARD_H, HID_KEYBOARD_I, HID_KEYBOARD_J, + HID_KEYBOARD_K, HID_KEYBOARD_L, HID_KEYBOARD_M, HID_KEYBOARD_N, HID_KEYBOARD_O, + HID_KEYBOARD_P, HID_KEYBOARD_Q, HID_KEYBOARD_R, HID_KEYBOARD_S, HID_KEYBOARD_T, + HID_KEYBOARD_U, HID_KEYBOARD_V, HID_KEYBOARD_W, HID_KEYBOARD_X, HID_KEYBOARD_Z, + HID_KEYBOARD_Y}; + static uint32_t get_keystroke_delay(TokenAutomationFeature features) { if(features & TokenAutomationFeatureTypeSlower) { return 100; @@ -70,6 +80,9 @@ void totp_type_code_worker_execute_automation( case AutomationKeyboardLayoutAZERTY: keyboard_layout_dict = &hid_azerty_keys_map[0]; break; + case AutomationKeyboardLayoutQWERTZ: + keyboard_layout_dict = &hid_qwertz_keys_map[0]; + break; default: return;