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-12734] [LLD] Device disconnect during restore apps on LNX causing the app restore to fail #7157

Merged
merged 3 commits into from
Jun 21, 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
6 changes: 6 additions & 0 deletions .changeset/orange-icons-rescue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": patch
"@ledgerhq/device-core": patch
---

Reload app restauration if device disconnected after firmware update with language pack
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ const Dashboard = ({
// - If a disconnection happens during a reset prevention period
// and the drawer is currently closed
if (!currentDevice || deviceChangedWhenResetPrevented.current) {
onReset([]);
onReset(appsToRestore);
}
}, [onReset, preventResetOnDeviceChange, currentDevice, drawerState.open]);
}, [appsToRestore, onReset, preventResetOnDeviceChange, currentDevice, drawerState.open]);
const exec = useMemo(
() =>
getEnv("MOCK")
Expand Down
16 changes: 0 additions & 16 deletions libs/device-core/src/commands/use-cases/getDeviceName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@ import { LocalTracer } from "@ledgerhq/logs";
import { APDU } from "../entities/APDU";
import { parseGetDeviceNameResponse } from "./parseGetDeviceNameResponse";

/**
* A first APDU that we send because getDeviceName sometimes misbehaves on LNX
* if it's not sent.
* cf. https://github.com/LedgerHQ/ledger-live/pull/2250 where it was removed
* cf. https://github.com/LedgerHQ/ledger-live/pull/2401 where it was added back
*/
const CLEANING_APDU: APDU = [0xe0, 0x50, 0x00, 0x00, undefined];

const GET_DEVICE_NAME_APDU: APDU = [0xe0, 0xd2, 0x00, 0x00, Buffer.from([])];

export async function getDeviceName(transport: Transport): Promise<string> {
Expand All @@ -20,14 +12,6 @@ export async function getDeviceName(transport: Transport): Promise<string> {
});
tracer.trace("Start");

try {
// Legacy: prevents bad apdu response for LNX
await transport.send(...CLEANING_APDU);
} catch (error) {
tracer.trace(`Error on 0xe0500000: ${error}`, { error });
}
tracer.trace("Sent cleaning 0xe0500000");

const res = await transport.send(...GET_DEVICE_NAME_APDU, [
StatusCodes.OK,
StatusCodes.DEVICE_NOT_ONBOARDED,
Expand Down
Loading