@onekeyfe/hd-core 1.2.8-alpha.123 → 1.2.8-alpha.124
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__/protocol-v2.test.ts +12 -14
- package/dist/index.js +1 -1
- package/package.json +4 -4
- package/src/api/FirmwareUpdateV4.ts +5 -5
|
@@ -9080,11 +9080,11 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
9080
9080
|
});
|
|
9081
9081
|
|
|
9082
9082
|
test.each([
|
|
9083
|
-
['1.0.
|
|
9084
|
-
['1.0.10', '1.0.
|
|
9085
|
-
['1.0.
|
|
9086
|
-
['0.0.0.1', '1.0.
|
|
9087
|
-
['1.0.
|
|
9083
|
+
['1.0.3', '1.0.3', true],
|
|
9084
|
+
['1.0.10', '1.0.3', true],
|
|
9085
|
+
['1.0.2', '1.0.3', false],
|
|
9086
|
+
['0.0.0.1', '1.0.3', false],
|
|
9087
|
+
['1.0.3', '', false],
|
|
9088
9088
|
] as const)(
|
|
9089
9089
|
'gates the BLE file write window on bootloader %s with minimum %s',
|
|
9090
9090
|
(bootloaderVersion, minBootloaderVersion, expected) => {
|
|
@@ -9094,9 +9094,8 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
9094
9094
|
}
|
|
9095
9095
|
);
|
|
9096
9096
|
|
|
9097
|
-
test('keeps released 1.0.2
|
|
9098
|
-
expect(supportsProtocolV2BleFileWriteWindow('1.0.
|
|
9099
|
-
expect(supportsProtocolV2BleFileWriteWindow('1.0.3')).toBe(false);
|
|
9097
|
+
test('keeps released 1.0.2 bootloaders serial by default', () => {
|
|
9098
|
+
expect(supportsProtocolV2BleFileWriteWindow('1.0.3')).toBe(true);
|
|
9100
9099
|
expect(supportsProtocolV2BleFileWriteWindow('1.0.2')).toBe(false);
|
|
9101
9100
|
});
|
|
9102
9101
|
|
|
@@ -9117,12 +9116,12 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
9117
9116
|
},
|
|
9118
9117
|
});
|
|
9119
9118
|
(method as any).device = stubDevice({
|
|
9120
|
-
features: { mode, bootloaderMode: mode === 'bootloader', bootloaderVersion: '1.0.
|
|
9119
|
+
features: { mode, bootloaderMode: mode === 'bootloader', bootloaderVersion: '1.0.3' },
|
|
9121
9120
|
});
|
|
9122
9121
|
|
|
9123
9122
|
try {
|
|
9124
|
-
expect((method as any).shouldUseProtocolV2BleFileWriteWindow('1.0.
|
|
9125
|
-
expect((method as any).shouldUseProtocolV2BleFileWriteWindow('1.0.
|
|
9123
|
+
expect((method as any).shouldUseProtocolV2BleFileWriteWindow('1.0.3')).toBe(expected);
|
|
9124
|
+
expect((method as any).shouldUseProtocolV2BleFileWriteWindow('1.0.4')).toBe(false);
|
|
9126
9125
|
} finally {
|
|
9127
9126
|
getSettingsSpy.mockRestore();
|
|
9128
9127
|
}
|
|
@@ -9131,10 +9130,9 @@ describe('Protocol V2 firmware update targets', () => {
|
|
|
9131
9130
|
|
|
9132
9131
|
test.each([
|
|
9133
9132
|
['1.0.2', false],
|
|
9134
|
-
['1.0.3',
|
|
9135
|
-
['1.0.4', true],
|
|
9133
|
+
['1.0.3', true],
|
|
9136
9134
|
// The parsed bootloader version drops prerelease tags.
|
|
9137
|
-
['1.0.
|
|
9135
|
+
['1.0.3-rc.1', true],
|
|
9138
9136
|
] as const)(
|
|
9139
9137
|
'gates the default minimum on a running %s bootloader in React Native',
|
|
9140
9138
|
(bootloaderVersion, expected) => {
|
package/dist/index.js
CHANGED
|
@@ -52635,7 +52635,7 @@ const PROTOCOL_V2_CONNECT_SINGLE_TIMEOUT = 75 * 1000;
|
|
|
52635
52635
|
const PROTOCOL_V2_DEVICE_INFO_READY_TIMEOUT = 30 * 1000;
|
|
52636
52636
|
const PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT = 3;
|
|
52637
52637
|
const PROTOCOL_V2_RESOURCE_HEADER_RECOVERY_LIMIT = 2;
|
|
52638
|
-
const PROTOCOL_V2_BLE_FILE_WRITE_WINDOW_MIN_BOOTLOADER_VERSION = '1.0.
|
|
52638
|
+
const PROTOCOL_V2_BLE_FILE_WRITE_WINDOW_MIN_BOOTLOADER_VERSION = '1.0.3';
|
|
52639
52639
|
const PROTOCOL_V2_TRANSFER_PROGRESS_HEARTBEAT_MS = 1000;
|
|
52640
52640
|
const PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE = 'FirmwareInstallStatusConflict';
|
|
52641
52641
|
const PROTOCOL_V2_INSTALL_FAILED_CODE = 'FirmwareInstallFailed';
|
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.124",
|
|
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.124",
|
|
29
|
+
"@onekeyfe/hd-transport": "1.2.8-alpha.124",
|
|
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": "1e8e8b7084a3ceb01f656117739b154797312d9f"
|
|
50
50
|
}
|
|
@@ -106,11 +106,11 @@ const PROTOCOL_V2_FILE_TRANSFER_RETRY_COUNT = 3;
|
|
|
106
106
|
const PROTOCOL_V2_RESOURCE_HEADER_RECOVERY_LIMIT = 2;
|
|
107
107
|
// Minimum running bootloader that receives two in-flight BLE FilesystemFileWrite frames.
|
|
108
108
|
// Bootloaders with the 2048-byte BLE UART FIFO have no room beside one waiting FileWrite frame,
|
|
109
|
-
// so a second frame can overflow it. Released bootloaders
|
|
110
|
-
// serial. Firmware has been asked to ship the 4096-byte FIFO from 1.0.
|
|
111
|
-
// nor the BLE coprocessor margin for two frames; any bootloader reporting 1.0.
|
|
109
|
+
// so a second frame can overflow it. Released bootloaders report 1.0.2 with that FIFO and stay
|
|
110
|
+
// serial. Firmware has been asked to ship the 4096-byte FIFO from 1.0.3 but has not confirmed it,
|
|
111
|
+
// nor the BLE coprocessor margin for two frames; any bootloader reporting 1.0.3 or later gets the
|
|
112
112
|
// window. Set it to undefined to keep every transfer serial.
|
|
113
|
-
const PROTOCOL_V2_BLE_FILE_WRITE_WINDOW_MIN_BOOTLOADER_VERSION: string | undefined = '1.0.
|
|
113
|
+
const PROTOCOL_V2_BLE_FILE_WRITE_WINDOW_MIN_BOOTLOADER_VERSION: string | undefined = '1.0.3';
|
|
114
114
|
const PROTOCOL_V2_TRANSFER_PROGRESS_HEARTBEAT_MS = 1000;
|
|
115
115
|
const PROTOCOL_V2_INSTALL_STATUS_CONFLICT_CODE = 'FirmwareInstallStatusConflict';
|
|
116
116
|
const PROTOCOL_V2_INSTALL_FAILED_CODE = 'FirmwareInstallFailed';
|
|
@@ -3343,7 +3343,7 @@ export default class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod<FirmwareU
|
|
|
3343
3343
|
return false;
|
|
3344
3344
|
}
|
|
3345
3345
|
// The transfer runs in the device's current bootloader, not the one being installed. The
|
|
3346
|
-
// parsed version keeps major.minor.patch only, so a 1.0.
|
|
3346
|
+
// parsed version keeps major.minor.patch only, so a 1.0.3 prerelease counts as 1.0.3.
|
|
3347
3347
|
const bootloaderVersion = getDeviceBootloaderVersion(this.device.features).join('.');
|
|
3348
3348
|
const enabled = supportsProtocolV2BleFileWriteWindow(bootloaderVersion, minBootloaderVersion);
|
|
3349
3349
|
Log.debug('[FirmwareUpdateV4] BLE FileWrite window', {
|