@onekeyfe/hd-core 1.2.8-alpha.1 → 1.2.8-alpha.3
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__/DeviceCommands.test.ts +66 -13
- package/__tests__/core-error-output.test.ts +34 -3
- package/__tests__/device-lifecycle-events.test.ts +64 -17
- package/__tests__/device-pool-state.test.ts +50 -0
- package/__tests__/protocol-v2-bootloader-mode.test.ts +31 -2
- package/__tests__/protocol-v2.test.ts +0 -47
- package/__tests__/refresh-device-state.test.ts +19 -17
- package/__tests__/sol-sign-offchain-message.test.ts +0 -8
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetDeviceState.d.ts.map +1 -1
- package/dist/core/index.d.ts +0 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/device/Device.d.ts +2 -0
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/device/DeviceCommands.d.ts +4 -4
- package/dist/device/DeviceCommands.d.ts.map +1 -1
- package/dist/device/DevicePool.d.ts.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +38 -28
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +8 -25
- package/src/api/GetDeviceState.ts +2 -5
- package/src/core/index.ts +3 -7
- package/src/device/Device.ts +11 -1
- package/src/device/DeviceCommands.ts +15 -1
- package/src/device/DevicePool.ts +12 -2
- package/src/events/core.ts +2 -2
- package/src/types/params.ts +1 -1
|
@@ -130,19 +130,6 @@ describe('DeviceCommands failure mapping', () => {
|
|
|
130
130
|
);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it('preserves the Protocol V2 peer-removed pairing error code', async () => {
|
|
134
|
-
const commands = createCommands();
|
|
135
|
-
const transportError = Object.assign(new Error('Peer removed pairing information'), {
|
|
136
|
-
errorCode: HardwareErrorCode.BlePeerRemovedPairingInformation,
|
|
137
|
-
});
|
|
138
|
-
commands.mainId = 'main-id';
|
|
139
|
-
commands.transport = {
|
|
140
|
-
call: jest.fn().mockRejectedValue(transportError),
|
|
141
|
-
} as any;
|
|
142
|
-
|
|
143
|
-
await expect(commands._commonCall('DeviceInfoGet', {})).rejects.toBe(transportError);
|
|
144
|
-
});
|
|
145
|
-
|
|
146
133
|
it('logs canonical DeviceStatus response fields without exposing the device ID', async () => {
|
|
147
134
|
const commands = createCommands();
|
|
148
135
|
const log = getLogger(LoggerNames.DeviceCommands);
|
|
@@ -414,6 +401,27 @@ describe('DeviceCommands failure mapping', () => {
|
|
|
414
401
|
).rejects.toMatchObject({ errorCode: HardwareErrorCode.DeviceBusy });
|
|
415
402
|
});
|
|
416
403
|
|
|
404
|
+
it('maps commands rejected during a Protocol V2 firmware update to DeviceBusy', async () => {
|
|
405
|
+
const commands = createCommands();
|
|
406
|
+
const message = 'Requested command not allowed while a firmware update is in progress';
|
|
407
|
+
|
|
408
|
+
await expect(
|
|
409
|
+
commands._filterCommonTypes(
|
|
410
|
+
{
|
|
411
|
+
type: 'Failure',
|
|
412
|
+
message: { code: 'Failure_ProcessError', message },
|
|
413
|
+
} as any,
|
|
414
|
+
'ProtocolInfoRequest'
|
|
415
|
+
)
|
|
416
|
+
).rejects.toMatchObject({
|
|
417
|
+
errorCode: HardwareErrorCode.DeviceBusy,
|
|
418
|
+
params: {
|
|
419
|
+
failureCode: 'Failure_ProcessError',
|
|
420
|
+
firmwareMessage: message,
|
|
421
|
+
},
|
|
422
|
+
});
|
|
423
|
+
});
|
|
424
|
+
|
|
417
425
|
it('maps the current AskPin passphrase-disabled response without relying on a subcode', async () => {
|
|
418
426
|
const commands = createCommands();
|
|
419
427
|
|
|
@@ -551,6 +559,51 @@ describe('DeviceCommands failure mapping', () => {
|
|
|
551
559
|
}
|
|
552
560
|
);
|
|
553
561
|
|
|
562
|
+
it('maps the Protocol V2 seed-session busy response to DeviceBusy', async () => {
|
|
563
|
+
const commands = createCommands();
|
|
564
|
+
|
|
565
|
+
await expect(
|
|
566
|
+
commands._filterCommonTypes(
|
|
567
|
+
{
|
|
568
|
+
type: 'Failure',
|
|
569
|
+
message: {
|
|
570
|
+
code: 'Failure_ProcessError',
|
|
571
|
+
subcode: DeviceSessionErrorCode.DeviceSessionError_UserCancelled,
|
|
572
|
+
message: 'PIN cancelled',
|
|
573
|
+
},
|
|
574
|
+
} as any,
|
|
575
|
+
'SignTx'
|
|
576
|
+
)
|
|
577
|
+
).rejects.toMatchObject({
|
|
578
|
+
errorCode: HardwareErrorCode.DeviceBusy,
|
|
579
|
+
params: {
|
|
580
|
+
failureCode: 'Failure_ProcessError',
|
|
581
|
+
subcode: DeviceSessionErrorCode.DeviceSessionError_UserCancelled,
|
|
582
|
+
firmwareMessage: 'PIN cancelled',
|
|
583
|
+
},
|
|
584
|
+
});
|
|
585
|
+
});
|
|
586
|
+
|
|
587
|
+
it('keeps the same Protocol V2 response as ActionCancelled for DeviceSession calls', async () => {
|
|
588
|
+
const commands = createCommands();
|
|
589
|
+
|
|
590
|
+
await expect(
|
|
591
|
+
commands._filterCommonTypes(
|
|
592
|
+
{
|
|
593
|
+
type: 'Failure',
|
|
594
|
+
message: {
|
|
595
|
+
code: 'Failure_ProcessError',
|
|
596
|
+
subcode: DeviceSessionErrorCode.DeviceSessionError_UserCancelled,
|
|
597
|
+
message: 'PIN cancelled',
|
|
598
|
+
},
|
|
599
|
+
} as any,
|
|
600
|
+
'DeviceSessionAskPin'
|
|
601
|
+
)
|
|
602
|
+
).rejects.toMatchObject({
|
|
603
|
+
errorCode: HardwareErrorCode.ActionCancelled,
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
|
|
554
607
|
it('does not use the legacy cancellation-message fallback for Protocol V1', async () => {
|
|
555
608
|
const commands = createCommands();
|
|
556
609
|
(commands.device.isProtocolV2 as jest.Mock).mockReturnValue(false);
|
|
@@ -3,7 +3,7 @@ import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
|
3
3
|
import { initConnector, initCore } from '../src/core';
|
|
4
4
|
import { DataManager } from '../src/data-manager';
|
|
5
5
|
import TransportManager from '../src/data-manager/TransportManager';
|
|
6
|
-
import { IFRAME } from '../src/events';
|
|
6
|
+
import { IFRAME, createErrorMessage } from '../src/events';
|
|
7
7
|
import SearchDevices from '../src/api/SearchDevices';
|
|
8
8
|
import { DeviceList } from '../src/device/DeviceList';
|
|
9
9
|
import { Device } from '../src/device/Device';
|
|
@@ -28,6 +28,23 @@ describe('Core 错误输出边界', () => {
|
|
|
28
28
|
jest.restoreAllMocks();
|
|
29
29
|
});
|
|
30
30
|
|
|
31
|
+
test('entry-point errors preserve USB recovery context across JSON serialization', () => {
|
|
32
|
+
const params = {
|
|
33
|
+
operation: 'open',
|
|
34
|
+
nativeErrorName: 'SecurityError',
|
|
35
|
+
nativeErrorMessage: 'Access denied',
|
|
36
|
+
};
|
|
37
|
+
const error = ERRORS.TypedError(
|
|
38
|
+
HardwareErrorCode.BridgeNeedsPermission,
|
|
39
|
+
'Access denied',
|
|
40
|
+
params
|
|
41
|
+
);
|
|
42
|
+
expect(JSON.parse(JSON.stringify(createErrorMessage(error)))).toEqual({
|
|
43
|
+
success: false,
|
|
44
|
+
payload: { code: HardwareErrorCode.BridgeNeedsPermission, error: 'Access denied', params },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
|
|
31
48
|
test.each([
|
|
32
49
|
['webusb', false],
|
|
33
50
|
['desktop-webusb', false],
|
|
@@ -108,14 +125,28 @@ describe('Core 错误输出边界', () => {
|
|
|
108
125
|
HardwareErrorCode.BleDeviceBondedCanceled,
|
|
109
126
|
HardwareErrorCode.BleDeviceDisconnected,
|
|
110
127
|
HardwareErrorCode.PollingTimeout,
|
|
128
|
+
HardwareErrorCode.BlePoweredOff,
|
|
129
|
+
HardwareErrorCode.BleUnsupported,
|
|
130
|
+
HardwareErrorCode.BridgeNeedsPermission,
|
|
131
|
+
HardwareErrorCode.WebUsbDeviceAccessError,
|
|
111
132
|
])(
|
|
112
|
-
'preserves terminal
|
|
133
|
+
'preserves terminal transport error %s in the public response without polling again',
|
|
113
134
|
async errorCode => {
|
|
114
|
-
jest
|
|
135
|
+
jest
|
|
136
|
+
.spyOn(DataManager, 'getSettings')
|
|
137
|
+
.mockReturnValue(
|
|
138
|
+
[
|
|
139
|
+
HardwareErrorCode.BridgeNeedsPermission,
|
|
140
|
+
HardwareErrorCode.WebUsbDeviceAccessError,
|
|
141
|
+
].includes(errorCode)
|
|
142
|
+
? ('desktop-webusb' as never)
|
|
143
|
+
: ('react-native' as never)
|
|
144
|
+
);
|
|
115
145
|
const error = ERRORS.TypedError(errorCode);
|
|
116
146
|
const acquire = jest.fn().mockRejectedValue(error);
|
|
117
147
|
jest.spyOn(TransportManager, 'getTransport').mockReturnValue({
|
|
118
148
|
acquire,
|
|
149
|
+
enumerate: jest.fn().mockResolvedValue([{ path: 'ble-pairing-test' }]),
|
|
119
150
|
release: jest.fn().mockResolvedValue(true),
|
|
120
151
|
stop: jest.fn().mockResolvedValue(undefined),
|
|
121
152
|
} as never);
|
|
@@ -10,7 +10,6 @@ import {
|
|
|
10
10
|
isMissingDetectedProtocolV2Error,
|
|
11
11
|
isRetryableBleConnectionError,
|
|
12
12
|
isRetryableBleProtocolV2ProbeError,
|
|
13
|
-
isTerminalBleStaleBondError,
|
|
14
13
|
resolveBleConnectProtocol,
|
|
15
14
|
} from '../src/core';
|
|
16
15
|
import { DataManager } from '../src/data-manager';
|
|
@@ -611,7 +610,6 @@ describe('public device lifecycle events', () => {
|
|
|
611
610
|
test.each([
|
|
612
611
|
[HardwareErrorCode.RuntimeError, true],
|
|
613
612
|
[HardwareErrorCode.BleDeviceBondError, false],
|
|
614
|
-
[HardwareErrorCode.BlePeerRemovedPairingInformation, false],
|
|
615
613
|
] as const)(
|
|
616
614
|
'retries a Protocol V2 probe mismatch with error code %s: %s',
|
|
617
615
|
(errorCode, expected) => {
|
|
@@ -631,8 +629,6 @@ describe('public device lifecycle events', () => {
|
|
|
631
629
|
[HardwareErrorCode.BleTimeoutError, true],
|
|
632
630
|
[HardwareErrorCode.PollingTimeout, false],
|
|
633
631
|
[HardwareErrorCode.BleDeviceBondError, false],
|
|
634
|
-
[HardwareErrorCode.BlePeerRemovedPairingInformation, false],
|
|
635
|
-
[HardwareErrorCode.BleBondInvalid, false],
|
|
636
632
|
] as const)('retries a BLE connection error with error code %s: %s', (errorCode, expected) => {
|
|
637
633
|
const method = { payload: { connectProtocol: 'V2' } } as never;
|
|
638
634
|
const error = {
|
|
@@ -685,19 +681,6 @@ describe('public device lifecycle events', () => {
|
|
|
685
681
|
}
|
|
686
682
|
);
|
|
687
683
|
|
|
688
|
-
test.each([
|
|
689
|
-
[HardwareErrorCode.BleDeviceBondError, true],
|
|
690
|
-
[HardwareErrorCode.BlePeerRemovedPairingInformation, true],
|
|
691
|
-
[HardwareErrorCode.BleBondInvalid, true],
|
|
692
|
-
[HardwareErrorCode.DeviceNotFound, false],
|
|
693
|
-
] as const)('treats BLE stale-bond error code %s as terminal: %s', (errorCode, expected) => {
|
|
694
|
-
const error = {
|
|
695
|
-
errorCode,
|
|
696
|
-
};
|
|
697
|
-
|
|
698
|
-
expect(isTerminalBleStaleBondError(error)).toBe(expected);
|
|
699
|
-
});
|
|
700
|
-
|
|
701
684
|
test.each([
|
|
702
685
|
[HardwareErrorCode.DeviceCheckDeviceIdError, true],
|
|
703
686
|
[HardwareErrorCode.DeviceNotFound, false],
|
|
@@ -729,6 +712,48 @@ describe('public device lifecycle events', () => {
|
|
|
729
712
|
expect(() => JSON.stringify(disconnectMessage?.payload.device)).not.toThrow();
|
|
730
713
|
});
|
|
731
714
|
|
|
715
|
+
test.each(['V1', 'V2'] as const)(
|
|
716
|
+
'preserves the %s connection identity for a transport disconnect after wipe',
|
|
717
|
+
protocol => {
|
|
718
|
+
jest.spyOn(DataManager, 'getSettings').mockReturnValue('webusb' as never);
|
|
719
|
+
core = initCore();
|
|
720
|
+
initConnector();
|
|
721
|
+
const messages: CoreMessage[] = [];
|
|
722
|
+
core.on(CORE_EVENT, message => messages.push(message));
|
|
723
|
+
const device = createInitializedDevice(protocol);
|
|
724
|
+
const connectId = device.getConnectId();
|
|
725
|
+
DevicePool.devicesCache[connectId] = device;
|
|
726
|
+
|
|
727
|
+
device.invalidateAfterWipe();
|
|
728
|
+
expect(device.toMessageObject()).toBeNull();
|
|
729
|
+
DevicePool.emitter.emit(DEVICE.CONNECT, device);
|
|
730
|
+
expect(messages.some(message => message.type === DEVICE.CONNECT)).toBe(false);
|
|
731
|
+
DevicePool.emitter.emit(TRANSPORT_EVENT.DEVICE_DISCONNECT, { connectId });
|
|
732
|
+
|
|
733
|
+
const disconnects = messages.filter(message => message.type === DEVICE.DISCONNECT);
|
|
734
|
+
expect(disconnects).toHaveLength(1);
|
|
735
|
+
expect(disconnects[0].payload.device).toMatchObject({
|
|
736
|
+
connectId,
|
|
737
|
+
serialNo: 'SERIAL-001',
|
|
738
|
+
deviceId: 'wallet-device-id',
|
|
739
|
+
});
|
|
740
|
+
expect(() => JSON.stringify(disconnects[0].payload.device)).not.toThrow();
|
|
741
|
+
|
|
742
|
+
device.features = {
|
|
743
|
+
...createInitializedDevice(protocol).features,
|
|
744
|
+
deviceId: 'new-device-id',
|
|
745
|
+
initialized: false,
|
|
746
|
+
mode: 'notInitialized',
|
|
747
|
+
} as never;
|
|
748
|
+
DevicePool.emitter.emit(TRANSPORT_EVENT.DEVICE_DISCONNECT, { connectId });
|
|
749
|
+
const nextDisconnects = messages.filter(message => message.type === DEVICE.DISCONNECT);
|
|
750
|
+
expect(nextDisconnects[1].payload.device).toMatchObject({
|
|
751
|
+
deviceId: 'new-device-id',
|
|
752
|
+
mode: 'notInitialized',
|
|
753
|
+
});
|
|
754
|
+
}
|
|
755
|
+
);
|
|
756
|
+
|
|
732
757
|
test('treats an acquired BLE device as reusable until the transport disconnects', async () => {
|
|
733
758
|
jest.spyOn(DataManager, 'getSettings').mockReturnValue('desktop-web-ble' as never);
|
|
734
759
|
const device = createInitializedDevice('V2');
|
|
@@ -1014,6 +1039,28 @@ describe('public device lifecycle events', () => {
|
|
|
1014
1039
|
expect(device.wasInterruptedByUser()).toBe(false);
|
|
1015
1040
|
});
|
|
1016
1041
|
|
|
1042
|
+
test.each(['V1', 'V2'] as const)(
|
|
1043
|
+
'retires a failed USB %s session before the next user attempt',
|
|
1044
|
+
async protocol => {
|
|
1045
|
+
jest.spyOn(DataManager, 'getSettings').mockReturnValue('desktop-webusb' as never);
|
|
1046
|
+
const device = createInitializedDevice(protocol);
|
|
1047
|
+
device.originalDescriptor = { ...device.originalDescriptor, session: device.mainId };
|
|
1048
|
+
const disconnect = jest.fn().mockResolvedValue(undefined);
|
|
1049
|
+
const release = jest.fn().mockResolvedValue(undefined);
|
|
1050
|
+
device.deviceConnector = { disconnect, release } as never;
|
|
1051
|
+
device.commands = { disposed: false, dispose: jest.fn() } as never;
|
|
1052
|
+
(device as unknown as { deviceAcquired: boolean }).deviceAcquired = true;
|
|
1053
|
+
const error = ERRORS.TypedError(HardwareErrorCode.WebUsbDeviceAccessError);
|
|
1054
|
+
await expect(device.run(() => Promise.reject(error))).rejects.toBe(error);
|
|
1055
|
+
await new Promise(resolve => {
|
|
1056
|
+
setImmediate(resolve);
|
|
1057
|
+
});
|
|
1058
|
+
expect(disconnect).toHaveBeenCalledWith(device.mainId);
|
|
1059
|
+
expect(release).toHaveBeenCalledTimes(1);
|
|
1060
|
+
expect(device.hasDeviceAcquire()).toBe(false);
|
|
1061
|
+
}
|
|
1062
|
+
);
|
|
1063
|
+
|
|
1017
1064
|
test('waits for the canceled run to finish releasing before cancellation completes', async () => {
|
|
1018
1065
|
jest.spyOn(DataManager, 'getSettings').mockReturnValue('react-native' as never);
|
|
1019
1066
|
const device = createInitializedDevice('V2');
|
|
@@ -85,6 +85,56 @@ describe('DevicePool state lifecycle', () => {
|
|
|
85
85
|
expect(result.deviceList).toEqual([device]);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
+
test.each([
|
|
89
|
+
['V1', undefined],
|
|
90
|
+
['V1', 'wipe-path'],
|
|
91
|
+
['V2', undefined],
|
|
92
|
+
['V2', 'wipe-path'],
|
|
93
|
+
] as const)('rediscovers a wiped %s device with connect id %s', async (protocol, connectId) => {
|
|
94
|
+
const descriptor = { path: 'wipe-path', protocolType: protocol } as never;
|
|
95
|
+
const device = Device.fromDescriptor(descriptor);
|
|
96
|
+
device.features = {
|
|
97
|
+
protocol,
|
|
98
|
+
deviceType: protocol === 'V2' ? 'pro2' : 'classic',
|
|
99
|
+
deviceId: 'old-device-id',
|
|
100
|
+
serialNo: 'wipe-path',
|
|
101
|
+
initialized: true,
|
|
102
|
+
mode: 'normal',
|
|
103
|
+
} as never;
|
|
104
|
+
DevicePool.devicesCache = { 'wipe-path': device };
|
|
105
|
+
device.invalidateAfterWipe();
|
|
106
|
+
expect(device.toMessageObject()).toBeNull();
|
|
107
|
+
const connect = jest.spyOn(device, 'connect').mockResolvedValue(true);
|
|
108
|
+
const initialize = jest.spyOn(device, 'initialize').mockImplementation(() => {
|
|
109
|
+
device.features = {
|
|
110
|
+
protocol,
|
|
111
|
+
deviceType: protocol === 'V2' ? 'pro2' : 'classic',
|
|
112
|
+
deviceId: 'new-device-id',
|
|
113
|
+
serialNo: 'wipe-path',
|
|
114
|
+
initialized: false,
|
|
115
|
+
mode: 'notInitialized',
|
|
116
|
+
} as never;
|
|
117
|
+
return Promise.resolve();
|
|
118
|
+
});
|
|
119
|
+
const release = jest.spyOn(device, 'release').mockResolvedValue(undefined);
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const result = await DevicePool.getDevices([descriptor], connectId);
|
|
123
|
+
expect(initialize).toHaveBeenCalledTimes(1);
|
|
124
|
+
expect(connect).toHaveBeenCalledTimes(1);
|
|
125
|
+
expect(release).toHaveBeenCalledTimes(1);
|
|
126
|
+
expect(result.deviceList[0].toMessageObject()).toMatchObject({
|
|
127
|
+
deviceId: 'new-device-id',
|
|
128
|
+
mode: 'notInitialized',
|
|
129
|
+
features: { initialized: false },
|
|
130
|
+
});
|
|
131
|
+
await DevicePool.getDevices([descriptor], connectId);
|
|
132
|
+
expect(initialize).toHaveBeenCalledTimes(1);
|
|
133
|
+
} finally {
|
|
134
|
+
jest.restoreAllMocks();
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
|
|
88
138
|
test('keeps a discovered device when its Protocol V2 label cannot be read', async () => {
|
|
89
139
|
const labelError = new Error('settings unavailable');
|
|
90
140
|
const getDeviceState = jest
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { EDeviceType } from '@onekeyfe/hd-shared';
|
|
2
|
+
|
|
1
3
|
import { Device } from '../src/device/Device';
|
|
2
4
|
import { UI_REQUEST } from '../src/events/ui-request';
|
|
3
5
|
|
|
@@ -23,12 +25,39 @@ const createBootloaderDevice = (protocolType: 'V1' | 'V2') => {
|
|
|
23
25
|
};
|
|
24
26
|
|
|
25
27
|
describe('Pro2 bootloader mode', () => {
|
|
26
|
-
test('
|
|
28
|
+
test('blocks Protocol V2 methods that are not allowed in bootloader mode', () => {
|
|
29
|
+
const device = createBootloaderDevice('V2');
|
|
30
|
+
|
|
31
|
+
expect(device.hasUnexpectedMode([], [])).toBe(UI_REQUEST.BOOTLOADER);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test('allows Protocol V2 methods that explicitly support bootloader mode', () => {
|
|
27
35
|
const device = createBootloaderDevice('V2');
|
|
28
36
|
|
|
29
|
-
expect(device.hasUnexpectedMode([], [])).toBeNull();
|
|
37
|
+
expect(device.hasUnexpectedMode([UI_REQUEST.BOOTLOADER], [])).toBeNull();
|
|
30
38
|
});
|
|
31
39
|
|
|
40
|
+
test.each([EDeviceType.Pro2, EDeviceType.Neo])(
|
|
41
|
+
'blocks unsupported Protocol V2 methods in %s romloader mode',
|
|
42
|
+
deviceType => {
|
|
43
|
+
const device = createBootloaderDevice('V2');
|
|
44
|
+
device.updateState(
|
|
45
|
+
{
|
|
46
|
+
protocol: 'V2',
|
|
47
|
+
identity: { deviceType },
|
|
48
|
+
status: { mode: 'romloader', initialized: null },
|
|
49
|
+
},
|
|
50
|
+
'initialize'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(device.hasUnexpectedMode([], [])).toBe(UI_REQUEST.BOOTLOADER);
|
|
54
|
+
expect(device.hasUnexpectedMode([UI_REQUEST.NOT_INITIALIZE], [])).toBe(UI_REQUEST.BOOTLOADER);
|
|
55
|
+
expect(
|
|
56
|
+
device.hasUnexpectedMode([UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE], [])
|
|
57
|
+
).toBeNull();
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
|
|
32
61
|
test('keeps the Protocol V1 bootloader restriction', () => {
|
|
33
62
|
const device = createBootloaderDevice('V1');
|
|
34
63
|
|
|
@@ -4991,23 +4991,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
4991
4991
|
expect(typedCall.mock.calls.map(call => call[0])).toEqual(['DeviceInfoGet']);
|
|
4992
4992
|
});
|
|
4993
4993
|
|
|
4994
|
-
test('stops V4 bootloader reconnect polling on a stale BLE bond', async () => {
|
|
4995
|
-
const method = new FirmwareUpdateV4({
|
|
4996
|
-
id: 1,
|
|
4997
|
-
payload: {
|
|
4998
|
-
method: 'firmwareUpdateV4',
|
|
4999
|
-
},
|
|
5000
|
-
});
|
|
5001
|
-
const staleBondError = ERRORS.TypedError(HardwareErrorCode.BlePeerRemovedPairingInformation);
|
|
5002
|
-
const reconnectProtocolV2Device = jest.fn().mockRejectedValue(staleBondError);
|
|
5003
|
-
(method as any).reconnectProtocolV2Device = reconnectProtocolV2Device;
|
|
5004
|
-
|
|
5005
|
-
await expect((method as any).waitForProtocolV2BootloaderMode(60_000, 0)).rejects.toBe(
|
|
5006
|
-
staleBondError
|
|
5007
|
-
);
|
|
5008
|
-
expect(reconnectProtocolV2Device).toHaveBeenCalledTimes(1);
|
|
5009
|
-
});
|
|
5010
|
-
|
|
5011
4994
|
test('polls again when Protocol V2 bootloader serial is temporarily unavailable', async () => {
|
|
5012
4995
|
const method = new FirmwareUpdateV4({
|
|
5013
4996
|
id: 1,
|
|
@@ -9009,36 +8992,6 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
9009
8992
|
);
|
|
9010
8993
|
});
|
|
9011
8994
|
|
|
9012
|
-
test('does not retry or wrap a stale BLE bond during a V4 file transfer', async () => {
|
|
9013
|
-
const method = new FirmwareUpdateV4({
|
|
9014
|
-
id: 1,
|
|
9015
|
-
payload: {
|
|
9016
|
-
method: 'firmwareUpdateV4',
|
|
9017
|
-
},
|
|
9018
|
-
});
|
|
9019
|
-
const staleBondError = ERRORS.TypedError(HardwareErrorCode.BlePeerRemovedPairingInformation);
|
|
9020
|
-
(method as any).fileWriteChunk = jest.fn().mockRejectedValue(staleBondError);
|
|
9021
|
-
const recoverProtocolV2FileTransfer = jest.fn();
|
|
9022
|
-
(method as any).recoverProtocolV2FileTransfer = recoverProtocolV2FileTransfer;
|
|
9023
|
-
const source = await openFirmwareByteSource({
|
|
9024
|
-
binary: new Uint8Array([1]).buffer,
|
|
9025
|
-
});
|
|
9026
|
-
|
|
9027
|
-
try {
|
|
9028
|
-
await expect(
|
|
9029
|
-
(method as any).protocolV2SourceUpdateProcess({
|
|
9030
|
-
source,
|
|
9031
|
-
filePath: 'vol1:firmware.bin',
|
|
9032
|
-
processedSize: 0,
|
|
9033
|
-
totalSize: 1,
|
|
9034
|
-
})
|
|
9035
|
-
).rejects.toBe(staleBondError);
|
|
9036
|
-
} finally {
|
|
9037
|
-
await source?.close();
|
|
9038
|
-
}
|
|
9039
|
-
expect(recoverProtocolV2FileTransfer).not.toHaveBeenCalled();
|
|
9040
|
-
});
|
|
9041
|
-
|
|
9042
8995
|
test('does not recover or wrap a cancelled V4 file transfer', async () => {
|
|
9043
8996
|
const method = new FirmwareUpdateV4({
|
|
9044
8997
|
id: 1,
|
|
@@ -73,24 +73,26 @@ describe('live device state reads', () => {
|
|
|
73
73
|
}
|
|
74
74
|
);
|
|
75
75
|
|
|
76
|
-
test('
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
test.each(['bootloader', 'romloader'] as const)(
|
|
77
|
+
'reports %s mode for settings scope after minimal mode detection',
|
|
78
|
+
async mode => {
|
|
79
|
+
const getDeviceState = jest.fn().mockResolvedValue({ status: { mode } });
|
|
80
|
+
const method = new GetDeviceState({
|
|
81
|
+
id: 1,
|
|
82
|
+
payload: { method: 'getDeviceState', scope: 'settings' },
|
|
83
|
+
});
|
|
84
|
+
method.init();
|
|
85
|
+
(method as any).device = {
|
|
86
|
+
isProtocolV2: () => true,
|
|
87
|
+
getDeviceState,
|
|
88
|
+
};
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
90
|
+
await expect(method.run()).rejects.toMatchObject({
|
|
91
|
+
errorCode: HardwareErrorCode.NotAllowInBootloaderMode,
|
|
92
|
+
});
|
|
93
|
+
expect(getDeviceState).toHaveBeenCalledWith({ refreshSections: ['status', 'settings'] });
|
|
94
|
+
}
|
|
95
|
+
);
|
|
94
96
|
|
|
95
97
|
test('rejects an unknown scope', () => {
|
|
96
98
|
const method = new GetDeviceState({
|
|
@@ -54,14 +54,6 @@ describe('SolSignOffchainMessage', () => {
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
|
|
57
|
-
test('maps omitted required signers to an empty repeated field', () => {
|
|
58
|
-
const method = createMethod({ requiredSigners: undefined });
|
|
59
|
-
|
|
60
|
-
method.init();
|
|
61
|
-
|
|
62
|
-
expect(method.params.required_signers).toEqual([]);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
57
|
test.each([
|
|
66
58
|
{ requiredSigners: ['11'], error: '32-byte hex public key' },
|
|
67
59
|
{ requiredSigners: [signerB, signerA], error: 'strictly sorted and unique' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FirmwareUpdateV4.d.ts","sourceRoot":"","sources":["../../src/api/FirmwareUpdateV4.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
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;AAiC/E,OAAO,KAAK,EAEV,sBAAsB,EAEvB,MAAM,6BAA6B,CAAC;AAuErC,wBAAgB,wCAAwC,CACtD,UAAU,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,EAC5C,MAAM,EAAE,sBAAsB,EAC9B,0BAA0B,UAAQ,QAiCnC;AA6UD,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;IAC5F,OAAO,CAAC,8BAA8B,CAAC,CAAS;IAEhD,OAAO,CAAC,sBAAsB,CAAC,CAAS;IAExC,OAAO,CAAC,oCAAoC,CAAS;IAErD,qBAAqB;IAIrB,OAAO,CAAC,yBAAyB,CAA4B;IAE7D,OAAO,CAAC,2BAA2B,CAAS;IAE5C,OAAO,CAAC,iCAAiC,CAAS;IAElD,OAAO,CAAC,iCAAiC,CAA6B;IAEtE,OAAO,CAAC,4BAA4B,CAAqB;IAEzD,OAAO,CAAC,6BAA6B,CAAC,CAAW;IAEjD,OAAO,CAAC,+BAA+B,CAAC,CAAuB;IAE/D,OAAO,CAAC,2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kBrB,+BAA+B;IAkD7C,OAAO,CAAC,6BAA6B;YAkCvB,6BAA6B;YA0B7B,0CAA0C;YA6B1C,uBAAuB;YAiCvB,8BAA8B;YAkF9B,6BAA6B;IAuF3C,OAAO,CAAC,mCAAmC;YAI7B,0BAA0B;IAaxC,OAAO,CAAC,8BAA8B;IAiBtC,OAAO,CAAC,4BAA4B;IAoLpC,OAAO,CAAC,6BAA6B;IAcrC,OAAO,CAAC,qCAAqC;IAoC7C,OAAO,CAAC,kCAAkC;IAyC1C,OAAO,CAAC,8CAA8C;YAIxC,uCAAuC;YA8UvC,gCAAgC;YAehC,yBAAyB;IAUvC,OAAO,CAAC,2BAA2B;YAMrB,8BAA8B;IAQ5C,OAAO,CAAC,0BAA0B;YAkBpB,mCAAmC;YAWnC,qCAAqC;YAmDrC,yBAAyB;YAgGzB,8BAA8B;IAU5C,OAAO,CAAC,kCAAkC;YAQ5B,cAAc;YAyCd,6BAA6B;YAW7B,0BAA0B;YAoB1B,6BAA6B;YAwD7B,gBAAgB;IA0B9B,OAAO,CAAC,qBAAqB;CAM9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDeviceState.d.ts","sourceRoot":"","sources":["../../src/api/GetDeviceState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAU1F,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CACpD,QAAQ,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAC9C;IACC,qBAAqB;IAIrB,IAAI;IAmBE,GAAG;
|
|
1
|
+
{"version":3,"file":"GetDeviceState.d.ts","sourceRoot":"","sources":["../../src/api/GetDeviceState.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,KAAK,EAAoB,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAU1F,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,UAAU,CACpD,QAAQ,CAAC,IAAI,CAAC,oBAAoB,EAAE,OAAO,CAAC,CAAC,CAC9C;IACC,qBAAqB;IAIrB,IAAI;IAmBE,GAAG;CAaV"}
|
package/dist/core/index.d.ts
CHANGED
|
@@ -12,7 +12,6 @@ export declare function getPostCallPendingPromise(method: BaseMethod, device: De
|
|
|
12
12
|
export declare function isRetryableBleProtocolV2ProbeError(method: BaseMethod, error: unknown): boolean;
|
|
13
13
|
export declare function isRetryableBleConnectionError(method: BaseMethod, error: unknown): boolean;
|
|
14
14
|
export declare function isMissingDetectedProtocolV2Error(method: BaseMethod, error: unknown): boolean;
|
|
15
|
-
export declare function isTerminalBleStaleBondError(error: unknown): boolean;
|
|
16
15
|
export declare function isDeviceIdentityMismatchError(error: unknown): boolean;
|
|
17
16
|
export declare function resolveBleConnectProtocol(method: BaseMethod): ProtocolType | undefined;
|
|
18
17
|
export declare const cancel: (context: CoreContext, connectId?: string) => void;
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAEL,KAAK,6BAA6B,EAElC,KAAK,YAAY,EAIlB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";AACA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAClC,OAAO,EAEL,KAAK,6BAA6B,EAElC,KAAK,YAAY,EAIlB,MAAM,wBAAwB,CAAC;AAgChC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAsB1C,OAAO,eAAe,MAAM,2BAA2B,CAAC;AAYxD,OAAO,KAAK,EAAE,eAAe,EAAyB,MAAM,UAAU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;CAiC/B;AAED,eAAO,MAAM,QAAQ,YAIpB,CAAC;AAEF,eAAO,MAAM,aAAa,uBAYzB,CAAC;AAMF,eAAO,MAAM,IAAI,aACL,eAAe,aACd,GAAG,WACL,6BAA6B,8BAiBvC,CAAC;AAEF,eAAO,MAAM,eAAe;SAKrB,eAAe,CAAC,KAAK,CAAC;eAChB,GAAG;;UASf,CAAC"}
|
package/dist/device/Device.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare class Device extends EventEmitter {
|
|
|
70
70
|
private connectionAttempt;
|
|
71
71
|
private interruptedAttempt;
|
|
72
72
|
private stateStore;
|
|
73
|
+
private deviceBeforeWipe;
|
|
73
74
|
private protocolV2StateNeedsReload;
|
|
74
75
|
private protocolV2RuntimeContext?;
|
|
75
76
|
private protocolV2RuntimeContextPromise?;
|
|
@@ -98,6 +99,7 @@ export declare class Device extends EventEmitter {
|
|
|
98
99
|
constructor(descriptor: DeviceDescriptor, sdkInstanceId?: string);
|
|
99
100
|
static fromDescriptor(originalDescriptor: DeviceDescriptor, sdkInstanceId?: string): Device;
|
|
100
101
|
toMessageObject(): DeviceTyped | null;
|
|
102
|
+
toDisconnectMessageObject(): DeviceTyped | null;
|
|
101
103
|
connect(connectProtocol?: HardwareConnectProtocol, options?: {
|
|
102
104
|
forceProtocolDetection?: boolean;
|
|
103
105
|
}): Promise<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Device.d.ts","sourceRoot":"","sources":["../../src/device/Device.ts"],"names":[],"mappings":";AAAA,OAAO,YAAY,MAAM,QAAQ,CAAC;AAElC,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAmB,MAAM,wBAAwB,CAAC;AACjG,OAAO,EAEL,aAAa,EASd,MAAM,qBAAqB,CAAC;AAU7B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAalD,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,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O,CAAC,EACzC,UAAU,EAAE,yBAAyB,CAAC,YAAY,CAAC,EACnD,OAAO,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,CAAC;KAChD,GACA,yBAAyB,GAAG,SAAS;IAsBxC,yBAAyB,CACvB,KAAK,EAAE,yBAAyB,EAChC,OAAO,GAAE,yBAAyB,CAAC,SAAS,CAAe;IAQ7D,6BAA6B,CAC3B,OAAO,CAAC,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC9C,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,CAAA;KAAE;IAwBxC,8BAA8B;IAI9B,yBAAyB,IAAI,mBAAmB;IAS1C,YAAY,CAChB,OAAO,CAAC,EAAE,oBAAoB,EAC9B,OAAO,CAAC,EAAE,yBAAyB,GAAG;QAAE,WAAW,CAAC,EAAE,OAAO,CAAA;KAAE;IAmG3D,0BAA0B,CAC9B,eAAe,CAAC,EAAE,MAAM,EACxB,kBAAkB,CAAC,EAAE,OAAO,EAC5B,mBAAmB,CAAC,EAAE,OAAO,EAC7B,aAAa,CAAC,EAAE,OAAO,EACvB,eAAe,CAAC,EAAE,OAAO;CA0D5B;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -31,7 +31,7 @@ export declare const cancelDeviceInPrompt: (device: Device, expectResponse?: boo
|
|
|
31
31
|
};
|
|
32
32
|
} | {
|
|
33
33
|
success: boolean;
|
|
34
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
34
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
35
35
|
payload: {
|
|
36
36
|
message: string;
|
|
37
37
|
};
|
|
@@ -50,7 +50,7 @@ export declare const cancelDeviceWithInitialize: (device: Device) => Promise<{
|
|
|
50
50
|
};
|
|
51
51
|
} | {
|
|
52
52
|
success: boolean;
|
|
53
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
53
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
54
54
|
payload: {
|
|
55
55
|
message: string;
|
|
56
56
|
};
|
|
@@ -81,7 +81,7 @@ export declare class DeviceCommands {
|
|
|
81
81
|
};
|
|
82
82
|
} | {
|
|
83
83
|
success: boolean;
|
|
84
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
84
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
85
85
|
payload: {
|
|
86
86
|
message: string;
|
|
87
87
|
};
|
|
@@ -100,7 +100,7 @@ export declare class DeviceCommands {
|
|
|
100
100
|
};
|
|
101
101
|
} | {
|
|
102
102
|
success: boolean;
|
|
103
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
103
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
104
104
|
payload: {
|
|
105
105
|
message: string;
|
|
106
106
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeviceCommands.d.ts","sourceRoot":"","sources":["../../src/device/DeviceCommands.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,oBAAoB,EAG1B,MAAM,wBAAwB,CAAC;AAIhC,OAAO,EAAU,KAAK,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAQlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,MAAM,wBAAwB,GAAG;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,K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C,YAAY,CAAC,SAAS,EAAE,eAAe;WAIjC,UAAU,CACrB,cAAc,EAAE,gBAAgB,EAAE,EAClC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,WAAW;;;;IA4D3B,MAAM,CAAC,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM;WAQ7B,aAAa,CACxB,UAAU,EAAE,gBAAgB,EAC5B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,MAAM,CAAC;WAmCL,oBAAoB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW;WA0B9D,gCAAgC,CAAC,MAAM,EAAE,MAAM;WAa/C,gBAAgB,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM;WAK9D,mBAAmB,CAAC,WAAW,CAAC,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,MAAM;IAY9E,MAAM,CAAC,sBAAsB;IAY7B,MAAM,CAAC,kBAAkB,CAAC,QAAQ,EAAE,gBAAgB,EAAE;IAsCtD,MAAM,CAAC,eAAe,CAAC,IAAI,EAAE,MAAM;IAOnC,MAAM,CAAC,yBAAyB,CAAC,UAAU,EAAE,gBAAgB;IAU7D,MAAM,CAAC,8BAA8B,CAAC,IAAI,EAAE,MAAM;IAOlD,MAAM,CAAC,4BAA4B,CAAC,UAAU,EAAE,gBAAgB;IAUhE,MAAM,CAAC,UAAU;IAUjB,MAAM,CAAC,OAAO;CAIf"}
|
package/dist/index.d.ts
CHANGED
|
@@ -82,6 +82,7 @@ interface Unsuccessful {
|
|
|
82
82
|
payload: {
|
|
83
83
|
error: string;
|
|
84
84
|
code?: string | number;
|
|
85
|
+
params?: Record<string, unknown>;
|
|
85
86
|
};
|
|
86
87
|
}
|
|
87
88
|
interface Success<T> {
|
|
@@ -144,7 +145,7 @@ declare class DeviceCommands {
|
|
|
144
145
|
};
|
|
145
146
|
} | {
|
|
146
147
|
success: boolean;
|
|
147
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
148
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
148
149
|
payload: {
|
|
149
150
|
message: string;
|
|
150
151
|
};
|
|
@@ -163,7 +164,7 @@ declare class DeviceCommands {
|
|
|
163
164
|
};
|
|
164
165
|
} | {
|
|
165
166
|
success: boolean;
|
|
166
|
-
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902;
|
|
167
|
+
error: 0 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 200 | 300 | 301 | 302 | 303 | 304 | 305 | 400 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 500 | 600 | 601 | 602 | 603 | 700 | 701 | 702 | 703 | 704 | 705 | 706 | 707 | 708 | 709 | 710 | 711 | 712 | 713 | 714 | 715 | 716 | 717 | 718 | 719 | 720 | 721 | 722 | 723 | 724 | 800 | 801 | 802 | 803 | 804 | 805 | 806 | 807 | 808 | 809 | 810 | 811 | 812 | 813 | 814 | 815 | 816 | 817 | 818 | 819 | 820 | 821 | 822 | 823 | 824 | 825 | 826 | 827 | 828 | 830 | 831 | 832 | 900 | 901 | 902 | 903;
|
|
167
168
|
payload: {
|
|
168
169
|
message: string;
|
|
169
170
|
};
|
|
@@ -821,6 +822,8 @@ declare class Device extends EventEmitter {
|
|
|
821
822
|
private interruptedAttempt;
|
|
822
823
|
/** Canonical device-state cache; legacy Features is a compatibility projection. */
|
|
823
824
|
private stateStore;
|
|
825
|
+
/** Retain the old public identity only for disconnect notifications after wipe. */
|
|
826
|
+
private deviceBeforeWipe;
|
|
824
827
|
/** Force the next initialization to reload DeviceInfo after reconnect or reboot. */
|
|
825
828
|
private protocolV2StateNeedsReload;
|
|
826
829
|
/** Runtime context negotiated once per active Protocol V2 link. */
|
|
@@ -860,6 +863,7 @@ declare class Device extends EventEmitter {
|
|
|
860
863
|
constructor(descriptor: OneKeyDeviceInfo, sdkInstanceId?: string);
|
|
861
864
|
static fromDescriptor(originalDescriptor: OneKeyDeviceInfo, sdkInstanceId?: string): Device;
|
|
862
865
|
toMessageObject(): Device$1 | null;
|
|
866
|
+
toDisconnectMessageObject(): Device$1 | null;
|
|
863
867
|
/**
|
|
864
868
|
* Device connect
|
|
865
869
|
* @returns {Promise<boolean>}
|
package/dist/index.js
CHANGED
|
@@ -41534,7 +41534,7 @@ const parseMessage = (messageData) => {
|
|
|
41534
41534
|
const createErrorMessage = (error) => {
|
|
41535
41535
|
let payload = { error: error.message, code: error.code };
|
|
41536
41536
|
if (error instanceof hdShared.HardwareError) {
|
|
41537
|
-
payload = { error: error.message, code: error.errorCode };
|
|
41537
|
+
payload = { error: error.message, code: error.errorCode, params: error.params };
|
|
41538
41538
|
}
|
|
41539
41539
|
return {
|
|
41540
41540
|
success: false,
|
|
@@ -43466,7 +43466,9 @@ class DevicePool extends events.exports {
|
|
|
43466
43466
|
const exist = canPathIdentifyDevice(cachedPath)
|
|
43467
43467
|
? descriptorList.find(d => d.path === cachedPath)
|
|
43468
43468
|
: undefined;
|
|
43469
|
-
if (exist &&
|
|
43469
|
+
if (exist &&
|
|
43470
|
+
!(initOptions === null || initOptions === void 0 ? void 0 : initOptions.forceProtocolDetection) &&
|
|
43471
|
+
!(device.needReloadDevice && device.isUnacquired())) {
|
|
43470
43472
|
device.updateDescriptor(exist, true);
|
|
43471
43473
|
yield this._refreshRuntimeState(device, initOptions);
|
|
43472
43474
|
devices[connectId] = device;
|
|
@@ -43522,7 +43524,11 @@ class DevicePool extends events.exports {
|
|
|
43522
43524
|
const forceProtocolDetection = (initOptions === null || initOptions === void 0 ? void 0 : initOptions.forceProtocolDetection) === true;
|
|
43523
43525
|
const isNewDevice = !cachedDevice;
|
|
43524
43526
|
const device = cachedDevice !== null && cachedDevice !== void 0 ? cachedDevice : Device.fromDescriptor(descriptor);
|
|
43525
|
-
if (isNewDevice ||
|
|
43527
|
+
if (isNewDevice ||
|
|
43528
|
+
forceProtocolDetection ||
|
|
43529
|
+
(device.needReloadDevice && device.isUnacquired())) {
|
|
43530
|
+
if (cachedDevice)
|
|
43531
|
+
device.updateDescriptor(descriptor, true);
|
|
43526
43532
|
device.deviceConnector = this.connector;
|
|
43527
43533
|
(_a = device.beginConnectionAttempt) === null || _a === void 0 ? void 0 : _a.call(device);
|
|
43528
43534
|
if (forceProtocolDetection && !isNewDevice) {
|
|
@@ -44209,6 +44215,12 @@ class DeviceCommands {
|
|
|
44209
44215
|
const isProtocolV2DeviceBusyFailure = this.device.isProtocolV2() &&
|
|
44210
44216
|
DEVICE_CONTROL_CALLS.has(callType) &&
|
|
44211
44217
|
subcode === hdTransport.DeviceErrorCode.DeviceError_Busy;
|
|
44218
|
+
const isProtocolV2PinCancelledBusyFailure = this.device.isProtocolV2() &&
|
|
44219
|
+
!DEVICE_SESSION_CALLS.has(callType) &&
|
|
44220
|
+
subcode === hdTransport.DeviceSessionErrorCode.DeviceSessionError_UserCancelled &&
|
|
44221
|
+
/^pin cancelled$/i.test(normalizedMessage);
|
|
44222
|
+
const isProtocolV2FirmwareUpdateBusyFailure = this.device.isProtocolV2() &&
|
|
44223
|
+
/^requested command not allowed while a firmware update is in progress$/i.test(normalizedMessage);
|
|
44212
44224
|
const isLegacyProtocolV2LockedFailure = this.device.isProtocolV2() && /^device (?:is )?locked$/i.test(normalizedMessage);
|
|
44213
44225
|
if (DEVICE_SESSION_CALLS.has(callType) &&
|
|
44214
44226
|
subcode === hdTransport.DeviceSessionErrorCode.DeviceSessionError_InvalidSession) {
|
|
@@ -44259,7 +44271,9 @@ class DeviceCommands {
|
|
|
44259
44271
|
firmwareMessage: message,
|
|
44260
44272
|
});
|
|
44261
44273
|
}
|
|
44262
|
-
else if (isProtocolV2DeviceBusyFailure
|
|
44274
|
+
else if (isProtocolV2DeviceBusyFailure ||
|
|
44275
|
+
isProtocolV2PinCancelledBusyFailure ||
|
|
44276
|
+
isProtocolV2FirmwareUpdateBusyFailure) {
|
|
44263
44277
|
error = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceBusy, message, {
|
|
44264
44278
|
failureCode: code,
|
|
44265
44279
|
subcode,
|
|
@@ -45486,6 +45500,7 @@ class Device extends events.exports {
|
|
|
45486
45500
|
this.connectionAttempt = 0;
|
|
45487
45501
|
this.interruptedAttempt = null;
|
|
45488
45502
|
this.stateStore = new DeviceStateStore();
|
|
45503
|
+
this.deviceBeforeWipe = null;
|
|
45489
45504
|
this.protocolV2StateNeedsReload = false;
|
|
45490
45505
|
this.protocolV2UiInteractionCounter = 0;
|
|
45491
45506
|
this.externalState = [];
|
|
@@ -45509,6 +45524,7 @@ class Device extends events.exports {
|
|
|
45509
45524
|
var _a;
|
|
45510
45525
|
if (this.isUnacquired() || !this.features)
|
|
45511
45526
|
return null;
|
|
45527
|
+
this.deviceBeforeWipe = null;
|
|
45512
45528
|
const env = DataManager.getSettings('env');
|
|
45513
45529
|
const deviceType = this.getCurrentDeviceType();
|
|
45514
45530
|
const bleName = this.getCurrentBleName();
|
|
@@ -45542,6 +45558,10 @@ class Device extends events.exports {
|
|
|
45542
45558
|
unavailableCapabilities: this.unavailableCapabilities,
|
|
45543
45559
|
};
|
|
45544
45560
|
}
|
|
45561
|
+
toDisconnectMessageObject() {
|
|
45562
|
+
var _a;
|
|
45563
|
+
return (_a = this.toMessageObject()) !== null && _a !== void 0 ? _a : this.deviceBeforeWipe;
|
|
45564
|
+
}
|
|
45545
45565
|
connect(connectProtocol, options) {
|
|
45546
45566
|
const env = DataManager.getSettings('env');
|
|
45547
45567
|
return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -46293,6 +46313,8 @@ class Device extends events.exports {
|
|
|
46293
46313
|
this.invalidateProtocolV2RuntimeState();
|
|
46294
46314
|
}
|
|
46295
46315
|
invalidateAfterWipe() {
|
|
46316
|
+
var _a;
|
|
46317
|
+
this.deviceBeforeWipe = (_a = this.toMessageObject()) !== null && _a !== void 0 ? _a : this.deviceBeforeWipe;
|
|
46296
46318
|
const deviceId = this.getCurrentDeviceId();
|
|
46297
46319
|
if (deviceId) {
|
|
46298
46320
|
deviceWalletSessionStore.deleteDevice(deviceId);
|
|
@@ -46661,7 +46683,7 @@ class Device extends events.exports {
|
|
|
46661
46683
|
}
|
|
46662
46684
|
hasUnexpectedMode(allow, require) {
|
|
46663
46685
|
if (!this.isUnacquired()) {
|
|
46664
|
-
if (this.isBootloader()
|
|
46686
|
+
if ((this.isBootloader() || this.isRomloader()) && !allow.includes(UI_REQUEST.BOOTLOADER)) {
|
|
46665
46687
|
return UI_REQUEST.BOOTLOADER;
|
|
46666
46688
|
}
|
|
46667
46689
|
if (!this.isInitialized() && !allow.includes(UI_REQUEST.NOT_INITIALIZE)) {
|
|
@@ -47472,7 +47494,7 @@ class GetDeviceState extends BaseMethod {
|
|
|
47472
47494
|
if (this.params.scope === 'settings' &&
|
|
47473
47495
|
this.device.isProtocolV2() &&
|
|
47474
47496
|
isLoaderMode(state.status.mode)) {
|
|
47475
|
-
throw hdShared.
|
|
47497
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.NotAllowInBootloaderMode);
|
|
47476
47498
|
}
|
|
47477
47499
|
return state;
|
|
47478
47500
|
});
|
|
@@ -52591,12 +52613,11 @@ const getProtocolV2ErrorCode = (error) => {
|
|
|
52591
52613
|
};
|
|
52592
52614
|
const isProtocolV2TerminalInstallStatusError = (error) => {
|
|
52593
52615
|
var _a;
|
|
52594
|
-
return hdShared.
|
|
52595
|
-
(error
|
|
52596
|
-
|
|
52597
|
-
|
|
52598
|
-
|
|
52599
|
-
((_a = error.params) === null || _a === void 0 ? void 0 : _a.firmwareUpdateCode) === PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE));
|
|
52616
|
+
return error instanceof hdShared.HardwareError &&
|
|
52617
|
+
(error.errorCode === hdShared.HardwareErrorCode.ActionCancelled ||
|
|
52618
|
+
error.errorCode === hdShared.HardwareErrorCode.FirmwareError ||
|
|
52619
|
+
error.errorCode === hdShared.HardwareErrorCode.FirmwareVerificationFailed ||
|
|
52620
|
+
((_a = error.params) === null || _a === void 0 ? void 0 : _a.firmwareUpdateCode) === PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE);
|
|
52600
52621
|
};
|
|
52601
52622
|
const isProtocolV2TargetStatusFinished = (status) => normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_FINISHED;
|
|
52602
52623
|
const isProtocolV2TargetStatusInProgress = (status) => normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_PENDING ||
|
|
@@ -53690,9 +53711,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53690
53711
|
return true;
|
|
53691
53712
|
}
|
|
53692
53713
|
catch (error) {
|
|
53693
|
-
if (hdShared.isBleStaleBondHardwareError(error)) {
|
|
53694
|
-
throw error;
|
|
53695
|
-
}
|
|
53696
53714
|
Log$6.log(`[FirmwareUpdateV4] RESC bundle ${bundle.name} header check failed: `, error);
|
|
53697
53715
|
return false;
|
|
53698
53716
|
}
|
|
@@ -53777,7 +53795,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53777
53795
|
lastError = new Error('Protocol V2 device is reachable but is not in bootloader mode');
|
|
53778
53796
|
}
|
|
53779
53797
|
catch (error) {
|
|
53780
|
-
if (
|
|
53798
|
+
if (this.isProtocolV2ReconnectIdentityError(error)) {
|
|
53781
53799
|
throw error;
|
|
53782
53800
|
}
|
|
53783
53801
|
shouldReconnect = true;
|
|
@@ -53994,9 +54012,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
53994
54012
|
}
|
|
53995
54013
|
catch (error) {
|
|
53996
54014
|
this.throwIfAborted();
|
|
53997
|
-
if (hdShared.isBleStaleBondHardwareError(error)) {
|
|
53998
|
-
throw error;
|
|
53999
|
-
}
|
|
54000
54015
|
lastError = error;
|
|
54001
54016
|
if (attempt < PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT) {
|
|
54002
54017
|
yield this.recoverProtocolV2FileTransfer();
|
|
@@ -54485,9 +54500,6 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
54485
54500
|
}
|
|
54486
54501
|
}
|
|
54487
54502
|
catch (error) {
|
|
54488
|
-
if (hdShared.isBleStaleBondHardwareError(error)) {
|
|
54489
|
-
throw error;
|
|
54490
|
-
}
|
|
54491
54503
|
Log$6.log('[FirmwareUpdateV4] unable to confirm App mode before Normal reboot: ', error);
|
|
54492
54504
|
}
|
|
54493
54505
|
yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Normal);
|
|
@@ -54562,7 +54574,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
54562
54574
|
lastError = hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 device is still in bootloader mode');
|
|
54563
54575
|
}
|
|
54564
54576
|
catch (error) {
|
|
54565
|
-
if (
|
|
54577
|
+
if (this.isProtocolV2ReconnectIdentityError(error)) {
|
|
54566
54578
|
throw error;
|
|
54567
54579
|
}
|
|
54568
54580
|
shouldReconnect = true;
|
|
@@ -66683,9 +66695,6 @@ function isMissingDetectedProtocolV2Error(method, error) {
|
|
|
66683
66695
|
typeof typedError.message === 'string' &&
|
|
66684
66696
|
typedError.message.includes('Device protocol has not been detected'));
|
|
66685
66697
|
}
|
|
66686
|
-
function isTerminalBleStaleBondError(error) {
|
|
66687
|
-
return hdShared.isBleStaleBondHardwareError(error);
|
|
66688
|
-
}
|
|
66689
66698
|
function isDeviceIdentityMismatchError(error) {
|
|
66690
66699
|
return ((error === null || error === void 0 ? void 0 : error.errorCode) === hdShared.HardwareErrorCode.DeviceCheckDeviceIdError);
|
|
66691
66700
|
}
|
|
@@ -66850,6 +66859,7 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
|
|
|
66850
66859
|
hdShared.HardwareErrorCode.BridgeNotInstalled,
|
|
66851
66860
|
hdShared.HardwareErrorCode.BridgeTimeoutError,
|
|
66852
66861
|
hdShared.HardwareErrorCode.BridgeNeedsPermission,
|
|
66862
|
+
hdShared.HardwareErrorCode.WebUsbDeviceAccessError,
|
|
66853
66863
|
].includes(error.errorCode)) {
|
|
66854
66864
|
_deviceList = undefined;
|
|
66855
66865
|
reject(error);
|
|
@@ -66924,12 +66934,12 @@ const ensureConnected = (_context, method, connectId, pollingId, abortSignal) =>
|
|
|
66924
66934
|
hdShared.HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
66925
66935
|
hdShared.HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
66926
66936
|
hdShared.HardwareErrorCode.BridgeNeedsPermission,
|
|
66937
|
+
hdShared.HardwareErrorCode.WebUsbDeviceAccessError,
|
|
66927
66938
|
hdShared.HardwareErrorCode.DeviceInterruptedFromUser,
|
|
66928
66939
|
hdShared.HardwareErrorCode.CallQueueActionCancelled,
|
|
66929
66940
|
].includes(error.errorCode) ||
|
|
66930
66941
|
(env === 'react-native' &&
|
|
66931
66942
|
[hdShared.HardwareErrorCode.BleDeviceDisconnected, hdShared.HardwareErrorCode.PollingTimeout].includes(error.errorCode)) ||
|
|
66932
|
-
isTerminalBleStaleBondError(error) ||
|
|
66933
66943
|
isDeviceIdentityMismatchError(error)) {
|
|
66934
66944
|
reject(error);
|
|
66935
66945
|
return;
|
|
@@ -67089,7 +67099,7 @@ const onDeviceConnectHandler = (device) => {
|
|
|
67089
67099
|
};
|
|
67090
67100
|
const onDeviceDisconnectHandler = (device) => {
|
|
67091
67101
|
device.clearPreInitialized();
|
|
67092
|
-
const deviceObject = device.
|
|
67102
|
+
const deviceObject = device.toDisconnectMessageObject();
|
|
67093
67103
|
if (!deviceObject)
|
|
67094
67104
|
return;
|
|
67095
67105
|
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
|
package/dist/types/params.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../../src/types/params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,MAAM,WAAW,YAAY;IAQ3B,WAAW,CAAC,EAAE,OAAO,CAAC;IAItB,UAAU,CAAC,EAAE,MAAM,CAAC;IAIpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAI1B,OAAO,CAAC,EAAE,MAAM,CAAC;IAIjB,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAIvC,eAAe,CAAC,EAAE,MAAM,CAAC;IAIzB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAI7B,WAAW,CAAC,EAAE,OAAO,CAAC;IAKtB,aAAa,CAAC,EAAE,OAAO,CAAC;IAGxB,sBAAsB,CAAC,EAAE,OAAO,CAAC;IAKjC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAK9B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAK9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAK/B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAM3B,eAAe,CAAC,EAAE,uBAAuB,CAAC;IAM1C,sBAAsB,CAAC,EAAE,OAAO,CAAC;CAClC;AAED,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,YAAY,GAAG,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAElE,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,OAAO,EAAE;QAAE,KAAK,EA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O,CAAC,CAAC;IACxB,OAAO,EAAE,IAAI,CAAC;IACd,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "1.2.8-alpha.
|
|
3
|
+
"version": "1.2.8-alpha.3",
|
|
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.8-alpha.
|
|
29
|
-
"@onekeyfe/hd-transport": "1.2.8-alpha.
|
|
28
|
+
"@onekeyfe/hd-shared": "1.2.8-alpha.3",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.8-alpha.3",
|
|
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": "18c57239359413a079fffa730b36149c8516aa85"
|
|
50
50
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EDeviceType,
|
|
3
|
-
ERRORS,
|
|
4
|
-
HardwareError,
|
|
5
|
-
HardwareErrorCode,
|
|
6
|
-
isBleStaleBondHardwareError,
|
|
7
|
-
wait,
|
|
8
|
-
} from '@onekeyfe/hd-shared';
|
|
1
|
+
import { EDeviceType, ERRORS, HardwareError, HardwareErrorCode, wait } from '@onekeyfe/hd-shared';
|
|
9
2
|
import JSZip from 'jszip';
|
|
10
3
|
import {
|
|
11
4
|
DeviceRebootType,
|
|
@@ -393,12 +386,11 @@ const getProtocolV2ErrorCode = (error: unknown): number | string | undefined =>
|
|
|
393
386
|
};
|
|
394
387
|
|
|
395
388
|
const isProtocolV2TerminalInstallStatusError = (error: unknown) =>
|
|
396
|
-
|
|
397
|
-
(error
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
error.params?.firmwareUpdateCode === PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE));
|
|
389
|
+
error instanceof HardwareError &&
|
|
390
|
+
(error.errorCode === HardwareErrorCode.ActionCancelled ||
|
|
391
|
+
error.errorCode === HardwareErrorCode.FirmwareError ||
|
|
392
|
+
error.errorCode === HardwareErrorCode.FirmwareVerificationFailed ||
|
|
393
|
+
error.params?.firmwareUpdateCode === PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE);
|
|
402
394
|
|
|
403
395
|
const isProtocolV2TargetStatusFinished = (status: ProtocolV2FirmwareUpdateStatusTarget['status']) =>
|
|
404
396
|
normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_FINISHED;
|
|
@@ -1880,9 +1872,6 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
1880
1872
|
if (!expectedHeaderHash || header.headerHash !== expectedHeaderHash) return false;
|
|
1881
1873
|
return true;
|
|
1882
1874
|
} catch (error) {
|
|
1883
|
-
if (isBleStaleBondHardwareError(error)) {
|
|
1884
|
-
throw error;
|
|
1885
|
-
}
|
|
1886
1875
|
Log.log(`[FirmwareUpdateV4] RESC bundle ${bundle.name} header check failed: `, error);
|
|
1887
1876
|
return false;
|
|
1888
1877
|
}
|
|
@@ -1976,7 +1965,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
1976
1965
|
}
|
|
1977
1966
|
lastError = new Error('Protocol V2 device is reachable but is not in bootloader mode');
|
|
1978
1967
|
} catch (error) {
|
|
1979
|
-
if (
|
|
1968
|
+
if (this.isProtocolV2ReconnectIdentityError(error)) {
|
|
1980
1969
|
throw error;
|
|
1981
1970
|
}
|
|
1982
1971
|
shouldReconnect = true;
|
|
@@ -2274,9 +2263,6 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2274
2263
|
return processedSize + source.size;
|
|
2275
2264
|
} catch (error) {
|
|
2276
2265
|
this.throwIfAborted();
|
|
2277
|
-
if (isBleStaleBondHardwareError(error)) {
|
|
2278
|
-
throw error;
|
|
2279
|
-
}
|
|
2280
2266
|
lastError = error;
|
|
2281
2267
|
if (attempt < PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT) {
|
|
2282
2268
|
await this.recoverProtocolV2FileTransfer();
|
|
@@ -2944,9 +2930,6 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
2944
2930
|
return;
|
|
2945
2931
|
}
|
|
2946
2932
|
} catch (error) {
|
|
2947
|
-
if (isBleStaleBondHardwareError(error)) {
|
|
2948
|
-
throw error;
|
|
2949
|
-
}
|
|
2950
2933
|
Log.log('[FirmwareUpdateV4] unable to confirm App mode before Normal reboot: ', error);
|
|
2951
2934
|
}
|
|
2952
2935
|
await this.protocolV2Reboot(DeviceRebootType.Normal);
|
|
@@ -3039,7 +3022,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
3039
3022
|
'Protocol V2 device is still in bootloader mode'
|
|
3040
3023
|
);
|
|
3041
3024
|
} catch (error) {
|
|
3042
|
-
if (
|
|
3025
|
+
if (this.isProtocolV2ReconnectIdentityError(error)) {
|
|
3043
3026
|
throw error;
|
|
3044
3027
|
}
|
|
3045
3028
|
shouldReconnect = true;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ERRORS, HardwareErrorCode
|
|
1
|
+
import { ERRORS, HardwareErrorCode } from '@onekeyfe/hd-shared';
|
|
2
2
|
|
|
3
3
|
import { UI_REQUEST } from '../constants/ui-request';
|
|
4
4
|
import { BaseMethod } from './BaseMethod';
|
|
@@ -49,10 +49,7 @@ export default class GetDeviceState extends BaseMethod<
|
|
|
49
49
|
this.device.isProtocolV2() &&
|
|
50
50
|
isLoaderMode(state.status.mode)
|
|
51
51
|
) {
|
|
52
|
-
throw
|
|
53
|
-
`${this.name}:${this.params.scope}`,
|
|
54
|
-
this.device.getCurrentFirmwareType()
|
|
55
|
-
);
|
|
52
|
+
throw ERRORS.TypedError(HardwareErrorCode.NotAllowInBootloaderMode);
|
|
56
53
|
}
|
|
57
54
|
return state;
|
|
58
55
|
}
|
package/src/core/index.ts
CHANGED
|
@@ -23,7 +23,6 @@ import {
|
|
|
23
23
|
createNeedUpgradeFirmwareHardwareError,
|
|
24
24
|
createNewFirmwareForceUpdateHardwareError,
|
|
25
25
|
createNewFirmwareUnReleaseHardwareError,
|
|
26
|
-
isBleStaleBondHardwareError,
|
|
27
26
|
} from '@onekeyfe/hd-shared';
|
|
28
27
|
|
|
29
28
|
import { LoggerNames, enableLog, getLogger, setLoggerPostMessage, wait } from '../utils';
|
|
@@ -1035,10 +1034,6 @@ export function isMissingDetectedProtocolV2Error(method: BaseMethod, error: unkn
|
|
|
1035
1034
|
);
|
|
1036
1035
|
}
|
|
1037
1036
|
|
|
1038
|
-
export function isTerminalBleStaleBondError(error: unknown) {
|
|
1039
|
-
return isBleStaleBondHardwareError(error);
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
1037
|
export function isDeviceIdentityMismatchError(error: unknown) {
|
|
1043
1038
|
return (
|
|
1044
1039
|
(error as { errorCode?: unknown })?.errorCode === HardwareErrorCode.DeviceCheckDeviceIdError
|
|
@@ -1277,6 +1272,7 @@ const ensureConnected = async (
|
|
|
1277
1272
|
HardwareErrorCode.BridgeNotInstalled,
|
|
1278
1273
|
HardwareErrorCode.BridgeTimeoutError,
|
|
1279
1274
|
HardwareErrorCode.BridgeNeedsPermission,
|
|
1275
|
+
HardwareErrorCode.WebUsbDeviceAccessError,
|
|
1280
1276
|
].includes(error.errorCode)
|
|
1281
1277
|
) {
|
|
1282
1278
|
_deviceList = undefined;
|
|
@@ -1363,6 +1359,7 @@ const ensureConnected = async (
|
|
|
1363
1359
|
HardwareErrorCode.DeviceDetectInBootloaderMode,
|
|
1364
1360
|
HardwareErrorCode.BleCharacteristicNotifyChangeFailure,
|
|
1365
1361
|
HardwareErrorCode.BridgeNeedsPermission,
|
|
1362
|
+
HardwareErrorCode.WebUsbDeviceAccessError,
|
|
1366
1363
|
HardwareErrorCode.DeviceInterruptedFromUser,
|
|
1367
1364
|
HardwareErrorCode.CallQueueActionCancelled,
|
|
1368
1365
|
].includes(error.errorCode) ||
|
|
@@ -1370,7 +1367,6 @@ const ensureConnected = async (
|
|
|
1370
1367
|
[HardwareErrorCode.BleDeviceDisconnected, HardwareErrorCode.PollingTimeout].includes(
|
|
1371
1368
|
error.errorCode
|
|
1372
1369
|
)) ||
|
|
1373
|
-
isTerminalBleStaleBondError(error) ||
|
|
1374
1370
|
isDeviceIdentityMismatchError(error)
|
|
1375
1371
|
) {
|
|
1376
1372
|
reject(error);
|
|
@@ -1593,7 +1589,7 @@ const onDeviceConnectHandler = (device: Device) => {
|
|
|
1593
1589
|
|
|
1594
1590
|
const onDeviceDisconnectHandler = (device: Device) => {
|
|
1595
1591
|
device.clearPreInitialized();
|
|
1596
|
-
const deviceObject = device.
|
|
1592
|
+
const deviceObject = device.toDisconnectMessageObject();
|
|
1597
1593
|
if (!deviceObject) return;
|
|
1598
1594
|
postMessage(createDeviceMessage(DEVICE.DISCONNECT, { device: deviceObject }));
|
|
1599
1595
|
};
|
package/src/device/Device.ts
CHANGED
|
@@ -248,6 +248,9 @@ export class Device extends EventEmitter {
|
|
|
248
248
|
/** Canonical device-state cache; legacy Features is a compatibility projection. */
|
|
249
249
|
private stateStore = new DeviceStateStore();
|
|
250
250
|
|
|
251
|
+
/** Retain the old public identity only for disconnect notifications after wipe. */
|
|
252
|
+
private deviceBeforeWipe: DeviceTyped | null = null;
|
|
253
|
+
|
|
251
254
|
/** Force the next initialization to reload DeviceInfo after reconnect or reboot. */
|
|
252
255
|
private protocolV2StateNeedsReload = false;
|
|
253
256
|
|
|
@@ -351,6 +354,8 @@ export class Device extends EventEmitter {
|
|
|
351
354
|
toMessageObject(): DeviceTyped | null {
|
|
352
355
|
if (this.isUnacquired() || !this.features) return null;
|
|
353
356
|
|
|
357
|
+
this.deviceBeforeWipe = null;
|
|
358
|
+
|
|
354
359
|
const env = DataManager.getSettings('env');
|
|
355
360
|
const deviceType = this.getCurrentDeviceType();
|
|
356
361
|
|
|
@@ -395,6 +400,10 @@ export class Device extends EventEmitter {
|
|
|
395
400
|
};
|
|
396
401
|
}
|
|
397
402
|
|
|
403
|
+
toDisconnectMessageObject(): DeviceTyped | null {
|
|
404
|
+
return this.toMessageObject() ?? this.deviceBeforeWipe;
|
|
405
|
+
}
|
|
406
|
+
|
|
398
407
|
/**
|
|
399
408
|
* Device connect
|
|
400
409
|
* @returns {Promise<boolean>}
|
|
@@ -1364,6 +1373,7 @@ export class Device extends EventEmitter {
|
|
|
1364
1373
|
}
|
|
1365
1374
|
|
|
1366
1375
|
invalidateAfterWipe() {
|
|
1376
|
+
this.deviceBeforeWipe = this.toMessageObject() ?? this.deviceBeforeWipe;
|
|
1367
1377
|
const deviceId = this.getCurrentDeviceId();
|
|
1368
1378
|
if (deviceId) {
|
|
1369
1379
|
deviceWalletSessionStore.deleteDevice(deviceId);
|
|
@@ -1801,7 +1811,7 @@ export class Device extends EventEmitter {
|
|
|
1801
1811
|
// both allow and require cases might generate single unexpected mode
|
|
1802
1812
|
if (!this.isUnacquired()) {
|
|
1803
1813
|
// allow cases
|
|
1804
|
-
if (this.isBootloader()
|
|
1814
|
+
if ((this.isBootloader() || this.isRomloader()) && !allow.includes(UI_REQUEST.BOOTLOADER)) {
|
|
1805
1815
|
return UI_REQUEST.BOOTLOADER;
|
|
1806
1816
|
}
|
|
1807
1817
|
if (!this.isInitialized() && !allow.includes(UI_REQUEST.NOT_INITIALIZE)) {
|
|
@@ -549,6 +549,16 @@ export class DeviceCommands {
|
|
|
549
549
|
this.device.isProtocolV2() &&
|
|
550
550
|
DEVICE_CONTROL_CALLS.has(callType) &&
|
|
551
551
|
subcode === DeviceErrorCode.DeviceError_Busy;
|
|
552
|
+
const isProtocolV2PinCancelledBusyFailure =
|
|
553
|
+
this.device.isProtocolV2() &&
|
|
554
|
+
!DEVICE_SESSION_CALLS.has(callType) &&
|
|
555
|
+
subcode === DeviceSessionErrorCode.DeviceSessionError_UserCancelled &&
|
|
556
|
+
/^pin cancelled$/i.test(normalizedMessage);
|
|
557
|
+
const isProtocolV2FirmwareUpdateBusyFailure =
|
|
558
|
+
this.device.isProtocolV2() &&
|
|
559
|
+
/^requested command not allowed while a firmware update is in progress$/i.test(
|
|
560
|
+
normalizedMessage
|
|
561
|
+
);
|
|
552
562
|
const isLegacyProtocolV2LockedFailure =
|
|
553
563
|
this.device.isProtocolV2() && /^device (?:is )?locked$/i.test(normalizedMessage);
|
|
554
564
|
if (
|
|
@@ -606,7 +616,11 @@ export class DeviceCommands {
|
|
|
606
616
|
subcode,
|
|
607
617
|
firmwareMessage: message,
|
|
608
618
|
});
|
|
609
|
-
} else if (
|
|
619
|
+
} else if (
|
|
620
|
+
isProtocolV2DeviceBusyFailure ||
|
|
621
|
+
isProtocolV2PinCancelledBusyFailure ||
|
|
622
|
+
isProtocolV2FirmwareUpdateBusyFailure
|
|
623
|
+
) {
|
|
610
624
|
error = ERRORS.TypedError(HardwareErrorCode.DeviceBusy, message, {
|
|
611
625
|
failureCode: code,
|
|
612
626
|
subcode,
|
package/src/device/DevicePool.ts
CHANGED
|
@@ -114,7 +114,11 @@ export class DevicePool extends EventEmitter {
|
|
|
114
114
|
const exist = canPathIdentifyDevice(cachedPath)
|
|
115
115
|
? descriptorList.find(d => d.path === cachedPath)
|
|
116
116
|
: undefined;
|
|
117
|
-
if (
|
|
117
|
+
if (
|
|
118
|
+
exist &&
|
|
119
|
+
!initOptions?.forceProtocolDetection &&
|
|
120
|
+
!(device.needReloadDevice && device.isUnacquired())
|
|
121
|
+
) {
|
|
118
122
|
// Log.debug('find existed Device: ', connectId);
|
|
119
123
|
device.updateDescriptor(exist, true);
|
|
120
124
|
await this._refreshRuntimeState(device, initOptions);
|
|
@@ -170,7 +174,13 @@ export class DevicePool extends EventEmitter {
|
|
|
170
174
|
const forceProtocolDetection = initOptions?.forceProtocolDetection === true;
|
|
171
175
|
const isNewDevice = !cachedDevice;
|
|
172
176
|
const device = cachedDevice ?? Device.fromDescriptor(descriptor);
|
|
173
|
-
if (
|
|
177
|
+
if (
|
|
178
|
+
isNewDevice ||
|
|
179
|
+
forceProtocolDetection ||
|
|
180
|
+
(device.needReloadDevice && device.isUnacquired())
|
|
181
|
+
) {
|
|
182
|
+
// Wipe invalidates state while the same USB path can remain discoverable.
|
|
183
|
+
if (cachedDevice) device.updateDescriptor(descriptor, true);
|
|
174
184
|
device.deviceConnector = this.connector;
|
|
175
185
|
// Search/discovery acquires outside Device.run(). Start a new attempt so
|
|
176
186
|
// a previous user cancel does not hide this device from later searches.
|
package/src/events/core.ts
CHANGED
|
@@ -54,9 +54,9 @@ export const parseMessage = (messageData: any): CoreMessage => {
|
|
|
54
54
|
};
|
|
55
55
|
|
|
56
56
|
export const createErrorMessage = (error: Error & { code?: string | number }): Unsuccessful => {
|
|
57
|
-
let payload = { error: error.message, code: error.code };
|
|
57
|
+
let payload: Unsuccessful['payload'] = { error: error.message, code: error.code };
|
|
58
58
|
if (error instanceof HardwareError) {
|
|
59
|
-
payload = { error: error.message, code: error.errorCode };
|
|
59
|
+
payload = { error: error.message, code: error.errorCode, params: error.params };
|
|
60
60
|
}
|
|
61
61
|
return {
|
|
62
62
|
success: false,
|
package/src/types/params.ts
CHANGED
|
@@ -83,7 +83,7 @@ export type Params<T> = CommonParams & T & { bundle?: undefined };
|
|
|
83
83
|
|
|
84
84
|
export interface Unsuccessful {
|
|
85
85
|
success: false;
|
|
86
|
-
payload: { error: string; code?: string | number };
|
|
86
|
+
payload: { error: string; code?: string | number; params?: Record<string, unknown> };
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export interface Success<T> {
|