Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LIVE-12403] [LLM] πŸ› Issue if Stax loses connection with LLM during firmware upgrade #7050

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/few-penguins-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"live-mobile": patch
---

Fix issue if Stax loses connection with LLM during firmware upgrade
8 changes: 8 additions & 0 deletions apps/ledger-live-mobile/src/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -4362,6 +4362,14 @@
"pleaseConnectUsbTitle": "USB cable needed",
"pleaseConnectUsbDescription": "To start the firmware update, plug your {{deviceName}} to your mobile phone using a USB cable."
},
"updateStatusErrors": {
"errors": {
"TimeoutError": {
"title": "Device disconnected",
"description": "The update was unable to continue because we lost connection to {{deviceName}}"
}
}
},
"batteryStatusErrors": {
"errors": {
"TimeoutError": {
Expand Down
16 changes: 16 additions & 0 deletions apps/ledger-live-mobile/src/screens/FirmwareUpdate/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,21 @@ export const FirmwareUpdate = ({
);
}

if (updateActionState.error?.name === "TimeoutError") {
return (
<DeviceActionError
t={t}
device={device}
errorName={updateActionState.error.name}
translationContext="FirmwareUpdate.updateStatusErrors"
>
<Button type="main" outline={false} onPress={quitUpdate} mt={6} alignSelf="stretch">
{t("FirmwareUpdate.quitUpdate")}
</Button>
</DeviceActionError>
);
}

if (batteryStatusesState.error !== null) {
return (
<DeviceActionError
Expand Down Expand Up @@ -758,6 +773,7 @@ export const FirmwareUpdate = ({
restoreStepDeniedError,
userSolvableError,
updateActionState.step,
updateActionState.error,
updateActionState.progress,
t,
device,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export const userSolvableErrorClasses: Array<CustomErrorClassType | TransportSta
ImageCommitRefusedOnDevice,
ImageLoadRefusedOnDevice,
WebsocketConnectionFailed,
DisconnectedDeviceDuringOperation,
];

export type FirmwareUpdateParams = {
Expand Down Expand Up @@ -247,9 +248,21 @@ export const useUpdateFirmwareAndRestoreSettings = ({
break;

case "firmwareUpdate":
hasUnrecoverableError =
updateActionState.error &&
!userSolvableErrorClasses.some(
err =>
updateActionState.error instanceof err ||
updateActionState.error?.name === "TimeoutError",
);

if (updateActionState.step === "preparingUpdate" && !updateActionState.lockedDevice) {
triggerUpdate();
} else if (updateActionState.step === "firmwareUpdateCompleted") {
} else if (updateActionState.step === "firmwareUpdateCompleted" || hasUnrecoverableError) {
if (hasUnrecoverableError) {
log("FirmwareUpdate", "error while updating firmware", updateActionState.error);
}

proceedToLanguageRestore();
}
break;
Expand Down Expand Up @@ -324,6 +337,7 @@ export const useUpdateFirmwareAndRestoreSettings = ({
staxLoadImageState.imageLoaded,
triggerUpdate,
updateActionState.step,
updateActionState.error,
updateActionState.lockedDevice,
updateStep,
restoreAppsState.error,
Expand Down
Loading