Skip to content

Commit

Permalink
fix(legacy): fix OK-19317 (#392)
Browse files Browse the repository at this point in the history
  • Loading branch information
lyxyx authored May 11, 2023
1 parent 6d616dc commit 0bf60dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions legacy/firmware/layout2.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ void onboarding(uint8_t key) {
"have fun\nwith your OneKey Classic."),
NULL, NULL, NULL, NULL);
key = protectWaitKey(0, 1);
if (protectAbortedByInitialize) return;
if (protectAbortedByInitializeOnboarding) return;
if (key != KEY_CONFIRM) {
goto done1;
}
Expand All @@ -610,7 +610,7 @@ void onboarding(uint8_t key) {
oledRefresh();
}
key = protectWaitKey(0, 1);
if (protectAbortedByInitialize) return;
if (protectAbortedByInitializeOnboarding) return;
if (key != KEY_CONFIRM) {
goto done1;
}
Expand All @@ -629,7 +629,7 @@ void onboarding(uint8_t key) {
oledRefresh();
}
key = protectWaitKey(0, 1);
if (protectAbortedByInitialize) return;
if (protectAbortedByInitializeOnboarding) return;
if (key != KEY_CONFIRM) {
goto done2;
}
Expand Down
4 changes: 4 additions & 0 deletions legacy/firmware/protect.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
#define MAX_WRONG_PINS 15

bool protectAbortedByCancel = false;
// allow the app to connect to the device when in the tutorial page
bool protectAbortedByInitializeOnboarding = false;
bool protectAbortedByInitialize = false;
bool protectAbortedByTimeout = false;
extern bool exitBlindSignByInitialize;
Expand Down Expand Up @@ -751,6 +753,7 @@ uint8_t protectWaitKey(uint32_t time_out, uint8_t mode) {
uint8_t key = KEY_NULL;

protectAbortedByInitialize = false;
protectAbortedByInitializeOnboarding = false;
usbTiny(1);
timer_out_set(timer_out_oper, time_out);
while (1) {
Expand Down Expand Up @@ -784,6 +787,7 @@ uint8_t protectWaitKey(uint32_t time_out, uint8_t mode) {
}
}
usbTiny(0);
protectAbortedByInitializeOnboarding = protectAbortedByInitialize;
if (protectAbortedByInitialize) {
if (device_sleep_state) device_sleep_state = SLEEP_CANCEL_BY_USB;
fsm_sendFailure(FailureType_Failure_ActionCancelled, NULL);
Expand Down
1 change: 1 addition & 0 deletions legacy/firmware/protect.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,6 @@ void enter_sleep(void);

extern bool protectAbortedByCancel;
extern bool protectAbortedByInitialize;
extern bool protectAbortedByInitializeOnboarding;
extern bool protectAbortedByTimeout;
#endif

0 comments on commit 0bf60dd

Please sign in to comment.