@onekeyfe/hardware-cli 1.2.0-alpha.84 → 1.2.0-alpha.85
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/dist/cli.d.ts +0 -5
- package/dist/cli.js +0 -19
- package/package.json +6 -6
- package/src/cli.ts +0 -26
package/dist/cli.d.ts
CHANGED
|
@@ -53,7 +53,6 @@ export declare function runFirmwareUpdateV4WithRetry({ sdk, globalOpts, params,
|
|
|
53
53
|
}): Promise<unknown>;
|
|
54
54
|
declare function buildFirmwareUpdateV4Params(opts: {
|
|
55
55
|
chunkSize?: string;
|
|
56
|
-
resourceFile?: string[];
|
|
57
56
|
romloader?: string;
|
|
58
57
|
bootloader?: string;
|
|
59
58
|
applicationP1?: string;
|
|
@@ -69,10 +68,6 @@ declare function buildFirmwareUpdateV4Params(opts: {
|
|
|
69
68
|
connectProtocol: "V2";
|
|
70
69
|
chunkSize: number | undefined;
|
|
71
70
|
forcedUpdateRes: boolean | undefined;
|
|
72
|
-
resourceFiles: {
|
|
73
|
-
binary: ArrayBuffer;
|
|
74
|
-
devicePath: string;
|
|
75
|
-
}[] | undefined;
|
|
76
71
|
romloaderBinary: ArrayBuffer | undefined;
|
|
77
72
|
bootloaderBinary: ArrayBuffer | undefined;
|
|
78
73
|
applicationP1Binary: ArrayBuffer | undefined;
|
package/dist/cli.js
CHANGED
|
@@ -485,7 +485,6 @@ program
|
|
|
485
485
|
.command('firmware-update-v4')
|
|
486
486
|
.description('Run Protocol V2 firmware update through sdk.firmwareUpdateV4')
|
|
487
487
|
.option('--chunk-size <bytes>', 'Transfer chunk size in bytes')
|
|
488
|
-
.option('--resource-file <spec...>', 'Resource direct-write spec: <localPath>:<devicePath>, e.g. wallpaper.okpkg:vol0:/bundles/images/wallpaper.okpkg')
|
|
489
488
|
.option('--romloader <path>', 'FW_MGMT_TARGET_ROMLOADER binary path')
|
|
490
489
|
.option('--bootloader <path>', 'FW_MGMT_TARGET_BOOTLOADER binary path')
|
|
491
490
|
.option('--application-p1 <path>', 'FW_MGMT_TARGET_APPLICATION_P1 binary path')
|
|
@@ -957,24 +956,8 @@ async function resolveLegacyFirmwareConnectId(sdk, explicitConnectId, deviceName
|
|
|
957
956
|
throw new Error(`BLE device has no connect ID: ${name}`);
|
|
958
957
|
return connectId;
|
|
959
958
|
}
|
|
960
|
-
function parseResourceFileParam(spec) {
|
|
961
|
-
const sep = spec.indexOf(':');
|
|
962
|
-
if (sep <= 0 || sep === spec.length - 1) {
|
|
963
|
-
throw new Error(`Invalid --resource-file value: "${spec}". Expected <localPath>:<devicePath>`);
|
|
964
|
-
}
|
|
965
|
-
const localPath = spec.slice(0, sep);
|
|
966
|
-
const devicePath = spec.slice(sep + 1);
|
|
967
|
-
if (!devicePath.startsWith('vol')) {
|
|
968
|
-
throw new Error(`Invalid --resource-file device path: "${devicePath}". Expected a vol*:/... path`);
|
|
969
|
-
}
|
|
970
|
-
return {
|
|
971
|
-
binary: readBinaryParam(localPath),
|
|
972
|
-
devicePath,
|
|
973
|
-
};
|
|
974
|
-
}
|
|
975
959
|
function getFirmwareUpdateV4TotalBytes(params) {
|
|
976
960
|
return [
|
|
977
|
-
...(params.resourceFiles?.map(item => item.binary) ?? []),
|
|
978
961
|
params.bootloaderBinary,
|
|
979
962
|
params.applicationP1Binary,
|
|
980
963
|
params.applicationP2Binary,
|
|
@@ -1209,7 +1192,6 @@ function buildFirmwareUpdateV4Params(opts) {
|
|
|
1209
1192
|
connectProtocol: 'V2',
|
|
1210
1193
|
chunkSize: opts.chunkSize ? safeParseInt(opts.chunkSize, '--chunk-size') : undefined,
|
|
1211
1194
|
forcedUpdateRes: opts.forcedUpdateRes,
|
|
1212
|
-
resourceFiles: opts.resourceFile?.map(parseResourceFileParam),
|
|
1213
1195
|
romloaderBinary: opts.romloader ? readBinaryParam(opts.romloader) : undefined,
|
|
1214
1196
|
bootloaderBinary: opts.bootloader ? readBinaryParam(opts.bootloader) : undefined,
|
|
1215
1197
|
applicationP1Binary: opts.applicationP1 ? readBinaryParam(opts.applicationP1) : undefined,
|
|
@@ -1221,7 +1203,6 @@ function buildFirmwareUpdateV4Params(opts) {
|
|
|
1221
1203
|
se04Binary: opts.se04 ? readBinaryParam(opts.se04) : undefined,
|
|
1222
1204
|
};
|
|
1223
1205
|
const hasPayload = [
|
|
1224
|
-
params.resourceFiles,
|
|
1225
1206
|
params.romloaderBinary,
|
|
1226
1207
|
params.bootloaderBinary,
|
|
1227
1208
|
params.applicationP1Binary,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hardware-cli",
|
|
3
|
-
"version": "1.2.0-alpha.
|
|
3
|
+
"version": "1.2.0-alpha.85",
|
|
4
4
|
"description": "OneKey hardware wallet CLI for testing device communication",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
"test": "jest"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.
|
|
35
|
-
"@onekeyfe/hd-core": "1.2.0-alpha.
|
|
36
|
-
"@onekeyfe/hd-shared": "1.2.0-alpha.
|
|
37
|
-
"@onekeyfe/hd-transport-usb": "1.2.0-alpha.
|
|
34
|
+
"@onekeyfe/hd-common-connect-sdk": "1.2.0-alpha.85",
|
|
35
|
+
"@onekeyfe/hd-core": "1.2.0-alpha.85",
|
|
36
|
+
"@onekeyfe/hd-shared": "1.2.0-alpha.85",
|
|
37
|
+
"@onekeyfe/hd-transport-usb": "1.2.0-alpha.85",
|
|
38
38
|
"@stoprocent/noble": "2.3.16",
|
|
39
39
|
"commander": "^12.0.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "dd005dc6340613bb5d43234473ce454c89f7b5ac"
|
|
42
42
|
}
|
package/src/cli.ts
CHANGED
|
@@ -628,10 +628,6 @@ program
|
|
|
628
628
|
.command('firmware-update-v4')
|
|
629
629
|
.description('Run Protocol V2 firmware update through sdk.firmwareUpdateV4')
|
|
630
630
|
.option('--chunk-size <bytes>', 'Transfer chunk size in bytes')
|
|
631
|
-
.option(
|
|
632
|
-
'--resource-file <spec...>',
|
|
633
|
-
'Resource direct-write spec: <localPath>:<devicePath>, e.g. wallpaper.okpkg:vol0:/bundles/images/wallpaper.okpkg'
|
|
634
|
-
)
|
|
635
631
|
.option('--romloader <path>', 'FW_MGMT_TARGET_ROMLOADER binary path')
|
|
636
632
|
.option('--bootloader <path>', 'FW_MGMT_TARGET_BOOTLOADER binary path')
|
|
637
633
|
.option('--application-p1 <path>', 'FW_MGMT_TARGET_APPLICATION_P1 binary path')
|
|
@@ -1253,27 +1249,8 @@ async function resolveLegacyFirmwareConnectId(
|
|
|
1253
1249
|
return connectId;
|
|
1254
1250
|
}
|
|
1255
1251
|
|
|
1256
|
-
function parseResourceFileParam(spec: string): { binary: ArrayBuffer; devicePath: string } {
|
|
1257
|
-
const sep = spec.indexOf(':');
|
|
1258
|
-
if (sep <= 0 || sep === spec.length - 1) {
|
|
1259
|
-
throw new Error(`Invalid --resource-file value: "${spec}". Expected <localPath>:<devicePath>`);
|
|
1260
|
-
}
|
|
1261
|
-
const localPath = spec.slice(0, sep);
|
|
1262
|
-
const devicePath = spec.slice(sep + 1);
|
|
1263
|
-
if (!devicePath.startsWith('vol')) {
|
|
1264
|
-
throw new Error(
|
|
1265
|
-
`Invalid --resource-file device path: "${devicePath}". Expected a vol*:/... path`
|
|
1266
|
-
);
|
|
1267
|
-
}
|
|
1268
|
-
return {
|
|
1269
|
-
binary: readBinaryParam(localPath),
|
|
1270
|
-
devicePath,
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
|
|
1274
1252
|
function getFirmwareUpdateV4TotalBytes(params: ReturnType<typeof buildFirmwareUpdateV4Params>) {
|
|
1275
1253
|
return [
|
|
1276
|
-
...(params.resourceFiles?.map(item => item.binary) ?? []),
|
|
1277
1254
|
params.bootloaderBinary,
|
|
1278
1255
|
params.applicationP1Binary,
|
|
1279
1256
|
params.applicationP2Binary,
|
|
@@ -1598,7 +1575,6 @@ export async function runFirmwareUpdateV4WithRetry({
|
|
|
1598
1575
|
|
|
1599
1576
|
function buildFirmwareUpdateV4Params(opts: {
|
|
1600
1577
|
chunkSize?: string;
|
|
1601
|
-
resourceFile?: string[];
|
|
1602
1578
|
romloader?: string;
|
|
1603
1579
|
bootloader?: string;
|
|
1604
1580
|
applicationP1?: string;
|
|
@@ -1615,7 +1591,6 @@ function buildFirmwareUpdateV4Params(opts: {
|
|
|
1615
1591
|
connectProtocol: 'V2' as const,
|
|
1616
1592
|
chunkSize: opts.chunkSize ? safeParseInt(opts.chunkSize, '--chunk-size') : undefined,
|
|
1617
1593
|
forcedUpdateRes: opts.forcedUpdateRes,
|
|
1618
|
-
resourceFiles: opts.resourceFile?.map(parseResourceFileParam),
|
|
1619
1594
|
romloaderBinary: opts.romloader ? readBinaryParam(opts.romloader) : undefined,
|
|
1620
1595
|
bootloaderBinary: opts.bootloader ? readBinaryParam(opts.bootloader) : undefined,
|
|
1621
1596
|
applicationP1Binary: opts.applicationP1 ? readBinaryParam(opts.applicationP1) : undefined,
|
|
@@ -1628,7 +1603,6 @@ function buildFirmwareUpdateV4Params(opts: {
|
|
|
1628
1603
|
};
|
|
1629
1604
|
|
|
1630
1605
|
const hasPayload = [
|
|
1631
|
-
params.resourceFiles,
|
|
1632
1606
|
params.romloaderBinary,
|
|
1633
1607
|
params.bootloaderBinary,
|
|
1634
1608
|
params.applicationP1Binary,
|