diff --git a/Makefile b/Makefile index d97aab5f..543aa3ca 100644 --- a/Makefile +++ b/Makefile @@ -18,127 +18,58 @@ ifeq ($(BOLOS_SDK),) $(error Environment variable BOLOS_SDK is not set) endif - include $(BOLOS_SDK)/Makefile.defines all: default -# Main app configuration - APPNAME = "Recovery Check" APPVERSION_M = 1 -APPVERSION_N = 2 -APPVERSION_P = 3 +APPVERSION_N = 4 +APPVERSION_P = 0 APPVERSION = "$(APPVERSION_M).$(APPVERSION_N).$(APPVERSION_P)" -APP_LOAD_PARAMS = --appFlags 0x10 $(COMMON_LOAD_PARAMS) --curve secp256k1 --path "" +VARIANT_PARAM = NONE +VARIANT_VALUES = recovery_check -ifeq ($(TARGET_NAME), TARGET_NANOS) - ICONNAME=icons/nanos_app_recovery_check.gif -else ifeq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_EUROPA)) - ICONNAME=icons/stax_recovery_check_32px.gif -else - ICONNAME=icons/nanox_app_recovery_check.gif -endif +CURVE_APP_LOAD_PARAMS = secp256k1 +PATH_APP_LOAD_PARAMS = "" +HAVE_APPLICATION_FLAG_DERIVE_MASTER = 1 -# Build configuration +ICON_NANOS = icons/nanos_recovery_check.gif +ICON_NANOSP = icons/nanox_recovery_check.gif +ICON_NANOX = icons/nanox_recovery_check.gif +ICON_STAX = icons/stax_recovery_check.gif +ICON_FLEX = icons/flex_recovery_check.gif -DEFINES += APPVERSION=\"$(APPVERSION)\" -DEFINES += LEDGER_MAJOR_VERSION=$(APPVERSION_M) -DEFINES += LEDGER_MINOR_VERSION=$(APPVERSION_N) -DEFINES += LEDGER_PATCH_VERSION=$(APPVERSION_P) DEFINES += OS_IO_SEPROXYHAL DEFINES += HAVE_WEBUSB WEBUSB_URL_SIZE_B=0 WEBUSB_URL="" - DEFINES += BOLOS_APP_ICON_SIZE_B=\(9+32\) #DEFINES += HAVE_ELECTRUM DEFINES += IO_USB_MAX_ENDPOINTS=4 IO_HID_EP_LENGTH=64 DEFINES += HAVE_SPRINTF -ifneq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_EUROPA)) +ifneq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_FLEX)) $(info Using BAGL) - DEFINES += HAVE_BAGL HAVE_UX_FLOW -else - $(info Using NBGL) - DEFINES += NBGL_KEYBOARD -endif - -ifeq ($(TARGET_NAME), TARGET_NANOS) - DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128 -else - DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 - ifneq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_EUROPA)) + DEFINES += HAVE_BAGL + ifneq ($(TARGET_NAME), TARGET_NANOS) + DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 DEFINES += HAVE_GLO096 DEFINES += BAGL_WIDTH=128 BAGL_HEIGHT=64 DEFINES += HAVE_BAGL_ELLIPSIS # long label truncation feature DEFINES += HAVE_BAGL_FONT_OPEN_SANS_REGULAR_11PX DEFINES += HAVE_BAGL_FONT_OPEN_SANS_EXTRABOLD_11PX DEFINES += HAVE_BAGL_FONT_OPEN_SANS_LIGHT_16PX - DEFINES += HAVE_KEYBOARD_UX - endif -endif - -DEBUG = 0 - -ifneq ($(DEBUG), 0) - $(info DEBUG enabled) - DEFINES += HAVE_IO_USB HAVE_USB_APDU - SDK_SOURCE_PATH += lib_stusb lib_stusb_impl - DEFINES += HAVE_PRINTF - ifeq ($(TARGET_NAME), TARGET_NANOS) - DEFINES += PRINTF=screen_printf else - DEFINES += PRINTF=mcu_usb_printf + DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=128 endif else - DEFINES += PRINTF\(...\)= -endif - -############## -# Compiler # -############## -ifneq ($(BOLOS_ENV),) - $(info BOLOS_ENV=$(BOLOS_ENV)) - CLANGPATH := $(BOLOS_ENV)/clang-arm-fropi/bin/ - GCCPATH := $(BOLOS_ENV)/gcc-arm-none-eabi-5_3-2016q1/bin/ -else - $(info BOLOS_ENV is not set: falling back to CLANGPATH and GCCPATH) -endif -ifeq ($(CLANGPATH),) - $(info CLANGPATH is not set: clang will be used from PATH) -endif -ifeq ($(GCCPATH),) - $(info GCCPATH is not set: arm-none-eabi-* will be used from PATH) + $(info Using NBGL) + DEFINES += IO_SEPROXYHAL_BUFFER_SIZE_B=300 + DEFINES += NBGL_KEYBOARD endif -CC := $(CLANGPATH)clang -CFLAGS += -Wshadow -Wformat -AS := $(GCCPATH)arm-none-eabi-gcc -LD := $(GCCPATH)arm-none-eabi-gcc -LDLIBS += -lm -lgcc -lc - -include $(BOLOS_SDK)/Makefile.glyphs +DEBUG = 0 APP_SOURCE_PATH += src -ifneq ($(TARGET_NAME), TARGET_NANOS) - ifneq ($(TARGET_NAME), $(filter $(TARGET_NAME), TARGET_STAX TARGET_EUROPA)) - SDK_SOURCE_PATH += lib_ux - endif -endif - -# Main rules - -load: all - python -m ledgerblue.loadApp $(APP_LOAD_PARAMS) - -delete: - python -m ledgerblue.deleteApp $(COMMON_DELETE_PARAMS) - -# Import generic rules from the SDK - -include $(BOLOS_SDK)/Makefile.rules - - -listvariants: - @echo VARIANTS APP recovery_check +include $(BOLOS_SDK)/Makefile.standard_app diff --git a/icons/flex_recovery_check.gif b/icons/flex_recovery_check.gif new file mode 100644 index 00000000..5c76b763 Binary files /dev/null and b/icons/flex_recovery_check.gif differ diff --git a/icons/nanos_app_recovery_check.gif b/icons/nanos_recovery_check.gif similarity index 100% rename from icons/nanos_app_recovery_check.gif rename to icons/nanos_recovery_check.gif diff --git a/icons/nanox_app_recovery_check.gif b/icons/nanox_recovery_check.gif similarity index 100% rename from icons/nanox_app_recovery_check.gif rename to icons/nanox_recovery_check.gif diff --git a/icons/recovery_check.png b/icons/recovery_check.png deleted file mode 100644 index d400474a..00000000 Binary files a/icons/recovery_check.png and /dev/null differ diff --git a/icons/stax_recovery_check_32px.gif b/icons/stax_recovery_check.gif similarity index 100% rename from icons/stax_recovery_check_32px.gif rename to icons/stax_recovery_check.gif diff --git a/ledger_app.toml b/ledger_app.toml index 2b7b03a5..4d721eae 100644 --- a/ledger_app.toml +++ b/ledger_app.toml @@ -1,7 +1,7 @@ [app] build_directory = "./" sdk = "C" -devices = ["nanos", "nanox", "nanos+", "stax"] +devices = ["nanos", "nanox", "nanos+", "stax", "flex"] [tests] unit_directory = "./tests/unit" diff --git a/src/main.c b/src/app_main.c similarity index 69% rename from src/main.c rename to src/app_main.c index 56535b8a..f651201d 100644 --- a/src/main.c +++ b/src/app_main.c @@ -25,43 +25,26 @@ extern enum UI_STATE uiState; #endif -bolos_ux_params_t G_ux_params; -unsigned char G_io_seproxyhal_spi_buffer[IO_SEPROXYHAL_BUFFER_SIZE_B]; - static unsigned int current_text_pos; // parsing cursor in the text to display static unsigned int text_y; // current location of the displayed text // UI currently displayed enum UI_STATE { UI_IDLE, UI_TEXT, UI_APPROVAL }; -unsigned short io_exchange_al(unsigned char channel, unsigned short tx_len) { - switch (channel & ~(IO_FLAGS)) { - case CHANNEL_KEYBOARD: - break; - - // multiplexed io exchange over a SPI channel and TLV encapsulated protocol - case CHANNEL_SPI: - if (tx_len) { - io_seproxyhal_spi_send(G_io_apdu_buffer, tx_len); - - if (channel & IO_RESET_AFTER_REPLIED) { - reset(); - } - return 0; // nothing received from the master so far (it's a tx - // transaction) - } else { - return io_seproxyhal_spi_recv(G_io_apdu_buffer, sizeof(G_io_apdu_buffer), 0); - } +void app_main(void) { + current_text_pos = 0; + text_y = 60; +#if defined(HAVE_BAGL) + uiState = UI_IDLE; +#endif - default: - THROW(INVALID_PARAMETER); - } - return 0; -} +#if defined(HAVE_NBGL) + nbgl_objInit(); +#elif defined(HAVE_BAGL) + UX_INIT(); +#endif -static void sample_main(void) { - // next timer callback in 500 ms - // UX_CALLBACK_SET_INTERVAL(500); + ui_idle_init(); uint8_t flags = 0; @@ -99,7 +82,7 @@ unsigned char io_event(unsigned char channel __attribute__((unused))) { UX_DISPLAYED_EVENT(); } } -#elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) +#elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_FATSTACKS) UX_DISPLAYED_EVENT({}); #elif defined(HAVE_NBGL) UX_DEFAULT_EVENT(); @@ -129,35 +112,3 @@ unsigned char io_event(unsigned char channel __attribute__((unused))) { // command has been processed, DO NOT reset the current APDU transport return 1; } - -__attribute__((section(".boot"))) int main(void) { - // exit critical section - __asm volatile("cpsie i"); - - current_text_pos = 0; - text_y = 60; -#if defined(HAVE_BAGL) - uiState = UI_IDLE; -#endif - // ensure exception will work as planned - os_boot(); - -#if defined(HAVE_NBGL) - nbgl_objInit(); -#elif defined(HAVE_BAGL) - UX_INIT(); -#endif - - BEGIN_TRY { - TRY { - io_seproxyhal_init(); - ui_idle_init(); - sample_main(); - } - CATCH_OTHER(e) { - } - FINALLY { - } - } - END_TRY; -} diff --git a/src/nano/nanos_enter_phrase.c b/src/bagl/nanos_enter_phrase.c similarity index 100% rename from src/nano/nanos_enter_phrase.c rename to src/bagl/nanos_enter_phrase.c diff --git a/src/nano/nanox_enter_phrase.c b/src/bagl/nanox_enter_phrase.c similarity index 99% rename from src/nano/nanox_enter_phrase.c rename to src/bagl/nanox_enter_phrase.c index 6615eac0..7cece51f 100644 --- a/src/nano/nanox_enter_phrase.c +++ b/src/bagl/nanox_enter_phrase.c @@ -21,7 +21,7 @@ #include "../constants.h" #include "../ui.h" -#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) +#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_FATSTACKS) const bagl_element_t* screen_onboarding_4_restore_word_before_element_display_callback( const bagl_element_t* element); diff --git a/src/nano/ui_nano.c b/src/bagl/ui.c similarity index 98% rename from src/nano/ui_nano.c rename to src/bagl/ui.c index f34f2c53..a4c8e607 100644 --- a/src/nano/ui_nano.c +++ b/src/bagl/ui.c @@ -10,8 +10,6 @@ enum UI_STATE { UI_IDLE, UI_TEXT, UI_APPROVAL }; enum UI_STATE uiState; -ux_state_t G_ux; - #if defined(TARGET_NANOS) UX_STEP_CB(restore_3_1_1, bb, G_bolos_ux_context.onboarding_kind = MNEMONIC_SIZE_24; @@ -68,7 +66,7 @@ UX_STEP_VALID(ux_idle_flow_4_step, UX_FLOW(ux_idle_flow, &ux_idle_flow_1_step, &ux_idle_flow_3_step, &ux_idle_flow_4_step); -#elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) +#elif defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_FATSTACKS) ////////////////////////////////////////////////////////////////////// diff --git a/src/nano/ux_nano.h b/src/bagl/ux_nano.h similarity index 100% rename from src/nano/ux_nano.h rename to src/bagl/ux_nano.h diff --git a/src/nano/ux_nanos.c b/src/bagl/ux_nanos.c similarity index 100% rename from src/nano/ux_nanos.c rename to src/bagl/ux_nanos.c diff --git a/src/nano/ux_nanos_keyboard.c b/src/bagl/ux_nanos_keyboard.c similarity index 100% rename from src/nano/ux_nanos_keyboard.c rename to src/bagl/ux_nanos_keyboard.c diff --git a/src/nano/ux_nanox.c b/src/bagl/ux_nanox.c similarity index 100% rename from src/nano/ux_nanox.c rename to src/bagl/ux_nanox.c diff --git a/src/nano/ux_nanox_keyboard.c b/src/bagl/ux_nanox_keyboard.c similarity index 99% rename from src/nano/ux_nanox_keyboard.c rename to src/bagl/ux_nanox_keyboard.c index 7f0f922e..d6328d04 100644 --- a/src/nano/ux_nanox_keyboard.c +++ b/src/bagl/ux_nanox_keyboard.c @@ -17,7 +17,7 @@ #include "constants.h" #include "ui.h" -#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) +#if defined(TARGET_NANOX) || defined(TARGET_NANOS2) || defined(TARGET_FATSTACKS) #ifdef OS_IO_SEPROXYHAL diff --git a/src/constants.h b/src/constants.h index 6df9e923..69417e53 100644 --- a/src/constants.h +++ b/src/constants.h @@ -35,7 +35,7 @@ enum { // displayed and using the common string buffer as string parameter #define KEYBOARD_RENDER_WORD \ 3 // callback is called with a -1 when requesting complete word, or the char index else, - // returnin 0 implies no char is to be displayed + // returning 0 implies no char is to be displayed #define RESTORE_WORD_ACTION_REENTER_WORD 0 #define RESTORE_WORD_ACTION_FIRST_WORD 1 diff --git a/src/stax/mnemonic.c b/src/nbgl/mnemonic.c similarity index 96% rename from src/stax/mnemonic.c rename to src/nbgl/mnemonic.c index 2f51e52a..8db63bc2 100644 --- a/src/stax/mnemonic.c +++ b/src/nbgl/mnemonic.c @@ -58,7 +58,7 @@ bool remove_word_from_mnemonic() { mnemonic.current_word_index--; // removing previous word from mnemonic buffer (+ 1 blank space) mnemonic_shrink(current_length + 1); - PRINTF("Number of remaining words in the mnemonic: '%ld'\n", mnemonic.current_word_index + 1); + PRINTF("Number of remaining words in the mnemonic: '%d'\n", mnemonic.current_word_index + 1); return true; } diff --git a/src/stax/mnemonic.h b/src/nbgl/mnemonic.h similarity index 100% rename from src/stax/mnemonic.h rename to src/nbgl/mnemonic.h diff --git a/src/stax/passphrase_length_screen.c b/src/nbgl/passphrase_length_screen.c similarity index 97% rename from src/stax/passphrase_length_screen.c rename to src/nbgl/passphrase_length_screen.c index db9c5573..11c44fca 100644 --- a/src/stax/passphrase_length_screen.c +++ b/src/nbgl/passphrase_length_screen.c @@ -5,9 +5,9 @@ #include -#define UPPER_MARGIN 4 -#define ICON_X 0 -#define ICON_Y 148 +#define UPPER_MARGIN 4 +#define ICON_X 0 +#define ICON_Y 148 nbgl_image_t *passphrase_length_set_icon() { nbgl_image_t *image = (nbgl_image_t *) nbgl_objPoolGet(IMAGE, 0); diff --git a/src/stax/passphrase_length_screen.h b/src/nbgl/passphrase_length_screen.h similarity index 100% rename from src/stax/passphrase_length_screen.h rename to src/nbgl/passphrase_length_screen.h diff --git a/src/stax/ui_stax.c b/src/nbgl/ui.c similarity index 77% rename from src/stax/ui_stax.c rename to src/nbgl/ui.c index 1eb6727f..28c7e2ae 100644 --- a/src/stax/ui_stax.c +++ b/src/nbgl/ui.c @@ -56,7 +56,7 @@ static void on_quit(void) { * About menu */ static const char *const infoTypes[] = {"Version", "Recovery Check"}; -static const char *const infoContents[] = {APPVERSION, "(c) 2023 Ledger"}; +static const char *const infoContents[] = {APPVERSION, "(c) 2018-2024 Ledger"}; static bool on_infos(uint8_t page, nbgl_pageContent_t *content) { if (page == 0) { @@ -140,7 +140,7 @@ static void passphrase_length_page(void) { #define BUTTON_VMARGIN 32 static char textToEnter[MAX_WORD_LENGTH + 1] = {0}; -static int textIndex, suggestionIndex, keyboardIndex = 0; +static int keyboardIndex = 0; // the biggest word of BIP39 list is 8 char (9 with trailing '\0'), and // the max number of showed suggestions is NB_MAX_SUGGESTION_BUTTONS static char wordCandidates[(MAX_WORD_LENGTH + 1) * NB_MAX_SUGGESTION_BUTTONS] = {0}; @@ -172,6 +172,7 @@ static void keyboard_dispatcher(const int token, uint8_t index __attribute__((un static void key_press_callback(const char touchedKey) { size_t textLen = 0; uint32_t mask = 0; + // Update word currently displayed const size_t previousTextLen = strlen(textToEnter); if (touchedKey == BACKSPACE_KEY) { if (previousTextLen == 0) { @@ -184,24 +185,44 @@ static void key_press_callback(const char touchedKey) { textToEnter[previousTextLen + 1] = '\0'; textLen = previousTextLen + 1; } + + // Update the screen (written word, suggestions, ...) + nbgl_layoutSuggestionButtons_t suggestionButtons = { + .buttons = PIC(buttonTexts), + .firstButtonToken = FIRST_SUGGESTION_TOKEN, + .nbUsedButtons = 0, + }; + nbgl_layoutKeyboardContent_t keyboardContent = { + .type = KEYBOARD_WITH_SUGGESTIONS, + .title = PIC(headerText), + .text = PIC(textToEnter), + .numbered = true, + .number = get_current_word_number() + 1, + .grayedOut = false, + .textToken = KBD_TEXT_TOKEN, + .suggestionButtons = suggestionButtons, + .tuneId = TUNE_TAP_CASUAL, + }; PRINTF("Current text is: '%s' (size '%d')\n", textToEnter, textLen); - if (textLen == 0) { - // no suggestion until there is at least 2 characters - nbgl_layoutUpdateSuggestionButtons(layout, suggestionIndex, 0, buttonTexts); + + if (textLen < 2) { + // Suggestions only when the word contains 2+ letters + nbgl_layoutUpdateKeyboardContent(layout, &keyboardContent); } else { const size_t nbMatchingWords = bolos_ux_bip39_fill_with_candidates((unsigned char *) &(textToEnter[0]), strlen(textToEnter), wordCandidates, buttonTexts); - nbgl_layoutUpdateSuggestionButtons(layout, suggestionIndex, nbMatchingWords, buttonTexts); + keyboardContent.suggestionButtons.nbUsedButtons = nbMatchingWords; + nbgl_layoutUpdateKeyboardContent(layout, &keyboardContent); } if (textLen > 0) { mask = bolos_ux_bip39_get_keyboard_mask((unsigned char *) &(textToEnter[0]), strlen(textToEnter)); } + nbgl_layoutDraw(layout); nbgl_layoutUpdateKeyboard(layout, keyboardIndex, mask, false, LOWER_CASE); - nbgl_layoutUpdateEnteredText(layout, textIndex, false, 0, &(textToEnter[0]), false); nbgl_refreshSpecialWithPostRefresh(BLACK_AND_WHITE_REFRESH, POST_REFRESH_FORCE_POWER_ON); } @@ -212,13 +233,6 @@ static void display_keyboard_page() { .mode = MODE_LETTERS, // start in letters mode .keyMask = 0, // no inactive key .callback = &key_press_callback}; - nbgl_layoutCenteredInfo_t centeredInfo = {.text1 = NULL, - .text2 = headerText, // to use as "header" - .text3 = NULL, - .style = LARGE_CASE_INFO, - .icon = NULL, - .offsetY = 0, - .onTop = true}; textToEnter[0] = '\0'; memset(buttonTexts, 0, sizeof(buttonTexts[0]) * NB_MAX_SUGGESTION_BUTTONS); layout = nbgl_layoutGet(&layoutDescription); @@ -227,21 +241,33 @@ static void display_keyboard_page() { "Enter word n. %d/%d from your\nRecovery Sheet", get_current_word_number() + 1, get_mnemonic_final_size()); - nbgl_layoutAddProgressIndicator(layout, 0, 0, true, BACK_BUTTON_TOKEN, TUNE_TAP_CASUAL); - nbgl_layoutAddCenteredInfo(layout, ¢eredInfo); + + nbgl_layoutHeader_t headerDesc = {.type = HEADER_BACK_AND_TEXT, + .separationLine = false, + .backAndText.token = BACK_BUTTON_TOKEN, + .backAndText.tuneId = TUNE_TAP_CASUAL, + .backAndText.text = NULL}; + nbgl_layoutAddHeader(layout, &headerDesc); + keyboardIndex = nbgl_layoutAddKeyboard(layout, &kbdInfo); - suggestionIndex = nbgl_layoutAddSuggestionButtons(layout, - 0, // no used buttons at start-up - buttonTexts, - FIRST_SUGGESTION_TOKEN, - TUNE_TAP_CASUAL); - textIndex = nbgl_layoutAddEnteredText(layout, - true, // numbered - get_current_word_number() + 1, // number to use - textToEnter, // text to display - false, // not grayed-out - BUTTON_VMARGIN, // vertical margin from the buttons - KBD_TEXT_TOKEN); + + nbgl_layoutSuggestionButtons_t suggestionButtons = { + .buttons = PIC(buttonTexts), + .firstButtonToken = FIRST_SUGGESTION_TOKEN, + .nbUsedButtons = 0, + }; + nbgl_layoutKeyboardContent_t keyboardContent = { + .type = KEYBOARD_WITH_SUGGESTIONS, + .title = PIC(headerText), + .text = PIC(textToEnter), + .numbered = true, + .number = get_current_word_number() + 1, + .grayedOut = false, + .textToken = KBD_TEXT_TOKEN, + .suggestionButtons = suggestionButtons, + .tuneId = TUNE_TAP_CASUAL, + }; + nbgl_layoutAddKeyboardContent(layout, &keyboardContent); nbgl_layoutDraw(layout); } @@ -257,8 +283,13 @@ static void display_home_page() { reset_globals(); nbgl_useCaseHomeExt("Recovery Check", &C_stax_recovery_check_64px, - "This app lets you enter a\nSecret Recovery Phrase and\ntest if it matches " - "the one\npresent on this Ledger Stax", +#if defined(TARGET_STAX) + "This app lets you enter a Secret Recovery Phrase and test if it matches " + "the one present on this Ledger Stax", +#elif defined(TARGET_FLEX) + "Enter a Recovery Phrase and test if it matches " + "the one present on this Ledger Flex", +#endif false, "Start check", passphrase_length_page, @@ -266,15 +297,21 @@ static void display_home_page() { on_quit); } +#if defined(TARGET_STAX) +#define DEVICE "Ledger Stax" +#elif defined(TARGET_FLEX) +#define DEVICE "Ledger Flex" +#endif + /* * Result page */ static const char *possible_results[2][2] = { {"Incorrect Secret\nRecovery Phrase", - "The Recovery Phrase you have\nentered doesn't match the one\npresent on this Ledger Stax."}, + "The Recovery Phrase you have\nentered doesn't match the one\npresent on this " DEVICE "."}, {"Correct Secret\nRecovery Phrase", - "The Recovery Phrase you have\nentered matches the one\npresent on this Ledger Stax."}}; -static const nbgl_icon_details_t *icons[2] = {&C_warning64px, &C_round_check_64px}; + "The Recovery Phrase you have\nentered matches the one\npresent on this " DEVICE "."}}; +static const nbgl_icon_details_t *icons[2] = {&WARNING_ICON, &VALIDATE_ICON}; static void result_callback(int token __attribute__((unused)), uint8_t index __attribute__((unused))) { diff --git a/src/ui.h b/src/ui.h index c9d7dbcc..8dc5dcca 100644 --- a/src/ui.h +++ b/src/ui.h @@ -20,7 +20,7 @@ #if defined(TARGET_NANOS) || defined(TARGET_NANOX) || defined(TARGET_NANOS2) -#include "nano/ux_nano.h" +#include "bagl/ux_nano.h" #endif diff --git a/src/ux_common/onboarding_seed_bip39.c b/src/ux_common/onboarding_seed_bip39.c index a21f37ff..e78c28c4 100644 --- a/src/ux_common/onboarding_seed_bip39.c +++ b/src/ux_common/onboarding_seed_bip39.c @@ -240,7 +240,7 @@ size_t bolos_ux_bip39_fill_with_candidates(const unsigned char* startingChars, uint32_t bolos_ux_bip39_get_keyboard_mask(const unsigned char* prefix, const unsigned int prefixLength) { - uint32_t existing_mask = 0; + uint32_t existing_mask = 1 << 28; // Starting with the 'return' keypad activated unsigned char next_letters[ALPHABET_LENGTH] = {0}; PRINTF("Looking for letter candidates following '%s'\n", prefix); const size_t nb_letters = diff --git a/tests/functional/app.py b/tests/functional/app.py index d2cfc743..9b3299b7 100644 --- a/tests/functional/app.py +++ b/tests/functional/app.py @@ -1,19 +1,24 @@ -from ragger.firmware.nbgl.layouts import CenteredFooter, Element, LetterOnlyKeyboard, \ +from ragger.firmware import Firmware +from ragger.firmware.touch.layouts import CenteredFooter, Element, LetterOnlyKeyboard, \ NavigationHeader, Suggestions -from ragger.firmware.nbgl.use_cases import UseCaseHomeExt, UseCaseSettings -from ragger.firmware.nbgl.screen import MetaScreen +from ragger.firmware.touch.use_cases import UseCaseHomeExt, UseCaseSettings +from ragger.firmware.touch.screen import MetaScreen class CustomChoiceList(Element): - def choose(self, index: int): + def choose(self, index: int, firmware: Firmware): assert 1 <= index <= 6, "Choice index must be in [1, 6]" - x, y = (200, 430) - diff = 80 + if firmware == Firmware.STAX: + x, y = (200, 430) + diff = 80 + if firmware == Firmware.FLEX: + x, y = (240, 330) + diff = 100 self.client.finger_touch(x, y + (index - 1)*diff) -class StaxScreen(metaclass=MetaScreen): +class TouchScreen(metaclass=MetaScreen): # choosing the length a the passphrase. 3 choices layout_choice_list = CustomChoiceList # entering words diff --git a/tests/functional/conftest.py b/tests/functional/conftest.py index a140d9e8..e9a3f5dc 100644 --- a/tests/functional/conftest.py +++ b/tests/functional/conftest.py @@ -4,7 +4,7 @@ from ragger.conftest import configuration from ragger.firmware import Firmware -from .navigator import StaxNavigator +from .navigator import TouchNavigator ########################### @@ -30,6 +30,6 @@ def functional_test_directory() -> Path: @fixture -def navigator(backend: BackendInterface, firmware: Firmware) -> StaxNavigator: - navigator = StaxNavigator(backend, firmware) +def navigator(backend: BackendInterface, firmware: Firmware, golden_run: bool) -> TouchNavigator: + navigator = TouchNavigator(backend, firmware, golden_run) yield navigator diff --git a/tests/functional/navigator.py b/tests/functional/navigator.py index 7eae2509..02863848 100644 --- a/tests/functional/navigator.py +++ b/tests/functional/navigator.py @@ -4,7 +4,7 @@ from ragger.navigator.navigator import Navigator from time import sleep -from .app import StaxScreen +from .app import TouchScreen class CustomNavInsID(Enum): @@ -30,10 +30,10 @@ class CustomNavInsID(Enum): RESULT_TO_HOME = auto() -class StaxNavigator(Navigator): +class TouchNavigator(Navigator): - def __init__(self, backend, firmware): - self.screen = StaxScreen(backend, firmware) + def __init__(self, backend, firmware, golden_run=False): + self.screen = TouchScreen(backend, firmware) callbacks = { # has to be defined for Ragger Navigator internals @@ -44,16 +44,16 @@ def __init__(self, backend, firmware): CustomNavInsID.HOME_TO_QUIT: self.screen.home.quit, CustomNavInsID.HOME_TO_CHECK: self.screen.home.action, CustomNavInsID.SETTINGS_TO_HOME: self.screen.settings.single_page_exit, - CustomNavInsID.LENGTH_CHOOSE_24: partial(self.screen.choice_list.choose, 1), - CustomNavInsID.LENGTH_CHOOSE_18: partial(self.screen.choice_list.choose, 2), - CustomNavInsID.LENGTH_CHOOSE_12: partial(self.screen.choice_list.choose, 3), + CustomNavInsID.LENGTH_CHOOSE_24: partial(self.screen.choice_list.choose, 1, firmware), + CustomNavInsID.LENGTH_CHOOSE_18: partial(self.screen.choice_list.choose, 2, firmware), + CustomNavInsID.LENGTH_CHOOSE_12: partial(self.screen.choice_list.choose, 3, firmware), CustomNavInsID.LENGTH_TO_PREVIOUS: self.screen.navigation.tap, CustomNavInsID.KEYBOARD_TO_PREVIOUS: self.screen.navigation.tap, CustomNavInsID.KEYBOARD_WRITE: self._write, CustomNavInsID.KEYBOARD_SELECT_SUGGESTION: self.screen.suggestions.choose, CustomNavInsID.RESULT_TO_HOME: self.screen.dismiss.tap } - super().__init__(backend, firmware, callbacks) #, golden_run=True) + super().__init__(backend, firmware, callbacks, golden_run=golden_run) def _write(self, characters: str): # keyboard write is not an exact science on Ragger for now. The instruction together with diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00000.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00000.png new file mode 120000 index 00000000..45a96fe4 --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00000.png @@ -0,0 +1 @@ +../welcome.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00001.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00001.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00001.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00002.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00002.png new file mode 120000 index 00000000..3bb0c985 --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00002.png @@ -0,0 +1 @@ +../first_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00003.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00003.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00003.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00004.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00004.png new file mode 120000 index 00000000..9f68a777 --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00004.png @@ -0,0 +1 @@ +../first_18.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00005.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00005.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00005.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00006.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00006.png new file mode 120000 index 00000000..61e7b110 --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00006.png @@ -0,0 +1 @@ +../first_12.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_all_passphrase_lengths/00007.png b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00007.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_all_passphrase_lengths/00007.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_info_then_leave/00000.png b/tests/functional/snapshots/flex/check_info_then_leave/00000.png new file mode 120000 index 00000000..45a96fe4 --- /dev/null +++ b/tests/functional/snapshots/flex/check_info_then_leave/00000.png @@ -0,0 +1 @@ +../welcome.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_info_then_leave/00001.png b/tests/functional/snapshots/flex/check_info_then_leave/00001.png new file mode 120000 index 00000000..126b82a0 --- /dev/null +++ b/tests/functional/snapshots/flex/check_info_then_leave/00001.png @@ -0,0 +1 @@ +../info.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_info_then_leave/00002.png b/tests/functional/snapshots/flex/check_info_then_leave/00002.png new file mode 120000 index 00000000..45a96fe4 --- /dev/null +++ b/tests/functional/snapshots/flex/check_info_then_leave/00002.png @@ -0,0 +1 @@ +../welcome.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00000.png b/tests/functional/snapshots/flex/check_previous_word/00000.png new file mode 120000 index 00000000..45a96fe4 --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00000.png @@ -0,0 +1 @@ +../welcome.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00001.png b/tests/functional/snapshots/flex/check_previous_word/00001.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00001.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00002.png b/tests/functional/snapshots/flex/check_previous_word/00002.png new file mode 120000 index 00000000..3bb0c985 --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00002.png @@ -0,0 +1 @@ +../first_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00003.png b/tests/functional/snapshots/flex/check_previous_word/00003.png new file mode 100644 index 00000000..fe0aeb50 Binary files /dev/null and b/tests/functional/snapshots/flex/check_previous_word/00003.png differ diff --git a/tests/functional/snapshots/flex/check_previous_word/00004.png b/tests/functional/snapshots/flex/check_previous_word/00004.png new file mode 120000 index 00000000..f5978ebe --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00004.png @@ -0,0 +1 @@ +../second_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00005.png b/tests/functional/snapshots/flex/check_previous_word/00005.png new file mode 100644 index 00000000..f7987baa Binary files /dev/null and b/tests/functional/snapshots/flex/check_previous_word/00005.png differ diff --git a/tests/functional/snapshots/flex/check_previous_word/00006.png b/tests/functional/snapshots/flex/check_previous_word/00006.png new file mode 120000 index 00000000..c449407f --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00006.png @@ -0,0 +1 @@ +../third_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00007.png b/tests/functional/snapshots/flex/check_previous_word/00007.png new file mode 120000 index 00000000..f5978ebe --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00007.png @@ -0,0 +1 @@ +../second_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00008.png b/tests/functional/snapshots/flex/check_previous_word/00008.png new file mode 120000 index 00000000..3bb0c985 --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00008.png @@ -0,0 +1 @@ +../first_24.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00009.png b/tests/functional/snapshots/flex/check_previous_word/00009.png new file mode 120000 index 00000000..0bc6085b --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00009.png @@ -0,0 +1 @@ +../passphrase_length.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/check_previous_word/00010.png b/tests/functional/snapshots/flex/check_previous_word/00010.png new file mode 120000 index 00000000..45a96fe4 --- /dev/null +++ b/tests/functional/snapshots/flex/check_previous_word/00010.png @@ -0,0 +1 @@ +../welcome.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/correct.png b/tests/functional/snapshots/flex/correct.png new file mode 100644 index 00000000..662e2d72 Binary files /dev/null and b/tests/functional/snapshots/flex/correct.png differ diff --git a/tests/functional/snapshots/flex/first_12.png b/tests/functional/snapshots/flex/first_12.png new file mode 100644 index 00000000..d6af699d Binary files /dev/null and b/tests/functional/snapshots/flex/first_12.png differ diff --git a/tests/functional/snapshots/flex/first_18.png b/tests/functional/snapshots/flex/first_18.png new file mode 100644 index 00000000..a7ae9a9b Binary files /dev/null and b/tests/functional/snapshots/flex/first_18.png differ diff --git a/tests/functional/snapshots/flex/first_24.png b/tests/functional/snapshots/flex/first_24.png new file mode 100644 index 00000000..16964f50 Binary files /dev/null and b/tests/functional/snapshots/flex/first_24.png differ diff --git a/tests/functional/snapshots/flex/incorrect.png b/tests/functional/snapshots/flex/incorrect.png new file mode 100644 index 00000000..bf3fe960 Binary files /dev/null and b/tests/functional/snapshots/flex/incorrect.png differ diff --git a/tests/functional/snapshots/flex/info.png b/tests/functional/snapshots/flex/info.png new file mode 100644 index 00000000..1cf2a1da Binary files /dev/null and b/tests/functional/snapshots/flex/info.png differ diff --git a/tests/functional/snapshots/flex/nominal_full_passphrase_check_error_wrong_passphrase/00000.png b/tests/functional/snapshots/flex/nominal_full_passphrase_check_error_wrong_passphrase/00000.png new file mode 120000 index 00000000..c228d034 --- /dev/null +++ b/tests/functional/snapshots/flex/nominal_full_passphrase_check_error_wrong_passphrase/00000.png @@ -0,0 +1 @@ +../incorrect.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/nominal_full_passphrase_check_ok/00000.png b/tests/functional/snapshots/flex/nominal_full_passphrase_check_ok/00000.png new file mode 120000 index 00000000..eeacb4c2 --- /dev/null +++ b/tests/functional/snapshots/flex/nominal_full_passphrase_check_ok/00000.png @@ -0,0 +1 @@ +../correct.png \ No newline at end of file diff --git a/tests/functional/snapshots/flex/passphrase_length.png b/tests/functional/snapshots/flex/passphrase_length.png new file mode 100644 index 00000000..f65d62cf Binary files /dev/null and b/tests/functional/snapshots/flex/passphrase_length.png differ diff --git a/tests/functional/snapshots/flex/second_24.png b/tests/functional/snapshots/flex/second_24.png new file mode 100644 index 00000000..2f6e8eed Binary files /dev/null and b/tests/functional/snapshots/flex/second_24.png differ diff --git a/tests/functional/snapshots/flex/third_24.png b/tests/functional/snapshots/flex/third_24.png new file mode 100644 index 00000000..c788d5bc Binary files /dev/null and b/tests/functional/snapshots/flex/third_24.png differ diff --git a/tests/functional/snapshots/flex/welcome.png b/tests/functional/snapshots/flex/welcome.png new file mode 100644 index 00000000..bd14257c Binary files /dev/null and b/tests/functional/snapshots/flex/welcome.png differ diff --git a/tests/functional/snapshots/stax/check_previous_word/00003.png b/tests/functional/snapshots/stax/check_previous_word/00003.png index 0720b025..7dcef236 100644 Binary files a/tests/functional/snapshots/stax/check_previous_word/00003.png and b/tests/functional/snapshots/stax/check_previous_word/00003.png differ diff --git a/tests/functional/snapshots/stax/check_previous_word/00005.png b/tests/functional/snapshots/stax/check_previous_word/00005.png index 24cdb16d..b57f1694 100644 Binary files a/tests/functional/snapshots/stax/check_previous_word/00005.png and b/tests/functional/snapshots/stax/check_previous_word/00005.png differ diff --git a/tests/functional/snapshots/stax/correct.png b/tests/functional/snapshots/stax/correct.png index e986f595..3c918987 100644 Binary files a/tests/functional/snapshots/stax/correct.png and b/tests/functional/snapshots/stax/correct.png differ diff --git a/tests/functional/snapshots/stax/first_12.png b/tests/functional/snapshots/stax/first_12.png index f8c75cb5..23de5bd4 100644 Binary files a/tests/functional/snapshots/stax/first_12.png and b/tests/functional/snapshots/stax/first_12.png differ diff --git a/tests/functional/snapshots/stax/first_18.png b/tests/functional/snapshots/stax/first_18.png index bd8ca587..a81c9a20 100644 Binary files a/tests/functional/snapshots/stax/first_18.png and b/tests/functional/snapshots/stax/first_18.png differ diff --git a/tests/functional/snapshots/stax/first_24.png b/tests/functional/snapshots/stax/first_24.png index f681254f..40b4c01a 100644 Binary files a/tests/functional/snapshots/stax/first_24.png and b/tests/functional/snapshots/stax/first_24.png differ diff --git a/tests/functional/snapshots/stax/incorrect.png b/tests/functional/snapshots/stax/incorrect.png index 7d74653e..c8894fb6 100644 Binary files a/tests/functional/snapshots/stax/incorrect.png and b/tests/functional/snapshots/stax/incorrect.png differ diff --git a/tests/functional/snapshots/stax/info.png b/tests/functional/snapshots/stax/info.png index c25c6e8d..dfff384b 100644 Binary files a/tests/functional/snapshots/stax/info.png and b/tests/functional/snapshots/stax/info.png differ diff --git a/tests/functional/snapshots/stax/passphrase_length.png b/tests/functional/snapshots/stax/passphrase_length.png index 3a385fc0..7305557b 100644 Binary files a/tests/functional/snapshots/stax/passphrase_length.png and b/tests/functional/snapshots/stax/passphrase_length.png differ diff --git a/tests/functional/snapshots/stax/second_24.png b/tests/functional/snapshots/stax/second_24.png index 471a2439..b0cc3101 100644 Binary files a/tests/functional/snapshots/stax/second_24.png and b/tests/functional/snapshots/stax/second_24.png differ diff --git a/tests/functional/snapshots/stax/third_24.png b/tests/functional/snapshots/stax/third_24.png index 6b5a209e..86a598c5 100644 Binary files a/tests/functional/snapshots/stax/third_24.png and b/tests/functional/snapshots/stax/third_24.png differ diff --git a/tests/functional/snapshots/stax/welcome.png b/tests/functional/snapshots/stax/welcome.png index de43460d..ba59c1ea 100644 Binary files a/tests/functional/snapshots/stax/welcome.png and b/tests/functional/snapshots/stax/welcome.png differ diff --git a/tests/functional/test_fatstacks_full.py b/tests/functional/test_touch_full.py similarity index 90% rename from tests/functional/test_fatstacks_full.py rename to tests/functional/test_touch_full.py index f4827f81..e678c56f 100644 --- a/tests/functional/test_fatstacks_full.py +++ b/tests/functional/test_touch_full.py @@ -1,6 +1,6 @@ from ragger.navigator import NavIns -from .navigator import CustomNavInsID, StaxNavigator +from .navigator import CustomNavInsID, TouchNavigator from .utils import format_instructions @@ -9,7 +9,7 @@ "seven myth punch hobby comfort wild raise skin" -def test_nominal_full_passphrase_check_ok(navigator: StaxNavigator, functional_test_directory: str): +def test_nominal_full_passphrase_check_ok(navigator: TouchNavigator, functional_test_directory: str): # instructions to go the the keyboard instructions = [ CustomNavInsID.HOME_TO_CHECK, @@ -41,7 +41,7 @@ def test_nominal_full_passphrase_check_ok(navigator: StaxNavigator, functional_t screen_change_after_last_instruction=False) -def test_nominal_full_passphrase_check_error_wrong_passphrase(navigator: StaxNavigator, functional_test_directory: str): +def test_nominal_full_passphrase_check_error_wrong_passphrase(navigator: TouchNavigator, functional_test_directory: str): # instructions to go the the keyboard instructions = [ CustomNavInsID.HOME_TO_CHECK, @@ -51,7 +51,7 @@ def test_nominal_full_passphrase_check_error_wrong_passphrase(navigator: StaxNav for word in SPECULOS_MNEMONIC.split()[:12]: instructions += [ # test is designed to fail, so the first character is enough to select a word - NavIns(CustomNavInsID.KEYBOARD_WRITE, args=(word[0], )), + NavIns(CustomNavInsID.KEYBOARD_WRITE, args=(word[0:2], )), NavIns(CustomNavInsID.KEYBOARD_SELECT_SUGGESTION, args=(1, )), ] instructions = format_instructions(instructions) diff --git a/tests/functional/test_fatstacks_options.py b/tests/functional/test_touch_options.py similarity index 87% rename from tests/functional/test_fatstacks_options.py rename to tests/functional/test_touch_options.py index cc148dd2..8b005325 100644 --- a/tests/functional/test_fatstacks_options.py +++ b/tests/functional/test_touch_options.py @@ -1,6 +1,6 @@ from ragger.navigator import NavIns -from .navigator import CustomNavInsID, StaxNavigator +from .navigator import CustomNavInsID, TouchNavigator from .utils import format_instructions @@ -9,7 +9,7 @@ "seven myth punch hobby comfort wild raise skin" -def test_check_info_then_leave(navigator: StaxNavigator, functional_test_directory: str): +def test_check_info_then_leave(navigator: TouchNavigator, functional_test_directory: str): instructions = format_instructions([ CustomNavInsID.HOME_TO_SETTINGS, CustomNavInsID.SETTINGS_TO_HOME @@ -21,7 +21,7 @@ def test_check_info_then_leave(navigator: StaxNavigator, functional_test_directo screen_change_after_last_instruction=True) -def test_check_all_passphrase_lengths(navigator: StaxNavigator, functional_test_directory: str): +def test_check_all_passphrase_lengths(navigator: TouchNavigator, functional_test_directory: str): instructions = format_instructions([ CustomNavInsID.HOME_TO_CHECK, CustomNavInsID.LENGTH_CHOOSE_24, @@ -38,7 +38,7 @@ def test_check_all_passphrase_lengths(navigator: StaxNavigator, functional_test_ screen_change_after_last_instruction=True) -def test_check_previous_word(navigator: StaxNavigator, functional_test_directory: str): +def test_check_previous_word(navigator: TouchNavigator, functional_test_directory: str): instructions = format_instructions([ CustomNavInsID.HOME_TO_CHECK, CustomNavInsID.LENGTH_CHOOSE_24, diff --git a/tmp.sh b/tmp.sh new file mode 100644 index 00000000..da50affd --- /dev/null +++ b/tmp.sh @@ -0,0 +1,14 @@ +#!/bin/bash +cat < /etc/udev/rules.d/20-hw1.rules +# HW.1, Nano +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2581", ATTRS{idProduct}=="1b7c|2b7c|3b7c|4b7c", TAG+="uaccess", TAG+="udev-acl" + +# Blue, NanoS, Aramis, HW.2, Nano X, NanoSP, Stax, Ledger Test, +SUBSYSTEMS=="usb", ATTRS{idVendor}=="2c97", TAG+="uaccess", TAG+="udev-acl" + +# Same, but with hidraw-based library (instead of libusb) +KERNEL=="hidraw*", ATTRS{idVendor}=="2c97", MODE="0666" +EOF + +udevadm control --reload-rules +udevadm trigger