From 9628a084b5692edbcf7c43cdb33454cc21b3de73 Mon Sep 17 00:00:00 2001 From: Kirill Zhumarin Date: Mon, 23 Nov 2026 03:43:19 +0000 Subject: [PATCH] ebl: update response checks --- examples/ebl.ts | 8 +++++--- src/ebl/EBL.ts | 5 +---- src/utils.ts | 3 +++ 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/examples/ebl.ts b/examples/ebl.ts index 3e888c3..73f9332 100644 --- a/examples/ebl.ts +++ b/examples/ebl.ts @@ -45,13 +45,15 @@ switch (info.mode) { break; } -// const flashInfo = await ebl.getFlashInfo(); -// console.log(flashInfo); +const flashInfo = await ebl.getFlashInfo(); +console.log(flashInfo); -// await ebl.selectFlashDriver(flashInfo); +await ebl.selectFlashDriver(flashInfo); +console.log("setAddress"); await ebl.setAddress(0xA0000000); +console.log("readFlash"); const buffer = await ebl.readFlash(0x800); console.log(buffer.subarray(0x3C, 0x3C + 4).toString()); diff --git a/src/ebl/EBL.ts b/src/ebl/EBL.ts index 3e5fab4..992737f 100644 --- a/src/ebl/EBL.ts +++ b/src/ebl/EBL.ts @@ -113,15 +113,12 @@ export class EBL extends BaseSerialProtocol { async getFlashInfo(buffer?: Buffer): Promise { const response = await this.sendCommand(CMD.CFI_STAGE1, buffer ?? Buffer.from([0, 0])); - if (response.length != 0x100) + if (!response.length) throw new EBLError('Invalid CFI stage 1 response length: %d', response.length); return response; } async selectFlashDriver(flashInfo: Buffer): Promise { - if (flashInfo.length != 0x100) - throw new EBLError('CFI stage 2 requires exactly 0x100 bytes, got %d', flashInfo.length); - const response = await this.sendCommand(CMD.CFI_STAGE2, flashInfo); if (response.length < 2) throw new EBLError('Invalid CFI stage 2 response length: %d', response.length); diff --git a/src/utils.ts b/src/utils.ts index 1df9728..24d8950 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -18,8 +18,11 @@ const USB_DEVICES: Record = { "04DA:213C": "Softbank 810p", "04DA:2149": "Softbank 820p", "04DA:2159": "Softbank 821p", + "04DA:215A": "Softbank 822p", "04DA:2172": "Softbank 830p", "04DA:2173": "Softbank 831p", + "04DA:21A4": "Softbank 840p", + "04DA:21D0": "Softbank 002p", }; export function getUSBDeviceName(vid: number, pid: number): string | undefined {