Skip to content

Commit

Permalink
Merge pull request #7157 from LedgerHQ/bugfix/LIVE-12734-fw-update-la…
Browse files Browse the repository at this point in the history
…nguage-pack

🐛 [LIVE-12734] [LLD] Device disconnect during restore apps on LNX causing the app restore to fail
  • Loading branch information
jdabbech-ledger committed Jun 21, 2024
2 parents 7868bd7 + 38a18fd commit 612fd82
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 18 deletions.
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

0 comments on commit 612fd82

Please sign in to comment.