mirror of
https://github.com/siemens-mobile-hacks/node-sie-serial.git
synced 2026-11-25 17:17:17 +00:00
ebl: update response checks
This commit is contained in:
parent
d812e458cf
commit
9628a084b5
3 changed files with 9 additions and 7 deletions
|
|
@ -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());
|
||||
|
||||
|
|
|
|||
|
|
@ -113,15 +113,12 @@ export class EBL extends BaseSerialProtocol {
|
|||
|
||||
async getFlashInfo(buffer?: Buffer): Promise<Buffer> {
|
||||
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<number> {
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -18,8 +18,11 @@ const USB_DEVICES: Record<string, string> = {
|
|||
"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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue