@onekeyfe/hd-core 1.2.0-alpha.168 → 1.2.0-alpha.169
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__tests__/firmware-update/firmware-update-v4-install-poll.test.ts +6 -6
- package/__tests__/protocol-v2.test.ts +89 -0
- package/dist/api/FirmwareUpdateV4.d.ts +1 -0
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/device/DeviceConnector.d.ts +1 -1
- package/dist/device/DeviceConnector.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +46 -11
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +54 -12
- package/src/device/DeviceConnector.ts +8 -3
|
@@ -26,6 +26,10 @@ describe('FirmwareUpdateV4 install polling', () => {
|
|
|
26
26
|
const typedCall = jest
|
|
27
27
|
.fn()
|
|
28
28
|
.mockResolvedValueOnce({ type: 'Success', message: {} })
|
|
29
|
+
.mockResolvedValueOnce({
|
|
30
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
31
|
+
message: { records: [] },
|
|
32
|
+
})
|
|
29
33
|
.mockResolvedValueOnce({
|
|
30
34
|
type: 'DeviceFirmwareUpdateStatus',
|
|
31
35
|
message: {
|
|
@@ -64,13 +68,9 @@ describe('FirmwareUpdateV4 install polling', () => {
|
|
|
64
68
|
await firmwareUpdate.waitForProtocolV2FirmwareUpdateComplete(targets);
|
|
65
69
|
|
|
66
70
|
expect(typedCall.mock.calls[0]).toEqual(['DeviceFirmwareUpdateStage', 'Success', { targets }]);
|
|
67
|
-
expect(call).toHaveBeenCalledWith(
|
|
68
|
-
'DeviceFirmwareUpdateRequest',
|
|
69
|
-
{},
|
|
70
|
-
{ returnAfterWrite: true }
|
|
71
|
-
);
|
|
71
|
+
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
72
72
|
expect(typedCall.mock.calls[1]?.[0]).toBe('DeviceFirmwareUpdateStatusGet');
|
|
73
|
-
expect(call.mock.invocationCallOrder[0]).toBeLessThan(typedCall.mock.invocationCallOrder[
|
|
73
|
+
expect(call.mock.invocationCallOrder[0]).toBeLessThan(typedCall.mock.invocationCallOrder[2]);
|
|
74
74
|
});
|
|
75
75
|
|
|
76
76
|
test('does not send Request when Stage is rejected', async () => {
|
|
@@ -4925,6 +4925,34 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4925
4925
|
expect(initialize).not.toHaveBeenCalled();
|
|
4926
4926
|
});
|
|
4927
4927
|
|
|
4928
|
+
test('scans and reacquires the same BLE peripheral without probing during install recovery', async () => {
|
|
4929
|
+
const method = new FirmwareUpdateV4({
|
|
4930
|
+
id: 1,
|
|
4931
|
+
payload: {
|
|
4932
|
+
method: 'firmwareUpdateV4',
|
|
4933
|
+
},
|
|
4934
|
+
});
|
|
4935
|
+
const acquire = jest.fn().mockResolvedValue({ uuid: 'ble-id', protocolType: 'V2' });
|
|
4936
|
+
const enumerate = jest.fn().mockResolvedValue({
|
|
4937
|
+
descriptors: [{ id: 'ble-id', name: 'OneKey Pro 2', protocolType: 'V2' }],
|
|
4938
|
+
});
|
|
4939
|
+
const commands = { disposed: true, mainId: '' };
|
|
4940
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
4941
|
+
(method as any).device = stubDevice({
|
|
4942
|
+
originalDescriptor: { id: 'ble-id', path: 'ble-path', protocolType: 'V2' },
|
|
4943
|
+
deviceConnector: { acquire, enumerate },
|
|
4944
|
+
commands,
|
|
4945
|
+
getCommands: () => commands,
|
|
4946
|
+
});
|
|
4947
|
+
|
|
4948
|
+
await (method as any).reconnectProtocolV2Device({ skipBleProtocolProbe: true });
|
|
4949
|
+
|
|
4950
|
+
expect(enumerate).toHaveBeenCalledTimes(1);
|
|
4951
|
+
expect(acquire).toHaveBeenCalledWith('ble-id', null, true, 'V2', undefined, undefined, true);
|
|
4952
|
+
expect(commands.disposed).toBe(false);
|
|
4953
|
+
expect(commands.mainId).toBe('ble-id');
|
|
4954
|
+
});
|
|
4955
|
+
|
|
4928
4956
|
test('selects the matching physical device from multiple Protocol V2 USB reconnect candidates', async () => {
|
|
4929
4957
|
const method = new FirmwareUpdateV4({
|
|
4930
4958
|
id: 1,
|
|
@@ -5471,6 +5499,7 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5471
5499
|
createProtocolV2UiPhaseMetadata: jest.fn().mockReturnValue(undefined),
|
|
5472
5500
|
toMessageObject: jest.fn().mockReturnValue({ connectId: 'pro2' }),
|
|
5473
5501
|
});
|
|
5502
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
5474
5503
|
method.postMessage = jest.fn();
|
|
5475
5504
|
|
|
5476
5505
|
await expect(
|
|
@@ -5480,8 +5509,68 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
5480
5509
|
).resolves.toBeUndefined();
|
|
5481
5510
|
|
|
5482
5511
|
expect(call).toHaveBeenCalledWith('DeviceFirmwareUpdateRequest', {});
|
|
5512
|
+
expect((method as any).protocolV2InstallNeedsBleReconnect).toBe(true);
|
|
5483
5513
|
});
|
|
5484
5514
|
|
|
5515
|
+
test.each([
|
|
5516
|
+
{ name: 'bootloader', targetId: 3, path: 'vol0:/bootloader.bin' },
|
|
5517
|
+
{ name: 'application', targetId: 4, path: 'vol0:/application_p1.bin' },
|
|
5518
|
+
{ name: 'secure element', targetId: 7, path: 'vol0:/se01.bin' },
|
|
5519
|
+
])(
|
|
5520
|
+
'reconnects a released BLE install link before polling $name status without DeviceInfo',
|
|
5521
|
+
async ({ targetId, path }) => {
|
|
5522
|
+
const method = new FirmwareUpdateV4({
|
|
5523
|
+
id: 1,
|
|
5524
|
+
payload: {
|
|
5525
|
+
method: 'firmwareUpdateV4',
|
|
5526
|
+
},
|
|
5527
|
+
});
|
|
5528
|
+
const targets = [{ target_id: targetId, path }];
|
|
5529
|
+
const typedCall = jest
|
|
5530
|
+
.fn()
|
|
5531
|
+
.mockResolvedValueOnce({
|
|
5532
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5533
|
+
message: { records: [{ ...targets[0], status: 1, payload_version: 0 }] },
|
|
5534
|
+
})
|
|
5535
|
+
.mockResolvedValueOnce({
|
|
5536
|
+
type: 'DeviceFirmwareUpdateStatus',
|
|
5537
|
+
message: { records: [{ ...targets[0], status: 2, payload_version: 0x010000 }] },
|
|
5538
|
+
});
|
|
5539
|
+
const reconnectProtocolV2Device = jest.fn().mockResolvedValue(undefined);
|
|
5540
|
+
const verifyProtocolV2ReconnectIdentity = jest.fn();
|
|
5541
|
+
const setTimeoutSpy = jest.spyOn(global, 'setTimeout').mockImplementation(((
|
|
5542
|
+
callback: () => void
|
|
5543
|
+
) => {
|
|
5544
|
+
callback();
|
|
5545
|
+
return 0 as any;
|
|
5546
|
+
}) as typeof setTimeout);
|
|
5547
|
+
|
|
5548
|
+
(method as any).device = stubDevice({
|
|
5549
|
+
getCommands: () => ({ typedCall }),
|
|
5550
|
+
});
|
|
5551
|
+
(method as any).isBleReconnect = jest.fn(() => true);
|
|
5552
|
+
(method as any).protocolV2InstallNeedsBleReconnect = true;
|
|
5553
|
+
(method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
|
|
5554
|
+
(method as any).verifyProtocolV2ReconnectIdentity = verifyProtocolV2ReconnectIdentity;
|
|
5555
|
+
method.postProgressMessage = jest.fn();
|
|
5556
|
+
|
|
5557
|
+
try {
|
|
5558
|
+
await expect(
|
|
5559
|
+
(method as any).waitForProtocolV2FirmwareUpdateComplete(targets, true)
|
|
5560
|
+
).resolves.toBeUndefined();
|
|
5561
|
+
} finally {
|
|
5562
|
+
setTimeoutSpy.mockRestore();
|
|
5563
|
+
}
|
|
5564
|
+
|
|
5565
|
+
expect(reconnectProtocolV2Device).toHaveBeenCalledWith({ skipBleProtocolProbe: true });
|
|
5566
|
+
expect(verifyProtocolV2ReconnectIdentity).not.toHaveBeenCalled();
|
|
5567
|
+
expect(typedCall.mock.calls.map(callArgs => callArgs[0])).toEqual([
|
|
5568
|
+
'DeviceFirmwareUpdateStatusGet',
|
|
5569
|
+
'DeviceFirmwareUpdateStatusGet',
|
|
5570
|
+
]);
|
|
5571
|
+
}
|
|
5572
|
+
);
|
|
5573
|
+
|
|
5485
5574
|
test('polls only firmware status while Protocol V2 bootloader is installing', async () => {
|
|
5486
5575
|
const method = new FirmwareUpdateV4({
|
|
5487
5576
|
id: 1,
|
|
@@ -18,6 +18,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
18
18
|
private protocolV2LatestFinalDeviceInfo?;
|
|
19
19
|
private protocolV2InstallBaselineVersions;
|
|
20
20
|
private protocolV2InstallStatusBaseline?;
|
|
21
|
+
private protocolV2InstallNeedsBleReconnect;
|
|
21
22
|
private protocolV2LastRuntimeProbeFeatures?;
|
|
22
23
|
private protocolV2LastTransferProgress?;
|
|
23
24
|
private protocolV2LastTransferProgressAt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAkD,MAAM,qBAAqB,CAAC;AA0BlG,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AA+B/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAoErC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;AAmTD,eAAO,MAAM,oCAAoC,WACvC,WAAW,GAAG,UAAU,eACnB,MAAM,GAAG,SAAS,YAKhC,CAAC;AAEF,eAAO,MAAM,iCAAiC,0BACrB,MAAM,uBACR,MAAM,iBACZ,MAAM,eACR,MAAM,SAsBpB,CAAC;AAUF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,wBAAwB,CAAC,sBAAsB,CAAC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AWzC,OAAO,CAAC,2BAA2B;IAsBnC,OAAO,CAAC,yBAAyB;IAiBjC,OAAO,CAAC,wBAAwB;YAkBlB,iCAAiC;YA6CjC,uCAAuC;YA0CvC,+BAA+B;IAmF7C,OAAO,CAAC,6BAA6B;IAMrC,OAAO,CAAC,gCAAgC;YAM1B,8BAA8B;YAmD9B,kCAAkC;IA+BhD,OAAO,CAAC,0BAA0B;IAUlC,OAAO,CAAC,yBAAyB;YAcnB,4BAA4B;IAkBpC,6BAA6B;YAkBrB,+BAA+B;IAkD7C,OAAO,CAAC,6BAA6B;YAkCvB,6BAA6B;YA0B7B,0CAA0C;YA6B1C,uBAAuB;YAiCvB,8BAA8B;YAwE9B,6BAA6B;IA8E3C,OAAO,CAAC,mCAAmC;YAI7B,0BAA0B;IAaxC,OAAO,CAAC,4BAA4B;IA0GpC,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,qCAAqC;IAyB7C,OAAO,CAAC,kCAAkC;IAgB1C,OAAO,CAAC,8CAA8C;YAIxC,uCAAuC;YAyPvC,gCAAgC;YAehC,yBAAyB;IASvC,OAAO,CAAC,2BAA2B;YAMrB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAmDrC,yBAAyB;YA8DzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;YAuCd,6BAA6B;YAW7B,0BAA0B;YA2B1B,6BAA6B;YA4D7B,gBAAgB;IAiB9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -14,7 +14,7 @@ export default class DeviceConnector {
|
|
|
14
14
|
enumerate(): Promise<DeviceDescriptorDiff | undefined>;
|
|
15
15
|
listen(): Promise<void>;
|
|
16
16
|
stop(): void;
|
|
17
|
-
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean): Promise<string | undefined>;
|
|
17
|
+
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean, skipProtocolProbe?: boolean): Promise<string | undefined>;
|
|
18
18
|
release(session: string, onclose: boolean, keepSession?: boolean): Promise<void>;
|
|
19
19
|
disconnect(session: string | undefined | null): Promise<void>;
|
|
20
20
|
promptDeviceAccess(): Promise<USBDevice | BluetoothDevice | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceConnector.d.ts","sourceRoot":"","sources":["../../src/device/DeviceConnector.ts"],"names":[],"mappings":";;AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI9F,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,eAAe,SAAK;IAEpB,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAQ;IAE1C,QAAQ,EAAE,gBAAgB,EAAE,CAAM;IAElC,SAAS,UAAS;;IAQlB,OAAO,CAAC,kBAAkB;IAYpB,SAAS;IAWT,MAAM;IAgCZ,IAAI;IAIE,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,gBAAgB,CAAC,EAAE,uBAAuB,EAC1C,YAAY,CAAC,EAAE,uBAAuB,EACtC,sBAAsB,CAAC,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"DeviceConnector.d.ts","sourceRoot":"","sources":["../../src/device/DeviceConnector.ts"],"names":[],"mappings":";;AAUA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,IAAI,gBAAgB,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAI9F,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB,eAAe,SAAK;IAEpB,OAAO,EAAE,gBAAgB,EAAE,GAAG,IAAI,CAAQ;IAE1C,QAAQ,EAAE,gBAAgB,EAAE,CAAM;IAElC,SAAS,UAAS;;IAQlB,OAAO,CAAC,kBAAkB;IAYpB,SAAS;IAWT,MAAM;IAgCZ,IAAI;IAIE,OAAO,CACX,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,EACvB,oBAAoB,CAAC,EAAE,OAAO,EAC9B,gBAAgB,CAAC,EAAE,uBAAuB,EAC1C,YAAY,CAAC,EAAE,uBAAuB,EACtC,sBAAsB,CAAC,EAAE,OAAO,EAChC,iBAAiB,CAAC,EAAE,OAAO;IAwDvB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,OAAO;IAShE,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAWnD,kBAAkB,IAAI,OAAO,CAAC,SAAS,GAAG,eAAe,GAAG,IAAI,CAAC;IAQjE,oBAAoB;CAGrB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -700,7 +700,7 @@ declare class DeviceConnector {
|
|
|
700
700
|
enumerate(): Promise<DeviceDescriptorDiff | undefined>;
|
|
701
701
|
listen(): Promise<void>;
|
|
702
702
|
stop(): void;
|
|
703
|
-
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean): Promise<string | undefined>;
|
|
703
|
+
acquire(path: string, session?: string | null, forceCleanRunPromise?: boolean, expectedProtocol?: HardwareConnectProtocol, protocolHint?: HardwareConnectProtocol, forceProtocolDetection?: boolean, skipProtocolProbe?: boolean): Promise<string | undefined>;
|
|
704
704
|
release(session: string, onclose: boolean, keepSession?: boolean): Promise<void>;
|
|
705
705
|
disconnect(session: string | undefined | null): Promise<void>;
|
|
706
706
|
promptDeviceAccess(): Promise<USBDevice | BluetoothDevice | null>;
|
package/dist/index.js
CHANGED
|
@@ -52144,6 +52144,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
52144
52144
|
this.protocolV2CompletedTargetVersions = new Map();
|
|
52145
52145
|
this.protocolV2CompletedTargetIds = new Set();
|
|
52146
52146
|
this.protocolV2InstallBaselineVersions = new Map();
|
|
52147
|
+
this.protocolV2InstallNeedsBleReconnect = false;
|
|
52147
52148
|
this.protocolV2LastTransferProgressAt = 0;
|
|
52148
52149
|
}
|
|
52149
52150
|
getSupportedProtocols() {
|
|
@@ -53545,16 +53546,22 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53545
53546
|
? getProtocolV2FirmwareStatusFingerprint(effectiveBaselineStatusTargets)
|
|
53546
53547
|
: undefined;
|
|
53547
53548
|
let lastError;
|
|
53548
|
-
let shouldReconnect =
|
|
53549
|
+
let shouldReconnect = this.protocolV2InstallNeedsBleReconnect;
|
|
53550
|
+
this.protocolV2InstallNeedsBleReconnect = false;
|
|
53549
53551
|
let deviceInfo;
|
|
53552
|
+
let bleInstallLinkReady = false;
|
|
53550
53553
|
let installEvidenceObserved = false;
|
|
53551
53554
|
let currentInstallStatusObserved = false;
|
|
53552
53555
|
while (Date.now() - (installStartedAt !== null && installStartedAt !== void 0 ? installStartedAt : confirmationStartedAt) < PROTOCOL_V2_INSTALL_TIMEOUT) {
|
|
53553
53556
|
this.throwIfAborted();
|
|
53554
53557
|
try {
|
|
53555
53558
|
if (shouldReconnect) {
|
|
53556
|
-
|
|
53557
|
-
|
|
53559
|
+
const isBleInstallReconnect = this.isBleReconnect();
|
|
53560
|
+
yield this.reconnectProtocolV2Device({ skipBleProtocolProbe: isBleInstallReconnect });
|
|
53561
|
+
bleInstallLinkReady = isBleInstallReconnect;
|
|
53562
|
+
deviceInfo = isBleInstallReconnect
|
|
53563
|
+
? undefined
|
|
53564
|
+
: yield this.verifyProtocolV2ReconnectIdentity();
|
|
53558
53565
|
shouldReconnect = false;
|
|
53559
53566
|
}
|
|
53560
53567
|
const currentDeviceInfo = deviceInfo;
|
|
@@ -53650,9 +53657,16 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53650
53657
|
}
|
|
53651
53658
|
if (isProtocolV2FirmwareStatusEndpointUnavailable(error)) {
|
|
53652
53659
|
if (!currentDeviceInfo) {
|
|
53660
|
+
if (!bleInstallLinkReady) {
|
|
53661
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 device identity is unavailable during install polling');
|
|
53662
|
+
}
|
|
53663
|
+
deviceInfo = yield this.verifyProtocolV2ReconnectIdentity();
|
|
53664
|
+
}
|
|
53665
|
+
const reconnectDeviceInfo = currentDeviceInfo !== null && currentDeviceInfo !== void 0 ? currentDeviceInfo : deviceInfo;
|
|
53666
|
+
if (!reconnectDeviceInfo) {
|
|
53653
53667
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Protocol V2 device identity is unavailable during install polling');
|
|
53654
53668
|
}
|
|
53655
|
-
const isNormalMode = yield this.probeProtocolV2NormalMode(
|
|
53669
|
+
const isNormalMode = yield this.probeProtocolV2NormalMode(reconnectDeviceInfo);
|
|
53656
53670
|
if (isNormalMode &&
|
|
53657
53671
|
(installEvidenceObserved ||
|
|
53658
53672
|
this.hasProtocolV2InstallVersionChanged(expectedTargetIds))) {
|
|
@@ -53671,6 +53685,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53671
53685
|
else {
|
|
53672
53686
|
shouldReconnect = true;
|
|
53673
53687
|
deviceInfo = undefined;
|
|
53688
|
+
bleInstallLinkReady = false;
|
|
53674
53689
|
lastError = error;
|
|
53675
53690
|
Log$7.log('[FirmwareUpdateV4] DeviceFirmwareUpdateStatusGet unavailable during install: ', error);
|
|
53676
53691
|
}
|
|
@@ -53690,6 +53705,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53690
53705
|
}
|
|
53691
53706
|
shouldReconnect = true;
|
|
53692
53707
|
deviceInfo = undefined;
|
|
53708
|
+
bleInstallLinkReady = false;
|
|
53693
53709
|
Log$7.log('Protocol V2 firmware install device readiness probe failed: ', error);
|
|
53694
53710
|
}
|
|
53695
53711
|
yield hdShared.wait(1000);
|
|
@@ -53797,11 +53813,11 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53797
53813
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, `Protocol V2 final features not ready within ${timeout / 1000}s: ${this.normalizeErrorMessage(lastError)}`);
|
|
53798
53814
|
});
|
|
53799
53815
|
}
|
|
53800
|
-
reconnectProtocolV2Device() {
|
|
53816
|
+
reconnectProtocolV2Device(options) {
|
|
53801
53817
|
var _a, _b, _c, _d, _e, _f;
|
|
53802
53818
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53803
53819
|
if (this.isBleReconnect()) {
|
|
53804
|
-
yield this.acquireProtocolV2BleDevice();
|
|
53820
|
+
yield this.acquireProtocolV2BleDevice(options === null || options === void 0 ? void 0 : options.skipBleProtocolProbe);
|
|
53805
53821
|
return;
|
|
53806
53822
|
}
|
|
53807
53823
|
const deviceDiff = yield ((_a = this.device.deviceConnector) === null || _a === void 0 ? void 0 : _a.enumerate());
|
|
@@ -53896,10 +53912,23 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53896
53912
|
yield hdShared.wait(2000);
|
|
53897
53913
|
});
|
|
53898
53914
|
}
|
|
53899
|
-
acquireProtocolV2BleDevice() {
|
|
53915
|
+
acquireProtocolV2BleDevice(skipProtocolProbe = false) {
|
|
53900
53916
|
var _a;
|
|
53901
53917
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53902
|
-
|
|
53918
|
+
const connector = this.device.deviceConnector;
|
|
53919
|
+
const expectedId = this.device.originalDescriptor.id;
|
|
53920
|
+
if (!skipProtocolProbe) {
|
|
53921
|
+
yield (connector === null || connector === void 0 ? void 0 : connector.acquire(expectedId, null, true, PROTOCOL_V2_CONNECT_PROTOCOL));
|
|
53922
|
+
return;
|
|
53923
|
+
}
|
|
53924
|
+
const deviceDiff = yield (connector === null || connector === void 0 ? void 0 : connector.enumerate());
|
|
53925
|
+
const reconnectDescriptor = (_a = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) === null || _a === void 0 ? void 0 : _a.find(descriptor => descriptor.id === expectedId);
|
|
53926
|
+
if (!reconnectDescriptor) {
|
|
53927
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound);
|
|
53928
|
+
}
|
|
53929
|
+
yield (connector === null || connector === void 0 ? void 0 : connector.acquire(reconnectDescriptor.id, null, true, PROTOCOL_V2_CONNECT_PROTOCOL, undefined, undefined, skipProtocolProbe));
|
|
53930
|
+
this.device.commands.disposed = false;
|
|
53931
|
+
this.device.getCommands().mainId = reconnectDescriptor.id;
|
|
53903
53932
|
});
|
|
53904
53933
|
}
|
|
53905
53934
|
protocolV2StartFirmwareUpdate({ targets, }) {
|
|
@@ -53907,6 +53936,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53907
53936
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53908
53937
|
this.protocolV2LastRuntimeProbeFeatures = undefined;
|
|
53909
53938
|
this.protocolV2InstallStatusBaseline = undefined;
|
|
53939
|
+
this.protocolV2InstallNeedsBleReconnect = false;
|
|
53910
53940
|
const commands = this.device.getCommands();
|
|
53911
53941
|
yield commands.typedCall('DeviceFirmwareUpdateStage', 'Success', { targets });
|
|
53912
53942
|
try {
|
|
@@ -53937,6 +53967,9 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53937
53967
|
throw error;
|
|
53938
53968
|
}
|
|
53939
53969
|
Log$7.log('[FirmwareUpdateV4] BLE transport released after install request; continue status polling');
|
|
53970
|
+
if (this.isBleReconnect()) {
|
|
53971
|
+
this.protocolV2InstallNeedsBleReconnect = true;
|
|
53972
|
+
}
|
|
53940
53973
|
}
|
|
53941
53974
|
});
|
|
53942
53975
|
}
|
|
@@ -64756,7 +64789,7 @@ class DeviceConnector {
|
|
|
64756
64789
|
stop() {
|
|
64757
64790
|
this.listening = false;
|
|
64758
64791
|
}
|
|
64759
|
-
acquire(path, session, forceCleanRunPromise, expectedProtocol, protocolHint, forceProtocolDetection) {
|
|
64792
|
+
acquire(path, session, forceCleanRunPromise, expectedProtocol, protocolHint, forceProtocolDetection, skipProtocolProbe) {
|
|
64760
64793
|
return __awaiter(this, void 0, void 0, function* () {
|
|
64761
64794
|
Log$2.debug('acquire', path, session, expectedProtocol, protocolHint);
|
|
64762
64795
|
const env = DataManager.getSettings('env');
|
|
@@ -64764,13 +64797,15 @@ class DeviceConnector {
|
|
|
64764
64797
|
const transport = this.getActiveTransport();
|
|
64765
64798
|
let res;
|
|
64766
64799
|
if (DataManager.isBleConnect(env)) {
|
|
64767
|
-
|
|
64800
|
+
const acquireInput = {
|
|
64768
64801
|
uuid: path,
|
|
64769
64802
|
forceCleanRunPromise,
|
|
64770
64803
|
expectedProtocol,
|
|
64771
64804
|
protocolHint,
|
|
64772
64805
|
forceProtocolDetection,
|
|
64773
|
-
|
|
64806
|
+
skipProtocolProbe,
|
|
64807
|
+
};
|
|
64808
|
+
res = yield transport.acquire(acquireInput);
|
|
64774
64809
|
}
|
|
64775
64810
|
else {
|
|
64776
64811
|
res = yield transport.acquire({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.169",
|
|
4
4
|
"description": "Core processes and APIs for communicating with OneKey hardware devices.",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.0-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.169",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.0-alpha.169",
|
|
30
30
|
"axios": "1.15.2",
|
|
31
31
|
"bignumber.js": "^9.0.2",
|
|
32
32
|
"buffer": "^6.0.3",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"@types/w3c-web-usb": "^1.0.10",
|
|
47
47
|
"@types/web-bluetooth": "^0.0.21"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "79c2f32cf0d21d9f1ff3d4d8728b8c83bf48c0e9"
|
|
50
50
|
}
|
|
@@ -544,6 +544,8 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
544
544
|
|
|
545
545
|
private protocolV2InstallStatusBaseline?: ProtocolV2FirmwareUpdateStatusTarget[];
|
|
546
546
|
|
|
547
|
+
private protocolV2InstallNeedsBleReconnect = false;
|
|
548
|
+
|
|
547
549
|
private protocolV2LastRuntimeProbeFeatures?: Features;
|
|
548
550
|
|
|
549
551
|
private protocolV2LastTransferProgress?: number;
|
|
@@ -2404,10 +2406,12 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2404
2406
|
? getProtocolV2FirmwareStatusFingerprint(effectiveBaselineStatusTargets)
|
|
2405
2407
|
: undefined;
|
|
2406
2408
|
let lastError: unknown;
|
|
2407
|
-
//
|
|
2408
|
-
//
|
|
2409
|
-
let shouldReconnect =
|
|
2409
|
+
// USB may keep the loader link usable. BLE can release it as installation starts, so its
|
|
2410
|
+
// recovery reconnects directly to status polling without generic Ping or DeviceInfo probes.
|
|
2411
|
+
let shouldReconnect = this.protocolV2InstallNeedsBleReconnect;
|
|
2412
|
+
this.protocolV2InstallNeedsBleReconnect = false;
|
|
2410
2413
|
let deviceInfo: ProtocolV2DeviceInfo | undefined;
|
|
2414
|
+
let bleInstallLinkReady = false;
|
|
2411
2415
|
let installEvidenceObserved = false;
|
|
2412
2416
|
let currentInstallStatusObserved = false;
|
|
2413
2417
|
|
|
@@ -2417,8 +2421,12 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2417
2421
|
this.throwIfAborted();
|
|
2418
2422
|
try {
|
|
2419
2423
|
if (shouldReconnect) {
|
|
2420
|
-
|
|
2421
|
-
|
|
2424
|
+
const isBleInstallReconnect = this.isBleReconnect();
|
|
2425
|
+
await this.reconnectProtocolV2Device({ skipBleProtocolProbe: isBleInstallReconnect });
|
|
2426
|
+
bleInstallLinkReady = isBleInstallReconnect;
|
|
2427
|
+
deviceInfo = isBleInstallReconnect
|
|
2428
|
+
? undefined
|
|
2429
|
+
: await this.verifyProtocolV2ReconnectIdentity();
|
|
2422
2430
|
shouldReconnect = false;
|
|
2423
2431
|
}
|
|
2424
2432
|
const currentDeviceInfo = deviceInfo;
|
|
@@ -2550,12 +2558,22 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2550
2558
|
// missing endpoint as completion only after the runtime probe confirms App mode.
|
|
2551
2559
|
if (isProtocolV2FirmwareStatusEndpointUnavailable(error)) {
|
|
2552
2560
|
if (!currentDeviceInfo) {
|
|
2561
|
+
if (!bleInstallLinkReady) {
|
|
2562
|
+
throw ERRORS.TypedError(
|
|
2563
|
+
HardwareErrorCode.RuntimeError,
|
|
2564
|
+
'Protocol V2 device identity is unavailable during install polling'
|
|
2565
|
+
);
|
|
2566
|
+
}
|
|
2567
|
+
deviceInfo = await this.verifyProtocolV2ReconnectIdentity();
|
|
2568
|
+
}
|
|
2569
|
+
const reconnectDeviceInfo = currentDeviceInfo ?? deviceInfo;
|
|
2570
|
+
if (!reconnectDeviceInfo) {
|
|
2553
2571
|
throw ERRORS.TypedError(
|
|
2554
2572
|
HardwareErrorCode.RuntimeError,
|
|
2555
2573
|
'Protocol V2 device identity is unavailable during install polling'
|
|
2556
2574
|
);
|
|
2557
2575
|
}
|
|
2558
|
-
const isNormalMode = await this.probeProtocolV2NormalMode(
|
|
2576
|
+
const isNormalMode = await this.probeProtocolV2NormalMode(reconnectDeviceInfo);
|
|
2559
2577
|
if (
|
|
2560
2578
|
isNormalMode &&
|
|
2561
2579
|
(installEvidenceObserved ||
|
|
@@ -2580,6 +2598,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2580
2598
|
} else {
|
|
2581
2599
|
shouldReconnect = true;
|
|
2582
2600
|
deviceInfo = undefined;
|
|
2601
|
+
bleInstallLinkReady = false;
|
|
2583
2602
|
lastError = error;
|
|
2584
2603
|
Log.log(
|
|
2585
2604
|
'[FirmwareUpdateV4] DeviceFirmwareUpdateStatusGet unavailable during install: ',
|
|
@@ -2603,6 +2622,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2603
2622
|
}
|
|
2604
2623
|
shouldReconnect = true;
|
|
2605
2624
|
deviceInfo = undefined;
|
|
2625
|
+
bleInstallLinkReady = false;
|
|
2606
2626
|
Log.log('Protocol V2 firmware install device readiness probe failed: ', error);
|
|
2607
2627
|
}
|
|
2608
2628
|
await wait(1000);
|
|
@@ -2740,9 +2760,9 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2740
2760
|
);
|
|
2741
2761
|
}
|
|
2742
2762
|
|
|
2743
|
-
private async reconnectProtocolV2Device() {
|
|
2763
|
+
private async reconnectProtocolV2Device(options?: { skipBleProtocolProbe?: boolean }) {
|
|
2744
2764
|
if (this.isBleReconnect()) {
|
|
2745
|
-
await this.acquireProtocolV2BleDevice();
|
|
2765
|
+
await this.acquireProtocolV2BleDevice(options?.skipBleProtocolProbe);
|
|
2746
2766
|
return;
|
|
2747
2767
|
}
|
|
2748
2768
|
|
|
@@ -2870,13 +2890,31 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2870
2890
|
await wait(2000);
|
|
2871
2891
|
}
|
|
2872
2892
|
|
|
2873
|
-
private async acquireProtocolV2BleDevice() {
|
|
2874
|
-
|
|
2875
|
-
|
|
2893
|
+
private async acquireProtocolV2BleDevice(skipProtocolProbe = false) {
|
|
2894
|
+
const connector = this.device.deviceConnector;
|
|
2895
|
+
const expectedId = this.device.originalDescriptor.id;
|
|
2896
|
+
if (!skipProtocolProbe) {
|
|
2897
|
+
await connector?.acquire(expectedId, null, true, PROTOCOL_V2_CONNECT_PROTOCOL);
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
const deviceDiff = await connector?.enumerate();
|
|
2901
|
+
const reconnectDescriptor = deviceDiff?.descriptors?.find(
|
|
2902
|
+
descriptor => descriptor.id === expectedId
|
|
2903
|
+
);
|
|
2904
|
+
if (!reconnectDescriptor) {
|
|
2905
|
+
throw ERRORS.TypedError(HardwareErrorCode.DeviceNotFound);
|
|
2906
|
+
}
|
|
2907
|
+
await connector?.acquire(
|
|
2908
|
+
reconnectDescriptor.id,
|
|
2876
2909
|
null,
|
|
2877
2910
|
true,
|
|
2878
|
-
PROTOCOL_V2_CONNECT_PROTOCOL
|
|
2911
|
+
PROTOCOL_V2_CONNECT_PROTOCOL,
|
|
2912
|
+
undefined,
|
|
2913
|
+
undefined,
|
|
2914
|
+
skipProtocolProbe
|
|
2879
2915
|
);
|
|
2916
|
+
this.device.commands.disposed = false;
|
|
2917
|
+
this.device.getCommands().mainId = reconnectDescriptor.id;
|
|
2880
2918
|
}
|
|
2881
2919
|
|
|
2882
2920
|
private async protocolV2StartFirmwareUpdate({
|
|
@@ -2886,6 +2924,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2886
2924
|
}) {
|
|
2887
2925
|
this.protocolV2LastRuntimeProbeFeatures = undefined;
|
|
2888
2926
|
this.protocolV2InstallStatusBaseline = undefined;
|
|
2927
|
+
this.protocolV2InstallNeedsBleReconnect = false;
|
|
2889
2928
|
const commands = this.device.getCommands();
|
|
2890
2929
|
await commands.typedCall('DeviceFirmwareUpdateStage', 'Success', { targets });
|
|
2891
2930
|
try {
|
|
@@ -2932,6 +2971,9 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2932
2971
|
Log.log(
|
|
2933
2972
|
'[FirmwareUpdateV4] BLE transport released after install request; continue status polling'
|
|
2934
2973
|
);
|
|
2974
|
+
if (this.isBleReconnect()) {
|
|
2975
|
+
this.protocolV2InstallNeedsBleReconnect = true;
|
|
2976
|
+
}
|
|
2935
2977
|
}
|
|
2936
2978
|
}
|
|
2937
2979
|
|
|
@@ -96,7 +96,8 @@ export default class DeviceConnector {
|
|
|
96
96
|
forceCleanRunPromise?: boolean,
|
|
97
97
|
expectedProtocol?: HardwareConnectProtocol,
|
|
98
98
|
protocolHint?: HardwareConnectProtocol,
|
|
99
|
-
forceProtocolDetection?: boolean
|
|
99
|
+
forceProtocolDetection?: boolean,
|
|
100
|
+
skipProtocolProbe?: boolean
|
|
100
101
|
) {
|
|
101
102
|
Log.debug('acquire', path, session, expectedProtocol, protocolHint);
|
|
102
103
|
const env = DataManager.getSettings('env');
|
|
@@ -104,13 +105,17 @@ export default class DeviceConnector {
|
|
|
104
105
|
const transport = this.getActiveTransport();
|
|
105
106
|
let res;
|
|
106
107
|
if (DataManager.isBleConnect(env)) {
|
|
107
|
-
|
|
108
|
+
const acquireInput: Parameters<Transport['acquire']>[0] & {
|
|
109
|
+
skipProtocolProbe?: boolean;
|
|
110
|
+
} = {
|
|
108
111
|
uuid: path,
|
|
109
112
|
forceCleanRunPromise,
|
|
110
113
|
expectedProtocol,
|
|
111
114
|
protocolHint,
|
|
112
115
|
forceProtocolDetection,
|
|
113
|
-
|
|
116
|
+
skipProtocolProbe,
|
|
117
|
+
};
|
|
118
|
+
res = await transport.acquire(acquireInput);
|
|
114
119
|
} else {
|
|
115
120
|
res = await transport.acquire({
|
|
116
121
|
path,
|