@onekeyfe/hd-core 1.2.0-alpha.2 → 1.2.0-alpha.4
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__/preInitialize.test.ts +33 -0
- package/__tests__/protocol-v2.test.ts +1577 -624
- package/dist/api/FileRead.d.ts.map +1 -1
- package/dist/api/FileWrite.d.ts.map +1 -1
- package/dist/api/FirmwareUpdateV4.d.ts +20 -2
- package/dist/api/FirmwareUpdateV4.d.ts.map +1 -1
- package/dist/api/GetPassphraseState.d.ts +4 -4
- package/dist/api/GetPassphraseState.d.ts.map +1 -1
- package/dist/api/firmware/FirmwareUpdateBaseMethod.d.ts.map +1 -1
- package/dist/api/firmware/getBinary.d.ts +4 -0
- package/dist/api/firmware/getBinary.d.ts.map +1 -1
- package/dist/api/index.d.ts +5 -10
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts +6 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts +7 -0
- package/dist/api/protocol-v2/DeviceFactoryInfoSet.d.ts.map +1 -0
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts +1 -1
- package/dist/api/protocol-v2/DeviceFirmwareUpdate.d.ts.map +1 -1
- package/dist/api/protocol-v2/DeviceGetFirmwareUpdateStatus.d.ts +1 -1
- package/dist/api/protocol-v2/{DeviceGetDeviceInfo.d.ts → DeviceInfoGet.d.ts} +10 -10
- package/dist/api/protocol-v2/DeviceInfoGet.d.ts.map +1 -0
- package/dist/api/protocol-v2/{FilesystemFixPermission.d.ts → FilesystemPermissionFix.d.ts} +2 -2
- package/dist/api/protocol-v2/FilesystemPermissionFix.d.ts.map +1 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts +6 -0
- package/dist/api/protocol-v2/ProtocolInfoRequest.d.ts.map +1 -0
- package/dist/api/protocol-v2/helpers.d.ts +24 -19
- package/dist/api/protocol-v2/helpers.d.ts.map +1 -1
- package/dist/api/ton/TonSignData.d.ts +1 -5
- package/dist/api/ton/TonSignData.d.ts.map +1 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/data-manager/DataManager.d.ts +1 -1
- package/dist/data-manager/DataManager.d.ts.map +1 -1
- package/dist/device/Device.d.ts +5 -1
- package/dist/device/Device.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceFeatures.d.ts.map +1 -1
- package/dist/deviceProfile/buildDeviceProfile.d.ts.map +1 -1
- package/dist/index.d.ts +85 -58
- package/dist/index.js +1672 -1640
- package/dist/inject.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/features.d.ts +12 -14
- package/dist/protocols/protocol-v2/features.d.ts.map +1 -1
- package/dist/protocols/protocol-v2/firmware.d.ts +10 -9
- package/dist/protocols/protocol-v2/firmware.d.ts.map +1 -1
- package/dist/types/api/firmwareUpdate.d.ts +1 -6
- package/dist/types/api/firmwareUpdate.d.ts.map +1 -1
- package/dist/types/api/getDeviceInfo.d.ts +2 -0
- package/dist/types/api/getDeviceInfo.d.ts.map +1 -1
- package/dist/types/api/getPassphraseState.d.ts +4 -4
- package/dist/types/api/getPassphraseState.d.ts.map +1 -1
- package/dist/types/api/index.d.ts +6 -11
- package/dist/types/api/index.d.ts.map +1 -1
- package/dist/types/api/protocolV2.d.ts +12 -17
- package/dist/types/api/protocolV2.d.ts.map +1 -1
- package/dist/types/device.d.ts +1 -0
- package/dist/types/device.d.ts.map +1 -1
- package/dist/types/params.d.ts +1 -0
- package/dist/types/params.d.ts.map +1 -1
- package/dist/types/settings.d.ts +29 -1
- package/dist/types/settings.d.ts.map +1 -1
- package/dist/utils/deviceFeaturesUtils.d.ts +2 -0
- package/dist/utils/deviceFeaturesUtils.d.ts.map +1 -1
- package/dist/utils/patch.d.ts +1 -1
- package/dist/utils/patch.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/api/FileRead.ts +14 -1
- package/src/api/FileWrite.ts +14 -1
- package/src/api/FirmwareUpdateV4.ts +933 -197
- package/src/api/GetOnekeyFeatures.ts +1 -1
- package/src/api/GetPassphraseState.ts +7 -4
- package/src/api/device/DeviceRebootToBoardloader.ts +4 -4
- package/src/api/device/DeviceRebootToBootloader.ts +4 -4
- package/src/api/firmware/FirmwareUpdateBaseMethod.ts +11 -4
- package/src/api/index.ts +5 -10
- package/src/api/protocol-v2/{FactoryGetDeviceInfo.ts → DeviceFactoryInfoGet.ts} +3 -3
- package/src/api/protocol-v2/DeviceFactoryInfoSet.ts +32 -0
- package/src/api/protocol-v2/DeviceFirmwareUpdate.ts +3 -5
- package/src/api/protocol-v2/DeviceGetFirmwareUpdateStatus.ts +2 -2
- package/src/api/protocol-v2/{DeviceGetDeviceInfo.ts → DeviceInfoGet.ts} +52 -22
- package/src/api/protocol-v2/DeviceReboot.ts +2 -2
- package/src/api/protocol-v2/{FilesystemFixPermission.ts → FilesystemPermissionFix.ts} +2 -2
- package/src/api/protocol-v2/{GetProtoVersion.ts → ProtocolInfoRequest.ts} +2 -2
- package/src/api/protocol-v2/helpers.ts +48 -57
- package/src/api/ton/TonSignData.ts +1 -5
- package/src/constants/index.ts +10 -1
- package/src/core/index.ts +19 -3
- package/src/data/messages/messages-protocol-v2.json +1224 -1804
- package/src/data-manager/DataManager.ts +7 -0
- package/src/device/Device.ts +34 -12
- package/src/device/DevicePool.ts +6 -6
- package/src/deviceProfile/buildDeviceFeatures.ts +61 -63
- package/src/deviceProfile/buildDeviceProfile.ts +78 -60
- package/src/inject.ts +10 -16
- package/src/protocols/protocol-v2/features.ts +26 -62
- package/src/protocols/protocol-v2/firmware.ts +11 -36
- package/src/types/api/firmwareUpdate.ts +10 -20
- package/src/types/api/getDeviceInfo.ts +2 -0
- package/src/types/api/getPassphraseState.ts +4 -4
- package/src/types/api/index.ts +10 -20
- package/src/types/api/protocolV2.ts +21 -42
- package/src/types/device.ts +1 -0
- package/src/types/params.ts +4 -0
- package/src/types/settings.ts +44 -30
- package/src/utils/deviceFeaturesUtils.ts +52 -11
- package/dist/api/protocol-v2/DevReboot.d.ts +0 -7
- package/dist/api/protocol-v2/DevReboot.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts +0 -6
- package/dist/api/protocol-v2/DeviceGetOnboardingStatus.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts +0 -7
- package/dist/api/protocol-v2/FactoryDeviceInfoSettings.d.ts.map +0 -1
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts +0 -6
- package/dist/api/protocol-v2/FactoryGetDeviceInfo.d.ts.map +0 -1
- package/dist/api/protocol-v2/FilesystemFixPermission.d.ts.map +0 -1
- package/dist/api/protocol-v2/GetProtoVersion.d.ts +0 -6
- package/dist/api/protocol-v2/GetProtoVersion.d.ts.map +0 -1
- package/src/api/protocol-v2/DevReboot.ts +0 -24
- package/src/api/protocol-v2/DeviceGetOnboardingStatus.ts +0 -16
- package/src/api/protocol-v2/FactoryDeviceInfoSettings.ts +0 -29
package/dist/index.js
CHANGED
|
@@ -138,20 +138,15 @@ const createCoreApi = (call) => ({
|
|
|
138
138
|
deviceFlags: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFlags' })),
|
|
139
139
|
deviceRebootToBoardloader: connectId => call({ connectId, method: 'deviceRebootToBoardloader' }),
|
|
140
140
|
deviceRebootToBootloader: connectId => call({ connectId, method: 'deviceRebootToBootloader' }),
|
|
141
|
-
|
|
141
|
+
protocolInfoRequest: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'protocolInfoRequest' })),
|
|
142
142
|
ping: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'ping' })),
|
|
143
143
|
deviceReboot: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceReboot' })),
|
|
144
|
-
|
|
145
|
-
deviceGetOnboardingStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetOnboardingStatus' })),
|
|
144
|
+
deviceInfoGet: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceInfoGet' })),
|
|
146
145
|
deviceFirmwareUpdate: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFirmwareUpdate' })),
|
|
147
146
|
deviceGetFirmwareUpdateStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceGetFirmwareUpdateStatus' })),
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
devGetFirmwareUpdateStatus: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'devGetFirmwareUpdateStatus' })),
|
|
152
|
-
factoryDeviceInfoSettings: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'factoryDeviceInfoSettings' })),
|
|
153
|
-
factoryGetDeviceInfo: connectId => call({ connectId, method: 'factoryGetDeviceInfo' }),
|
|
154
|
-
filesystemFixPermission: connectId => call({ connectId, method: 'filesystemFixPermission' }),
|
|
147
|
+
deviceFactoryInfoSet: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFactoryInfoSet' })),
|
|
148
|
+
deviceFactoryInfoGet: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'deviceFactoryInfoGet' })),
|
|
149
|
+
filesystemPermissionFix: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'filesystemPermissionFix' })),
|
|
155
150
|
fileRead: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'fileRead' })),
|
|
156
151
|
fileWrite: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'fileWrite' })),
|
|
157
152
|
fileDelete: (connectId, params) => call(Object.assign(Object.assign({}, params), { connectId, method: 'fileDelete' })),
|
|
@@ -25392,7 +25387,6 @@ var nested = {
|
|
|
25392
25387
|
MessageType_GetFeatures: 55,
|
|
25393
25388
|
MessageType_SdProtect: 79,
|
|
25394
25389
|
MessageType_ChangeWipeCode: 82,
|
|
25395
|
-
MessageType_EndSession: 83,
|
|
25396
25390
|
MessageType_DoPreauthorized: 84,
|
|
25397
25391
|
MessageType_PreauthorizedRequest: 85,
|
|
25398
25392
|
MessageType_CancelAuthorization: 86,
|
|
@@ -25711,8 +25705,6 @@ var nested = {
|
|
|
25711
25705
|
MessageType_TonSignProof: 11905,
|
|
25712
25706
|
MessageType_TonSignedProof: 11906,
|
|
25713
25707
|
MessageType_TonTxAck: 11907,
|
|
25714
|
-
MessageType_TonSignData: 11908,
|
|
25715
|
-
MessageType_TonSignedData: 11909,
|
|
25716
25708
|
MessageType_ScdoGetAddress: 12001,
|
|
25717
25709
|
MessageType_ScdoAddress: 12002,
|
|
25718
25710
|
MessageType_ScdoSignTx: 12003,
|
|
@@ -25747,43 +25739,31 @@ var nested = {
|
|
|
25747
25739
|
MessageType_UiviewConfirmTxRequest: 30202,
|
|
25748
25740
|
MessageType_UiviewConfirmSignMessageRequest: 30203,
|
|
25749
25741
|
MessageType_UiviewResponse: 30204,
|
|
25750
|
-
|
|
25751
|
-
|
|
25752
|
-
|
|
25753
|
-
|
|
25754
|
-
|
|
25755
|
-
|
|
25756
|
-
|
|
25757
|
-
MessageType_ResourceUpload: 10018,
|
|
25758
|
-
MessageType_ZoomRequest: 10019,
|
|
25759
|
-
MessageType_BlurRequest: 10032,
|
|
25760
|
-
MessageType_ResourceRequest: 10020,
|
|
25761
|
-
MessageType_ResourceAck: 10021,
|
|
25762
|
-
MessageType_ResourceUpdate: 10022,
|
|
25763
|
-
MessageType_ListResDir: 10023,
|
|
25764
|
-
MessageType_FileInfoList: 10024,
|
|
25765
|
-
MessageType_OnekeyGetFeatures: 10025,
|
|
25766
|
-
MessageType_OnekeyFeatures: 10026,
|
|
25767
|
-
MessageType_WriteSEPrivateKey: 10027,
|
|
25768
|
-
MessageType_GetPassphraseState: 10028,
|
|
25769
|
-
MessageType_PassphraseState: 10029,
|
|
25770
|
-
MessageType_UnLockDevice: 10030,
|
|
25771
|
-
MessageType_UnLockDeviceResponse: 10031,
|
|
25772
|
-
MessageType_FactoryDeviceInfoSettings: 60000,
|
|
25773
|
-
MessageType_FactoryGetDeviceInfo: 60001,
|
|
25774
|
-
MessageType_FactoryDeviceInfo: 60002,
|
|
25775
|
-
MessageType_GetProtoVersion: 60200,
|
|
25776
|
-
MessageType_ProtoVersion: 60201,
|
|
25777
|
-
MessageType_StartSession: 60205,
|
|
25742
|
+
MessageType_DeviceFactoryInfoSet: 60000,
|
|
25743
|
+
MessageType_DeviceFactoryInfoGet: 60001,
|
|
25744
|
+
MessageType_DeviceFactoryInfo: 60002,
|
|
25745
|
+
MessageType_DeviceFactoryPermanentLock: 60003,
|
|
25746
|
+
MessageType_DeviceFactoryTest: 60004,
|
|
25747
|
+
MessageType_ProtocolInfoRequest: 60200,
|
|
25748
|
+
MessageType_ProtocolInfo: 60201,
|
|
25778
25749
|
MessageType_Ping: 60206,
|
|
25779
25750
|
MessageType_Success: 60207,
|
|
25780
25751
|
MessageType_Failure: 60208,
|
|
25781
|
-
|
|
25782
|
-
|
|
25752
|
+
MessageType_DeviceReboot: 60400,
|
|
25753
|
+
MessageType_DeviceSettings: 60410,
|
|
25754
|
+
MessageType_DeviceSettingsGet: 60411,
|
|
25755
|
+
MessageType_DeviceSettingsSet: 60412,
|
|
25756
|
+
MessageType_DeviceCertificate: 60420,
|
|
25757
|
+
MessageType_DeviceCertificateWrite: 60421,
|
|
25758
|
+
MessageType_DeviceCertificateRead: 60422,
|
|
25759
|
+
MessageType_DeviceCertificateSignature: 60423,
|
|
25760
|
+
MessageType_DeviceCertificateSign: 60424,
|
|
25761
|
+
MessageType_SetWallpaper: 60430,
|
|
25762
|
+
MessageType_GetWallpaper: 60431,
|
|
25763
|
+
MessageType_Wallpaper: 60432,
|
|
25764
|
+
MessageType_DeviceInfoGet: 60600,
|
|
25783
25765
|
MessageType_DeviceInfo: 60601,
|
|
25784
|
-
|
|
25785
|
-
MessageType_OnboardingStatus: 60603,
|
|
25786
|
-
MessageType_FilesystemFixPermission: 60800,
|
|
25766
|
+
MessageType_FilesystemPermissionFix: 60800,
|
|
25787
25767
|
MessageType_FilesystemPathInfo: 60801,
|
|
25788
25768
|
MessageType_FilesystemPathInfoQuery: 60802,
|
|
25789
25769
|
MessageType_FilesystemFile: 60803,
|
|
@@ -25795,17 +25775,28 @@ var nested = {
|
|
|
25795
25775
|
MessageType_FilesystemDirMake: 60809,
|
|
25796
25776
|
MessageType_FilesystemDirRemove: 60810,
|
|
25797
25777
|
MessageType_FilesystemFormat: 60811,
|
|
25798
|
-
|
|
25799
|
-
|
|
25800
|
-
|
|
25801
|
-
|
|
25802
|
-
|
|
25803
|
-
|
|
25804
|
-
|
|
25805
|
-
|
|
25806
|
-
|
|
25807
|
-
|
|
25808
|
-
|
|
25778
|
+
MessageType_DeviceFirmwareUpdateRequest: 61000,
|
|
25779
|
+
MessageType_DeviceFirmwareUpdateStatusGet: 61001,
|
|
25780
|
+
MessageType_DeviceFirmwareUpdateStatus: 61002
|
|
25781
|
+
},
|
|
25782
|
+
reserved: [
|
|
25783
|
+
[
|
|
25784
|
+
90,
|
|
25785
|
+
92
|
|
25786
|
+
],
|
|
25787
|
+
[
|
|
25788
|
+
114,
|
|
25789
|
+
122
|
|
25790
|
+
],
|
|
25791
|
+
[
|
|
25792
|
+
300,
|
|
25793
|
+
304
|
|
25794
|
+
],
|
|
25795
|
+
[
|
|
25796
|
+
309,
|
|
25797
|
+
312
|
|
25798
|
+
]
|
|
25799
|
+
]
|
|
25809
25800
|
},
|
|
25810
25801
|
AlephiumGetAddress: {
|
|
25811
25802
|
fields: {
|
|
@@ -31232,6 +31223,30 @@ var nested = {
|
|
|
31232
31223
|
}
|
|
31233
31224
|
}
|
|
31234
31225
|
},
|
|
31226
|
+
InternalMyAddressRequest: {
|
|
31227
|
+
fields: {
|
|
31228
|
+
coin_type: {
|
|
31229
|
+
rule: "required",
|
|
31230
|
+
type: "uint32",
|
|
31231
|
+
id: 1
|
|
31232
|
+
},
|
|
31233
|
+
chain_id: {
|
|
31234
|
+
rule: "required",
|
|
31235
|
+
type: "uint32",
|
|
31236
|
+
id: 2
|
|
31237
|
+
},
|
|
31238
|
+
account_index: {
|
|
31239
|
+
rule: "required",
|
|
31240
|
+
type: "uint32",
|
|
31241
|
+
id: 3
|
|
31242
|
+
},
|
|
31243
|
+
derive_type: {
|
|
31244
|
+
rule: "required",
|
|
31245
|
+
type: "uint32",
|
|
31246
|
+
id: 4
|
|
31247
|
+
}
|
|
31248
|
+
}
|
|
31249
|
+
},
|
|
31235
31250
|
KaspaGetAddress: {
|
|
31236
31251
|
fields: {
|
|
31237
31252
|
address_n: {
|
|
@@ -31409,7 +31424,7 @@ var nested = {
|
|
|
31409
31424
|
PromptTemporarily: 2
|
|
31410
31425
|
}
|
|
31411
31426
|
},
|
|
31412
|
-
|
|
31427
|
+
StartSession: {
|
|
31413
31428
|
fields: {
|
|
31414
31429
|
session_id: {
|
|
31415
31430
|
type: "bytes",
|
|
@@ -31425,22 +31440,10 @@ var nested = {
|
|
|
31425
31440
|
derive_cardano: {
|
|
31426
31441
|
type: "bool",
|
|
31427
31442
|
id: 3
|
|
31428
|
-
},
|
|
31429
|
-
passphrase_state: {
|
|
31430
|
-
type: "string",
|
|
31431
|
-
id: 8000
|
|
31432
|
-
},
|
|
31433
|
-
is_contains_attach: {
|
|
31434
|
-
type: "bool",
|
|
31435
|
-
id: 8001
|
|
31436
31443
|
}
|
|
31437
31444
|
}
|
|
31438
31445
|
},
|
|
31439
|
-
|
|
31440
|
-
fields: {
|
|
31441
|
-
}
|
|
31442
|
-
},
|
|
31443
|
-
OnekeyGetFeatures: {
|
|
31446
|
+
EndSession: {
|
|
31444
31447
|
fields: {
|
|
31445
31448
|
}
|
|
31446
31449
|
},
|
|
@@ -31465,399 +31468,17 @@ var nested = {
|
|
|
31465
31468
|
APP: 1
|
|
31466
31469
|
}
|
|
31467
31470
|
},
|
|
31468
|
-
Features: {
|
|
31469
|
-
fields: {
|
|
31470
|
-
vendor: {
|
|
31471
|
-
type: "string",
|
|
31472
|
-
id: 1
|
|
31473
|
-
},
|
|
31474
|
-
major_version: {
|
|
31475
|
-
rule: "required",
|
|
31476
|
-
type: "uint32",
|
|
31477
|
-
id: 2
|
|
31478
|
-
},
|
|
31479
|
-
minor_version: {
|
|
31480
|
-
rule: "required",
|
|
31481
|
-
type: "uint32",
|
|
31482
|
-
id: 3
|
|
31483
|
-
},
|
|
31484
|
-
patch_version: {
|
|
31485
|
-
rule: "required",
|
|
31486
|
-
type: "uint32",
|
|
31487
|
-
id: 4
|
|
31488
|
-
},
|
|
31489
|
-
bootloader_mode: {
|
|
31490
|
-
type: "bool",
|
|
31491
|
-
id: 5
|
|
31492
|
-
},
|
|
31493
|
-
device_id: {
|
|
31494
|
-
type: "string",
|
|
31495
|
-
id: 6
|
|
31496
|
-
},
|
|
31497
|
-
pin_protection: {
|
|
31498
|
-
type: "bool",
|
|
31499
|
-
id: 7
|
|
31500
|
-
},
|
|
31501
|
-
passphrase_protection: {
|
|
31502
|
-
type: "bool",
|
|
31503
|
-
id: 8
|
|
31504
|
-
},
|
|
31505
|
-
language: {
|
|
31506
|
-
type: "string",
|
|
31507
|
-
id: 9
|
|
31508
|
-
},
|
|
31509
|
-
label: {
|
|
31510
|
-
type: "string",
|
|
31511
|
-
id: 10
|
|
31512
|
-
},
|
|
31513
|
-
initialized: {
|
|
31514
|
-
type: "bool",
|
|
31515
|
-
id: 12
|
|
31516
|
-
},
|
|
31517
|
-
revision: {
|
|
31518
|
-
type: "bytes",
|
|
31519
|
-
id: 13
|
|
31520
|
-
},
|
|
31521
|
-
bootloader_hash: {
|
|
31522
|
-
type: "bytes",
|
|
31523
|
-
id: 14
|
|
31524
|
-
},
|
|
31525
|
-
imported: {
|
|
31526
|
-
type: "bool",
|
|
31527
|
-
id: 15
|
|
31528
|
-
},
|
|
31529
|
-
unlocked: {
|
|
31530
|
-
type: "bool",
|
|
31531
|
-
id: 16
|
|
31532
|
-
},
|
|
31533
|
-
_passphrase_cached: {
|
|
31534
|
-
type: "bool",
|
|
31535
|
-
id: 17,
|
|
31536
|
-
options: {
|
|
31537
|
-
deprecated: true
|
|
31538
|
-
}
|
|
31539
|
-
},
|
|
31540
|
-
firmware_present: {
|
|
31541
|
-
type: "bool",
|
|
31542
|
-
id: 18
|
|
31543
|
-
},
|
|
31544
|
-
needs_backup: {
|
|
31545
|
-
type: "bool",
|
|
31546
|
-
id: 19
|
|
31547
|
-
},
|
|
31548
|
-
flags: {
|
|
31549
|
-
type: "uint32",
|
|
31550
|
-
id: 20
|
|
31551
|
-
},
|
|
31552
|
-
model: {
|
|
31553
|
-
type: "string",
|
|
31554
|
-
id: 21
|
|
31555
|
-
},
|
|
31556
|
-
fw_major: {
|
|
31557
|
-
type: "uint32",
|
|
31558
|
-
id: 22
|
|
31559
|
-
},
|
|
31560
|
-
fw_minor: {
|
|
31561
|
-
type: "uint32",
|
|
31562
|
-
id: 23
|
|
31563
|
-
},
|
|
31564
|
-
fw_patch: {
|
|
31565
|
-
type: "uint32",
|
|
31566
|
-
id: 24
|
|
31567
|
-
},
|
|
31568
|
-
fw_vendor: {
|
|
31569
|
-
type: "string",
|
|
31570
|
-
id: 25
|
|
31571
|
-
},
|
|
31572
|
-
unfinished_backup: {
|
|
31573
|
-
type: "bool",
|
|
31574
|
-
id: 27
|
|
31575
|
-
},
|
|
31576
|
-
no_backup: {
|
|
31577
|
-
type: "bool",
|
|
31578
|
-
id: 28
|
|
31579
|
-
},
|
|
31580
|
-
recovery_mode: {
|
|
31581
|
-
type: "bool",
|
|
31582
|
-
id: 29
|
|
31583
|
-
},
|
|
31584
|
-
capabilities: {
|
|
31585
|
-
rule: "repeated",
|
|
31586
|
-
type: "Capability",
|
|
31587
|
-
id: 30,
|
|
31588
|
-
options: {
|
|
31589
|
-
packed: false
|
|
31590
|
-
}
|
|
31591
|
-
},
|
|
31592
|
-
backup_type: {
|
|
31593
|
-
type: "BackupType",
|
|
31594
|
-
id: 31
|
|
31595
|
-
},
|
|
31596
|
-
sd_card_present: {
|
|
31597
|
-
type: "bool",
|
|
31598
|
-
id: 32
|
|
31599
|
-
},
|
|
31600
|
-
sd_protection: {
|
|
31601
|
-
type: "bool",
|
|
31602
|
-
id: 33
|
|
31603
|
-
},
|
|
31604
|
-
wipe_code_protection: {
|
|
31605
|
-
type: "bool",
|
|
31606
|
-
id: 34
|
|
31607
|
-
},
|
|
31608
|
-
session_id: {
|
|
31609
|
-
type: "bytes",
|
|
31610
|
-
id: 35
|
|
31611
|
-
},
|
|
31612
|
-
passphrase_always_on_device: {
|
|
31613
|
-
type: "bool",
|
|
31614
|
-
id: 36
|
|
31615
|
-
},
|
|
31616
|
-
safety_checks: {
|
|
31617
|
-
type: "SafetyCheckLevel",
|
|
31618
|
-
id: 37
|
|
31619
|
-
},
|
|
31620
|
-
auto_lock_delay_ms: {
|
|
31621
|
-
type: "uint32",
|
|
31622
|
-
id: 38
|
|
31623
|
-
},
|
|
31624
|
-
display_rotation: {
|
|
31625
|
-
type: "uint32",
|
|
31626
|
-
id: 39
|
|
31627
|
-
},
|
|
31628
|
-
experimental_features: {
|
|
31629
|
-
type: "bool",
|
|
31630
|
-
id: 40
|
|
31631
|
-
},
|
|
31632
|
-
offset: {
|
|
31633
|
-
type: "uint32",
|
|
31634
|
-
id: 500
|
|
31635
|
-
},
|
|
31636
|
-
ble_name: {
|
|
31637
|
-
type: "string",
|
|
31638
|
-
id: 501
|
|
31639
|
-
},
|
|
31640
|
-
ble_ver: {
|
|
31641
|
-
type: "string",
|
|
31642
|
-
id: 502
|
|
31643
|
-
},
|
|
31644
|
-
ble_enable: {
|
|
31645
|
-
type: "bool",
|
|
31646
|
-
id: 503
|
|
31647
|
-
},
|
|
31648
|
-
se_enable: {
|
|
31649
|
-
type: "bool",
|
|
31650
|
-
id: 504
|
|
31651
|
-
},
|
|
31652
|
-
se_ver: {
|
|
31653
|
-
type: "string",
|
|
31654
|
-
id: 506
|
|
31655
|
-
},
|
|
31656
|
-
backup_only: {
|
|
31657
|
-
type: "bool",
|
|
31658
|
-
id: 507
|
|
31659
|
-
},
|
|
31660
|
-
onekey_version: {
|
|
31661
|
-
type: "string",
|
|
31662
|
-
id: 508
|
|
31663
|
-
},
|
|
31664
|
-
onekey_serial: {
|
|
31665
|
-
type: "string",
|
|
31666
|
-
id: 509
|
|
31667
|
-
},
|
|
31668
|
-
bootloader_version: {
|
|
31669
|
-
type: "string",
|
|
31670
|
-
id: 510
|
|
31671
|
-
},
|
|
31672
|
-
serial_no: {
|
|
31673
|
-
type: "string",
|
|
31674
|
-
id: 511
|
|
31675
|
-
},
|
|
31676
|
-
spi_flash: {
|
|
31677
|
-
type: "string",
|
|
31678
|
-
id: 512
|
|
31679
|
-
},
|
|
31680
|
-
initstates: {
|
|
31681
|
-
type: "uint32",
|
|
31682
|
-
id: 513
|
|
31683
|
-
},
|
|
31684
|
-
NFT_voucher: {
|
|
31685
|
-
type: "bytes",
|
|
31686
|
-
id: 514
|
|
31687
|
-
},
|
|
31688
|
-
cpu_info: {
|
|
31689
|
-
type: "string",
|
|
31690
|
-
id: 515
|
|
31691
|
-
},
|
|
31692
|
-
pre_firmware: {
|
|
31693
|
-
type: "string",
|
|
31694
|
-
id: 516
|
|
31695
|
-
},
|
|
31696
|
-
coin_switch: {
|
|
31697
|
-
type: "uint32",
|
|
31698
|
-
id: 517
|
|
31699
|
-
},
|
|
31700
|
-
build_id: {
|
|
31701
|
-
type: "bytes",
|
|
31702
|
-
id: 518
|
|
31703
|
-
},
|
|
31704
|
-
boardloader_version: {
|
|
31705
|
-
type: "string",
|
|
31706
|
-
id: 519
|
|
31707
|
-
},
|
|
31708
|
-
busy: {
|
|
31709
|
-
type: "bool",
|
|
31710
|
-
id: 41
|
|
31711
|
-
},
|
|
31712
|
-
onekey_device_type: {
|
|
31713
|
-
type: "OneKeyDeviceType",
|
|
31714
|
-
id: 600
|
|
31715
|
-
},
|
|
31716
|
-
onekey_se_type: {
|
|
31717
|
-
type: "OneKeySeType",
|
|
31718
|
-
id: 601
|
|
31719
|
-
},
|
|
31720
|
-
onekey_board_version: {
|
|
31721
|
-
type: "string",
|
|
31722
|
-
id: 602
|
|
31723
|
-
},
|
|
31724
|
-
onekey_board_hash: {
|
|
31725
|
-
type: "bytes",
|
|
31726
|
-
id: 603
|
|
31727
|
-
},
|
|
31728
|
-
onekey_boot_version: {
|
|
31729
|
-
type: "string",
|
|
31730
|
-
id: 604
|
|
31731
|
-
},
|
|
31732
|
-
onekey_boot_hash: {
|
|
31733
|
-
type: "bytes",
|
|
31734
|
-
id: 605
|
|
31735
|
-
},
|
|
31736
|
-
onekey_se01_version: {
|
|
31737
|
-
type: "string",
|
|
31738
|
-
id: 606
|
|
31739
|
-
},
|
|
31740
|
-
onekey_se01_hash: {
|
|
31741
|
-
type: "bytes",
|
|
31742
|
-
id: 607
|
|
31743
|
-
},
|
|
31744
|
-
onekey_se01_build_id: {
|
|
31745
|
-
type: "string",
|
|
31746
|
-
id: 608
|
|
31747
|
-
},
|
|
31748
|
-
onekey_firmware_version: {
|
|
31749
|
-
type: "string",
|
|
31750
|
-
id: 609
|
|
31751
|
-
},
|
|
31752
|
-
onekey_firmware_hash: {
|
|
31753
|
-
type: "bytes",
|
|
31754
|
-
id: 610
|
|
31755
|
-
},
|
|
31756
|
-
onekey_firmware_build_id: {
|
|
31757
|
-
type: "string",
|
|
31758
|
-
id: 611
|
|
31759
|
-
},
|
|
31760
|
-
onekey_serial_no: {
|
|
31761
|
-
type: "string",
|
|
31762
|
-
id: 612
|
|
31763
|
-
},
|
|
31764
|
-
onekey_boot_build_id: {
|
|
31765
|
-
type: "string",
|
|
31766
|
-
id: 613
|
|
31767
|
-
},
|
|
31768
|
-
onekey_ble_name: {
|
|
31769
|
-
type: "string",
|
|
31770
|
-
id: 614
|
|
31771
|
-
},
|
|
31772
|
-
onekey_ble_version: {
|
|
31773
|
-
type: "string",
|
|
31774
|
-
id: 615
|
|
31775
|
-
},
|
|
31776
|
-
onekey_ble_build_id: {
|
|
31777
|
-
type: "string",
|
|
31778
|
-
id: 616
|
|
31779
|
-
},
|
|
31780
|
-
onekey_ble_hash: {
|
|
31781
|
-
type: "bytes",
|
|
31782
|
-
id: 617
|
|
31783
|
-
},
|
|
31784
|
-
onekey_se02_version: {
|
|
31785
|
-
type: "string",
|
|
31786
|
-
id: 618
|
|
31787
|
-
},
|
|
31788
|
-
onekey_se03_version: {
|
|
31789
|
-
type: "string",
|
|
31790
|
-
id: 619
|
|
31791
|
-
},
|
|
31792
|
-
onekey_se04_version: {
|
|
31793
|
-
type: "string",
|
|
31794
|
-
id: 620
|
|
31795
|
-
},
|
|
31796
|
-
onekey_se01_state: {
|
|
31797
|
-
type: "OneKeySEState",
|
|
31798
|
-
id: 621
|
|
31799
|
-
},
|
|
31800
|
-
onekey_se02_state: {
|
|
31801
|
-
type: "OneKeySEState",
|
|
31802
|
-
id: 622
|
|
31803
|
-
},
|
|
31804
|
-
onekey_se03_state: {
|
|
31805
|
-
type: "OneKeySEState",
|
|
31806
|
-
id: 623
|
|
31807
|
-
},
|
|
31808
|
-
onekey_se04_state: {
|
|
31809
|
-
type: "OneKeySEState",
|
|
31810
|
-
id: 624
|
|
31811
|
-
},
|
|
31812
|
-
attach_to_pin_user: {
|
|
31813
|
-
type: "bool",
|
|
31814
|
-
id: 625
|
|
31815
|
-
},
|
|
31816
|
-
unlocked_attach_pin: {
|
|
31817
|
-
type: "bool",
|
|
31818
|
-
id: 626
|
|
31819
|
-
}
|
|
31820
|
-
},
|
|
31821
|
-
nested: {
|
|
31822
|
-
Capability: {
|
|
31823
|
-
options: {
|
|
31824
|
-
"(has_bitcoin_only_values)": true
|
|
31825
|
-
},
|
|
31826
|
-
values: {
|
|
31827
|
-
Capability_Bitcoin: 1,
|
|
31828
|
-
Capability_Bitcoin_like: 2,
|
|
31829
|
-
Capability_Binance: 3,
|
|
31830
|
-
Capability_Cardano: 4,
|
|
31831
|
-
Capability_Crypto: 5,
|
|
31832
|
-
Capability_EOS: 6,
|
|
31833
|
-
Capability_Ethereum: 7,
|
|
31834
|
-
Capability_Lisk: 8,
|
|
31835
|
-
Capability_Monero: 9,
|
|
31836
|
-
Capability_NEM: 10,
|
|
31837
|
-
Capability_Ripple: 11,
|
|
31838
|
-
Capability_Stellar: 12,
|
|
31839
|
-
Capability_Tezos: 13,
|
|
31840
|
-
Capability_U2F: 14,
|
|
31841
|
-
Capability_Shamir: 15,
|
|
31842
|
-
Capability_ShamirGroups: 16,
|
|
31843
|
-
Capability_PassphraseEntry: 17,
|
|
31844
|
-
Capability_AttachToPin: 18,
|
|
31845
|
-
Capability_EthereumTypedData: 1000
|
|
31846
|
-
}
|
|
31847
|
-
}
|
|
31848
|
-
}
|
|
31849
|
-
},
|
|
31850
31471
|
OnekeyFeatures: {
|
|
31851
31472
|
fields: {
|
|
31852
31473
|
onekey_device_type: {
|
|
31853
31474
|
type: "OneKeyDeviceType",
|
|
31854
31475
|
id: 1
|
|
31855
31476
|
},
|
|
31856
|
-
|
|
31477
|
+
onekey_romloader_version: {
|
|
31857
31478
|
type: "string",
|
|
31858
31479
|
id: 2
|
|
31859
31480
|
},
|
|
31860
|
-
|
|
31481
|
+
onekey_bootloader_version: {
|
|
31861
31482
|
type: "string",
|
|
31862
31483
|
id: 3
|
|
31863
31484
|
},
|
|
@@ -31865,11 +31486,11 @@ var nested = {
|
|
|
31865
31486
|
type: "string",
|
|
31866
31487
|
id: 4
|
|
31867
31488
|
},
|
|
31868
|
-
|
|
31489
|
+
onekey_romloader_hash: {
|
|
31869
31490
|
type: "bytes",
|
|
31870
31491
|
id: 5
|
|
31871
31492
|
},
|
|
31872
|
-
|
|
31493
|
+
onekey_bootloader_hash: {
|
|
31873
31494
|
type: "bytes",
|
|
31874
31495
|
id: 6
|
|
31875
31496
|
},
|
|
@@ -31877,11 +31498,11 @@ var nested = {
|
|
|
31877
31498
|
type: "bytes",
|
|
31878
31499
|
id: 7
|
|
31879
31500
|
},
|
|
31880
|
-
|
|
31501
|
+
onekey_romloader_build_id: {
|
|
31881
31502
|
type: "string",
|
|
31882
31503
|
id: 8
|
|
31883
31504
|
},
|
|
31884
|
-
|
|
31505
|
+
onekey_bootloader_build_id: {
|
|
31885
31506
|
type: "string",
|
|
31886
31507
|
id: 9
|
|
31887
31508
|
},
|
|
@@ -31893,19 +31514,19 @@ var nested = {
|
|
|
31893
31514
|
type: "string",
|
|
31894
31515
|
id: 11
|
|
31895
31516
|
},
|
|
31896
|
-
|
|
31517
|
+
onekey_coprocessor_bt_name: {
|
|
31897
31518
|
type: "string",
|
|
31898
31519
|
id: 12
|
|
31899
31520
|
},
|
|
31900
|
-
|
|
31521
|
+
onekey_coprocessor_version: {
|
|
31901
31522
|
type: "string",
|
|
31902
31523
|
id: 13
|
|
31903
31524
|
},
|
|
31904
|
-
|
|
31525
|
+
onekey_coprocessor_build_id: {
|
|
31905
31526
|
type: "string",
|
|
31906
31527
|
id: 14
|
|
31907
31528
|
},
|
|
31908
|
-
|
|
31529
|
+
onekey_coprocessor_hash: {
|
|
31909
31530
|
type: "bytes",
|
|
31910
31531
|
id: 15
|
|
31911
31532
|
},
|
|
@@ -31977,51 +31598,51 @@ var nested = {
|
|
|
31977
31598
|
type: "string",
|
|
31978
31599
|
id: 32
|
|
31979
31600
|
},
|
|
31980
|
-
|
|
31601
|
+
onekey_se01_bootloader_version: {
|
|
31981
31602
|
type: "string",
|
|
31982
31603
|
id: 33
|
|
31983
31604
|
},
|
|
31984
|
-
|
|
31605
|
+
onekey_se02_bootloader_version: {
|
|
31985
31606
|
type: "string",
|
|
31986
31607
|
id: 34
|
|
31987
31608
|
},
|
|
31988
|
-
|
|
31609
|
+
onekey_se03_bootloader_version: {
|
|
31989
31610
|
type: "string",
|
|
31990
31611
|
id: 35
|
|
31991
31612
|
},
|
|
31992
|
-
|
|
31613
|
+
onekey_se04_bootloader_version: {
|
|
31993
31614
|
type: "string",
|
|
31994
31615
|
id: 36
|
|
31995
31616
|
},
|
|
31996
|
-
|
|
31617
|
+
onekey_se01_bootloader_hash: {
|
|
31997
31618
|
type: "bytes",
|
|
31998
31619
|
id: 37
|
|
31999
31620
|
},
|
|
32000
|
-
|
|
31621
|
+
onekey_se02_bootloader_hash: {
|
|
32001
31622
|
type: "bytes",
|
|
32002
31623
|
id: 38
|
|
32003
31624
|
},
|
|
32004
|
-
|
|
31625
|
+
onekey_se03_bootloader_hash: {
|
|
32005
31626
|
type: "bytes",
|
|
32006
31627
|
id: 39
|
|
32007
31628
|
},
|
|
32008
|
-
|
|
31629
|
+
onekey_se04_bootloader_hash: {
|
|
32009
31630
|
type: "bytes",
|
|
32010
31631
|
id: 40
|
|
32011
31632
|
},
|
|
32012
|
-
|
|
31633
|
+
onekey_se01_bootloader_build_id: {
|
|
32013
31634
|
type: "string",
|
|
32014
31635
|
id: 41
|
|
32015
31636
|
},
|
|
32016
|
-
|
|
31637
|
+
onekey_se02_bootloader_build_id: {
|
|
32017
31638
|
type: "string",
|
|
32018
31639
|
id: 42
|
|
32019
31640
|
},
|
|
32020
|
-
|
|
31641
|
+
onekey_se03_bootloader_build_id: {
|
|
32021
31642
|
type: "string",
|
|
32022
31643
|
id: 43
|
|
32023
31644
|
},
|
|
32024
|
-
|
|
31645
|
+
onekey_se04_bootloader_build_id: {
|
|
32025
31646
|
type: "string",
|
|
32026
31647
|
id: 44
|
|
32027
31648
|
}
|
|
@@ -32039,10 +31660,6 @@ var nested = {
|
|
|
32039
31660
|
}
|
|
32040
31661
|
}
|
|
32041
31662
|
},
|
|
32042
|
-
EndSession: {
|
|
32043
|
-
fields: {
|
|
32044
|
-
}
|
|
32045
|
-
},
|
|
32046
31663
|
ApplySettings: {
|
|
32047
31664
|
fields: {
|
|
32048
31665
|
language: {
|
|
@@ -32576,6 +32193,49 @@ var nested = {
|
|
|
32576
32193
|
}
|
|
32577
32194
|
}
|
|
32578
32195
|
},
|
|
32196
|
+
WallpaperTarget: {
|
|
32197
|
+
values: {
|
|
32198
|
+
Home: 0,
|
|
32199
|
+
Lock: 1
|
|
32200
|
+
}
|
|
32201
|
+
},
|
|
32202
|
+
SetWallpaper: {
|
|
32203
|
+
fields: {
|
|
32204
|
+
target: {
|
|
32205
|
+
rule: "required",
|
|
32206
|
+
type: "WallpaperTarget",
|
|
32207
|
+
id: 1
|
|
32208
|
+
},
|
|
32209
|
+
path: {
|
|
32210
|
+
rule: "required",
|
|
32211
|
+
type: "string",
|
|
32212
|
+
id: 2
|
|
32213
|
+
}
|
|
32214
|
+
}
|
|
32215
|
+
},
|
|
32216
|
+
GetWallpaper: {
|
|
32217
|
+
fields: {
|
|
32218
|
+
target: {
|
|
32219
|
+
rule: "required",
|
|
32220
|
+
type: "WallpaperTarget",
|
|
32221
|
+
id: 1
|
|
32222
|
+
}
|
|
32223
|
+
}
|
|
32224
|
+
},
|
|
32225
|
+
Wallpaper: {
|
|
32226
|
+
fields: {
|
|
32227
|
+
target: {
|
|
32228
|
+
rule: "required",
|
|
32229
|
+
type: "WallpaperTarget",
|
|
32230
|
+
id: 1
|
|
32231
|
+
},
|
|
32232
|
+
path: {
|
|
32233
|
+
rule: "required",
|
|
32234
|
+
type: "string",
|
|
32235
|
+
id: 2
|
|
32236
|
+
}
|
|
32237
|
+
}
|
|
32238
|
+
},
|
|
32579
32239
|
ResourceUpdate: {
|
|
32580
32240
|
fields: {
|
|
32581
32241
|
file_name: {
|
|
@@ -34759,142 +34419,6 @@ var nested = {
|
|
|
34759
34419
|
}
|
|
34760
34420
|
}
|
|
34761
34421
|
},
|
|
34762
|
-
ScdoGetAddress: {
|
|
34763
|
-
fields: {
|
|
34764
|
-
address_n: {
|
|
34765
|
-
rule: "repeated",
|
|
34766
|
-
type: "uint32",
|
|
34767
|
-
id: 1,
|
|
34768
|
-
options: {
|
|
34769
|
-
packed: false
|
|
34770
|
-
}
|
|
34771
|
-
},
|
|
34772
|
-
show_display: {
|
|
34773
|
-
type: "bool",
|
|
34774
|
-
id: 2
|
|
34775
|
-
}
|
|
34776
|
-
}
|
|
34777
|
-
},
|
|
34778
|
-
ScdoAddress: {
|
|
34779
|
-
fields: {
|
|
34780
|
-
address: {
|
|
34781
|
-
rule: "required",
|
|
34782
|
-
type: "string",
|
|
34783
|
-
id: 1
|
|
34784
|
-
}
|
|
34785
|
-
}
|
|
34786
|
-
},
|
|
34787
|
-
ScdoSignTx: {
|
|
34788
|
-
fields: {
|
|
34789
|
-
address_n: {
|
|
34790
|
-
rule: "repeated",
|
|
34791
|
-
type: "uint32",
|
|
34792
|
-
id: 1,
|
|
34793
|
-
options: {
|
|
34794
|
-
packed: false
|
|
34795
|
-
}
|
|
34796
|
-
},
|
|
34797
|
-
nonce: {
|
|
34798
|
-
rule: "required",
|
|
34799
|
-
type: "bytes",
|
|
34800
|
-
id: 2
|
|
34801
|
-
},
|
|
34802
|
-
gas_price: {
|
|
34803
|
-
rule: "required",
|
|
34804
|
-
type: "bytes",
|
|
34805
|
-
id: 3
|
|
34806
|
-
},
|
|
34807
|
-
gas_limit: {
|
|
34808
|
-
rule: "required",
|
|
34809
|
-
type: "bytes",
|
|
34810
|
-
id: 4
|
|
34811
|
-
},
|
|
34812
|
-
to: {
|
|
34813
|
-
rule: "required",
|
|
34814
|
-
type: "string",
|
|
34815
|
-
id: 5
|
|
34816
|
-
},
|
|
34817
|
-
value: {
|
|
34818
|
-
rule: "required",
|
|
34819
|
-
type: "bytes",
|
|
34820
|
-
id: 6
|
|
34821
|
-
},
|
|
34822
|
-
timestamp: {
|
|
34823
|
-
rule: "required",
|
|
34824
|
-
type: "bytes",
|
|
34825
|
-
id: 7
|
|
34826
|
-
},
|
|
34827
|
-
data_initial_chunk: {
|
|
34828
|
-
type: "bytes",
|
|
34829
|
-
id: 8,
|
|
34830
|
-
options: {
|
|
34831
|
-
"default": ""
|
|
34832
|
-
}
|
|
34833
|
-
},
|
|
34834
|
-
data_length: {
|
|
34835
|
-
type: "uint32",
|
|
34836
|
-
id: 9,
|
|
34837
|
-
options: {
|
|
34838
|
-
"default": 0
|
|
34839
|
-
}
|
|
34840
|
-
},
|
|
34841
|
-
tx_type: {
|
|
34842
|
-
type: "uint32",
|
|
34843
|
-
id: 10,
|
|
34844
|
-
options: {
|
|
34845
|
-
"default": 0
|
|
34846
|
-
}
|
|
34847
|
-
}
|
|
34848
|
-
}
|
|
34849
|
-
},
|
|
34850
|
-
ScdoSignedTx: {
|
|
34851
|
-
fields: {
|
|
34852
|
-
data_length: {
|
|
34853
|
-
type: "uint32",
|
|
34854
|
-
id: 1
|
|
34855
|
-
},
|
|
34856
|
-
signature: {
|
|
34857
|
-
type: "bytes",
|
|
34858
|
-
id: 2
|
|
34859
|
-
}
|
|
34860
|
-
}
|
|
34861
|
-
},
|
|
34862
|
-
ScdoTxAck: {
|
|
34863
|
-
fields: {
|
|
34864
|
-
data_chunk: {
|
|
34865
|
-
type: "bytes",
|
|
34866
|
-
id: 1
|
|
34867
|
-
}
|
|
34868
|
-
}
|
|
34869
|
-
},
|
|
34870
|
-
ScdoSignMessage: {
|
|
34871
|
-
fields: {
|
|
34872
|
-
address_n: {
|
|
34873
|
-
rule: "repeated",
|
|
34874
|
-
type: "uint32",
|
|
34875
|
-
id: 1,
|
|
34876
|
-
options: {
|
|
34877
|
-
packed: false
|
|
34878
|
-
}
|
|
34879
|
-
},
|
|
34880
|
-
message: {
|
|
34881
|
-
type: "bytes",
|
|
34882
|
-
id: 2
|
|
34883
|
-
}
|
|
34884
|
-
}
|
|
34885
|
-
},
|
|
34886
|
-
ScdoSignedMessage: {
|
|
34887
|
-
fields: {
|
|
34888
|
-
signature: {
|
|
34889
|
-
type: "bytes",
|
|
34890
|
-
id: 1
|
|
34891
|
-
},
|
|
34892
|
-
address: {
|
|
34893
|
-
type: "string",
|
|
34894
|
-
id: 2
|
|
34895
|
-
}
|
|
34896
|
-
}
|
|
34897
|
-
},
|
|
34898
34422
|
SolanaOffChainMessageVersion: {
|
|
34899
34423
|
values: {
|
|
34900
34424
|
MESSAGE_VERSION_0: 0
|
|
@@ -36863,114 +36387,105 @@ var nested = {
|
|
|
36863
36387
|
}
|
|
36864
36388
|
}
|
|
36865
36389
|
},
|
|
36866
|
-
|
|
36390
|
+
ViewAmount: {
|
|
36867
36391
|
fields: {
|
|
36868
|
-
|
|
36392
|
+
is_unlimited: {
|
|
36869
36393
|
rule: "required",
|
|
36870
|
-
type: "
|
|
36394
|
+
type: "bool",
|
|
36871
36395
|
id: 1
|
|
36872
36396
|
},
|
|
36873
|
-
|
|
36874
|
-
rule: "required",
|
|
36875
|
-
type: "uint32",
|
|
36876
|
-
id: 2
|
|
36877
|
-
},
|
|
36878
|
-
symbol: {
|
|
36397
|
+
num: {
|
|
36879
36398
|
rule: "required",
|
|
36880
36399
|
type: "string",
|
|
36881
|
-
id:
|
|
36400
|
+
id: 2
|
|
36882
36401
|
}
|
|
36883
36402
|
}
|
|
36884
36403
|
},
|
|
36885
|
-
|
|
36404
|
+
ViewDetail: {
|
|
36886
36405
|
fields: {
|
|
36887
36406
|
key: {
|
|
36888
36407
|
rule: "required",
|
|
36889
36408
|
type: "uint32",
|
|
36890
36409
|
id: 1
|
|
36891
36410
|
},
|
|
36892
|
-
|
|
36411
|
+
value: {
|
|
36893
36412
|
rule: "required",
|
|
36894
36413
|
type: "string",
|
|
36895
36414
|
id: 2
|
|
36896
36415
|
},
|
|
36897
|
-
|
|
36898
|
-
|
|
36416
|
+
is_overview: {
|
|
36417
|
+
rule: "required",
|
|
36418
|
+
type: "bool",
|
|
36899
36419
|
id: 3
|
|
36900
36420
|
},
|
|
36901
|
-
|
|
36902
|
-
|
|
36421
|
+
has_icon: {
|
|
36422
|
+
rule: "required",
|
|
36423
|
+
type: "bool",
|
|
36903
36424
|
id: 4
|
|
36904
36425
|
}
|
|
36905
36426
|
}
|
|
36906
36427
|
},
|
|
36907
|
-
|
|
36428
|
+
ViewTipType: {
|
|
36429
|
+
values: {
|
|
36430
|
+
Default: 0,
|
|
36431
|
+
Highlight: 1,
|
|
36432
|
+
Recommend: 2,
|
|
36433
|
+
Warning: 3,
|
|
36434
|
+
Danger: 4
|
|
36435
|
+
}
|
|
36436
|
+
},
|
|
36437
|
+
ViewTip: {
|
|
36908
36438
|
fields: {
|
|
36909
|
-
|
|
36439
|
+
type: {
|
|
36910
36440
|
rule: "required",
|
|
36911
|
-
type: "
|
|
36441
|
+
type: "ViewTipType",
|
|
36912
36442
|
id: 1
|
|
36913
36443
|
},
|
|
36914
|
-
|
|
36915
|
-
|
|
36444
|
+
text: {
|
|
36445
|
+
rule: "required",
|
|
36446
|
+
type: "string",
|
|
36916
36447
|
id: 2
|
|
36917
36448
|
}
|
|
36918
36449
|
}
|
|
36919
36450
|
},
|
|
36920
|
-
|
|
36451
|
+
ViewSignPage: {
|
|
36921
36452
|
fields: {
|
|
36922
|
-
|
|
36453
|
+
title: {
|
|
36923
36454
|
rule: "required",
|
|
36924
|
-
type: "
|
|
36455
|
+
type: "string",
|
|
36925
36456
|
id: 1
|
|
36926
36457
|
},
|
|
36927
|
-
|
|
36928
|
-
|
|
36929
|
-
type: "string",
|
|
36458
|
+
amount: {
|
|
36459
|
+
type: "ViewAmount",
|
|
36930
36460
|
id: 2
|
|
36931
36461
|
},
|
|
36932
|
-
|
|
36933
|
-
rule: "
|
|
36934
|
-
type: "
|
|
36462
|
+
general: {
|
|
36463
|
+
rule: "repeated",
|
|
36464
|
+
type: "ViewDetail",
|
|
36935
36465
|
id: 3
|
|
36466
|
+
},
|
|
36467
|
+
tip: {
|
|
36468
|
+
type: "ViewTip",
|
|
36469
|
+
id: 4
|
|
36936
36470
|
}
|
|
36937
36471
|
}
|
|
36938
36472
|
},
|
|
36939
|
-
|
|
36940
|
-
values: {
|
|
36941
|
-
DISPLAY_TYPE_INFO: 0,
|
|
36942
|
-
DISPLAY_TYPE_SIGN: 1
|
|
36943
|
-
}
|
|
36944
|
-
},
|
|
36945
|
-
TxDetailsPage: {
|
|
36473
|
+
ViewVerifyPage: {
|
|
36946
36474
|
fields: {
|
|
36947
36475
|
title: {
|
|
36948
36476
|
rule: "required",
|
|
36949
36477
|
type: "string",
|
|
36950
36478
|
id: 1
|
|
36951
36479
|
},
|
|
36952
|
-
|
|
36480
|
+
address: {
|
|
36953
36481
|
rule: "required",
|
|
36954
|
-
type: "
|
|
36482
|
+
type: "string",
|
|
36955
36483
|
id: 2
|
|
36956
36484
|
},
|
|
36957
|
-
|
|
36958
|
-
|
|
36485
|
+
path: {
|
|
36486
|
+
rule: "required",
|
|
36487
|
+
type: "string",
|
|
36959
36488
|
id: 3
|
|
36960
|
-
},
|
|
36961
|
-
network: {
|
|
36962
|
-
type: "TxDetailsNetwork",
|
|
36963
|
-
id: 4
|
|
36964
|
-
},
|
|
36965
|
-
address: {
|
|
36966
|
-
rule: "repeated",
|
|
36967
|
-
type: "TxDetailsAddress",
|
|
36968
|
-
id: 5
|
|
36969
|
-
},
|
|
36970
|
-
general: {
|
|
36971
|
-
rule: "repeated",
|
|
36972
|
-
type: "TxDetailsGeneral",
|
|
36973
|
-
id: 6
|
|
36974
36489
|
}
|
|
36975
36490
|
}
|
|
36976
36491
|
},
|
|
@@ -37057,182 +36572,373 @@ var nested = {
|
|
|
37057
36572
|
}
|
|
37058
36573
|
}
|
|
37059
36574
|
},
|
|
37060
|
-
|
|
36575
|
+
ProtocolInfoRequest: {
|
|
37061
36576
|
fields: {
|
|
37062
|
-
|
|
36577
|
+
}
|
|
36578
|
+
},
|
|
36579
|
+
ProtocolInfo: {
|
|
36580
|
+
fields: {
|
|
36581
|
+
version: {
|
|
36582
|
+
rule: "required",
|
|
36583
|
+
type: "uint32",
|
|
36584
|
+
id: 1
|
|
36585
|
+
},
|
|
36586
|
+
supported_messages: {
|
|
37063
36587
|
rule: "repeated",
|
|
37064
36588
|
type: "uint32",
|
|
37065
|
-
id:
|
|
36589
|
+
id: 2,
|
|
37066
36590
|
options: {
|
|
37067
36591
|
packed: false
|
|
37068
36592
|
}
|
|
37069
36593
|
},
|
|
37070
|
-
|
|
37071
|
-
rule: "required",
|
|
37072
|
-
type: "TonSignDataType",
|
|
37073
|
-
id: 2
|
|
37074
|
-
},
|
|
37075
|
-
payload: {
|
|
37076
|
-
rule: "required",
|
|
37077
|
-
type: "bytes",
|
|
37078
|
-
id: 3
|
|
37079
|
-
},
|
|
37080
|
-
schema: {
|
|
37081
|
-
type: "string",
|
|
37082
|
-
id: 4
|
|
37083
|
-
},
|
|
37084
|
-
appdomain: {
|
|
37085
|
-
rule: "required",
|
|
36594
|
+
protobuf_definition: {
|
|
37086
36595
|
type: "string",
|
|
37087
|
-
id:
|
|
37088
|
-
}
|
|
37089
|
-
|
|
37090
|
-
|
|
37091
|
-
|
|
37092
|
-
|
|
37093
|
-
|
|
37094
|
-
from_address: {
|
|
36596
|
+
id: 3
|
|
36597
|
+
}
|
|
36598
|
+
}
|
|
36599
|
+
},
|
|
36600
|
+
Ping: {
|
|
36601
|
+
fields: {
|
|
36602
|
+
message: {
|
|
37095
36603
|
type: "string",
|
|
37096
|
-
id:
|
|
37097
|
-
},
|
|
37098
|
-
wallet_version: {
|
|
37099
|
-
type: "TonWalletVersion",
|
|
37100
|
-
id: 8,
|
|
37101
|
-
options: {
|
|
37102
|
-
"default": "V4R2"
|
|
37103
|
-
}
|
|
37104
|
-
},
|
|
37105
|
-
wallet_id: {
|
|
37106
|
-
type: "uint32",
|
|
37107
|
-
id: 9,
|
|
36604
|
+
id: 1,
|
|
37108
36605
|
options: {
|
|
37109
|
-
"default":
|
|
36606
|
+
"default": ""
|
|
37110
36607
|
}
|
|
37111
|
-
}
|
|
37112
|
-
|
|
37113
|
-
|
|
37114
|
-
|
|
36608
|
+
}
|
|
36609
|
+
}
|
|
36610
|
+
},
|
|
36611
|
+
Success: {
|
|
36612
|
+
fields: {
|
|
36613
|
+
message: {
|
|
36614
|
+
type: "string",
|
|
36615
|
+
id: 1,
|
|
37115
36616
|
options: {
|
|
37116
|
-
"default": "
|
|
36617
|
+
"default": ""
|
|
37117
36618
|
}
|
|
36619
|
+
}
|
|
36620
|
+
}
|
|
36621
|
+
},
|
|
36622
|
+
Failure: {
|
|
36623
|
+
fields: {
|
|
36624
|
+
code: {
|
|
36625
|
+
rule: "required",
|
|
36626
|
+
type: "FailureType",
|
|
36627
|
+
id: 1
|
|
37118
36628
|
},
|
|
37119
|
-
|
|
37120
|
-
type: "
|
|
37121
|
-
id:
|
|
37122
|
-
options: {
|
|
37123
|
-
"default": false
|
|
37124
|
-
}
|
|
36629
|
+
subcode: {
|
|
36630
|
+
type: "uint32",
|
|
36631
|
+
id: 2
|
|
37125
36632
|
},
|
|
37126
|
-
|
|
37127
|
-
type: "
|
|
37128
|
-
id:
|
|
37129
|
-
options: {
|
|
37130
|
-
"default": false
|
|
37131
|
-
}
|
|
36633
|
+
message: {
|
|
36634
|
+
type: "string",
|
|
36635
|
+
id: 3
|
|
37132
36636
|
}
|
|
37133
36637
|
},
|
|
37134
36638
|
nested: {
|
|
37135
|
-
|
|
36639
|
+
FailureType: {
|
|
37136
36640
|
values: {
|
|
37137
|
-
|
|
37138
|
-
|
|
37139
|
-
|
|
36641
|
+
Failure_InvalidMessage: 1,
|
|
36642
|
+
Failure_UndefinedError: 2,
|
|
36643
|
+
Failure_UsageError: 3,
|
|
36644
|
+
Failure_DataError: 4,
|
|
36645
|
+
Failure_ProcessError: 5
|
|
37140
36646
|
}
|
|
37141
36647
|
}
|
|
37142
36648
|
}
|
|
37143
36649
|
},
|
|
37144
|
-
|
|
36650
|
+
DeviceRebootType: {
|
|
36651
|
+
values: {
|
|
36652
|
+
Normal: 0,
|
|
36653
|
+
Romloader: 1,
|
|
36654
|
+
Bootloader: 2
|
|
36655
|
+
}
|
|
36656
|
+
},
|
|
36657
|
+
DeviceReboot: {
|
|
37145
36658
|
fields: {
|
|
37146
|
-
|
|
36659
|
+
reboot_type: {
|
|
36660
|
+
rule: "required",
|
|
36661
|
+
type: "DeviceRebootType",
|
|
36662
|
+
id: 1
|
|
36663
|
+
}
|
|
36664
|
+
}
|
|
36665
|
+
},
|
|
36666
|
+
DeviceSettings: {
|
|
36667
|
+
fields: {
|
|
36668
|
+
label: {
|
|
36669
|
+
type: "string",
|
|
36670
|
+
id: 1
|
|
36671
|
+
},
|
|
36672
|
+
bt_enable: {
|
|
36673
|
+
type: "bool",
|
|
36674
|
+
id: 2
|
|
36675
|
+
},
|
|
36676
|
+
language: {
|
|
36677
|
+
type: "string",
|
|
36678
|
+
id: 3
|
|
36679
|
+
}
|
|
36680
|
+
}
|
|
36681
|
+
},
|
|
36682
|
+
DeviceSettingsGet: {
|
|
36683
|
+
fields: {
|
|
36684
|
+
}
|
|
36685
|
+
},
|
|
36686
|
+
DeviceSettingsSet: {
|
|
36687
|
+
fields: {
|
|
36688
|
+
settings: {
|
|
36689
|
+
rule: "required",
|
|
36690
|
+
type: "DeviceSettings",
|
|
36691
|
+
id: 1
|
|
36692
|
+
}
|
|
36693
|
+
}
|
|
36694
|
+
},
|
|
36695
|
+
DeviceCertificate: {
|
|
36696
|
+
fields: {
|
|
36697
|
+
cert_and_pubkey: {
|
|
36698
|
+
rule: "required",
|
|
37147
36699
|
type: "bytes",
|
|
37148
36700
|
id: 1
|
|
37149
36701
|
},
|
|
37150
|
-
|
|
36702
|
+
private_key: {
|
|
37151
36703
|
type: "bytes",
|
|
37152
36704
|
id: 2
|
|
37153
36705
|
}
|
|
37154
36706
|
}
|
|
37155
36707
|
},
|
|
37156
|
-
|
|
36708
|
+
DeviceCertificateWrite: {
|
|
37157
36709
|
fields: {
|
|
36710
|
+
cert: {
|
|
36711
|
+
rule: "required",
|
|
36712
|
+
type: "DeviceCertificate",
|
|
36713
|
+
id: 1
|
|
36714
|
+
}
|
|
37158
36715
|
}
|
|
37159
36716
|
},
|
|
37160
|
-
|
|
36717
|
+
DeviceCertificateRead: {
|
|
37161
36718
|
fields: {
|
|
37162
|
-
|
|
36719
|
+
}
|
|
36720
|
+
},
|
|
36721
|
+
DeviceCertificateSignature: {
|
|
36722
|
+
fields: {
|
|
36723
|
+
data: {
|
|
37163
36724
|
rule: "required",
|
|
37164
|
-
type: "
|
|
36725
|
+
type: "bytes",
|
|
37165
36726
|
id: 1
|
|
37166
36727
|
}
|
|
37167
36728
|
}
|
|
37168
36729
|
},
|
|
37169
|
-
|
|
36730
|
+
DeviceCertificateSign: {
|
|
37170
36731
|
fields: {
|
|
37171
|
-
|
|
36732
|
+
data: {
|
|
36733
|
+
rule: "required",
|
|
36734
|
+
type: "bytes",
|
|
36735
|
+
id: 1
|
|
36736
|
+
}
|
|
36737
|
+
}
|
|
36738
|
+
},
|
|
36739
|
+
DeviceFirmwareTargetType: {
|
|
36740
|
+
values: {
|
|
36741
|
+
FW_MGMT_TARGET_INVALID: 0,
|
|
36742
|
+
FW_MGMT_TARGET_CRATE: 1,
|
|
36743
|
+
FW_MGMT_TARGET_ROMLOADER: 2,
|
|
36744
|
+
FW_MGMT_TARGET_BOOTLOADER: 3,
|
|
36745
|
+
FW_MGMT_TARGET_APPLICATION_P1: 4,
|
|
36746
|
+
FW_MGMT_TARGET_APPLICATION_P2: 5,
|
|
36747
|
+
FW_MGMT_TARGET_COPROCESSOR: 6,
|
|
36748
|
+
FW_MGMT_TARGET_SE01: 7,
|
|
36749
|
+
FW_MGMT_TARGET_SE02: 8,
|
|
36750
|
+
FW_MGMT_TARGET_SE03: 9,
|
|
36751
|
+
FW_MGMT_TARGET_SE04: 10
|
|
36752
|
+
}
|
|
36753
|
+
},
|
|
36754
|
+
DeviceFirmwareUpdateTaskStatus: {
|
|
36755
|
+
values: {
|
|
36756
|
+
FW_MGMT_UPDATER_TASK_STATUS_PENDING: 0,
|
|
36757
|
+
FW_MGMT_UPDATER_TASK_STATUS_IN_PROGRESS: 1,
|
|
36758
|
+
FW_MGMT_UPDATER_TASK_STATUS_FINISHED: 2,
|
|
36759
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_NOT_FOUND: 3,
|
|
36760
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_READ: 4,
|
|
36761
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_WRITE: 5,
|
|
36762
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_VERIFY: 6,
|
|
36763
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_INSTALL: 7,
|
|
36764
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ABORT: 8,
|
|
36765
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY: 9,
|
|
36766
|
+
FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS: 10
|
|
36767
|
+
}
|
|
36768
|
+
},
|
|
36769
|
+
DeviceFirmwareTarget: {
|
|
36770
|
+
fields: {
|
|
36771
|
+
target_id: {
|
|
36772
|
+
rule: "required",
|
|
36773
|
+
type: "DeviceFirmwareTargetType",
|
|
36774
|
+
id: 1
|
|
36775
|
+
},
|
|
36776
|
+
path: {
|
|
36777
|
+
rule: "required",
|
|
37172
36778
|
type: "string",
|
|
37173
|
-
id:
|
|
37174
|
-
options: {
|
|
37175
|
-
"default": ""
|
|
37176
|
-
}
|
|
36779
|
+
id: 2
|
|
37177
36780
|
}
|
|
37178
36781
|
}
|
|
37179
36782
|
},
|
|
37180
|
-
|
|
36783
|
+
DeviceFirmwareUpdateRequest: {
|
|
37181
36784
|
fields: {
|
|
37182
|
-
|
|
36785
|
+
targets: {
|
|
36786
|
+
rule: "repeated",
|
|
36787
|
+
type: "DeviceFirmwareTarget",
|
|
36788
|
+
id: 1
|
|
36789
|
+
}
|
|
36790
|
+
}
|
|
36791
|
+
},
|
|
36792
|
+
DeviceFirmwareUpdateRecord: {
|
|
36793
|
+
fields: {
|
|
36794
|
+
target_id: {
|
|
36795
|
+
rule: "required",
|
|
36796
|
+
type: "DeviceFirmwareTargetType",
|
|
36797
|
+
id: 1
|
|
36798
|
+
},
|
|
36799
|
+
status: {
|
|
36800
|
+
type: "DeviceFirmwareUpdateTaskStatus",
|
|
36801
|
+
id: 10
|
|
36802
|
+
},
|
|
36803
|
+
payload_version: {
|
|
36804
|
+
type: "uint32",
|
|
36805
|
+
id: 20
|
|
36806
|
+
},
|
|
36807
|
+
path: {
|
|
37183
36808
|
type: "string",
|
|
37184
|
-
id:
|
|
37185
|
-
options: {
|
|
37186
|
-
"default": ""
|
|
37187
|
-
}
|
|
36809
|
+
id: 30
|
|
37188
36810
|
}
|
|
37189
36811
|
}
|
|
37190
36812
|
},
|
|
37191
|
-
|
|
36813
|
+
DeviceFirmwareUpdateRecordFields: {
|
|
37192
36814
|
fields: {
|
|
37193
|
-
|
|
37194
|
-
type: "
|
|
36815
|
+
status: {
|
|
36816
|
+
type: "bool",
|
|
36817
|
+
id: 10
|
|
36818
|
+
},
|
|
36819
|
+
payload_version: {
|
|
36820
|
+
type: "bool",
|
|
36821
|
+
id: 20
|
|
36822
|
+
},
|
|
36823
|
+
path: {
|
|
36824
|
+
type: "bool",
|
|
36825
|
+
id: 30
|
|
36826
|
+
}
|
|
36827
|
+
}
|
|
36828
|
+
},
|
|
36829
|
+
DeviceFirmwareUpdateStatusGet: {
|
|
36830
|
+
fields: {
|
|
36831
|
+
fields: {
|
|
36832
|
+
type: "DeviceFirmwareUpdateRecordFields",
|
|
36833
|
+
id: 1
|
|
36834
|
+
}
|
|
36835
|
+
}
|
|
36836
|
+
},
|
|
36837
|
+
DeviceFirmwareUpdateStatus: {
|
|
36838
|
+
fields: {
|
|
36839
|
+
records: {
|
|
36840
|
+
rule: "repeated",
|
|
36841
|
+
type: "DeviceFirmwareUpdateRecord",
|
|
36842
|
+
id: 1
|
|
36843
|
+
}
|
|
36844
|
+
}
|
|
36845
|
+
},
|
|
36846
|
+
DeviceFactoryAck: {
|
|
36847
|
+
values: {
|
|
36848
|
+
FACTORY_ACK_SUCCESS: 0,
|
|
36849
|
+
FACTORY_ACK_FAIL: 1
|
|
36850
|
+
}
|
|
36851
|
+
},
|
|
36852
|
+
DeviceFactoryInfoManufactureTime: {
|
|
36853
|
+
fields: {
|
|
36854
|
+
year: {
|
|
36855
|
+
rule: "required",
|
|
36856
|
+
type: "uint32",
|
|
37195
36857
|
id: 1
|
|
37196
36858
|
},
|
|
37197
|
-
|
|
36859
|
+
month: {
|
|
36860
|
+
rule: "required",
|
|
36861
|
+
type: "uint32",
|
|
36862
|
+
id: 2
|
|
36863
|
+
},
|
|
36864
|
+
day: {
|
|
36865
|
+
rule: "required",
|
|
36866
|
+
type: "uint32",
|
|
36867
|
+
id: 3
|
|
36868
|
+
},
|
|
36869
|
+
hour: {
|
|
36870
|
+
rule: "required",
|
|
36871
|
+
type: "uint32",
|
|
36872
|
+
id: 4
|
|
36873
|
+
},
|
|
36874
|
+
minute: {
|
|
36875
|
+
rule: "required",
|
|
36876
|
+
type: "uint32",
|
|
36877
|
+
id: 5
|
|
36878
|
+
},
|
|
36879
|
+
second: {
|
|
36880
|
+
rule: "required",
|
|
36881
|
+
type: "uint32",
|
|
36882
|
+
id: 6
|
|
36883
|
+
}
|
|
36884
|
+
}
|
|
36885
|
+
},
|
|
36886
|
+
DeviceFactoryInfo: {
|
|
36887
|
+
fields: {
|
|
36888
|
+
version: {
|
|
36889
|
+
type: "uint32",
|
|
36890
|
+
id: 1
|
|
36891
|
+
},
|
|
36892
|
+
serial_number: {
|
|
37198
36893
|
type: "string",
|
|
37199
36894
|
id: 2
|
|
36895
|
+
},
|
|
36896
|
+
burn_in_completed: {
|
|
36897
|
+
type: "bool",
|
|
36898
|
+
id: 3
|
|
36899
|
+
},
|
|
36900
|
+
factory_test_completed: {
|
|
36901
|
+
type: "bool",
|
|
36902
|
+
id: 4
|
|
36903
|
+
},
|
|
36904
|
+
manufacture_time: {
|
|
36905
|
+
type: "DeviceFactoryInfoManufactureTime",
|
|
36906
|
+
id: 5
|
|
37200
36907
|
}
|
|
37201
|
-
}
|
|
37202
|
-
|
|
37203
|
-
|
|
37204
|
-
|
|
37205
|
-
|
|
37206
|
-
|
|
37207
|
-
|
|
37208
|
-
|
|
37209
|
-
Failure_PinExpected: 5,
|
|
37210
|
-
Failure_PinCancelled: 6,
|
|
37211
|
-
Failure_PinInvalid: 7,
|
|
37212
|
-
Failure_InvalidSignature: 8,
|
|
37213
|
-
Failure_ProcessError: 9,
|
|
37214
|
-
Failure_NotEnoughFunds: 10,
|
|
37215
|
-
Failure_NotInitialized: 11,
|
|
37216
|
-
Failure_PinMismatch: 12,
|
|
37217
|
-
Failure_WipeCodeMismatch: 13,
|
|
37218
|
-
Failure_InvalidSession: 14,
|
|
37219
|
-
Failure_FirmwareError: 99
|
|
37220
|
-
}
|
|
36908
|
+
}
|
|
36909
|
+
},
|
|
36910
|
+
DeviceFactoryInfoSet: {
|
|
36911
|
+
fields: {
|
|
36912
|
+
info: {
|
|
36913
|
+
rule: "required",
|
|
36914
|
+
type: "DeviceFactoryInfo",
|
|
36915
|
+
id: 1
|
|
37221
36916
|
}
|
|
37222
36917
|
}
|
|
37223
36918
|
},
|
|
37224
|
-
|
|
37225
|
-
|
|
37226
|
-
Normal: 0,
|
|
37227
|
-
Boardloader: 1,
|
|
37228
|
-
Bootloader: 2
|
|
36919
|
+
DeviceFactoryInfoGet: {
|
|
36920
|
+
fields: {
|
|
37229
36921
|
}
|
|
37230
36922
|
},
|
|
37231
|
-
|
|
36923
|
+
DeviceFactoryPermanentLock: {
|
|
37232
36924
|
fields: {
|
|
37233
|
-
|
|
36925
|
+
check_a: {
|
|
37234
36926
|
rule: "required",
|
|
37235
|
-
type: "
|
|
36927
|
+
type: "bytes",
|
|
36928
|
+
id: 1
|
|
36929
|
+
},
|
|
36930
|
+
check_b: {
|
|
36931
|
+
rule: "required",
|
|
36932
|
+
type: "bytes",
|
|
36933
|
+
id: 2
|
|
36934
|
+
}
|
|
36935
|
+
}
|
|
36936
|
+
},
|
|
36937
|
+
DeviceFactoryTest: {
|
|
36938
|
+
fields: {
|
|
36939
|
+
burn_in_test: {
|
|
36940
|
+
rule: "required",
|
|
36941
|
+
type: "bool",
|
|
37236
36942
|
id: 1
|
|
37237
36943
|
}
|
|
37238
36944
|
}
|
|
@@ -37244,23 +36950,25 @@ var nested = {
|
|
|
37244
36950
|
MINI: 2,
|
|
37245
36951
|
TOUCH: 3,
|
|
37246
36952
|
PRO: 5,
|
|
37247
|
-
CLASSIC1S_PURE: 6
|
|
36953
|
+
CLASSIC1S_PURE: 6,
|
|
36954
|
+
PRO2: 7,
|
|
36955
|
+
NEO: 8
|
|
37248
36956
|
}
|
|
37249
36957
|
},
|
|
37250
|
-
|
|
36958
|
+
DeviceSeType: {
|
|
37251
36959
|
values: {
|
|
37252
36960
|
THD89: 0,
|
|
37253
36961
|
SE608A: 1
|
|
37254
36962
|
}
|
|
37255
36963
|
},
|
|
37256
|
-
|
|
36964
|
+
DeviceSEState: {
|
|
37257
36965
|
values: {
|
|
37258
36966
|
BOOT: 0,
|
|
37259
36967
|
APP_FACTORY: 51,
|
|
37260
36968
|
APP: 85
|
|
37261
36969
|
}
|
|
37262
36970
|
},
|
|
37263
|
-
|
|
36971
|
+
DeviceFirmwareImageInfo: {
|
|
37264
36972
|
fields: {
|
|
37265
36973
|
version: {
|
|
37266
36974
|
type: "string",
|
|
@@ -37276,15 +36984,15 @@ var nested = {
|
|
|
37276
36984
|
}
|
|
37277
36985
|
}
|
|
37278
36986
|
},
|
|
37279
|
-
|
|
36987
|
+
DeviceHardwareInfo: {
|
|
37280
36988
|
fields: {
|
|
37281
|
-
|
|
36989
|
+
Device_type: {
|
|
37282
36990
|
type: "DeviceType",
|
|
37283
36991
|
id: 10
|
|
37284
36992
|
},
|
|
37285
36993
|
serial_no: {
|
|
37286
36994
|
type: "string",
|
|
37287
|
-
id:
|
|
36995
|
+
id: 20
|
|
37288
36996
|
},
|
|
37289
36997
|
hardware_version: {
|
|
37290
36998
|
type: "string",
|
|
@@ -37292,67 +37000,71 @@ var nested = {
|
|
|
37292
37000
|
},
|
|
37293
37001
|
hardware_version_raw_adc: {
|
|
37294
37002
|
type: "uint32",
|
|
37295
|
-
id:
|
|
37003
|
+
id: 110
|
|
37296
37004
|
}
|
|
37297
37005
|
}
|
|
37298
37006
|
},
|
|
37299
|
-
|
|
37007
|
+
DeviceMainMcuInfo: {
|
|
37300
37008
|
fields: {
|
|
37301
|
-
|
|
37302
|
-
type: "
|
|
37009
|
+
romloader: {
|
|
37010
|
+
type: "DeviceFirmwareImageInfo",
|
|
37303
37011
|
id: 10
|
|
37304
37012
|
},
|
|
37305
|
-
|
|
37306
|
-
type: "
|
|
37013
|
+
bootloader: {
|
|
37014
|
+
type: "DeviceFirmwareImageInfo",
|
|
37307
37015
|
id: 20
|
|
37308
37016
|
},
|
|
37309
|
-
|
|
37310
|
-
type: "
|
|
37017
|
+
application: {
|
|
37018
|
+
type: "DeviceFirmwareImageInfo",
|
|
37311
37019
|
id: 30
|
|
37020
|
+
},
|
|
37021
|
+
application_data: {
|
|
37022
|
+
type: "DeviceFirmwareImageInfo",
|
|
37023
|
+
id: 40
|
|
37312
37024
|
}
|
|
37313
37025
|
}
|
|
37314
37026
|
},
|
|
37315
|
-
|
|
37027
|
+
DeviceCoprocessorInfo: {
|
|
37316
37028
|
fields: {
|
|
37317
|
-
|
|
37318
|
-
type: "
|
|
37029
|
+
bootloader: {
|
|
37030
|
+
type: "DeviceFirmwareImageInfo",
|
|
37319
37031
|
id: 20
|
|
37320
37032
|
},
|
|
37321
|
-
|
|
37322
|
-
type: "
|
|
37033
|
+
application: {
|
|
37034
|
+
type: "DeviceFirmwareImageInfo",
|
|
37323
37035
|
id: 30
|
|
37324
37036
|
},
|
|
37325
|
-
|
|
37037
|
+
bt_adv_name: {
|
|
37326
37038
|
type: "string",
|
|
37327
37039
|
id: 100
|
|
37328
37040
|
},
|
|
37329
|
-
|
|
37041
|
+
bt_mac: {
|
|
37330
37042
|
type: "bytes",
|
|
37331
37043
|
id: 110
|
|
37332
37044
|
}
|
|
37333
37045
|
}
|
|
37334
37046
|
},
|
|
37335
|
-
|
|
37047
|
+
DeviceSEInfo: {
|
|
37336
37048
|
fields: {
|
|
37337
|
-
|
|
37338
|
-
type: "
|
|
37049
|
+
bootloader: {
|
|
37050
|
+
type: "DeviceFirmwareImageInfo",
|
|
37339
37051
|
id: 20
|
|
37340
37052
|
},
|
|
37341
|
-
|
|
37342
|
-
type: "
|
|
37053
|
+
application: {
|
|
37054
|
+
type: "DeviceFirmwareImageInfo",
|
|
37343
37055
|
id: 30
|
|
37344
37056
|
},
|
|
37345
37057
|
type: {
|
|
37346
|
-
type: "
|
|
37058
|
+
type: "DeviceSeType",
|
|
37347
37059
|
id: 100
|
|
37348
37060
|
},
|
|
37349
37061
|
state: {
|
|
37350
|
-
type: "
|
|
37062
|
+
type: "DeviceSEState",
|
|
37351
37063
|
id: 110
|
|
37352
37064
|
}
|
|
37353
37065
|
}
|
|
37354
37066
|
},
|
|
37355
|
-
|
|
37067
|
+
DeviceInfoTargets: {
|
|
37356
37068
|
fields: {
|
|
37357
37069
|
hw: {
|
|
37358
37070
|
type: "bool",
|
|
@@ -37362,7 +37074,7 @@ var nested = {
|
|
|
37362
37074
|
type: "bool",
|
|
37363
37075
|
id: 200
|
|
37364
37076
|
},
|
|
37365
|
-
|
|
37077
|
+
coprocessor: {
|
|
37366
37078
|
type: "bool",
|
|
37367
37079
|
id: 300
|
|
37368
37080
|
},
|
|
@@ -37388,7 +37100,7 @@ var nested = {
|
|
|
37388
37100
|
}
|
|
37389
37101
|
}
|
|
37390
37102
|
},
|
|
37391
|
-
|
|
37103
|
+
DeviceInfoTypes: {
|
|
37392
37104
|
fields: {
|
|
37393
37105
|
version: {
|
|
37394
37106
|
type: "bool",
|
|
@@ -37408,42 +37120,14 @@ var nested = {
|
|
|
37408
37120
|
}
|
|
37409
37121
|
}
|
|
37410
37122
|
},
|
|
37411
|
-
|
|
37412
|
-
fields: {
|
|
37413
|
-
language: {
|
|
37414
|
-
type: "string",
|
|
37415
|
-
id: 100
|
|
37416
|
-
},
|
|
37417
|
-
bt_enable: {
|
|
37418
|
-
type: "bool",
|
|
37419
|
-
id: 101
|
|
37420
|
-
},
|
|
37421
|
-
init_states: {
|
|
37422
|
-
type: "bool",
|
|
37423
|
-
id: 102
|
|
37424
|
-
},
|
|
37425
|
-
backup_required: {
|
|
37426
|
-
type: "bool",
|
|
37427
|
-
id: 200
|
|
37428
|
-
},
|
|
37429
|
-
passphrase_protection: {
|
|
37430
|
-
type: "bool",
|
|
37431
|
-
id: 201
|
|
37432
|
-
},
|
|
37433
|
-
label: {
|
|
37434
|
-
type: "string",
|
|
37435
|
-
id: 300
|
|
37436
|
-
}
|
|
37437
|
-
}
|
|
37438
|
-
},
|
|
37439
|
-
DevGetDeviceInfo: {
|
|
37123
|
+
DeviceInfoGet: {
|
|
37440
37124
|
fields: {
|
|
37441
37125
|
targets: {
|
|
37442
|
-
type: "
|
|
37126
|
+
type: "DeviceInfoTargets",
|
|
37443
37127
|
id: 1
|
|
37444
37128
|
},
|
|
37445
37129
|
types: {
|
|
37446
|
-
type: "
|
|
37130
|
+
type: "DeviceInfoTypes",
|
|
37447
37131
|
id: 2
|
|
37448
37132
|
}
|
|
37449
37133
|
}
|
|
@@ -37456,171 +37140,92 @@ var nested = {
|
|
|
37456
37140
|
id: 1
|
|
37457
37141
|
},
|
|
37458
37142
|
hw: {
|
|
37459
|
-
type: "
|
|
37143
|
+
type: "DeviceHardwareInfo",
|
|
37460
37144
|
id: 100
|
|
37461
37145
|
},
|
|
37462
37146
|
fw: {
|
|
37463
|
-
type: "
|
|
37147
|
+
type: "DeviceMainMcuInfo",
|
|
37464
37148
|
id: 200
|
|
37465
37149
|
},
|
|
37466
|
-
|
|
37467
|
-
type: "
|
|
37150
|
+
coprocessor: {
|
|
37151
|
+
type: "DeviceCoprocessorInfo",
|
|
37468
37152
|
id: 300
|
|
37469
37153
|
},
|
|
37470
37154
|
se1: {
|
|
37471
|
-
type: "
|
|
37155
|
+
type: "DeviceSEInfo",
|
|
37472
37156
|
id: 400
|
|
37473
37157
|
},
|
|
37474
37158
|
se2: {
|
|
37475
|
-
type: "
|
|
37159
|
+
type: "DeviceSEInfo",
|
|
37476
37160
|
id: 410
|
|
37477
37161
|
},
|
|
37478
37162
|
se3: {
|
|
37479
|
-
type: "
|
|
37163
|
+
type: "DeviceSEInfo",
|
|
37480
37164
|
id: 420
|
|
37481
37165
|
},
|
|
37482
37166
|
se4: {
|
|
37483
|
-
type: "
|
|
37167
|
+
type: "DeviceSEInfo",
|
|
37484
37168
|
id: 430
|
|
37485
37169
|
},
|
|
37486
37170
|
status: {
|
|
37487
|
-
type: "
|
|
37171
|
+
type: "DeviceStatus",
|
|
37488
37172
|
id: 10000
|
|
37489
37173
|
}
|
|
37490
37174
|
}
|
|
37491
37175
|
},
|
|
37492
|
-
|
|
37493
|
-
values: {
|
|
37494
|
-
TARGET_INVALID: 0,
|
|
37495
|
-
TARGET_ROMLOADER: 1,
|
|
37496
|
-
TARGET_BOOTLOADER: 2,
|
|
37497
|
-
TARGET_APPLICATION_P1: 3,
|
|
37498
|
-
TARGET_APPLICATION_P2: 4,
|
|
37499
|
-
TARGET_COPROCESSOR: 5,
|
|
37500
|
-
TARGET_SE01: 6,
|
|
37501
|
-
TARGET_SE02: 7,
|
|
37502
|
-
TARGET_SE03: 8,
|
|
37503
|
-
TARGET_SE04: 9,
|
|
37504
|
-
TARGET_RESOURCE: 10
|
|
37505
|
-
}
|
|
37506
|
-
},
|
|
37507
|
-
DevFirmwareTarget: {
|
|
37176
|
+
DeviceSessionGet: {
|
|
37508
37177
|
fields: {
|
|
37509
|
-
|
|
37510
|
-
|
|
37511
|
-
type: "DevFirmwareTargetType",
|
|
37512
|
-
id: 1
|
|
37513
|
-
},
|
|
37514
|
-
path: {
|
|
37515
|
-
rule: "required",
|
|
37516
|
-
type: "string",
|
|
37517
|
-
id: 2
|
|
37518
|
-
}
|
|
37519
|
-
}
|
|
37520
|
-
},
|
|
37521
|
-
DevFirmwareUpdate: {
|
|
37522
|
-
fields: {
|
|
37523
|
-
targets: {
|
|
37524
|
-
rule: "repeated",
|
|
37525
|
-
type: "DevFirmwareTarget",
|
|
37526
|
-
id: 1
|
|
37527
|
-
}
|
|
37528
|
-
}
|
|
37529
|
-
},
|
|
37530
|
-
DevFirmwareInstallProgress: {
|
|
37531
|
-
fields: {
|
|
37532
|
-
target_id: {
|
|
37533
|
-
rule: "required",
|
|
37534
|
-
type: "DevFirmwareTargetType",
|
|
37535
|
-
id: 1
|
|
37536
|
-
},
|
|
37537
|
-
progress: {
|
|
37538
|
-
rule: "required",
|
|
37539
|
-
type: "uint32",
|
|
37540
|
-
id: 2
|
|
37541
|
-
},
|
|
37542
|
-
stage: {
|
|
37543
|
-
type: "string",
|
|
37544
|
-
id: 3
|
|
37545
|
-
}
|
|
37546
|
-
}
|
|
37547
|
-
},
|
|
37548
|
-
DevFirmwareUpdateStatusEntry: {
|
|
37549
|
-
fields: {
|
|
37550
|
-
target_id: {
|
|
37551
|
-
rule: "required",
|
|
37552
|
-
type: "DevFirmwareTargetType",
|
|
37553
|
-
id: 1
|
|
37554
|
-
},
|
|
37555
|
-
status: {
|
|
37556
|
-
rule: "required",
|
|
37557
|
-
type: "uint32",
|
|
37558
|
-
id: 2
|
|
37559
|
-
}
|
|
37560
|
-
}
|
|
37561
|
-
},
|
|
37562
|
-
DevGetFirmwareUpdateStatus: {
|
|
37563
|
-
fields: {
|
|
37564
|
-
}
|
|
37565
|
-
},
|
|
37566
|
-
DevFirmwareUpdateStatus: {
|
|
37567
|
-
fields: {
|
|
37568
|
-
targets: {
|
|
37569
|
-
rule: "repeated",
|
|
37570
|
-
type: "DevFirmwareUpdateStatusEntry",
|
|
37178
|
+
session_id: {
|
|
37179
|
+
type: "bytes",
|
|
37571
37180
|
id: 1
|
|
37572
37181
|
}
|
|
37573
37182
|
}
|
|
37574
37183
|
},
|
|
37575
|
-
|
|
37184
|
+
DeviceSession: {
|
|
37576
37185
|
fields: {
|
|
37577
|
-
|
|
37578
|
-
type: "
|
|
37186
|
+
session_id: {
|
|
37187
|
+
type: "bytes",
|
|
37579
37188
|
id: 1
|
|
37580
37189
|
},
|
|
37581
|
-
|
|
37190
|
+
btc_test_address: {
|
|
37582
37191
|
type: "string",
|
|
37583
37192
|
id: 2
|
|
37584
|
-
},
|
|
37585
|
-
pre_firmware: {
|
|
37586
|
-
type: "string",
|
|
37587
|
-
id: 3
|
|
37588
37193
|
}
|
|
37589
37194
|
}
|
|
37590
37195
|
},
|
|
37591
|
-
|
|
37196
|
+
DeviceStatus: {
|
|
37592
37197
|
fields: {
|
|
37593
|
-
|
|
37594
|
-
},
|
|
37595
|
-
FactoryDeviceInfo: {
|
|
37596
|
-
fields: {
|
|
37597
|
-
serial_no: {
|
|
37198
|
+
device_id: {
|
|
37598
37199
|
type: "string",
|
|
37599
37200
|
id: 1
|
|
37600
37201
|
},
|
|
37601
|
-
|
|
37602
|
-
type: "
|
|
37202
|
+
unlocked: {
|
|
37203
|
+
type: "bool",
|
|
37603
37204
|
id: 2
|
|
37604
37205
|
},
|
|
37605
|
-
|
|
37606
|
-
type: "
|
|
37206
|
+
init_states: {
|
|
37207
|
+
type: "bool",
|
|
37607
37208
|
id: 3
|
|
37608
37209
|
},
|
|
37609
|
-
|
|
37610
|
-
type: "
|
|
37210
|
+
backup_required: {
|
|
37211
|
+
type: "bool",
|
|
37611
37212
|
id: 4
|
|
37612
37213
|
},
|
|
37613
|
-
|
|
37614
|
-
type: "
|
|
37615
|
-
id:
|
|
37214
|
+
passphrase_enabled: {
|
|
37215
|
+
type: "bool",
|
|
37216
|
+
id: 10
|
|
37616
37217
|
},
|
|
37617
|
-
|
|
37618
|
-
type: "
|
|
37619
|
-
id:
|
|
37218
|
+
attach_to_pin_enabled: {
|
|
37219
|
+
type: "bool",
|
|
37220
|
+
id: 11
|
|
37221
|
+
},
|
|
37222
|
+
unlocked_by_attach_to_pin: {
|
|
37223
|
+
type: "bool",
|
|
37224
|
+
id: 12
|
|
37620
37225
|
}
|
|
37621
37226
|
}
|
|
37622
37227
|
},
|
|
37623
|
-
|
|
37228
|
+
FilesystemPermissionFix: {
|
|
37624
37229
|
fields: {
|
|
37625
37230
|
}
|
|
37626
37231
|
},
|
|
@@ -37837,76 +37442,6 @@ var nested = {
|
|
|
37837
37442
|
fields: {
|
|
37838
37443
|
}
|
|
37839
37444
|
},
|
|
37840
|
-
OnboardingStep: {
|
|
37841
|
-
values: {
|
|
37842
|
-
ONBOARDING_STEP_UNKNOWN: 0,
|
|
37843
|
-
ONBOARDING_STEP_DEVICE_VERIFICATION: 1,
|
|
37844
|
-
ONBOARDING_STEP_PERSONALIZATION: 2,
|
|
37845
|
-
ONBOARDING_STEP_SETUP: 3,
|
|
37846
|
-
ONBOARDING_STEP_FIRMWARE: 4
|
|
37847
|
-
}
|
|
37848
|
-
},
|
|
37849
|
-
GetOnboardingStatus: {
|
|
37850
|
-
fields: {
|
|
37851
|
-
}
|
|
37852
|
-
},
|
|
37853
|
-
OnboardingStatus: {
|
|
37854
|
-
fields: {
|
|
37855
|
-
step: {
|
|
37856
|
-
rule: "required",
|
|
37857
|
-
type: "OnboardingStep",
|
|
37858
|
-
id: 1
|
|
37859
|
-
},
|
|
37860
|
-
setup: {
|
|
37861
|
-
type: "Setup",
|
|
37862
|
-
id: 2
|
|
37863
|
-
},
|
|
37864
|
-
detail_code: {
|
|
37865
|
-
type: "uint32",
|
|
37866
|
-
id: 3
|
|
37867
|
-
},
|
|
37868
|
-
detail_str: {
|
|
37869
|
-
type: "string",
|
|
37870
|
-
id: 4
|
|
37871
|
-
}
|
|
37872
|
-
},
|
|
37873
|
-
nested: {
|
|
37874
|
-
Setup: {
|
|
37875
|
-
fields: {
|
|
37876
|
-
new_device: {
|
|
37877
|
-
type: "NewDevice",
|
|
37878
|
-
id: 1
|
|
37879
|
-
},
|
|
37880
|
-
restore: {
|
|
37881
|
-
type: "Restore",
|
|
37882
|
-
id: 2
|
|
37883
|
-
}
|
|
37884
|
-
},
|
|
37885
|
-
nested: {
|
|
37886
|
-
NewDevice: {
|
|
37887
|
-
fields: {
|
|
37888
|
-
seedcard_backup: {
|
|
37889
|
-
type: "bool",
|
|
37890
|
-
id: 1
|
|
37891
|
-
}
|
|
37892
|
-
}
|
|
37893
|
-
},
|
|
37894
|
-
Restore: {
|
|
37895
|
-
fields: {
|
|
37896
|
-
mnemonic: {
|
|
37897
|
-
type: "bool",
|
|
37898
|
-
id: 1
|
|
37899
|
-
},
|
|
37900
|
-
seedcard: {
|
|
37901
|
-
type: "bool",
|
|
37902
|
-
id: 2
|
|
37903
|
-
}
|
|
37904
|
-
}
|
|
37905
|
-
}
|
|
37906
|
-
}
|
|
37907
|
-
}
|
|
37908
|
-
}
|
|
37909
|
-
},
|
|
37910
37445
|
google: {
|
|
37911
37446
|
nested: {
|
|
37912
37447
|
protobuf: {
|
|
@@ -38641,117 +38176,6 @@ var nested = {
|
|
|
38641
38176
|
}
|
|
38642
38177
|
}
|
|
38643
38178
|
}
|
|
38644
|
-
},
|
|
38645
|
-
DeviceRebootType: {
|
|
38646
|
-
values: {
|
|
38647
|
-
Normal: 0,
|
|
38648
|
-
Romloader: 1,
|
|
38649
|
-
Bootloader: 2
|
|
38650
|
-
}
|
|
38651
|
-
},
|
|
38652
|
-
DeviceReboot: {
|
|
38653
|
-
fields: {
|
|
38654
|
-
reboot_type: {
|
|
38655
|
-
rule: "required",
|
|
38656
|
-
type: "DeviceRebootType",
|
|
38657
|
-
id: 1
|
|
38658
|
-
}
|
|
38659
|
-
}
|
|
38660
|
-
},
|
|
38661
|
-
DeviceGetDeviceInfo: {
|
|
38662
|
-
fields: {
|
|
38663
|
-
targets: {
|
|
38664
|
-
type: "DevInfoTargets",
|
|
38665
|
-
id: 1
|
|
38666
|
-
},
|
|
38667
|
-
types: {
|
|
38668
|
-
type: "DevInfoTypes",
|
|
38669
|
-
id: 2
|
|
38670
|
-
}
|
|
38671
|
-
}
|
|
38672
|
-
},
|
|
38673
|
-
DeviceFirmwareTargetType: {
|
|
38674
|
-
values: {
|
|
38675
|
-
TARGET_INVALID: 0,
|
|
38676
|
-
TARGET_ROMLOADER: 1,
|
|
38677
|
-
TARGET_BOOTLOADER: 2,
|
|
38678
|
-
TARGET_APPLICATION_P1: 3,
|
|
38679
|
-
TARGET_APPLICATION_P2: 4,
|
|
38680
|
-
TARGET_COPROCESSOR: 5,
|
|
38681
|
-
TARGET_SE01: 6,
|
|
38682
|
-
TARGET_SE02: 7,
|
|
38683
|
-
TARGET_SE03: 8,
|
|
38684
|
-
TARGET_SE04: 9,
|
|
38685
|
-
TARGET_RESOURCE: 10
|
|
38686
|
-
}
|
|
38687
|
-
},
|
|
38688
|
-
DeviceFirmwareTarget: {
|
|
38689
|
-
fields: {
|
|
38690
|
-
target_id: {
|
|
38691
|
-
rule: "required",
|
|
38692
|
-
type: "DeviceFirmwareTargetType",
|
|
38693
|
-
id: 1
|
|
38694
|
-
},
|
|
38695
|
-
path: {
|
|
38696
|
-
rule: "required",
|
|
38697
|
-
type: "string",
|
|
38698
|
-
id: 2
|
|
38699
|
-
}
|
|
38700
|
-
}
|
|
38701
|
-
},
|
|
38702
|
-
DeviceFirmwareUpdate: {
|
|
38703
|
-
fields: {
|
|
38704
|
-
targets: {
|
|
38705
|
-
rule: "repeated",
|
|
38706
|
-
type: "DeviceFirmwareTarget",
|
|
38707
|
-
id: 1
|
|
38708
|
-
}
|
|
38709
|
-
}
|
|
38710
|
-
},
|
|
38711
|
-
DeviceFirmwareInstallProgress: {
|
|
38712
|
-
fields: {
|
|
38713
|
-
target_id: {
|
|
38714
|
-
rule: "required",
|
|
38715
|
-
type: "DeviceFirmwareTargetType",
|
|
38716
|
-
id: 1
|
|
38717
|
-
},
|
|
38718
|
-
progress: {
|
|
38719
|
-
rule: "required",
|
|
38720
|
-
type: "uint32",
|
|
38721
|
-
id: 2
|
|
38722
|
-
},
|
|
38723
|
-
stage: {
|
|
38724
|
-
type: "string",
|
|
38725
|
-
id: 3
|
|
38726
|
-
}
|
|
38727
|
-
}
|
|
38728
|
-
},
|
|
38729
|
-
DeviceFirmwareUpdateStatusEntry: {
|
|
38730
|
-
fields: {
|
|
38731
|
-
target_id: {
|
|
38732
|
-
rule: "required",
|
|
38733
|
-
type: "DeviceFirmwareTargetType",
|
|
38734
|
-
id: 1
|
|
38735
|
-
},
|
|
38736
|
-
status: {
|
|
38737
|
-
rule: "required",
|
|
38738
|
-
type: "uint32",
|
|
38739
|
-
id: 2
|
|
38740
|
-
}
|
|
38741
|
-
}
|
|
38742
|
-
},
|
|
38743
|
-
DeviceGetFirmwareUpdateStatus: {
|
|
38744
|
-
fields: {
|
|
38745
|
-
}
|
|
38746
|
-
},
|
|
38747
|
-
DeviceFirmwareUpdateStatus: {
|
|
38748
|
-
fields: {
|
|
38749
|
-
targets: {
|
|
38750
|
-
rule: "repeated",
|
|
38751
|
-
type: "DeviceFirmwareUpdateStatusEntry",
|
|
38752
|
-
id: 1
|
|
38753
|
-
}
|
|
38754
|
-
}
|
|
38755
38179
|
}
|
|
38756
38180
|
};
|
|
38757
38181
|
var MessagesProtocolV2JSON = {
|
|
@@ -38786,12 +38210,14 @@ var _a$1;
|
|
|
38786
38210
|
const Log$g = getLogger(exports.LoggerNames.Core);
|
|
38787
38211
|
const FIRMWARE_FIELDS = [
|
|
38788
38212
|
'firmware',
|
|
38213
|
+
'firmware-v1',
|
|
38789
38214
|
'firmware-v2',
|
|
38790
38215
|
'firmware-v8',
|
|
38791
38216
|
'firmware-btc-v8',
|
|
38792
38217
|
];
|
|
38793
38218
|
const FIRMWARE_FIELD_TYPE_MAP = {
|
|
38794
38219
|
firmware: hdShared.EFirmwareType.Universal,
|
|
38220
|
+
'firmware-v1': hdShared.EFirmwareType.Universal,
|
|
38795
38221
|
'firmware-v2': hdShared.EFirmwareType.Universal,
|
|
38796
38222
|
'firmware-v8': hdShared.EFirmwareType.Universal,
|
|
38797
38223
|
'firmware-btc-v8': hdShared.EFirmwareType.BitcoinOnly,
|
|
@@ -38883,6 +38309,7 @@ class DataManager {
|
|
|
38883
38309
|
[hdShared.EDeviceType.Mini]: this.enrichFirmwareReleaseInfo(data.mini),
|
|
38884
38310
|
[hdShared.EDeviceType.Touch]: this.enrichFirmwareReleaseInfo(data.touch),
|
|
38885
38311
|
[hdShared.EDeviceType.Pro]: this.enrichFirmwareReleaseInfo(data.pro),
|
|
38312
|
+
[hdShared.EDeviceType.Pro2]: this.enrichFirmwareReleaseInfo(data.pro2),
|
|
38886
38313
|
};
|
|
38887
38314
|
this.assets = {
|
|
38888
38315
|
bridge: data.bridge,
|
|
@@ -38943,6 +38370,10 @@ DataManager.deviceMap = {
|
|
|
38943
38370
|
firmware: [],
|
|
38944
38371
|
ble: [],
|
|
38945
38372
|
},
|
|
38373
|
+
[hdShared.EDeviceType.Pro2]: {
|
|
38374
|
+
firmware: [],
|
|
38375
|
+
ble: [],
|
|
38376
|
+
},
|
|
38946
38377
|
[hdShared.EDeviceType.ClassicPure]: {
|
|
38947
38378
|
firmware: [],
|
|
38948
38379
|
ble: [],
|
|
@@ -39201,10 +38632,13 @@ const supportInputPinOnSoftware = (features) => {
|
|
|
39201
38632
|
return { support: semver__default["default"].gte(currentVersion, '2.3.0'), require: '2.3.0' };
|
|
39202
38633
|
};
|
|
39203
38634
|
const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39204
|
-
var _a, _b;
|
|
38635
|
+
var _a, _b, _c;
|
|
39205
38636
|
const { features } = device;
|
|
39206
38637
|
const locked = (features === null || features === void 0 ? void 0 : features.unlocked) === false;
|
|
39207
38638
|
const deviceType = device.getCurrentDeviceType();
|
|
38639
|
+
if (options === null || options === void 0 ? void 0 : options.initSession) {
|
|
38640
|
+
device.clearInternalState();
|
|
38641
|
+
}
|
|
39208
38642
|
const { passphraseState, newSession, unlockedAttachPin } = yield getPassphraseState(device, Object.assign({}, options));
|
|
39209
38643
|
const isModeT = deviceType === hdShared.EDeviceType.Touch ||
|
|
39210
38644
|
deviceType === hdShared.EDeviceType.Pro ||
|
|
@@ -39215,20 +38649,39 @@ const getPassphraseStateWithRefreshDeviceInfo = (device, options) => __awaiter(v
|
|
|
39215
38649
|
yield device.getFeatures();
|
|
39216
38650
|
}
|
|
39217
38651
|
const deviceId = device.getCurrentDeviceId();
|
|
39218
|
-
device.updateInternalState((_a = device.getCurrentPassphraseProtection()) !== null && _a !== void 0 ? _a : false, passphraseState, deviceId, newSession, (_b = device.features) === null || _b === void 0 ? void 0 : _b.sessionId);
|
|
39219
|
-
return {
|
|
38652
|
+
device.updateInternalState((_a = device.getCurrentPassphraseProtection()) !== null && _a !== void 0 ? _a : false, passphraseState, deviceId, newSession, (options === null || options === void 0 ? void 0 : options.initSession) ? null : (_b = device.features) === null || _b === void 0 ? void 0 : _b.sessionId);
|
|
38653
|
+
return {
|
|
38654
|
+
passphraseState,
|
|
38655
|
+
newSession,
|
|
38656
|
+
unlockedAttachPin: unlockedAttachPin !== null && unlockedAttachPin !== void 0 ? unlockedAttachPin : (_c = device.features) === null || _c === void 0 ? void 0 : _c.unlockedAttachPin,
|
|
38657
|
+
};
|
|
39220
38658
|
});
|
|
39221
38659
|
const supportProSeriesAttachPinPassphrase = (deviceType, firmwareVersion) => deviceType === hdShared.EDeviceType.Pro && semver__default["default"].gte(firmwareVersion, '4.15.0');
|
|
39222
38660
|
const getPassphraseState = (device, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
39223
|
-
var
|
|
38661
|
+
var _d, _e;
|
|
39224
38662
|
const { features, commands } = device;
|
|
39225
38663
|
if (!features)
|
|
39226
38664
|
return { passphraseState: undefined, newSession: undefined, unlockedAttachPin: undefined };
|
|
39227
|
-
const firmwareVersion = (
|
|
38665
|
+
const firmwareVersion = (_d = device.getCurrentFirmwareVersionString()) !== null && _d !== void 0 ? _d : '0.0.0';
|
|
39228
38666
|
const deviceType = device.getCurrentDeviceType();
|
|
38667
|
+
if (device.isProtocolV2()) {
|
|
38668
|
+
const payload = {};
|
|
38669
|
+
const cachedSessionId = typeof device.getInternalState === 'function' ? device.getInternalState() : undefined;
|
|
38670
|
+
if (cachedSessionId) {
|
|
38671
|
+
payload.session_id = cachedSessionId;
|
|
38672
|
+
}
|
|
38673
|
+
const { message, type } = yield commands.typedCall('DeviceSessionGet', 'DeviceSession', payload);
|
|
38674
|
+
if (type === 'CallMethodError') {
|
|
38675
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Get the passphrase state error');
|
|
38676
|
+
}
|
|
38677
|
+
return {
|
|
38678
|
+
passphraseState: message.btc_test_address,
|
|
38679
|
+
newSession: message.session_id,
|
|
38680
|
+
unlockedAttachPin: (_e = features.unlockedAttachPin) !== null && _e !== void 0 ? _e : undefined,
|
|
38681
|
+
};
|
|
38682
|
+
}
|
|
39229
38683
|
const supportAttachPinCapability = existCapability(features, hdTransport.Enum_Capability.Capability_AttachToPin);
|
|
39230
|
-
const supportGetPassphraseState =
|
|
39231
|
-
supportAttachPinCapability ||
|
|
38684
|
+
const supportGetPassphraseState = supportAttachPinCapability ||
|
|
39232
38685
|
supportProSeriesAttachPinPassphrase(deviceType, firmwareVersion);
|
|
39233
38686
|
if (supportGetPassphraseState) {
|
|
39234
38687
|
const payload = (options === null || options === void 0 ? void 0 : options.onlyMainPin)
|
|
@@ -39302,6 +38755,9 @@ const getFirmwareUpdateField = ({ features, updateType, targetVersion, firmwareT
|
|
|
39302
38755
|
if (deviceType === hdShared.EDeviceType.Pro) {
|
|
39303
38756
|
return latestFirmwareField;
|
|
39304
38757
|
}
|
|
38758
|
+
if (deviceType === hdShared.EDeviceType.Pro2) {
|
|
38759
|
+
return 'firmware-v1';
|
|
38760
|
+
}
|
|
39305
38761
|
return 'firmware';
|
|
39306
38762
|
};
|
|
39307
38763
|
const getFirmwareUpdateFieldArray = (features, updateType) => {
|
|
@@ -39331,6 +38787,9 @@ const getFirmwareUpdateFieldArray = (features, updateType) => {
|
|
|
39331
38787
|
if (deviceType === 'pro') {
|
|
39332
38788
|
return ['firmware-v8'];
|
|
39333
38789
|
}
|
|
38790
|
+
if (deviceType === 'pro2') {
|
|
38791
|
+
return ['firmware-v1'];
|
|
38792
|
+
}
|
|
39334
38793
|
return ['firmware'];
|
|
39335
38794
|
};
|
|
39336
38795
|
function fixVersion(version) {
|
|
@@ -40212,14 +39671,14 @@ class DevicePool extends events.exports {
|
|
|
40212
39671
|
_a = false;
|
|
40213
39672
|
const descriptor = _d;
|
|
40214
39673
|
const device = yield this._createDevice(descriptor, initOptions);
|
|
40215
|
-
const
|
|
40216
|
-
if (
|
|
40217
|
-
if (this.devicesCache[
|
|
40218
|
-
const cache = this.devicesCache[
|
|
39674
|
+
const connectId = device.getConnectId();
|
|
39675
|
+
if (connectId) {
|
|
39676
|
+
if (this.devicesCache[connectId]) {
|
|
39677
|
+
const cache = this.devicesCache[connectId];
|
|
40219
39678
|
cache.updateDescriptor(descriptor, true);
|
|
40220
39679
|
}
|
|
40221
|
-
this.devicesCache[
|
|
40222
|
-
devices[
|
|
39680
|
+
this.devicesCache[connectId] = device;
|
|
39681
|
+
devices[connectId] = device;
|
|
40223
39682
|
}
|
|
40224
39683
|
deviceList.push(device);
|
|
40225
39684
|
}
|
|
@@ -41040,11 +40499,12 @@ class DeviceCommands {
|
|
|
41040
40499
|
}
|
|
41041
40500
|
}
|
|
41042
40501
|
|
|
40502
|
+
const isProtocolV2BootloaderDeviceInfo = (deviceInfo) => !!deviceInfo && deviceInfo.status == null;
|
|
41043
40503
|
const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
41044
40504
|
targets: {
|
|
41045
40505
|
hw: true,
|
|
41046
40506
|
fw: true,
|
|
41047
|
-
|
|
40507
|
+
coprocessor: true,
|
|
41048
40508
|
status: true,
|
|
41049
40509
|
},
|
|
41050
40510
|
types: {
|
|
@@ -41055,7 +40515,7 @@ const PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST = {
|
|
|
41055
40515
|
const PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST = {
|
|
41056
40516
|
targets: {
|
|
41057
40517
|
hw: true,
|
|
41058
|
-
|
|
40518
|
+
coprocessor: true,
|
|
41059
40519
|
status: true,
|
|
41060
40520
|
},
|
|
41061
40521
|
types: {
|
|
@@ -41067,7 +40527,7 @@ const PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST = {
|
|
|
41067
40527
|
targets: {
|
|
41068
40528
|
hw: true,
|
|
41069
40529
|
fw: true,
|
|
41070
|
-
|
|
40530
|
+
coprocessor: true,
|
|
41071
40531
|
se1: true,
|
|
41072
40532
|
se2: true,
|
|
41073
40533
|
se3: true,
|
|
@@ -41083,7 +40543,7 @@ const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
|
41083
40543
|
targets: {
|
|
41084
40544
|
hw: true,
|
|
41085
40545
|
fw: true,
|
|
41086
|
-
|
|
40546
|
+
coprocessor: true,
|
|
41087
40547
|
se1: true,
|
|
41088
40548
|
se2: true,
|
|
41089
40549
|
se3: true,
|
|
@@ -41099,27 +40559,12 @@ const PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST = {
|
|
|
41099
40559
|
};
|
|
41100
40560
|
const PROTOCOL_V2_DEVICE_INFO_REQUEST = PROTOCOL_V2_FULL_DEVICE_INFO_REQUEST;
|
|
41101
40561
|
const PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS = 10 * 1000;
|
|
41102
|
-
const buildMockProtocolV2DeviceInfo = () => ({
|
|
41103
|
-
protocol_version: 2,
|
|
41104
|
-
hw: {
|
|
41105
|
-
serial_no: '',
|
|
41106
|
-
},
|
|
41107
|
-
fw: {
|
|
41108
|
-
app: { version: '0.1.0' },
|
|
41109
|
-
},
|
|
41110
|
-
bt: {},
|
|
41111
|
-
status: {
|
|
41112
|
-
init_states: true,
|
|
41113
|
-
language: 'en_US',
|
|
41114
|
-
passphrase_protection: false,
|
|
41115
|
-
bt_enable: true,
|
|
41116
|
-
},
|
|
41117
|
-
});
|
|
41118
40562
|
function requestProtocolV2DeviceInfo({ commands, timeoutMs = PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS, request = PROTOCOL_V2_FEATURES_DEVICE_INFO_REQUEST, }) {
|
|
41119
40563
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41120
|
-
{
|
|
41121
|
-
|
|
41122
|
-
}
|
|
40564
|
+
const { message } = yield commands.typedCall('DeviceInfoGet', 'DeviceInfo', request, {
|
|
40565
|
+
timeoutMs,
|
|
40566
|
+
});
|
|
40567
|
+
return message;
|
|
41123
40568
|
});
|
|
41124
40569
|
}
|
|
41125
40570
|
|
|
@@ -41131,7 +40576,7 @@ const versionArrayToString = (version) => {
|
|
|
41131
40576
|
const value = version.join('.');
|
|
41132
40577
|
return isMeaningfulVersion(value) ? value : null;
|
|
41133
40578
|
};
|
|
41134
|
-
const bytesToHex$
|
|
40579
|
+
const bytesToHex$3 = (value) => {
|
|
41135
40580
|
if (!value)
|
|
41136
40581
|
return undefined;
|
|
41137
40582
|
if (typeof value === 'string')
|
|
@@ -41148,7 +40593,7 @@ const bytesToHex$2 = (value) => {
|
|
|
41148
40593
|
};
|
|
41149
40594
|
const getImageVersion$1 = (image) => { var _a; return (_a = image === null || image === void 0 ? void 0 : image.version) !== null && _a !== void 0 ? _a : null; };
|
|
41150
40595
|
const getImageBuildId$1 = (image) => { var _a; return (_a = image === null || image === void 0 ? void 0 : image.build_id) !== null && _a !== void 0 ? _a : undefined; };
|
|
41151
|
-
const getImageHash$1 = (image) => bytesToHex$
|
|
40596
|
+
const getImageHash$1 = (image) => bytesToHex$3(image === null || image === void 0 ? void 0 : image.hash);
|
|
41152
40597
|
const shouldIncludeVerify = (scope) => scope === 'verify' || scope === 'full';
|
|
41153
40598
|
const getDeviceMode = (features) => {
|
|
41154
40599
|
if (!features)
|
|
@@ -41163,6 +40608,8 @@ const getDeviceMode = (features) => {
|
|
|
41163
40608
|
};
|
|
41164
40609
|
const getProtocolV2Mode = (deviceInfo) => {
|
|
41165
40610
|
var _a;
|
|
40611
|
+
if (isProtocolV2BootloaderDeviceInfo(deviceInfo))
|
|
40612
|
+
return 'bootloader';
|
|
41166
40613
|
const initialized = (_a = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.status) === null || _a === void 0 ? void 0 : _a.init_states;
|
|
41167
40614
|
if (initialized === false)
|
|
41168
40615
|
return 'notInitialized';
|
|
@@ -41185,49 +40632,56 @@ const normalizeV1Versions = (features, protocolV1OneKeyFeatures) => ({
|
|
|
41185
40632
|
se04Boot: firstMeaningfulVersion$1(protocolV1OneKeyFeatures === null || protocolV1OneKeyFeatures === void 0 ? void 0 : protocolV1OneKeyFeatures.onekey_se04_boot_version, features === null || features === void 0 ? void 0 : features.se04BootVersion),
|
|
41186
40633
|
});
|
|
41187
40634
|
const normalizeV2Versions = (deviceInfo) => {
|
|
41188
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
41189
|
-
|
|
41190
|
-
|
|
41191
|
-
|
|
41192
|
-
|
|
41193
|
-
|
|
41194
|
-
|
|
41195
|
-
|
|
41196
|
-
|
|
41197
|
-
|
|
41198
|
-
|
|
41199
|
-
|
|
41200
|
-
|
|
41201
|
-
|
|
41202
|
-
|
|
40635
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
40636
|
+
const info = deviceInfo;
|
|
40637
|
+
return {
|
|
40638
|
+
firmware: firstMeaningfulVersion$1(getImageVersion$1((_a = info === null || info === void 0 ? void 0 : info.fw) === null || _a === void 0 ? void 0 : _a.application)),
|
|
40639
|
+
bootloader: firstMeaningfulVersion$1(getImageVersion$1((_b = info === null || info === void 0 ? void 0 : info.fw) === null || _b === void 0 ? void 0 : _b.bootloader)),
|
|
40640
|
+
board: firstMeaningfulVersion$1(getImageVersion$1((_d = (_c = info === null || info === void 0 ? void 0 : info.fw) === null || _c === void 0 ? void 0 : _c.application_data) !== null && _d !== void 0 ? _d : (_e = info === null || info === void 0 ? void 0 : info.fw) === null || _e === void 0 ? void 0 : _e.romloader)),
|
|
40641
|
+
ble: firstMeaningfulVersion$1(getImageVersion$1((_f = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _f === void 0 ? void 0 : _f.application)),
|
|
40642
|
+
se01: firstMeaningfulVersion$1(getImageVersion$1((_g = info === null || info === void 0 ? void 0 : info.se1) === null || _g === void 0 ? void 0 : _g.application)),
|
|
40643
|
+
se02: firstMeaningfulVersion$1(getImageVersion$1((_h = info === null || info === void 0 ? void 0 : info.se2) === null || _h === void 0 ? void 0 : _h.application)),
|
|
40644
|
+
se03: firstMeaningfulVersion$1(getImageVersion$1((_j = info === null || info === void 0 ? void 0 : info.se3) === null || _j === void 0 ? void 0 : _j.application)),
|
|
40645
|
+
se04: firstMeaningfulVersion$1(getImageVersion$1((_k = info === null || info === void 0 ? void 0 : info.se4) === null || _k === void 0 ? void 0 : _k.application)),
|
|
40646
|
+
se01Boot: firstMeaningfulVersion$1(getImageVersion$1((_l = info === null || info === void 0 ? void 0 : info.se1) === null || _l === void 0 ? void 0 : _l.bootloader)),
|
|
40647
|
+
se02Boot: firstMeaningfulVersion$1(getImageVersion$1((_m = info === null || info === void 0 ? void 0 : info.se2) === null || _m === void 0 ? void 0 : _m.bootloader)),
|
|
40648
|
+
se03Boot: firstMeaningfulVersion$1(getImageVersion$1((_o = info === null || info === void 0 ? void 0 : info.se3) === null || _o === void 0 ? void 0 : _o.bootloader)),
|
|
40649
|
+
se04Boot: firstMeaningfulVersion$1(getImageVersion$1((_p = info === null || info === void 0 ? void 0 : info.se4) === null || _p === void 0 ? void 0 : _p.bootloader)),
|
|
40650
|
+
};
|
|
41203
40651
|
};
|
|
41204
40652
|
const normalizeV1Status = (features) => {
|
|
41205
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
40653
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
41206
40654
|
return ({
|
|
41207
40655
|
mode: getDeviceMode(features),
|
|
41208
40656
|
initialized: (_a = features === null || features === void 0 ? void 0 : features.initialized) !== null && _a !== void 0 ? _a : null,
|
|
41209
40657
|
bootloaderMode: (_b = features === null || features === void 0 ? void 0 : features.bootloaderMode) !== null && _b !== void 0 ? _b : null,
|
|
41210
40658
|
unlocked: (_c = features === null || features === void 0 ? void 0 : features.unlocked) !== null && _c !== void 0 ? _c : null,
|
|
41211
40659
|
passphraseProtection: (_d = features === null || features === void 0 ? void 0 : features.passphraseProtection) !== null && _d !== void 0 ? _d : null,
|
|
41212
|
-
|
|
41213
|
-
|
|
41214
|
-
|
|
41215
|
-
|
|
40660
|
+
attachToPinEnabled: (_e = features === null || features === void 0 ? void 0 : features.attachToPinEnabled) !== null && _e !== void 0 ? _e : null,
|
|
40661
|
+
unlockedAttachPin: (_f = features === null || features === void 0 ? void 0 : features.unlockedAttachPin) !== null && _f !== void 0 ? _f : null,
|
|
40662
|
+
backupRequired: (_g = features === null || features === void 0 ? void 0 : features.backupRequired) !== null && _g !== void 0 ? _g : null,
|
|
40663
|
+
noBackup: (_h = features === null || features === void 0 ? void 0 : features.noBackup) !== null && _h !== void 0 ? _h : null,
|
|
40664
|
+
language: (_j = features === null || features === void 0 ? void 0 : features.language) !== null && _j !== void 0 ? _j : null,
|
|
40665
|
+
bleEnabled: (_k = features === null || features === void 0 ? void 0 : features.bleEnabled) !== null && _k !== void 0 ? _k : null,
|
|
41216
40666
|
});
|
|
41217
40667
|
};
|
|
41218
40668
|
const normalizeV2Status = (deviceInfo) => {
|
|
41219
|
-
var _a, _b, _c, _d, _e, _f
|
|
41220
|
-
|
|
40669
|
+
var _a, _b, _c, _d, _e, _f;
|
|
40670
|
+
const status = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.status;
|
|
40671
|
+
const bootloaderMode = isProtocolV2BootloaderDeviceInfo(deviceInfo);
|
|
40672
|
+
return {
|
|
41221
40673
|
mode: getProtocolV2Mode(deviceInfo),
|
|
41222
|
-
initialized: (
|
|
41223
|
-
bootloaderMode
|
|
41224
|
-
unlocked: null,
|
|
41225
|
-
passphraseProtection: (
|
|
41226
|
-
|
|
40674
|
+
initialized: (_a = status === null || status === void 0 ? void 0 : status.init_states) !== null && _a !== void 0 ? _a : null,
|
|
40675
|
+
bootloaderMode,
|
|
40676
|
+
unlocked: (_b = status === null || status === void 0 ? void 0 : status.unlocked) !== null && _b !== void 0 ? _b : null,
|
|
40677
|
+
passphraseProtection: (_c = status === null || status === void 0 ? void 0 : status.passphrase_enabled) !== null && _c !== void 0 ? _c : null,
|
|
40678
|
+
attachToPinEnabled: (_d = status === null || status === void 0 ? void 0 : status.attach_to_pin_enabled) !== null && _d !== void 0 ? _d : null,
|
|
40679
|
+
unlockedAttachPin: (_e = status === null || status === void 0 ? void 0 : status.unlocked_by_attach_to_pin) !== null && _e !== void 0 ? _e : null,
|
|
40680
|
+
backupRequired: (_f = status === null || status === void 0 ? void 0 : status.backup_required) !== null && _f !== void 0 ? _f : null,
|
|
41227
40681
|
noBackup: null,
|
|
41228
|
-
language:
|
|
41229
|
-
bleEnabled:
|
|
41230
|
-
}
|
|
40682
|
+
language: null,
|
|
40683
|
+
bleEnabled: null,
|
|
40684
|
+
};
|
|
41231
40685
|
};
|
|
41232
40686
|
const normalizeV1Verify = (features, protocolV1OneKeyFeatures) => {
|
|
41233
40687
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23;
|
|
@@ -41259,33 +40713,34 @@ const normalizeV1Verify = (features, protocolV1OneKeyFeatures) => {
|
|
|
41259
40713
|
});
|
|
41260
40714
|
};
|
|
41261
40715
|
const normalizeV2Verify = (deviceInfo) => {
|
|
41262
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
41263
|
-
|
|
41264
|
-
|
|
41265
|
-
|
|
41266
|
-
|
|
41267
|
-
|
|
41268
|
-
|
|
41269
|
-
|
|
41270
|
-
|
|
41271
|
-
|
|
41272
|
-
|
|
41273
|
-
|
|
41274
|
-
|
|
41275
|
-
|
|
41276
|
-
|
|
41277
|
-
|
|
41278
|
-
|
|
41279
|
-
|
|
41280
|
-
|
|
41281
|
-
|
|
41282
|
-
|
|
41283
|
-
|
|
41284
|
-
|
|
41285
|
-
|
|
41286
|
-
|
|
41287
|
-
|
|
41288
|
-
|
|
40716
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3;
|
|
40717
|
+
const info = deviceInfo;
|
|
40718
|
+
return {
|
|
40719
|
+
firmwareBuildId: getImageBuildId$1((_a = info === null || info === void 0 ? void 0 : info.fw) === null || _a === void 0 ? void 0 : _a.application),
|
|
40720
|
+
firmwareHash: getImageHash$1((_b = info === null || info === void 0 ? void 0 : info.fw) === null || _b === void 0 ? void 0 : _b.application),
|
|
40721
|
+
bootloaderBuildId: getImageBuildId$1((_c = info === null || info === void 0 ? void 0 : info.fw) === null || _c === void 0 ? void 0 : _c.bootloader),
|
|
40722
|
+
bootloaderHash: getImageHash$1((_d = info === null || info === void 0 ? void 0 : info.fw) === null || _d === void 0 ? void 0 : _d.bootloader),
|
|
40723
|
+
boardBuildId: getImageBuildId$1((_f = (_e = info === null || info === void 0 ? void 0 : info.fw) === null || _e === void 0 ? void 0 : _e.application_data) !== null && _f !== void 0 ? _f : (_g = info === null || info === void 0 ? void 0 : info.fw) === null || _g === void 0 ? void 0 : _g.romloader),
|
|
40724
|
+
boardHash: getImageHash$1((_j = (_h = info === null || info === void 0 ? void 0 : info.fw) === null || _h === void 0 ? void 0 : _h.application_data) !== null && _j !== void 0 ? _j : (_k = info === null || info === void 0 ? void 0 : info.fw) === null || _k === void 0 ? void 0 : _k.romloader),
|
|
40725
|
+
bleBuildId: getImageBuildId$1((_l = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _l === void 0 ? void 0 : _l.application),
|
|
40726
|
+
bleHash: getImageHash$1((_m = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _m === void 0 ? void 0 : _m.application),
|
|
40727
|
+
se01BuildId: getImageBuildId$1((_o = info === null || info === void 0 ? void 0 : info.se1) === null || _o === void 0 ? void 0 : _o.application),
|
|
40728
|
+
se01Hash: getImageHash$1((_p = info === null || info === void 0 ? void 0 : info.se1) === null || _p === void 0 ? void 0 : _p.application),
|
|
40729
|
+
se02BuildId: getImageBuildId$1((_q = info === null || info === void 0 ? void 0 : info.se2) === null || _q === void 0 ? void 0 : _q.application),
|
|
40730
|
+
se02Hash: getImageHash$1((_r = info === null || info === void 0 ? void 0 : info.se2) === null || _r === void 0 ? void 0 : _r.application),
|
|
40731
|
+
se03BuildId: getImageBuildId$1((_s = info === null || info === void 0 ? void 0 : info.se3) === null || _s === void 0 ? void 0 : _s.application),
|
|
40732
|
+
se03Hash: getImageHash$1((_t = info === null || info === void 0 ? void 0 : info.se3) === null || _t === void 0 ? void 0 : _t.application),
|
|
40733
|
+
se04BuildId: getImageBuildId$1((_u = info === null || info === void 0 ? void 0 : info.se4) === null || _u === void 0 ? void 0 : _u.application),
|
|
40734
|
+
se04Hash: getImageHash$1((_v = info === null || info === void 0 ? void 0 : info.se4) === null || _v === void 0 ? void 0 : _v.application),
|
|
40735
|
+
se01BootBuildId: getImageBuildId$1((_w = info === null || info === void 0 ? void 0 : info.se1) === null || _w === void 0 ? void 0 : _w.bootloader),
|
|
40736
|
+
se01BootHash: getImageHash$1((_x = info === null || info === void 0 ? void 0 : info.se1) === null || _x === void 0 ? void 0 : _x.bootloader),
|
|
40737
|
+
se02BootBuildId: getImageBuildId$1((_y = info === null || info === void 0 ? void 0 : info.se2) === null || _y === void 0 ? void 0 : _y.bootloader),
|
|
40738
|
+
se02BootHash: getImageHash$1((_z = info === null || info === void 0 ? void 0 : info.se2) === null || _z === void 0 ? void 0 : _z.bootloader),
|
|
40739
|
+
se03BootBuildId: getImageBuildId$1((_0 = info === null || info === void 0 ? void 0 : info.se3) === null || _0 === void 0 ? void 0 : _0.bootloader),
|
|
40740
|
+
se03BootHash: getImageHash$1((_1 = info === null || info === void 0 ? void 0 : info.se3) === null || _1 === void 0 ? void 0 : _1.bootloader),
|
|
40741
|
+
se04BootBuildId: getImageBuildId$1((_2 = info === null || info === void 0 ? void 0 : info.se4) === null || _2 === void 0 ? void 0 : _2.bootloader),
|
|
40742
|
+
se04BootHash: getImageHash$1((_3 = info === null || info === void 0 ? void 0 : info.se4) === null || _3 === void 0 ? void 0 : _3.bootloader),
|
|
40743
|
+
};
|
|
41289
40744
|
};
|
|
41290
40745
|
const normalizeRaw = ({ features, protocolV1OneKeyFeatures, protocolV2DeviceInfo, }) => (Object.assign(Object.assign(Object.assign({}, (features ? { features } : {})), (protocolV1OneKeyFeatures ? { protocolV1OneKeyFeatures } : {})), (protocolV2DeviceInfo ? { protocolV2DeviceInfo } : {})));
|
|
41291
40746
|
function buildProfileFromProtocolV1({ protocol = 'V1', features, protocolV1OneKeyFeatures, sources = ['features'], scope = 'basic', includeRaw = false, }) {
|
|
@@ -41302,12 +40757,15 @@ function buildProfileFromProtocolV1({ protocol = 'V1', features, protocolV1OneKe
|
|
|
41302
40757
|
: {}));
|
|
41303
40758
|
}
|
|
41304
40759
|
function buildProfileFromProtocolV2({ deviceInfo, sources = ['deviceInfo'], scope = 'basic', includeRaw = false, }) {
|
|
41305
|
-
var _a, _b, _c, _d
|
|
41306
|
-
const
|
|
41307
|
-
const
|
|
41308
|
-
const
|
|
40760
|
+
var _a, _b, _c, _d;
|
|
40761
|
+
const info = deviceInfo;
|
|
40762
|
+
const deviceId = ((_a = info === null || info === void 0 ? void 0 : info.status) === null || _a === void 0 ? void 0 : _a.device_id) || '';
|
|
40763
|
+
const serialNo = ((_b = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.hw) === null || _b === void 0 ? void 0 : _b.serial_no) || '';
|
|
40764
|
+
const label = null;
|
|
40765
|
+
const bleName = (_d = (_c = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _c === void 0 ? void 0 : _c.bt_adv_name) !== null && _d !== void 0 ? _d : null;
|
|
41309
40766
|
const verify = normalizeV2Verify(deviceInfo);
|
|
41310
|
-
return Object.assign(Object.assign({ protocol: 'V2', sources, deviceType: hdShared.EDeviceType.Pro2, firmwareType: hdShared.EFirmwareType.Universal, deviceId
|
|
40767
|
+
return Object.assign(Object.assign({ protocol: 'V2', sources, deviceType: hdShared.EDeviceType.Pro2, firmwareType: hdShared.EFirmwareType.Universal, deviceId,
|
|
40768
|
+
serialNo,
|
|
41311
40769
|
label,
|
|
41312
40770
|
bleName, status: normalizeV2Status(deviceInfo), versions: normalizeV2Versions(deviceInfo) }, (shouldIncludeVerify(scope) ? { verify } : {})), (includeRaw
|
|
41313
40771
|
? {
|
|
@@ -41319,7 +40777,7 @@ function buildProfileFromProtocolV2({ deviceInfo, sources = ['deviceInfo'], scop
|
|
|
41319
40777
|
}
|
|
41320
40778
|
|
|
41321
40779
|
const getImageVersion = (image) => { var _a; return (_a = image === null || image === void 0 ? void 0 : image.version) !== null && _a !== void 0 ? _a : null; };
|
|
41322
|
-
const bytesToHex$
|
|
40780
|
+
const bytesToHex$2 = (value) => {
|
|
41323
40781
|
if (!value)
|
|
41324
40782
|
return undefined;
|
|
41325
40783
|
if (typeof value === 'string')
|
|
@@ -41335,7 +40793,7 @@ const bytesToHex$1 = (value) => {
|
|
|
41335
40793
|
return undefined;
|
|
41336
40794
|
};
|
|
41337
40795
|
const getImageBuildId = (image) => { var _a; return (_a = image === null || image === void 0 ? void 0 : image.build_id) !== null && _a !== void 0 ? _a : undefined; };
|
|
41338
|
-
const getImageHash = (image) => bytesToHex$
|
|
40796
|
+
const getImageHash = (image) => bytesToHex$2(image === null || image === void 0 ? void 0 : image.hash);
|
|
41339
40797
|
const firstValue = (...values) => values.find(value => value !== undefined && value !== null);
|
|
41340
40798
|
const firstMeaningfulVersion = (...versions) => { var _a; return (_a = versions.find(version => Boolean(version && version !== '0.0.0'))) !== null && _a !== void 0 ? _a : null; };
|
|
41341
40799
|
const versionFromParts = (major, minor, patch) => [major, minor, patch].map(part => Number(part) || 0).join('.');
|
|
@@ -41494,41 +40952,54 @@ const buildProtocolV1FeaturesPayload = (protocolV1Features, previous) => {
|
|
|
41494
40952
|
};
|
|
41495
40953
|
};
|
|
41496
40954
|
const buildProtocolV2FeaturesPayload = (deviceInfo, previous) => {
|
|
41497
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70
|
|
40955
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, _65, _66, _67, _68, _69, _70;
|
|
41498
40956
|
const info = deviceInfo;
|
|
41499
|
-
const fwApplication =
|
|
41500
|
-
const fwBootloader =
|
|
41501
|
-
const fwBoard = firstValue((
|
|
41502
|
-
const bleApplication =
|
|
40957
|
+
const fwApplication = (_a = info === null || info === void 0 ? void 0 : info.fw) === null || _a === void 0 ? void 0 : _a.application;
|
|
40958
|
+
const fwBootloader = (_b = info === null || info === void 0 ? void 0 : info.fw) === null || _b === void 0 ? void 0 : _b.bootloader;
|
|
40959
|
+
const fwBoard = firstValue((_c = info === null || info === void 0 ? void 0 : info.fw) === null || _c === void 0 ? void 0 : _c.application_data, (_d = info === null || info === void 0 ? void 0 : info.fw) === null || _d === void 0 ? void 0 : _d.romloader);
|
|
40960
|
+
const bleApplication = (_e = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _e === void 0 ? void 0 : _e.application;
|
|
40961
|
+
const status = info === null || info === void 0 ? void 0 : info.status;
|
|
41503
40962
|
const firmwareVersion = firstMeaningfulVersion(getImageVersion(fwApplication), previous === null || previous === void 0 ? void 0 : previous.firmwareVersion);
|
|
41504
40963
|
const bootloaderVersion = firstMeaningfulVersion(getImageVersion(fwBootloader), previous === null || previous === void 0 ? void 0 : previous.bootloaderVersion);
|
|
41505
40964
|
const boardVersion = firstMeaningfulVersion(getImageVersion(fwBoard), previous === null || previous === void 0 ? void 0 : previous.boardVersion);
|
|
41506
40965
|
const bleVersion = firstMeaningfulVersion(getImageVersion(bleApplication), previous === null || previous === void 0 ? void 0 : previous.bleVersion);
|
|
41507
|
-
const
|
|
41508
|
-
const
|
|
41509
|
-
const
|
|
41510
|
-
const
|
|
41511
|
-
const
|
|
41512
|
-
const
|
|
41513
|
-
const
|
|
41514
|
-
const
|
|
40966
|
+
const deviceId = (_f = status === null || status === void 0 ? void 0 : status.device_id) !== null && _f !== void 0 ? _f : null;
|
|
40967
|
+
const serialNo = (_h = firstValue((_g = info === null || info === void 0 ? void 0 : info.hw) === null || _g === void 0 ? void 0 : _g.serial_no, previous === null || previous === void 0 ? void 0 : previous.serialNo)) !== null && _h !== void 0 ? _h : '';
|
|
40968
|
+
const label = (_j = previous === null || previous === void 0 ? void 0 : previous.label) !== null && _j !== void 0 ? _j : null;
|
|
40969
|
+
const bleName = firstValue((_k = info === null || info === void 0 ? void 0 : info.coprocessor) === null || _k === void 0 ? void 0 : _k.bt_adv_name, previous === null || previous === void 0 ? void 0 : previous.bleName);
|
|
40970
|
+
const initialized = (_l = firstValue(status === null || status === void 0 ? void 0 : status.init_states, previous === null || previous === void 0 ? void 0 : previous.initialized)) !== null && _l !== void 0 ? _l : null;
|
|
40971
|
+
const passphraseProtection = (_m = status === null || status === void 0 ? void 0 : status.passphrase_enabled) !== null && _m !== void 0 ? _m : null;
|
|
40972
|
+
const language = (_o = previous === null || previous === void 0 ? void 0 : previous.language) !== null && _o !== void 0 ? _o : null;
|
|
40973
|
+
const backupRequired = (_p = firstValue(status === null || status === void 0 ? void 0 : status.backup_required, previous === null || previous === void 0 ? void 0 : previous.backupRequired)) !== null && _p !== void 0 ? _p : null;
|
|
40974
|
+
const bleEnabled = previous === null || previous === void 0 ? void 0 : previous.bleEnabled;
|
|
40975
|
+
const unlocked = (_q = firstValue(status === null || status === void 0 ? void 0 : status.unlocked, previous === null || previous === void 0 ? void 0 : previous.unlocked)) !== null && _q !== void 0 ? _q : null;
|
|
40976
|
+
const attachToPinEnabled = (_r = status === null || status === void 0 ? void 0 : status.attach_to_pin_enabled) !== null && _r !== void 0 ? _r : null;
|
|
40977
|
+
const unlockedAttachPin = (_s = status === null || status === void 0 ? void 0 : status.unlocked_by_attach_to_pin) !== null && _s !== void 0 ? _s : undefined;
|
|
40978
|
+
const bootloaderMode = isProtocolV2BootloaderDeviceInfo(info);
|
|
40979
|
+
const mode = bootloaderMode
|
|
40980
|
+
? 'bootloader'
|
|
40981
|
+
: initialized === false
|
|
40982
|
+
? 'notInitialized'
|
|
40983
|
+
: initialized === true
|
|
40984
|
+
? 'normal'
|
|
40985
|
+
: 'unknown';
|
|
41515
40986
|
return {
|
|
41516
40987
|
protocol: 'V2',
|
|
41517
|
-
protocolVersion: (
|
|
40988
|
+
protocolVersion: (_u = (_t = deviceInfo === null || deviceInfo === void 0 ? void 0 : deviceInfo.protocol_version) !== null && _t !== void 0 ? _t : previous === null || previous === void 0 ? void 0 : previous.protocolVersion) !== null && _u !== void 0 ? _u : null,
|
|
41518
40989
|
deviceType: hdShared.EDeviceType.Pro2,
|
|
41519
|
-
firmwareType: (
|
|
40990
|
+
firmwareType: (_v = previous === null || previous === void 0 ? void 0 : previous.firmwareType) !== null && _v !== void 0 ? _v : hdShared.EFirmwareType.Universal,
|
|
41520
40991
|
model: 'pro2',
|
|
41521
40992
|
vendor: 'onekey.so',
|
|
41522
|
-
deviceId
|
|
40993
|
+
deviceId,
|
|
41523
40994
|
serialNo,
|
|
41524
40995
|
label,
|
|
41525
40996
|
bleName: bleName !== null && bleName !== void 0 ? bleName : null,
|
|
41526
40997
|
capabilities: [],
|
|
41527
|
-
mode
|
|
40998
|
+
mode,
|
|
41528
40999
|
initialized,
|
|
41529
|
-
bootloaderMode
|
|
41530
|
-
unlocked
|
|
41531
|
-
firmwarePresent: (
|
|
41000
|
+
bootloaderMode,
|
|
41001
|
+
unlocked,
|
|
41002
|
+
firmwarePresent: (_w = previous === null || previous === void 0 ? void 0 : previous.firmwarePresent) !== null && _w !== void 0 ? _w : null,
|
|
41532
41003
|
passphraseProtection,
|
|
41533
41004
|
pinProtection: null,
|
|
41534
41005
|
backupRequired,
|
|
@@ -41541,6 +41012,7 @@ const buildProtocolV2FeaturesPayload = (deviceInfo, previous) => {
|
|
|
41541
41012
|
sdProtection: null,
|
|
41542
41013
|
wipeCodeProtection: null,
|
|
41543
41014
|
passphraseAlwaysOnDevice: null,
|
|
41015
|
+
attachToPinEnabled,
|
|
41544
41016
|
safetyChecks: null,
|
|
41545
41017
|
autoLockDelayMs: null,
|
|
41546
41018
|
displayRotation: null,
|
|
@@ -41549,44 +41021,44 @@ const buildProtocolV2FeaturesPayload = (deviceInfo, previous) => {
|
|
|
41549
41021
|
bootloaderVersion,
|
|
41550
41022
|
boardVersion,
|
|
41551
41023
|
bleVersion,
|
|
41552
|
-
se01Version: firstMeaningfulVersion(getImageVersion((
|
|
41553
|
-
se02Version: firstMeaningfulVersion(getImageVersion((
|
|
41554
|
-
se03Version: firstMeaningfulVersion(getImageVersion((
|
|
41555
|
-
se04Version: firstMeaningfulVersion(getImageVersion((
|
|
41556
|
-
se01BootVersion: firstMeaningfulVersion(getImageVersion((
|
|
41557
|
-
se02BootVersion: firstMeaningfulVersion(getImageVersion((
|
|
41558
|
-
se03BootVersion: firstMeaningfulVersion(getImageVersion((
|
|
41559
|
-
se04BootVersion: firstMeaningfulVersion(getImageVersion((
|
|
41560
|
-
seVersion: (
|
|
41024
|
+
se01Version: firstMeaningfulVersion(getImageVersion((_x = info === null || info === void 0 ? void 0 : info.se1) === null || _x === void 0 ? void 0 : _x.application), previous === null || previous === void 0 ? void 0 : previous.se01Version),
|
|
41025
|
+
se02Version: firstMeaningfulVersion(getImageVersion((_y = info === null || info === void 0 ? void 0 : info.se2) === null || _y === void 0 ? void 0 : _y.application), previous === null || previous === void 0 ? void 0 : previous.se02Version),
|
|
41026
|
+
se03Version: firstMeaningfulVersion(getImageVersion((_z = info === null || info === void 0 ? void 0 : info.se3) === null || _z === void 0 ? void 0 : _z.application), previous === null || previous === void 0 ? void 0 : previous.se03Version),
|
|
41027
|
+
se04Version: firstMeaningfulVersion(getImageVersion((_0 = info === null || info === void 0 ? void 0 : info.se4) === null || _0 === void 0 ? void 0 : _0.application), previous === null || previous === void 0 ? void 0 : previous.se04Version),
|
|
41028
|
+
se01BootVersion: firstMeaningfulVersion(getImageVersion((_1 = info === null || info === void 0 ? void 0 : info.se1) === null || _1 === void 0 ? void 0 : _1.bootloader), previous === null || previous === void 0 ? void 0 : previous.se01BootVersion),
|
|
41029
|
+
se02BootVersion: firstMeaningfulVersion(getImageVersion((_2 = info === null || info === void 0 ? void 0 : info.se2) === null || _2 === void 0 ? void 0 : _2.bootloader), previous === null || previous === void 0 ? void 0 : previous.se02BootVersion),
|
|
41030
|
+
se03BootVersion: firstMeaningfulVersion(getImageVersion((_3 = info === null || info === void 0 ? void 0 : info.se3) === null || _3 === void 0 ? void 0 : _3.bootloader), previous === null || previous === void 0 ? void 0 : previous.se03BootVersion),
|
|
41031
|
+
se04BootVersion: firstMeaningfulVersion(getImageVersion((_4 = info === null || info === void 0 ? void 0 : info.se4) === null || _4 === void 0 ? void 0 : _4.bootloader), previous === null || previous === void 0 ? void 0 : previous.se04BootVersion),
|
|
41032
|
+
seVersion: (_5 = previous === null || previous === void 0 ? void 0 : previous.seVersion) !== null && _5 !== void 0 ? _5 : null,
|
|
41561
41033
|
verify: {
|
|
41562
|
-
firmwareBuildId: (
|
|
41563
|
-
firmwareHash: (
|
|
41564
|
-
bootloaderBuildId: (
|
|
41565
|
-
bootloaderHash: (
|
|
41566
|
-
boardBuildId: (
|
|
41567
|
-
boardHash: (
|
|
41568
|
-
bleBuildId: (
|
|
41569
|
-
bleHash: (
|
|
41570
|
-
se01BuildId: (
|
|
41571
|
-
se01Hash: (
|
|
41572
|
-
se02BuildId: (
|
|
41573
|
-
se02Hash: (
|
|
41574
|
-
se03BuildId: (
|
|
41575
|
-
se03Hash: (
|
|
41576
|
-
se04BuildId: (
|
|
41577
|
-
se04Hash: (
|
|
41578
|
-
se01BootBuildId: (
|
|
41579
|
-
se01BootHash: (
|
|
41580
|
-
se02BootBuildId: (
|
|
41581
|
-
se02BootHash: (
|
|
41582
|
-
se03BootBuildId: (
|
|
41583
|
-
se03BootHash: (
|
|
41584
|
-
se04BootBuildId: (
|
|
41585
|
-
se04BootHash: (
|
|
41034
|
+
firmwareBuildId: (_6 = getImageBuildId(fwApplication)) !== null && _6 !== void 0 ? _6 : (_7 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _7 === void 0 ? void 0 : _7.firmwareBuildId,
|
|
41035
|
+
firmwareHash: (_8 = getImageHash(fwApplication)) !== null && _8 !== void 0 ? _8 : (_9 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _9 === void 0 ? void 0 : _9.firmwareHash,
|
|
41036
|
+
bootloaderBuildId: (_10 = getImageBuildId(fwBootloader)) !== null && _10 !== void 0 ? _10 : (_11 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _11 === void 0 ? void 0 : _11.bootloaderBuildId,
|
|
41037
|
+
bootloaderHash: (_12 = getImageHash(fwBootloader)) !== null && _12 !== void 0 ? _12 : (_13 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _13 === void 0 ? void 0 : _13.bootloaderHash,
|
|
41038
|
+
boardBuildId: (_14 = getImageBuildId(fwBoard)) !== null && _14 !== void 0 ? _14 : (_15 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _15 === void 0 ? void 0 : _15.boardBuildId,
|
|
41039
|
+
boardHash: (_16 = getImageHash(fwBoard)) !== null && _16 !== void 0 ? _16 : (_17 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _17 === void 0 ? void 0 : _17.boardHash,
|
|
41040
|
+
bleBuildId: (_18 = getImageBuildId(bleApplication)) !== null && _18 !== void 0 ? _18 : (_19 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _19 === void 0 ? void 0 : _19.bleBuildId,
|
|
41041
|
+
bleHash: (_20 = getImageHash(bleApplication)) !== null && _20 !== void 0 ? _20 : (_21 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _21 === void 0 ? void 0 : _21.bleHash,
|
|
41042
|
+
se01BuildId: (_23 = getImageBuildId((_22 = info === null || info === void 0 ? void 0 : info.se1) === null || _22 === void 0 ? void 0 : _22.application)) !== null && _23 !== void 0 ? _23 : (_24 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _24 === void 0 ? void 0 : _24.se01BuildId,
|
|
41043
|
+
se01Hash: (_26 = getImageHash((_25 = info === null || info === void 0 ? void 0 : info.se1) === null || _25 === void 0 ? void 0 : _25.application)) !== null && _26 !== void 0 ? _26 : (_27 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _27 === void 0 ? void 0 : _27.se01Hash,
|
|
41044
|
+
se02BuildId: (_29 = getImageBuildId((_28 = info === null || info === void 0 ? void 0 : info.se2) === null || _28 === void 0 ? void 0 : _28.application)) !== null && _29 !== void 0 ? _29 : (_30 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _30 === void 0 ? void 0 : _30.se02BuildId,
|
|
41045
|
+
se02Hash: (_32 = getImageHash((_31 = info === null || info === void 0 ? void 0 : info.se2) === null || _31 === void 0 ? void 0 : _31.application)) !== null && _32 !== void 0 ? _32 : (_33 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _33 === void 0 ? void 0 : _33.se02Hash,
|
|
41046
|
+
se03BuildId: (_35 = getImageBuildId((_34 = info === null || info === void 0 ? void 0 : info.se3) === null || _34 === void 0 ? void 0 : _34.application)) !== null && _35 !== void 0 ? _35 : (_36 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _36 === void 0 ? void 0 : _36.se03BuildId,
|
|
41047
|
+
se03Hash: (_38 = getImageHash((_37 = info === null || info === void 0 ? void 0 : info.se3) === null || _37 === void 0 ? void 0 : _37.application)) !== null && _38 !== void 0 ? _38 : (_39 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _39 === void 0 ? void 0 : _39.se03Hash,
|
|
41048
|
+
se04BuildId: (_41 = getImageBuildId((_40 = info === null || info === void 0 ? void 0 : info.se4) === null || _40 === void 0 ? void 0 : _40.application)) !== null && _41 !== void 0 ? _41 : (_42 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _42 === void 0 ? void 0 : _42.se04BuildId,
|
|
41049
|
+
se04Hash: (_44 = getImageHash((_43 = info === null || info === void 0 ? void 0 : info.se4) === null || _43 === void 0 ? void 0 : _43.application)) !== null && _44 !== void 0 ? _44 : (_45 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _45 === void 0 ? void 0 : _45.se04Hash,
|
|
41050
|
+
se01BootBuildId: (_47 = getImageBuildId((_46 = info === null || info === void 0 ? void 0 : info.se1) === null || _46 === void 0 ? void 0 : _46.bootloader)) !== null && _47 !== void 0 ? _47 : (_48 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _48 === void 0 ? void 0 : _48.se01BootBuildId,
|
|
41051
|
+
se01BootHash: (_50 = getImageHash((_49 = info === null || info === void 0 ? void 0 : info.se1) === null || _49 === void 0 ? void 0 : _49.bootloader)) !== null && _50 !== void 0 ? _50 : (_51 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _51 === void 0 ? void 0 : _51.se01BootHash,
|
|
41052
|
+
se02BootBuildId: (_53 = getImageBuildId((_52 = info === null || info === void 0 ? void 0 : info.se2) === null || _52 === void 0 ? void 0 : _52.bootloader)) !== null && _53 !== void 0 ? _53 : (_54 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _54 === void 0 ? void 0 : _54.se02BootBuildId,
|
|
41053
|
+
se02BootHash: (_56 = getImageHash((_55 = info === null || info === void 0 ? void 0 : info.se2) === null || _55 === void 0 ? void 0 : _55.bootloader)) !== null && _56 !== void 0 ? _56 : (_57 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _57 === void 0 ? void 0 : _57.se02BootHash,
|
|
41054
|
+
se03BootBuildId: (_59 = getImageBuildId((_58 = info === null || info === void 0 ? void 0 : info.se3) === null || _58 === void 0 ? void 0 : _58.bootloader)) !== null && _59 !== void 0 ? _59 : (_60 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _60 === void 0 ? void 0 : _60.se03BootBuildId,
|
|
41055
|
+
se03BootHash: (_62 = getImageHash((_61 = info === null || info === void 0 ? void 0 : info.se3) === null || _61 === void 0 ? void 0 : _61.bootloader)) !== null && _62 !== void 0 ? _62 : (_63 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _63 === void 0 ? void 0 : _63.se03BootHash,
|
|
41056
|
+
se04BootBuildId: (_65 = getImageBuildId((_64 = info === null || info === void 0 ? void 0 : info.se4) === null || _64 === void 0 ? void 0 : _64.bootloader)) !== null && _65 !== void 0 ? _65 : (_66 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _66 === void 0 ? void 0 : _66.se04BootBuildId,
|
|
41057
|
+
se04BootHash: (_68 = getImageHash((_67 = info === null || info === void 0 ? void 0 : info.se4) === null || _67 === void 0 ? void 0 : _67.bootloader)) !== null && _68 !== void 0 ? _68 : (_69 = previous === null || previous === void 0 ? void 0 : previous.verify) === null || _69 === void 0 ? void 0 : _69.se04BootHash,
|
|
41586
41058
|
},
|
|
41587
|
-
sessionId: (
|
|
41059
|
+
sessionId: (_70 = previous === null || previous === void 0 ? void 0 : previous.sessionId) !== null && _70 !== void 0 ? _70 : null,
|
|
41588
41060
|
passphraseState: previous === null || previous === void 0 ? void 0 : previous.passphraseState,
|
|
41589
|
-
unlockedAttachPin
|
|
41061
|
+
unlockedAttachPin,
|
|
41590
41062
|
raw: {
|
|
41591
41063
|
protocolV2DeviceInfo: deviceInfo,
|
|
41592
41064
|
},
|
|
@@ -41637,10 +41109,11 @@ class Device extends events.exports {
|
|
|
41637
41109
|
const bleName = this.getCurrentBleName();
|
|
41638
41110
|
const label = this.getCurrentLabel();
|
|
41639
41111
|
const serialNo = this.getCurrentSerialNo();
|
|
41112
|
+
const connectId = this.getConnectId();
|
|
41640
41113
|
const deviceId = this.getCurrentDeviceId() || null;
|
|
41641
41114
|
const features = this.features;
|
|
41642
41115
|
return {
|
|
41643
|
-
connectId: DataManager.isBleConnect(env) ? this.mainId || null :
|
|
41116
|
+
connectId: DataManager.isBleConnect(env) ? this.mainId || null : connectId,
|
|
41644
41117
|
uuid: serialNo,
|
|
41645
41118
|
commType: this.originalDescriptor.commType,
|
|
41646
41119
|
sdkInstanceId: this.sdkInstanceId,
|
|
@@ -41690,7 +41163,7 @@ class Device extends events.exports {
|
|
|
41690
41163
|
resolve(false);
|
|
41691
41164
|
}));
|
|
41692
41165
|
}
|
|
41693
|
-
acquire(connectProtocol) {
|
|
41166
|
+
acquire(connectProtocol, options) {
|
|
41694
41167
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
41695
41168
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41696
41169
|
const env = DataManager.getSettings('env');
|
|
@@ -41720,6 +41193,9 @@ class Device extends events.exports {
|
|
|
41720
41193
|
this.commands = new DeviceCommands(this, (_g = this.mainId) !== null && _g !== void 0 ? _g : '');
|
|
41721
41194
|
}
|
|
41722
41195
|
catch (error) {
|
|
41196
|
+
if (options === null || options === void 0 ? void 0 : options.throwOnRunPromiseError) {
|
|
41197
|
+
throw error;
|
|
41198
|
+
}
|
|
41723
41199
|
if (this.runPromise) {
|
|
41724
41200
|
this.runPromise.reject(error);
|
|
41725
41201
|
}
|
|
@@ -41829,6 +41305,12 @@ class Device extends events.exports {
|
|
|
41829
41305
|
getCurrentSerialNo() {
|
|
41830
41306
|
return this.features ? getDeviceUUID(this.features) : '';
|
|
41831
41307
|
}
|
|
41308
|
+
getConnectId() {
|
|
41309
|
+
const serialNo = this.getCurrentSerialNo();
|
|
41310
|
+
if (serialNo)
|
|
41311
|
+
return serialNo;
|
|
41312
|
+
return this.originalDescriptor.path || this.originalDescriptor.id || '';
|
|
41313
|
+
}
|
|
41832
41314
|
getCurrentBleName() {
|
|
41833
41315
|
return getDeviceBleName(this.features);
|
|
41834
41316
|
}
|
|
@@ -41997,10 +41479,13 @@ class Device extends events.exports {
|
|
|
41997
41479
|
if (this.isProtocolV2()) {
|
|
41998
41480
|
this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
41999
41481
|
if (this.features && !this.featuresNeedsReload && !(options === null || options === void 0 ? void 0 : options.initSession)) {
|
|
42000
|
-
|
|
41482
|
+
if (this.features.bootloaderMode) {
|
|
41483
|
+
return;
|
|
41484
|
+
}
|
|
41485
|
+
yield this._refreshProtocolV2Status(options);
|
|
42001
41486
|
return;
|
|
42002
41487
|
}
|
|
42003
|
-
yield this._initializeProtocolV2();
|
|
41488
|
+
yield this._initializeProtocolV2(options);
|
|
42004
41489
|
return;
|
|
42005
41490
|
}
|
|
42006
41491
|
this.passphraseState = options === null || options === void 0 ? void 0 : options.passphraseState;
|
|
@@ -42038,12 +41523,13 @@ class Device extends events.exports {
|
|
|
42038
41523
|
}
|
|
42039
41524
|
});
|
|
42040
41525
|
}
|
|
42041
|
-
_initializeProtocolV2() {
|
|
41526
|
+
_initializeProtocolV2(options) {
|
|
42042
41527
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42043
41528
|
Log$c.debug('Initialize device via Protocol V2 features adapter');
|
|
42044
41529
|
try {
|
|
42045
41530
|
const deviceInfo = yield requestProtocolV2DeviceInfo({
|
|
42046
41531
|
commands: this.commands,
|
|
41532
|
+
timeoutMs: options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs,
|
|
42047
41533
|
});
|
|
42048
41534
|
const features = this.updateProtocolV2Features(deviceInfo);
|
|
42049
41535
|
Log$c.debug('Protocol V2 features:', features);
|
|
@@ -42055,12 +41541,13 @@ class Device extends events.exports {
|
|
|
42055
41541
|
}
|
|
42056
41542
|
});
|
|
42057
41543
|
}
|
|
42058
|
-
_refreshProtocolV2Status() {
|
|
41544
|
+
_refreshProtocolV2Status(options) {
|
|
42059
41545
|
return __awaiter(this, void 0, void 0, function* () {
|
|
42060
41546
|
try {
|
|
42061
41547
|
const deviceInfo = yield requestProtocolV2DeviceInfo({
|
|
42062
41548
|
commands: this.commands,
|
|
42063
41549
|
request: PROTOCOL_V2_STATUS_DEVICE_INFO_REQUEST,
|
|
41550
|
+
timeoutMs: options === null || options === void 0 ? void 0 : options.protocolV2DeviceInfoTimeoutMs,
|
|
42064
41551
|
});
|
|
42065
41552
|
const features = this.updateProtocolV2Features(deviceInfo);
|
|
42066
41553
|
Log$c.debug('Protocol V2 features (status refresh):', features);
|
|
@@ -42810,36 +42297,17 @@ class GetFeatures extends BaseMethod {
|
|
|
42810
42297
|
}
|
|
42811
42298
|
|
|
42812
42299
|
const ProtocolV2FirmwareTargetType = {
|
|
42813
|
-
|
|
42814
|
-
|
|
42815
|
-
|
|
42816
|
-
|
|
42817
|
-
|
|
42818
|
-
|
|
42819
|
-
|
|
42820
|
-
|
|
42300
|
+
FW_MGMT_TARGET_CRATE: 1,
|
|
42301
|
+
FW_MGMT_TARGET_ROMLOADER: 2,
|
|
42302
|
+
FW_MGMT_TARGET_BOOTLOADER: 3,
|
|
42303
|
+
FW_MGMT_TARGET_APPLICATION_P1: 4,
|
|
42304
|
+
FW_MGMT_TARGET_APPLICATION_P2: 5,
|
|
42305
|
+
FW_MGMT_TARGET_COPROCESSOR: 6,
|
|
42306
|
+
FW_MGMT_TARGET_SE01: 7,
|
|
42307
|
+
FW_MGMT_TARGET_SE02: 8,
|
|
42308
|
+
FW_MGMT_TARGET_SE03: 9,
|
|
42309
|
+
FW_MGMT_TARGET_SE04: 10,
|
|
42821
42310
|
};
|
|
42822
|
-
function protocolV2FileNameToTargetId(fileName) {
|
|
42823
|
-
const normalized = fileName.toLowerCase();
|
|
42824
|
-
if (normalized.includes('bootloader') || normalized.includes('update_rom')) {
|
|
42825
|
-
return ProtocolV2FirmwareTargetType.TARGET_MAIN_BOOT;
|
|
42826
|
-
}
|
|
42827
|
-
if (normalized.includes('coprocessor') ||
|
|
42828
|
-
normalized.includes('ble') ||
|
|
42829
|
-
normalized.includes('bluetooth') ||
|
|
42830
|
-
normalized.includes('bt')) {
|
|
42831
|
-
return ProtocolV2FirmwareTargetType.TARGET_BT;
|
|
42832
|
-
}
|
|
42833
|
-
if (normalized.includes('se4'))
|
|
42834
|
-
return ProtocolV2FirmwareTargetType.TARGET_SE4;
|
|
42835
|
-
if (normalized.includes('se3'))
|
|
42836
|
-
return ProtocolV2FirmwareTargetType.TARGET_SE3;
|
|
42837
|
-
if (normalized.includes('se2'))
|
|
42838
|
-
return ProtocolV2FirmwareTargetType.TARGET_SE2;
|
|
42839
|
-
if (normalized.includes('se'))
|
|
42840
|
-
return ProtocolV2FirmwareTargetType.TARGET_SE1;
|
|
42841
|
-
return ProtocolV2FirmwareTargetType.TARGET_MAIN_APP;
|
|
42842
|
-
}
|
|
42843
42311
|
|
|
42844
42312
|
const DEVICE_INFO_SCOPES = ['basic', 'versions', 'verify', 'full'];
|
|
42845
42313
|
function isDeviceInfoScope(scope) {
|
|
@@ -43054,16 +42522,19 @@ class GetPassphraseState extends BaseMethod {
|
|
|
43054
42522
|
expectPassphraseState: this.payload.passphraseState,
|
|
43055
42523
|
onlyMainPin: this.payload.useEmptyPassphrase,
|
|
43056
42524
|
allowCreateAttachPin: this.payload.allowCreateAttachPin,
|
|
42525
|
+
initSession: this.payload.initSession,
|
|
43057
42526
|
});
|
|
43058
42527
|
const { features } = this.device;
|
|
43059
42528
|
const passphraseProtection = (_a = this.device.getCurrentPassphraseProtection()) !== null && _a !== void 0 ? _a : null;
|
|
43060
42529
|
const deviceType = this.device.getCurrentDeviceType();
|
|
43061
42530
|
const isProSeries = deviceType === hdShared.EDeviceType.Pro || deviceType === hdShared.EDeviceType.Pro2;
|
|
43062
42531
|
return Promise.resolve({
|
|
43063
|
-
|
|
43064
|
-
|
|
43065
|
-
|
|
43066
|
-
|
|
42532
|
+
passphraseState: isProSeries || passphraseProtection === true ? passphraseState : undefined,
|
|
42533
|
+
sessionId: this.payload.initSession
|
|
42534
|
+
? newSession !== null && newSession !== void 0 ? newSession : undefined
|
|
42535
|
+
: (_b = newSession !== null && newSession !== void 0 ? newSession : features === null || features === void 0 ? void 0 : features.sessionId) !== null && _b !== void 0 ? _b : undefined,
|
|
42536
|
+
unlockedAttachPin: unlockedAttachPin !== null && unlockedAttachPin !== void 0 ? unlockedAttachPin : features === null || features === void 0 ? void 0 : features.unlockedAttachPin,
|
|
42537
|
+
passphraseProtection,
|
|
43067
42538
|
});
|
|
43068
42539
|
});
|
|
43069
42540
|
}
|
|
@@ -43393,7 +42864,7 @@ const formatAnyHex = value => {
|
|
|
43393
42864
|
return value;
|
|
43394
42865
|
};
|
|
43395
42866
|
const hexes = Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, '0'));
|
|
43396
|
-
function bytesToHex(uint8a) {
|
|
42867
|
+
function bytesToHex$1(uint8a) {
|
|
43397
42868
|
if (!(uint8a instanceof Uint8Array))
|
|
43398
42869
|
throw new Error('Uint8Array expected');
|
|
43399
42870
|
let hex = '';
|
|
@@ -43591,8 +43062,8 @@ class DeviceRebootToBootloader extends BaseMethod {
|
|
|
43591
43062
|
run() {
|
|
43592
43063
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43593
43064
|
if (this.device.isProtocolV2()) {
|
|
43594
|
-
const res = yield this.device.commands.typedCall('
|
|
43595
|
-
reboot_type: hdTransport.
|
|
43065
|
+
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
43066
|
+
reboot_type: hdTransport.DeviceRebootType.Bootloader,
|
|
43596
43067
|
});
|
|
43597
43068
|
return Promise.resolve(res.message);
|
|
43598
43069
|
}
|
|
@@ -43620,8 +43091,8 @@ class DeviceRebootToBoardloader extends BaseMethod {
|
|
|
43620
43091
|
run() {
|
|
43621
43092
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43622
43093
|
if (this.device.isProtocolV2()) {
|
|
43623
|
-
const res = yield this.device.commands.typedCall('
|
|
43624
|
-
reboot_type: hdTransport.
|
|
43094
|
+
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
43095
|
+
reboot_type: hdTransport.DeviceRebootType.Romloader,
|
|
43625
43096
|
});
|
|
43626
43097
|
return Promise.resolve(res.message);
|
|
43627
43098
|
}
|
|
@@ -44129,7 +43600,7 @@ const uploadFirmware = (updateType, typedCall, postMessage, device, { payload, r
|
|
|
44129
43600
|
const header = new Uint8Array(payload.slice(0, HEADER_SIZE));
|
|
44130
43601
|
try {
|
|
44131
43602
|
const headerRes = yield typedCall('UpgradeFileHeader', 'Success', {
|
|
44132
|
-
data: bytesToHex(header),
|
|
43603
|
+
data: bytesToHex$1(header),
|
|
44133
43604
|
});
|
|
44134
43605
|
const isUnknownMessage = (_b = (_a = headerRes.message) === null || _a === void 0 ? void 0 : _a.message) === null || _b === void 0 ? void 0 : _b.includes('Failure_UnknownMessage');
|
|
44135
43606
|
if (headerRes.type !== 'Success' && !isUnknownMessage) {
|
|
@@ -44378,8 +43849,8 @@ const processResourceRequest = (typedCall, res, data) => __awaiter(void 0, void
|
|
|
44378
43849
|
const payload = new Uint8Array(data.slice(offset, Math.min(offset + data_length, data.byteLength)));
|
|
44379
43850
|
const digest = blake2s.blake2s(payload);
|
|
44380
43851
|
const resourceAckParams = {
|
|
44381
|
-
data_chunk: bytesToHex(payload),
|
|
44382
|
-
hash: bytesToHex(digest),
|
|
43852
|
+
data_chunk: bytesToHex$1(payload),
|
|
43853
|
+
hash: bytesToHex$1(digest),
|
|
44383
43854
|
};
|
|
44384
43855
|
const response = yield typedCall('ResourceAck', ['ResourceRequest', 'Success'], Object.assign({}, resourceAckParams));
|
|
44385
43856
|
return processResourceRequest(typedCall, response, data);
|
|
@@ -44390,8 +43861,8 @@ const updateResource = (typedCall, fileName, data, onConfirmAfter) => __awaiter(
|
|
|
44390
43861
|
const res = yield typedCall('ResourceUpdate', ['ResourceRequest', 'Success'], {
|
|
44391
43862
|
file_name: fileName,
|
|
44392
43863
|
data_length: data.byteLength,
|
|
44393
|
-
initial_data_chunk: bytesToHex(chunk),
|
|
44394
|
-
hash: bytesToHex(digest),
|
|
43864
|
+
initial_data_chunk: bytesToHex$1(chunk),
|
|
43865
|
+
hash: bytesToHex$1(digest),
|
|
44395
43866
|
});
|
|
44396
43867
|
onConfirmAfter === null || onConfirmAfter === void 0 ? void 0 : onConfirmAfter();
|
|
44397
43868
|
return processResourceRequest(typedCall, res, data);
|
|
@@ -44564,6 +44035,8 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
44564
44035
|
Log$8.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] isBleReconnect: ', isBleReconnect);
|
|
44565
44036
|
let isFirstCheck = true;
|
|
44566
44037
|
let checkCount = 0;
|
|
44038
|
+
let hasPromptedWebDevice = false;
|
|
44039
|
+
let isPromptingWebDevice = false;
|
|
44567
44040
|
let timeoutTimer;
|
|
44568
44041
|
const isTouchOrProDevice = ((_a = this === null || this === void 0 ? void 0 : this.device) === null || _a === void 0 ? void 0 : _a.getCurrentDeviceType()) === hdShared.EDeviceType.Touch ||
|
|
44569
44042
|
((_b = this === null || this === void 0 ? void 0 : this.device) === null || _b === void 0 ? void 0 : _b.getCurrentDeviceType()) === hdShared.EDeviceType.Pro;
|
|
@@ -44578,20 +44051,27 @@ class FirmwareUpdateBaseMethod extends BaseMethod {
|
|
|
44578
44051
|
}
|
|
44579
44052
|
if (checkCount > 4 &&
|
|
44580
44053
|
DataManager.isBrowserWebUsb(DataManager.getSettings('env')) &&
|
|
44581
|
-
!this.payload.skipWebDevicePrompt
|
|
44582
|
-
|
|
44583
|
-
|
|
44054
|
+
!this.payload.skipWebDevicePrompt &&
|
|
44055
|
+
!hasPromptedWebDevice &&
|
|
44056
|
+
!isPromptingWebDevice) {
|
|
44057
|
+
isPromptingWebDevice = true;
|
|
44584
44058
|
try {
|
|
44585
44059
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.SelectDeviceInBootloaderForWebDevice);
|
|
44586
44060
|
const confirmed = yield this._promptDeviceInBootloaderForWebDevice();
|
|
44061
|
+
hasPromptedWebDevice = true;
|
|
44587
44062
|
if (confirmed) {
|
|
44588
44063
|
yield this._checkDeviceInBootloaderMode(connectId, intervalTimer, timeoutTimer);
|
|
44589
44064
|
}
|
|
44590
44065
|
}
|
|
44591
44066
|
catch (e) {
|
|
44067
|
+
clearInterval(intervalTimer);
|
|
44068
|
+
clearTimeout(timeoutTimer);
|
|
44592
44069
|
Log$8.log('FirmwareUpdateBaseMethod [checkDeviceToBootloader] _promptDeviceInBootloaderForWebDevice failed: ', e);
|
|
44593
44070
|
(_c = this.checkPromise) === null || _c === void 0 ? void 0 : _c.reject(e);
|
|
44594
44071
|
}
|
|
44072
|
+
finally {
|
|
44073
|
+
isPromptingWebDevice = false;
|
|
44074
|
+
}
|
|
44595
44075
|
return;
|
|
44596
44076
|
}
|
|
44597
44077
|
if (isBleReconnect) {
|
|
@@ -45854,16 +45334,6 @@ function validateRequiredData(value, name) {
|
|
|
45854
45334
|
}
|
|
45855
45335
|
}
|
|
45856
45336
|
|
|
45857
|
-
const DEV_REBOOT_TYPES = {
|
|
45858
|
-
Normal: hdTransport.DevRebootType.Normal,
|
|
45859
|
-
normal: hdTransport.DevRebootType.Normal,
|
|
45860
|
-
Romloader: hdTransport.DevRebootType.Boardloader,
|
|
45861
|
-
romloader: hdTransport.DevRebootType.Boardloader,
|
|
45862
|
-
Boardloader: hdTransport.DevRebootType.Boardloader,
|
|
45863
|
-
boardloader: hdTransport.DevRebootType.Boardloader,
|
|
45864
|
-
Bootloader: hdTransport.DevRebootType.Bootloader,
|
|
45865
|
-
bootloader: hdTransport.DevRebootType.Bootloader,
|
|
45866
|
-
};
|
|
45867
45337
|
const DEVICE_REBOOT_TYPES = {
|
|
45868
45338
|
Normal: hdTransport.DeviceRebootType.Normal,
|
|
45869
45339
|
normal: hdTransport.DeviceRebootType.Normal,
|
|
@@ -45875,9 +45345,9 @@ const DEVICE_REBOOT_TYPES = {
|
|
|
45875
45345
|
bootloader: hdTransport.DeviceRebootType.Bootloader,
|
|
45876
45346
|
};
|
|
45877
45347
|
const PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS = {
|
|
45878
|
-
intermediateTypes: ['
|
|
45348
|
+
intermediateTypes: ['DeviceFirmwareUpdateStatus'],
|
|
45879
45349
|
};
|
|
45880
|
-
const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES = ['Success', '
|
|
45350
|
+
const PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES = ['Success', 'DeviceFirmwareUpdateStatus'];
|
|
45881
45351
|
const getProtocolV2UnknownErrorText = (error) => {
|
|
45882
45352
|
if (!error) {
|
|
45883
45353
|
return '';
|
|
@@ -45928,18 +45398,6 @@ const isProtocolV2DeviceDisconnectedError = (error) => {
|
|
|
45928
45398
|
message.includes('rxerror error 6'));
|
|
45929
45399
|
};
|
|
45930
45400
|
function normalizeRebootType(value) {
|
|
45931
|
-
if (typeof value === 'number')
|
|
45932
|
-
return value;
|
|
45933
|
-
if (typeof value === 'string') {
|
|
45934
|
-
const numeric = Number(value);
|
|
45935
|
-
if (Number.isFinite(numeric))
|
|
45936
|
-
return numeric;
|
|
45937
|
-
if (value in DEV_REBOOT_TYPES)
|
|
45938
|
-
return DEV_REBOOT_TYPES[value];
|
|
45939
|
-
}
|
|
45940
|
-
return hdTransport.DevRebootType.Normal;
|
|
45941
|
-
}
|
|
45942
|
-
function normalizeDeviceRebootType(value) {
|
|
45943
45401
|
if (typeof value === 'number')
|
|
45944
45402
|
return value;
|
|
45945
45403
|
if (typeof value === 'string') {
|
|
@@ -45951,12 +45409,16 @@ function normalizeDeviceRebootType(value) {
|
|
|
45951
45409
|
}
|
|
45952
45410
|
return hdTransport.DeviceRebootType.Normal;
|
|
45953
45411
|
}
|
|
45954
|
-
const VALID_FIRMWARE_TARGET_IDS = new Set(
|
|
45412
|
+
const VALID_FIRMWARE_TARGET_IDS = new Set(Object.values(ProtocolV2FirmwareTargetType).filter(value => typeof value === 'number'));
|
|
45413
|
+
const FIRMWARE_TARGET_ID_BY_NAME = new Map(Object.entries(ProtocolV2FirmwareTargetType).flatMap(([key, value]) => VALID_FIRMWARE_TARGET_IDS.has(value)
|
|
45414
|
+
? [[key, value]]
|
|
45415
|
+
: []));
|
|
45955
45416
|
function normalizeTargetId(value, name) {
|
|
45956
45417
|
if (value === undefined || value === null) {
|
|
45957
45418
|
throw invalidParameter(`Missing required parameter: ${name}`);
|
|
45958
45419
|
}
|
|
45959
|
-
const
|
|
45420
|
+
const named = typeof value === 'string' ? FIRMWARE_TARGET_ID_BY_NAME.get(value) : undefined;
|
|
45421
|
+
const numeric = named !== null && named !== void 0 ? named : (typeof value === 'number' ? value : Number(value));
|
|
45960
45422
|
if (Number.isSafeInteger(numeric) && VALID_FIRMWARE_TARGET_IDS.has(numeric)) {
|
|
45961
45423
|
return numeric;
|
|
45962
45424
|
}
|
|
@@ -45994,13 +45456,101 @@ const Log$4 = getLogger(exports.LoggerNames.Method);
|
|
|
45994
45456
|
const SESSION_ERROR = 'session not found';
|
|
45995
45457
|
const PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT = 60 * 1000;
|
|
45996
45458
|
const PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT = 5 * 1000;
|
|
45459
|
+
const PROTOCOL_V2_START_UPDATE_TIMEOUT = 60 * 1000;
|
|
45997
45460
|
const PROTOCOL_V2_INSTALL_TIMEOUT = 5 * 60 * 1000;
|
|
45998
|
-
const
|
|
45461
|
+
const PROTOCOL_V2_TARGET_STATUS_PENDING = 0;
|
|
45999
45462
|
const PROTOCOL_V2_TARGET_STATUS_IN_PROGRESS = 1;
|
|
46000
|
-
const
|
|
45463
|
+
const PROTOCOL_V2_TARGET_STATUS_FINISHED = 2;
|
|
45464
|
+
const PROTOCOL_V2_TARGET_STATUS_FAILED_MIN = 3;
|
|
46001
45465
|
const PROTOCOL_V2_CONNECT_PROTOCOL = 'V2';
|
|
46002
45466
|
const PROTOCOL_V2_FIRMWARE_STAGING_VOLUME = 'vol1:';
|
|
46003
45467
|
const PROTOCOL_V2_MIN_FILE_CHUNK_SIZE = 64;
|
|
45468
|
+
const PROTOCOL_V2_CONNECT_RETRY_COUNT = 10;
|
|
45469
|
+
const PROTOCOL_V2_CONNECT_POLL_INTERVAL = 500;
|
|
45470
|
+
const PROTOCOL_V2_CONNECT_SINGLE_TIMEOUT = 75 * 1000;
|
|
45471
|
+
const PROTOCOL_V2_DEVICE_INFO_READY_TIMEOUT = 60 * 1000;
|
|
45472
|
+
const PROTOCOL_V2_OKPP_HEADER_SIZE = 0x52a0;
|
|
45473
|
+
const PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET = 0x200;
|
|
45474
|
+
const PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET = 0x240;
|
|
45475
|
+
const PROTOCOL_V2_OKPP_HASH_SIZE = 64;
|
|
45476
|
+
const getProtocolV2DeviceTransferProgress = (bytesBeforeChunk, bytesAfterChunk, totalBytes) => {
|
|
45477
|
+
if (!Number.isFinite(totalBytes) || totalBytes <= 0) {
|
|
45478
|
+
return 100;
|
|
45479
|
+
}
|
|
45480
|
+
if (bytesBeforeChunk <= 0 && bytesAfterChunk < totalBytes) {
|
|
45481
|
+
return 0;
|
|
45482
|
+
}
|
|
45483
|
+
if (bytesAfterChunk >= totalBytes) {
|
|
45484
|
+
return 100;
|
|
45485
|
+
}
|
|
45486
|
+
return Math.min(Math.max(Math.ceil((bytesAfterChunk / totalBytes) * 100), 1), 99);
|
|
45487
|
+
};
|
|
45488
|
+
const formatProtocolV2TransferSpeed = (bytes, elapsedMs) => {
|
|
45489
|
+
const safeElapsedMs = Math.max(elapsedMs, 1);
|
|
45490
|
+
return (bytes / 1024 / (safeElapsedMs / 1000)).toFixed(2);
|
|
45491
|
+
};
|
|
45492
|
+
const PROTOCOL_V2_REMOTE_COMPONENT_TARGETS = {
|
|
45493
|
+
BOOTLOADER: {
|
|
45494
|
+
fileName: 'bootloader.bin',
|
|
45495
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER,
|
|
45496
|
+
kind: 'bootloader',
|
|
45497
|
+
},
|
|
45498
|
+
APPLICATION_P1: {
|
|
45499
|
+
fileName: 'application_p1.bin',
|
|
45500
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1,
|
|
45501
|
+
kind: 'firmware',
|
|
45502
|
+
},
|
|
45503
|
+
APPLICATION_P2: {
|
|
45504
|
+
fileName: 'application_p2.bin',
|
|
45505
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P2,
|
|
45506
|
+
kind: 'firmware',
|
|
45507
|
+
},
|
|
45508
|
+
COPROCESSOR: {
|
|
45509
|
+
fileName: 'coprocessor.bin',
|
|
45510
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_COPROCESSOR,
|
|
45511
|
+
kind: 'firmware',
|
|
45512
|
+
},
|
|
45513
|
+
SE01: {
|
|
45514
|
+
fileName: 'se01.bin',
|
|
45515
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE01,
|
|
45516
|
+
kind: 'firmware',
|
|
45517
|
+
},
|
|
45518
|
+
SE02: {
|
|
45519
|
+
fileName: 'se02.bin',
|
|
45520
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE02,
|
|
45521
|
+
kind: 'firmware',
|
|
45522
|
+
},
|
|
45523
|
+
SE03: {
|
|
45524
|
+
fileName: 'se03.bin',
|
|
45525
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE03,
|
|
45526
|
+
kind: 'firmware',
|
|
45527
|
+
},
|
|
45528
|
+
SE04: {
|
|
45529
|
+
fileName: 'se04.bin',
|
|
45530
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE04,
|
|
45531
|
+
kind: 'firmware',
|
|
45532
|
+
},
|
|
45533
|
+
CRATE: {
|
|
45534
|
+
fileName: 'resource.bin',
|
|
45535
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
45536
|
+
kind: 'resource',
|
|
45537
|
+
},
|
|
45538
|
+
};
|
|
45539
|
+
const PROTOCOL_V2_ROMLOADER_UNSUPPORTED_MESSAGE = 'FW_MGMT_TARGET_ROMLOADER is not accepted by the current Pro2 bootloader update request. Flash romloader with the loader-specific flow instead of firmwareUpdateV4.';
|
|
45540
|
+
const PROTOCOL_V2_TARGET_ID_BY_DECODED_NAME = new Map(Object.entries(ProtocolV2FirmwareTargetType).map(([key, value]) => [key, value]));
|
|
45541
|
+
const PROTOCOL_V2_TARGET_STATUS_BY_DECODED_NAME = new Map([
|
|
45542
|
+
['FW_MGMT_UPDATER_TASK_STATUS_PENDING', PROTOCOL_V2_TARGET_STATUS_PENDING],
|
|
45543
|
+
['FW_MGMT_UPDATER_TASK_STATUS_IN_PROGRESS', PROTOCOL_V2_TARGET_STATUS_IN_PROGRESS],
|
|
45544
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FINISHED', PROTOCOL_V2_TARGET_STATUS_FINISHED],
|
|
45545
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_NOT_FOUND', 3],
|
|
45546
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_READ', 4],
|
|
45547
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_FILE_WRITE', 5],
|
|
45548
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_VERIFY', 6],
|
|
45549
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_INSTALL', 7],
|
|
45550
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_ABORT', 8],
|
|
45551
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_BUSY', 9],
|
|
45552
|
+
['FW_MGMT_UPDATER_TASK_STATUS_FAILED_ENTRY_OUT_OF_BOUNDS', 10],
|
|
45553
|
+
]);
|
|
46004
45554
|
const isProtocolV2ReconnectProbeError = (error) => {
|
|
46005
45555
|
const message = getProtocolV2UnknownErrorText(error).toLowerCase();
|
|
46006
45556
|
return ((message.includes('device protocol mismatch') && message.includes('expected v2')) ||
|
|
@@ -46010,10 +45560,127 @@ const isProtocolV2PollingTransientError = (error) => {
|
|
|
46010
45560
|
const message = getProtocolV2UnknownErrorText(error).toLowerCase();
|
|
46011
45561
|
return (isProtocolV2DeviceDisconnectedError(error) ||
|
|
46012
45562
|
isProtocolV2ReconnectProbeError(error) ||
|
|
46013
|
-
|
|
45563
|
+
message.includes('libusb_transfer_timed_out') ||
|
|
45564
|
+
(message.includes('response timeout') && message.includes('devicefirmwareupdatestatusget')) ||
|
|
46014
45565
|
message.includes('device not found') ||
|
|
46015
45566
|
message.includes('transportnotfound'));
|
|
46016
45567
|
};
|
|
45568
|
+
const isProtocolV2StartUpdateTransientError = (error) => {
|
|
45569
|
+
const message = getProtocolV2UnknownErrorText(error).toLowerCase();
|
|
45570
|
+
return (isProtocolV2DeviceDisconnectedError(error) ||
|
|
45571
|
+
isProtocolV2ReconnectProbeError(error) ||
|
|
45572
|
+
message.includes('libusb_transfer_timed_out') ||
|
|
45573
|
+
(message.includes('response timeout') && message.includes('devicefirmwareupdaterequest')));
|
|
45574
|
+
};
|
|
45575
|
+
const isProtocolV2TargetStatusFinished = (status) => normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_FINISHED;
|
|
45576
|
+
const isProtocolV2TargetStatusInProgress = (status) => normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_PENDING ||
|
|
45577
|
+
normalizeProtocolV2TargetStatus(status) === PROTOCOL_V2_TARGET_STATUS_IN_PROGRESS;
|
|
45578
|
+
const isProtocolV2TargetStatusFailed = (status) => {
|
|
45579
|
+
const normalizedStatus = normalizeProtocolV2TargetStatus(status);
|
|
45580
|
+
return (typeof normalizedStatus === 'number' && normalizedStatus >= PROTOCOL_V2_TARGET_STATUS_FAILED_MIN);
|
|
45581
|
+
};
|
|
45582
|
+
const normalizeProtocolV2TargetId = (targetId) => {
|
|
45583
|
+
if (typeof targetId === 'number') {
|
|
45584
|
+
return targetId;
|
|
45585
|
+
}
|
|
45586
|
+
return PROTOCOL_V2_TARGET_ID_BY_DECODED_NAME.get(targetId);
|
|
45587
|
+
};
|
|
45588
|
+
const normalizeProtocolV2TargetStatus = (status) => {
|
|
45589
|
+
if (typeof status === 'number') {
|
|
45590
|
+
return status;
|
|
45591
|
+
}
|
|
45592
|
+
if (typeof status === 'string') {
|
|
45593
|
+
return PROTOCOL_V2_TARGET_STATUS_BY_DECODED_NAME.get(status);
|
|
45594
|
+
}
|
|
45595
|
+
return undefined;
|
|
45596
|
+
};
|
|
45597
|
+
const normalizeProtocolV2Hex = (value) => value === null || value === void 0 ? void 0 : value.replace(/^0x/i, '').toLowerCase();
|
|
45598
|
+
const versionArrayToNumber = (version) => {
|
|
45599
|
+
if (!version)
|
|
45600
|
+
return undefined;
|
|
45601
|
+
return version[0] * 0x10000 + version[1] * 0x100 + version[2];
|
|
45602
|
+
};
|
|
45603
|
+
const versionStringToArray = (version) => {
|
|
45604
|
+
if (!version)
|
|
45605
|
+
return undefined;
|
|
45606
|
+
const parts = version.split('.').map(part => Number(part));
|
|
45607
|
+
if (parts.length !== 3 || parts.some(part => !Number.isFinite(part)))
|
|
45608
|
+
return undefined;
|
|
45609
|
+
return parts;
|
|
45610
|
+
};
|
|
45611
|
+
const compareProtocolV2Versions = (current, target) => {
|
|
45612
|
+
const currentNumber = versionArrayToNumber(current);
|
|
45613
|
+
const targetNumber = versionArrayToNumber(target);
|
|
45614
|
+
if (currentNumber === undefined || targetNumber === undefined)
|
|
45615
|
+
return undefined;
|
|
45616
|
+
return currentNumber - targetNumber;
|
|
45617
|
+
};
|
|
45618
|
+
const bytesToHex = (bytes) => Array.from(bytes)
|
|
45619
|
+
.map(byte => byte.toString(16).padStart(2, '0'))
|
|
45620
|
+
.join('');
|
|
45621
|
+
const hexToProtocolV2Bytes = (hex) => {
|
|
45622
|
+
const normalized = hex.replace(/^0x/i, '');
|
|
45623
|
+
if (!normalized || normalized.length % 2 !== 0 || /[^0-9a-f]/i.test(normalized)) {
|
|
45624
|
+
return new Uint8Array(0);
|
|
45625
|
+
}
|
|
45626
|
+
const bytes = new Uint8Array(normalized.length / 2);
|
|
45627
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
45628
|
+
bytes[i] = Number.parseInt(normalized.slice(i * 2, i * 2 + 2), 16);
|
|
45629
|
+
}
|
|
45630
|
+
return bytes;
|
|
45631
|
+
};
|
|
45632
|
+
const toProtocolV2Bytes = (value) => {
|
|
45633
|
+
if (value instanceof Uint8Array)
|
|
45634
|
+
return value;
|
|
45635
|
+
if (value instanceof ArrayBuffer)
|
|
45636
|
+
return new Uint8Array(value);
|
|
45637
|
+
if (ArrayBuffer.isView(value)) {
|
|
45638
|
+
return new Uint8Array(value.buffer, value.byteOffset, value.byteLength);
|
|
45639
|
+
}
|
|
45640
|
+
if (typeof value === 'string')
|
|
45641
|
+
return hexToProtocolV2Bytes(value);
|
|
45642
|
+
return new Uint8Array(0);
|
|
45643
|
+
};
|
|
45644
|
+
const toProtocolV2FiniteNumber = (value) => {
|
|
45645
|
+
if (typeof value === 'number' && Number.isFinite(value))
|
|
45646
|
+
return value;
|
|
45647
|
+
if (typeof value === 'string') {
|
|
45648
|
+
const numeric = Number(value);
|
|
45649
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
45650
|
+
}
|
|
45651
|
+
if (value && typeof value === 'object') {
|
|
45652
|
+
const longLike = value;
|
|
45653
|
+
if (typeof longLike.toNumber === 'function') {
|
|
45654
|
+
const numeric = longLike.toNumber();
|
|
45655
|
+
return Number.isFinite(numeric) ? numeric : undefined;
|
|
45656
|
+
}
|
|
45657
|
+
}
|
|
45658
|
+
return undefined;
|
|
45659
|
+
};
|
|
45660
|
+
const readProtocolV2Ascii = (bytes, offset, length) => Array.from(bytes.slice(offset, offset + length))
|
|
45661
|
+
.map(byte => String.fromCharCode(byte))
|
|
45662
|
+
.join('');
|
|
45663
|
+
const parseProtocolV2OkppHeader = (bytes) => {
|
|
45664
|
+
if (bytes.byteLength < PROTOCOL_V2_OKPP_HEADER_SIZE)
|
|
45665
|
+
return null;
|
|
45666
|
+
if (readProtocolV2Ascii(bytes, 0, 4) !== 'OKPP')
|
|
45667
|
+
return null;
|
|
45668
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
45669
|
+
const headerLen = view.getUint32(0x0c, true);
|
|
45670
|
+
if (headerLen !== PROTOCOL_V2_OKPP_HEADER_SIZE)
|
|
45671
|
+
return null;
|
|
45672
|
+
const packedVersion = view.getUint32(0x10, true);
|
|
45673
|
+
return {
|
|
45674
|
+
type: readProtocolV2Ascii(bytes, 0x08, 4),
|
|
45675
|
+
version: [
|
|
45676
|
+
Math.floor(packedVersion / 0x10000) % 0x100,
|
|
45677
|
+
Math.floor(packedVersion / 0x100) % 0x100,
|
|
45678
|
+
packedVersion % 0x100,
|
|
45679
|
+
],
|
|
45680
|
+
payloadHash: bytesToHex(bytes.slice(PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET, PROTOCOL_V2_OKPP_PAYLOAD_HASH_OFFSET + PROTOCOL_V2_OKPP_HASH_SIZE)),
|
|
45681
|
+
headerHash: bytesToHex(bytes.slice(PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET, PROTOCOL_V2_OKPP_HEADER_HASH_OFFSET + PROTOCOL_V2_OKPP_HASH_SIZE)),
|
|
45682
|
+
};
|
|
45683
|
+
};
|
|
46017
45684
|
class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
46018
45685
|
init() {
|
|
46019
45686
|
this.allowDeviceMode = [UI_REQUEST.BOOTLOADER, UI_REQUEST.NOT_INITIALIZE];
|
|
@@ -46021,15 +45688,22 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46021
45688
|
this.useDevicePassphraseState = false;
|
|
46022
45689
|
this.skipForceUpdateCheck = true;
|
|
46023
45690
|
const { payload } = this;
|
|
45691
|
+
if (typeof payload.retryCount !== 'number') {
|
|
45692
|
+
payload.retryCount = PROTOCOL_V2_CONNECT_RETRY_COUNT;
|
|
45693
|
+
}
|
|
45694
|
+
if (typeof payload.pollIntervalTime !== 'number') {
|
|
45695
|
+
payload.pollIntervalTime = PROTOCOL_V2_CONNECT_POLL_INTERVAL;
|
|
45696
|
+
}
|
|
45697
|
+
if (typeof payload.timeout !== 'number') {
|
|
45698
|
+
payload.timeout = PROTOCOL_V2_CONNECT_SINGLE_TIMEOUT;
|
|
45699
|
+
}
|
|
45700
|
+
if (typeof payload.protocolV2DeviceInfoTimeoutMs !== 'number') {
|
|
45701
|
+
payload.protocolV2DeviceInfoTimeoutMs = PROTOCOL_V2_DEVICE_INFO_READY_TIMEOUT;
|
|
45702
|
+
}
|
|
46024
45703
|
validateParams(payload, [
|
|
46025
|
-
{ name: 'bleVersion', type: 'array' },
|
|
46026
|
-
{ name: 'bleBinary', type: 'buffer' },
|
|
46027
45704
|
{ name: 'chunkSize', type: 'number' },
|
|
46028
|
-
{ name: '
|
|
46029
|
-
{ name: 'firmwareBinary', type: 'buffer' },
|
|
46030
|
-
{ name: 'resourceBinary', type: 'buffer' },
|
|
45705
|
+
{ name: 'resourceBinaries', type: 'array', allowEmpty: true },
|
|
46031
45706
|
{ name: 'forcedUpdateRes', type: 'boolean' },
|
|
46032
|
-
{ name: 'bootloaderVersion', type: 'array' },
|
|
46033
45707
|
{ name: 'bootloaderBinary', type: 'buffer' },
|
|
46034
45708
|
{ name: 'romloaderBinary', type: 'buffer' },
|
|
46035
45709
|
{ name: 'applicationP1Binary', type: 'buffer' },
|
|
@@ -46043,12 +45717,8 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46043
45717
|
{ name: 'platform', type: 'string' },
|
|
46044
45718
|
]);
|
|
46045
45719
|
this.params = {
|
|
46046
|
-
bleBinary: payload.bleBinary,
|
|
46047
45720
|
chunkSize: payload.chunkSize,
|
|
46048
|
-
firmwareBinary: payload.firmwareBinary,
|
|
46049
45721
|
forcedUpdateRes: payload.forcedUpdateRes,
|
|
46050
|
-
bleVersion: payload.bleVersion,
|
|
46051
|
-
bootloaderVersion: payload.bootloaderVersion,
|
|
46052
45722
|
bootloaderBinary: payload.bootloaderBinary,
|
|
46053
45723
|
romloaderBinary: payload.romloaderBinary,
|
|
46054
45724
|
applicationP1Binary: payload.applicationP1Binary,
|
|
@@ -46058,8 +45728,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46058
45728
|
se02Binary: payload.se02Binary,
|
|
46059
45729
|
se03Binary: payload.se03Binary,
|
|
46060
45730
|
se04Binary: payload.se04Binary,
|
|
46061
|
-
|
|
46062
|
-
resourceBinary: payload.resourceBinary,
|
|
45731
|
+
resourceBinaries: payload.resourceBinaries,
|
|
46063
45732
|
firmwareType: payload.firmwareType,
|
|
46064
45733
|
platform: payload.platform,
|
|
46065
45734
|
};
|
|
@@ -46091,25 +45760,31 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46091
45760
|
const deviceFeatures = yield this.getProtocolV2DeviceFeatures();
|
|
46092
45761
|
const deviceFirmwareType = getFirmwareType(deviceFeatures);
|
|
46093
45762
|
const firmwareType = (_a = this.params.firmwareType) !== null && _a !== void 0 ? _a : deviceFirmwareType;
|
|
46094
|
-
let
|
|
45763
|
+
let resourceBinaryMap = [];
|
|
46095
45764
|
let fwBinaryMap = [];
|
|
46096
45765
|
let bootloaderBinary = null;
|
|
46097
45766
|
try {
|
|
46098
45767
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.StartDownloadFirmware);
|
|
46099
|
-
|
|
46100
|
-
fwBinaryMap =
|
|
46101
|
-
bootloaderBinary =
|
|
46102
|
-
|
|
45768
|
+
resourceBinaryMap = yield this.prepareResourceBinaries(firmwareType, deviceFeatures);
|
|
45769
|
+
fwBinaryMap = this.collectExplicitTargetBinaries();
|
|
45770
|
+
bootloaderBinary = this.prepareBootloaderBinary();
|
|
45771
|
+
if (!this.hasExplicitProtocolV2Payload(fwBinaryMap)) {
|
|
45772
|
+
const remoteBinaries = yield this.prepareRemoteProtocolV2Binaries(firmwareType, deviceFeatures);
|
|
45773
|
+
resourceBinaryMap = remoteBinaries.resourceBinaryMap;
|
|
45774
|
+
bootloaderBinary = remoteBinaries.bootloaderBinary;
|
|
45775
|
+
fwBinaryMap = remoteBinaries.fwBinaryMap;
|
|
45776
|
+
}
|
|
46103
45777
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.FinishDownloadFirmware);
|
|
46104
45778
|
}
|
|
46105
45779
|
catch (err) {
|
|
46106
45780
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, (_b = err.message) !== null && _b !== void 0 ? _b : err);
|
|
46107
45781
|
}
|
|
46108
|
-
if (
|
|
45782
|
+
if (resourceBinaryMap.length === 0 && !bootloaderBinary && fwBinaryMap.length === 0) {
|
|
46109
45783
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateDownloadFailed, 'No firmware to update');
|
|
46110
45784
|
}
|
|
45785
|
+
yield this.enterProtocolV2BootloaderMode();
|
|
46111
45786
|
yield this.executeProtocolV2Update({
|
|
46112
|
-
|
|
45787
|
+
resourceBinaryMap,
|
|
46113
45788
|
fwBinaryMap,
|
|
46114
45789
|
bootloaderBinary,
|
|
46115
45790
|
});
|
|
@@ -46122,21 +45797,31 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46122
45797
|
}
|
|
46123
45798
|
getProtocolV2DeviceFeatures() {
|
|
46124
45799
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45800
|
+
if (this.device.features) {
|
|
45801
|
+
return this.device.features;
|
|
45802
|
+
}
|
|
46125
45803
|
if (typeof this.device.getFeatures === 'function') {
|
|
46126
45804
|
const features = yield this.device.getFeatures();
|
|
46127
45805
|
if (features)
|
|
46128
45806
|
return features;
|
|
46129
45807
|
}
|
|
46130
|
-
if (this.device.features) {
|
|
46131
|
-
return this.device.features;
|
|
46132
|
-
}
|
|
46133
45808
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'Device features not available');
|
|
46134
45809
|
});
|
|
46135
45810
|
}
|
|
46136
|
-
|
|
45811
|
+
prepareResourceBinaries(firmwareType, features) {
|
|
45812
|
+
var _a;
|
|
46137
45813
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46138
|
-
if (this.params.
|
|
46139
|
-
|
|
45814
|
+
if ((_a = this.params.resourceBinaries) === null || _a === void 0 ? void 0 : _a.length) {
|
|
45815
|
+
this.params.resourceBinaries.forEach((binary, index) => {
|
|
45816
|
+
if (!(binary instanceof ArrayBuffer)) {
|
|
45817
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.CallMethodInvalidParameter, `Parameter [resourceBinaries.${index}] is of type invalid and should be [buffer].`);
|
|
45818
|
+
}
|
|
45819
|
+
});
|
|
45820
|
+
return this.params.resourceBinaries.map((binary, index) => ({
|
|
45821
|
+
fileName: `resource-${index + 1}.bin`,
|
|
45822
|
+
binary,
|
|
45823
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
45824
|
+
}));
|
|
46140
45825
|
}
|
|
46141
45826
|
const resourceUrl = DataManager.getSysResourcesLatestRelease({
|
|
46142
45827
|
features,
|
|
@@ -46145,25 +45830,271 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46145
45830
|
});
|
|
46146
45831
|
if (resourceUrl) {
|
|
46147
45832
|
const resource = (yield getSysResourceBinary(resourceUrl)).binary;
|
|
46148
|
-
return
|
|
45833
|
+
return [
|
|
45834
|
+
{
|
|
45835
|
+
fileName: 'resource.bin',
|
|
45836
|
+
binary: resource,
|
|
45837
|
+
targetId: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_CRATE,
|
|
45838
|
+
},
|
|
45839
|
+
];
|
|
46149
45840
|
}
|
|
46150
45841
|
Log$4.warn('No resource url found');
|
|
46151
|
-
return
|
|
45842
|
+
return [];
|
|
46152
45843
|
});
|
|
46153
45844
|
}
|
|
46154
|
-
prepareBootloaderBinary(
|
|
45845
|
+
prepareBootloaderBinary() {
|
|
45846
|
+
var _a;
|
|
45847
|
+
return (_a = this.params.bootloaderBinary) !== null && _a !== void 0 ? _a : null;
|
|
45848
|
+
}
|
|
45849
|
+
hasExplicitProtocolV2Payload(fwBinaryMap) {
|
|
45850
|
+
var _a;
|
|
45851
|
+
return (!!((_a = this.params.resourceBinaries) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
45852
|
+
!!this.params.bootloaderBinary ||
|
|
45853
|
+
fwBinaryMap.length > 0);
|
|
45854
|
+
}
|
|
45855
|
+
getRemoteComponentEntries(release) {
|
|
45856
|
+
var _a;
|
|
45857
|
+
const { components } = release;
|
|
45858
|
+
if (!components)
|
|
45859
|
+
return [];
|
|
45860
|
+
const orderedKeys = [
|
|
45861
|
+
...((_a = release.installOrder) !== null && _a !== void 0 ? _a : []),
|
|
45862
|
+
...Object.keys(components).filter(key => { var _a; return !((_a = release.installOrder) === null || _a === void 0 ? void 0 : _a.includes(key)); }),
|
|
45863
|
+
];
|
|
45864
|
+
return orderedKeys
|
|
45865
|
+
.map(key => {
|
|
45866
|
+
const component = components[key];
|
|
45867
|
+
return component ? [key, component] : undefined;
|
|
45868
|
+
})
|
|
45869
|
+
.filter((entry) => !!entry);
|
|
45870
|
+
}
|
|
45871
|
+
getRemoteComponentTarget(key, component) {
|
|
45872
|
+
var _a;
|
|
45873
|
+
const targetName = (_a = component.target) === null || _a === void 0 ? void 0 : _a.toUpperCase();
|
|
45874
|
+
if (targetName === 'ROMLOADER') {
|
|
45875
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, PROTOCOL_V2_ROMLOADER_UNSUPPORTED_MESSAGE);
|
|
45876
|
+
}
|
|
45877
|
+
const target = PROTOCOL_V2_REMOTE_COMPONENT_TARGETS[targetName];
|
|
45878
|
+
if (!target) {
|
|
45879
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Unsupported Protocol V2 firmware component target: ${key}/${component.target}`);
|
|
45880
|
+
}
|
|
45881
|
+
return target;
|
|
45882
|
+
}
|
|
45883
|
+
getProtocolV2ComponentTargetVersion(release, component, target) {
|
|
45884
|
+
if (component.version)
|
|
45885
|
+
return component.version;
|
|
45886
|
+
if (target.targetId === ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER) {
|
|
45887
|
+
return release.bootloaderVersion;
|
|
45888
|
+
}
|
|
45889
|
+
if (target.targetId === ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1 ||
|
|
45890
|
+
target.targetId === ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P2) {
|
|
45891
|
+
return release.version;
|
|
45892
|
+
}
|
|
45893
|
+
return undefined;
|
|
45894
|
+
}
|
|
45895
|
+
getProtocolV2ComponentCurrentVersion(features, target) {
|
|
45896
|
+
switch (target.targetId) {
|
|
45897
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER:
|
|
45898
|
+
return getDeviceBootloaderVersion(features);
|
|
45899
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1:
|
|
45900
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P2:
|
|
45901
|
+
return getDeviceFirmwareVersion(features);
|
|
45902
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_COPROCESSOR:
|
|
45903
|
+
return getDeviceBLEFirmwareVersion(features);
|
|
45904
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE01:
|
|
45905
|
+
return versionStringToArray(features.se01Version);
|
|
45906
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE02:
|
|
45907
|
+
return versionStringToArray(features.se02Version);
|
|
45908
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE03:
|
|
45909
|
+
return versionStringToArray(features.se03Version);
|
|
45910
|
+
case ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE04:
|
|
45911
|
+
return versionStringToArray(features.se04Version);
|
|
45912
|
+
default:
|
|
45913
|
+
return undefined;
|
|
45914
|
+
}
|
|
45915
|
+
}
|
|
45916
|
+
isProtocolV2ComponentVersionSatisfied(release, component, target, features) {
|
|
45917
|
+
const targetVersion = this.getProtocolV2ComponentTargetVersion(release, component, target);
|
|
45918
|
+
if (!targetVersion)
|
|
45919
|
+
return false;
|
|
45920
|
+
const currentVersion = this.getProtocolV2ComponentCurrentVersion(features, target);
|
|
45921
|
+
const compareResult = compareProtocolV2Versions(currentVersion, targetVersion);
|
|
45922
|
+
return compareResult !== undefined && compareResult >= 0;
|
|
45923
|
+
}
|
|
45924
|
+
getProtocolV2ResourceFilePath(path) {
|
|
45925
|
+
if (path.startsWith('vol'))
|
|
45926
|
+
return path;
|
|
45927
|
+
if (path.startsWith('/'))
|
|
45928
|
+
return `vol0:${path}`;
|
|
45929
|
+
return `vol0:/${path}`;
|
|
45930
|
+
}
|
|
45931
|
+
readProtocolV2DeviceFileHeader(path) {
|
|
45932
|
+
var _a, _b, _c, _d;
|
|
46155
45933
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46156
|
-
|
|
46157
|
-
|
|
45934
|
+
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
45935
|
+
const filePath = this.getProtocolV2ResourceFilePath(path);
|
|
45936
|
+
const pathInfoRes = yield typedCall('FilesystemPathInfoQuery', 'FilesystemPathInfo', {
|
|
45937
|
+
path: filePath,
|
|
45938
|
+
});
|
|
45939
|
+
const fileSize = toProtocolV2FiniteNumber((_a = pathInfoRes.message) === null || _a === void 0 ? void 0 : _a.size);
|
|
45940
|
+
if (!((_b = pathInfoRes.message) === null || _b === void 0 ? void 0 : _b.exist) ||
|
|
45941
|
+
((_c = pathInfoRes.message) === null || _c === void 0 ? void 0 : _c.directory) ||
|
|
45942
|
+
fileSize === undefined ||
|
|
45943
|
+
fileSize < PROTOCOL_V2_OKPP_HEADER_SIZE) {
|
|
45944
|
+
return null;
|
|
46158
45945
|
}
|
|
46159
|
-
|
|
46160
|
-
|
|
46161
|
-
|
|
46162
|
-
|
|
46163
|
-
|
|
45946
|
+
const chunkSize = this.getProtocolV2FirmwareChunkSize();
|
|
45947
|
+
const chunks = [];
|
|
45948
|
+
let offset = 0;
|
|
45949
|
+
while (offset < PROTOCOL_V2_OKPP_HEADER_SIZE) {
|
|
45950
|
+
const readLen = Math.min(chunkSize, PROTOCOL_V2_OKPP_HEADER_SIZE - offset);
|
|
45951
|
+
const res = yield typedCall('FilesystemFileRead', 'FilesystemFile', {
|
|
45952
|
+
file: {
|
|
45953
|
+
path: filePath,
|
|
45954
|
+
offset,
|
|
45955
|
+
total_size: 0,
|
|
45956
|
+
},
|
|
45957
|
+
chunk_len: readLen,
|
|
45958
|
+
ui_percentage: undefined,
|
|
45959
|
+
});
|
|
45960
|
+
const data = toProtocolV2Bytes((_d = res.message) === null || _d === void 0 ? void 0 : _d.data);
|
|
45961
|
+
if (data.byteLength === 0)
|
|
45962
|
+
return null;
|
|
45963
|
+
chunks.push(data);
|
|
45964
|
+
offset += data.byteLength;
|
|
45965
|
+
}
|
|
45966
|
+
const headerBytes = new Uint8Array(offset);
|
|
45967
|
+
let cursor = 0;
|
|
45968
|
+
chunks.forEach(chunk => {
|
|
45969
|
+
headerBytes.set(chunk, cursor);
|
|
45970
|
+
cursor += chunk.byteLength;
|
|
45971
|
+
});
|
|
45972
|
+
return parseProtocolV2OkppHeader(headerBytes);
|
|
45973
|
+
});
|
|
45974
|
+
}
|
|
45975
|
+
isProtocolV2ResourcePackageMatched(pkg, manifestVersion) {
|
|
45976
|
+
var _a, _b;
|
|
45977
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
45978
|
+
try {
|
|
45979
|
+
const header = yield this.readProtocolV2DeviceFileHeader(pkg.path);
|
|
45980
|
+
if (!header)
|
|
45981
|
+
return false;
|
|
45982
|
+
const expectedType = (_a = pkg.type) !== null && _a !== void 0 ? _a : 'RESC';
|
|
45983
|
+
const expectedVersion = (_b = pkg.version) !== null && _b !== void 0 ? _b : manifestVersion;
|
|
45984
|
+
if (header.type !== expectedType)
|
|
45985
|
+
return false;
|
|
45986
|
+
if (expectedVersion && compareProtocolV2Versions(header.version, expectedVersion) !== 0) {
|
|
45987
|
+
return false;
|
|
46164
45988
|
}
|
|
45989
|
+
const expectedPayloadHash = normalizeProtocolV2Hex(pkg.payloadHash);
|
|
45990
|
+
if (expectedPayloadHash && header.payloadHash !== expectedPayloadHash)
|
|
45991
|
+
return false;
|
|
45992
|
+
const expectedHeaderHash = normalizeProtocolV2Hex(pkg.headerHash);
|
|
45993
|
+
if (expectedHeaderHash && header.headerHash !== expectedHeaderHash)
|
|
45994
|
+
return false;
|
|
45995
|
+
return true;
|
|
46165
45996
|
}
|
|
46166
|
-
|
|
45997
|
+
catch (error) {
|
|
45998
|
+
Log$4.log(`Protocol V2 resource package check failed for ${pkg.path}: `, error);
|
|
45999
|
+
return false;
|
|
46000
|
+
}
|
|
46001
|
+
});
|
|
46002
|
+
}
|
|
46003
|
+
isProtocolV2ResourceManifestSatisfied(manifest) {
|
|
46004
|
+
var _a;
|
|
46005
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46006
|
+
if (!((_a = manifest === null || manifest === void 0 ? void 0 : manifest.packages) === null || _a === void 0 ? void 0 : _a.length))
|
|
46007
|
+
return false;
|
|
46008
|
+
for (const pkg of manifest.packages) {
|
|
46009
|
+
if (!(yield this.isProtocolV2ResourcePackageMatched(pkg, manifest.version))) {
|
|
46010
|
+
return false;
|
|
46011
|
+
}
|
|
46012
|
+
}
|
|
46013
|
+
return true;
|
|
46014
|
+
});
|
|
46015
|
+
}
|
|
46016
|
+
getProtocolV2ResourceManifest(release, component) {
|
|
46017
|
+
var _a;
|
|
46018
|
+
return (_a = component.resourceManifest) !== null && _a !== void 0 ? _a : release.resourceManifest;
|
|
46019
|
+
}
|
|
46020
|
+
getProtocolV2ResourceComponentFileName(key) {
|
|
46021
|
+
const safeKey = key.replace(/[^a-z0-9_-]/gi, '_') || 'resource';
|
|
46022
|
+
return `resource-${safeKey}.bin`;
|
|
46023
|
+
}
|
|
46024
|
+
shouldInstallRemoteProtocolV2Component(release, key, component, target, features) {
|
|
46025
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46026
|
+
if (target.kind === 'resource') {
|
|
46027
|
+
if (this.params.forcedUpdateRes ||
|
|
46028
|
+
features.bootloaderMode ||
|
|
46029
|
+
features.mode === 'bootloader') {
|
|
46030
|
+
return true;
|
|
46031
|
+
}
|
|
46032
|
+
const resourceMatched = yield this.isProtocolV2ResourceManifestSatisfied(this.getProtocolV2ResourceManifest(release, component));
|
|
46033
|
+
if (resourceMatched) {
|
|
46034
|
+
Log$4.log(`[FirmwareUpdateV4] skip Protocol V2 resource component ${key}; manifest matched`);
|
|
46035
|
+
}
|
|
46036
|
+
return !resourceMatched;
|
|
46037
|
+
}
|
|
46038
|
+
const versionSatisfied = this.isProtocolV2ComponentVersionSatisfied(release, component, target, features);
|
|
46039
|
+
if (versionSatisfied) {
|
|
46040
|
+
Log$4.log(`[FirmwareUpdateV4] skip Protocol V2 component ${key}; version is up to date`);
|
|
46041
|
+
}
|
|
46042
|
+
return !versionSatisfied;
|
|
46043
|
+
});
|
|
46044
|
+
}
|
|
46045
|
+
downloadRemoteProtocolV2Component(key, component) {
|
|
46046
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46047
|
+
const target = this.getRemoteComponentTarget(key, component);
|
|
46048
|
+
if (!component.url) {
|
|
46049
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, `Missing Protocol V2 firmware component url: ${key}/${component.target}`);
|
|
46050
|
+
}
|
|
46051
|
+
const { binary } = yield getSysResourceBinary(component.url);
|
|
46052
|
+
return Object.assign(Object.assign({}, target), { binary });
|
|
46053
|
+
});
|
|
46054
|
+
}
|
|
46055
|
+
prepareRemoteProtocolV2Binaries(firmwareType, features) {
|
|
46056
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46057
|
+
const release = DataManager.getFirmwareLatestRelease(features, firmwareType);
|
|
46058
|
+
const resourceBinaryMap = [];
|
|
46059
|
+
let bootloaderBinary = null;
|
|
46060
|
+
const fwBinaryMap = [];
|
|
46061
|
+
if (!release) {
|
|
46062
|
+
return {
|
|
46063
|
+
resourceBinaryMap,
|
|
46064
|
+
bootloaderBinary,
|
|
46065
|
+
fwBinaryMap,
|
|
46066
|
+
};
|
|
46067
|
+
}
|
|
46068
|
+
const entries = this.getRemoteComponentEntries(release);
|
|
46069
|
+
for (const [key, component] of entries) {
|
|
46070
|
+
const target = this.getRemoteComponentTarget(key, component);
|
|
46071
|
+
const shouldInstall = yield this.shouldInstallRemoteProtocolV2Component(release, key, component, target, features);
|
|
46072
|
+
if (shouldInstall) {
|
|
46073
|
+
const remoteBinary = yield this.downloadRemoteProtocolV2Component(key, component);
|
|
46074
|
+
if (remoteBinary.kind === 'resource') {
|
|
46075
|
+
resourceBinaryMap.push({
|
|
46076
|
+
fileName: this.getProtocolV2ResourceComponentFileName(key),
|
|
46077
|
+
binary: remoteBinary.binary,
|
|
46078
|
+
targetId: remoteBinary.targetId,
|
|
46079
|
+
});
|
|
46080
|
+
}
|
|
46081
|
+
else if (remoteBinary.kind === 'bootloader') {
|
|
46082
|
+
bootloaderBinary = remoteBinary.binary;
|
|
46083
|
+
}
|
|
46084
|
+
else {
|
|
46085
|
+
fwBinaryMap.push({
|
|
46086
|
+
fileName: remoteBinary.fileName,
|
|
46087
|
+
binary: remoteBinary.binary,
|
|
46088
|
+
targetId: remoteBinary.targetId,
|
|
46089
|
+
});
|
|
46090
|
+
}
|
|
46091
|
+
}
|
|
46092
|
+
}
|
|
46093
|
+
return {
|
|
46094
|
+
resourceBinaryMap,
|
|
46095
|
+
bootloaderBinary,
|
|
46096
|
+
fwBinaryMap,
|
|
46097
|
+
};
|
|
46167
46098
|
});
|
|
46168
46099
|
}
|
|
46169
46100
|
isProtocolV2BootloaderMode() {
|
|
@@ -46174,20 +46105,17 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46174
46105
|
return !!((_a = this.device.features) === null || _a === void 0 ? void 0 : _a.bootloaderMode);
|
|
46175
46106
|
}
|
|
46176
46107
|
enterProtocolV2BootloaderMode() {
|
|
46177
|
-
var _a, _b, _c;
|
|
46178
46108
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46179
46109
|
if (this.isProtocolV2BootloaderMode()) {
|
|
46110
|
+
Log$4.debug('Protocol V2 device is already in bootloader mode, skip reboot to bootloader');
|
|
46180
46111
|
return false;
|
|
46181
46112
|
}
|
|
46182
46113
|
try {
|
|
46183
46114
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.AutoRebootToBootloader);
|
|
46184
|
-
yield this.protocolV2Reboot(hdTransport.
|
|
46115
|
+
yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Bootloader);
|
|
46185
46116
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.GoToBootloaderSuccess);
|
|
46186
|
-
|
|
46187
|
-
yield
|
|
46188
|
-
this.checkPromise = null;
|
|
46189
|
-
yield hdShared.wait(1500);
|
|
46190
|
-
yield ((_c = (_b = this.device).acquire) === null || _c === void 0 ? void 0 : _c.call(_b));
|
|
46117
|
+
yield hdShared.wait(1000);
|
|
46118
|
+
yield this.waitForProtocolV2BootloaderMode();
|
|
46191
46119
|
return true;
|
|
46192
46120
|
}
|
|
46193
46121
|
catch (error) {
|
|
@@ -46199,129 +46127,151 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46199
46127
|
}
|
|
46200
46128
|
});
|
|
46201
46129
|
}
|
|
46130
|
+
waitForProtocolV2BootloaderMode(timeout = PROTOCOL_V2_BOOTLOADER_RECONNECT_TIMEOUT, retryInterval = 1000) {
|
|
46131
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46132
|
+
const startTime = Date.now();
|
|
46133
|
+
let lastError;
|
|
46134
|
+
while (Date.now() - startTime < timeout) {
|
|
46135
|
+
try {
|
|
46136
|
+
yield this.reconnectProtocolV2Device();
|
|
46137
|
+
const deviceInfo = yield requestProtocolV2DeviceInfo({
|
|
46138
|
+
commands: this.device.getCommands(),
|
|
46139
|
+
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
46140
|
+
});
|
|
46141
|
+
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
46142
|
+
if (features === null || features === void 0 ? void 0 : features.bootloaderMode) {
|
|
46143
|
+
return features;
|
|
46144
|
+
}
|
|
46145
|
+
lastError = new Error('Protocol V2 device is reachable but is not in bootloader mode');
|
|
46146
|
+
}
|
|
46147
|
+
catch (error) {
|
|
46148
|
+
lastError = error;
|
|
46149
|
+
Log$4.log('Protocol V2 bootloader mode not ready, polling reconnect: ', error);
|
|
46150
|
+
}
|
|
46151
|
+
yield hdShared.wait(retryInterval);
|
|
46152
|
+
}
|
|
46153
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareUpdateAutoEnterBootFailure, `Protocol V2 bootloader not ready within ${timeout / 1000}s: ${this.normalizeErrorMessage(lastError)}`);
|
|
46154
|
+
});
|
|
46155
|
+
}
|
|
46202
46156
|
collectExplicitTargetBinaries() {
|
|
46203
46157
|
const entries = [];
|
|
46204
46158
|
const push = (binary, fileName, targetId) => {
|
|
46205
46159
|
if (binary)
|
|
46206
46160
|
entries.push({ fileName, binary, targetId });
|
|
46207
46161
|
};
|
|
46208
|
-
|
|
46209
|
-
|
|
46210
|
-
|
|
46211
|
-
push(this.params.
|
|
46212
|
-
push(this.params.
|
|
46213
|
-
push(this.params.
|
|
46214
|
-
push(this.params.
|
|
46215
|
-
push(this.params.
|
|
46162
|
+
if (this.params.romloaderBinary) {
|
|
46163
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, PROTOCOL_V2_ROMLOADER_UNSUPPORTED_MESSAGE);
|
|
46164
|
+
}
|
|
46165
|
+
push(this.params.applicationP1Binary, 'application_p1.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P1);
|
|
46166
|
+
push(this.params.applicationP2Binary, 'application_p2.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_APPLICATION_P2);
|
|
46167
|
+
push(this.params.coprocessorBinary, 'coprocessor.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_COPROCESSOR);
|
|
46168
|
+
push(this.params.se01Binary, 'se01.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE01);
|
|
46169
|
+
push(this.params.se02Binary, 'se02.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE02);
|
|
46170
|
+
push(this.params.se03Binary, 'se03.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE03);
|
|
46171
|
+
push(this.params.se04Binary, 'se04.bin', ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_SE04);
|
|
46216
46172
|
return entries;
|
|
46217
46173
|
}
|
|
46218
|
-
|
|
46219
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46220
|
-
const fwBinaryMap = [];
|
|
46221
|
-
if (this.params.firmwareBinary) {
|
|
46222
|
-
fwBinaryMap.push({
|
|
46223
|
-
fileName: 'firmware.bin',
|
|
46224
|
-
binary: this.params.firmwareBinary,
|
|
46225
|
-
});
|
|
46226
|
-
}
|
|
46227
|
-
else if (this.params.firmwareVersion) {
|
|
46228
|
-
const firmwareBinary = (yield getBinary({
|
|
46229
|
-
features,
|
|
46230
|
-
version: this.params.firmwareVersion,
|
|
46231
|
-
updateType: 'firmware',
|
|
46232
|
-
isUpdateBootloader: false,
|
|
46233
|
-
firmwareType,
|
|
46234
|
-
})).binary;
|
|
46235
|
-
fwBinaryMap.push({
|
|
46236
|
-
fileName: 'firmware.bin',
|
|
46237
|
-
binary: firmwareBinary,
|
|
46238
|
-
});
|
|
46239
|
-
}
|
|
46240
|
-
if (this.params.bleBinary) {
|
|
46241
|
-
fwBinaryMap.push({
|
|
46242
|
-
fileName: 'ble-firmware.bin',
|
|
46243
|
-
binary: this.params.bleBinary,
|
|
46244
|
-
});
|
|
46245
|
-
}
|
|
46246
|
-
else if (this.params.bleVersion) {
|
|
46247
|
-
const bleBinary = yield getBinary({
|
|
46248
|
-
features,
|
|
46249
|
-
version: this.params.bleVersion,
|
|
46250
|
-
updateType: 'ble',
|
|
46251
|
-
firmwareType,
|
|
46252
|
-
});
|
|
46253
|
-
fwBinaryMap.push({
|
|
46254
|
-
fileName: 'ble-firmware.bin',
|
|
46255
|
-
binary: bleBinary.binary,
|
|
46256
|
-
});
|
|
46257
|
-
}
|
|
46258
|
-
return fwBinaryMap;
|
|
46259
|
-
});
|
|
46260
|
-
}
|
|
46261
|
-
executeProtocolV2Update({ resourceBinary, fwBinaryMap, bootloaderBinary, }) {
|
|
46262
|
-
var _a;
|
|
46174
|
+
executeProtocolV2Update({ resourceBinaryMap, fwBinaryMap, bootloaderBinary, }) {
|
|
46263
46175
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46264
46176
|
let totalSize = 0;
|
|
46265
46177
|
let processedSize = 0;
|
|
46266
|
-
|
|
46267
|
-
|
|
46178
|
+
let transferredSize = 0;
|
|
46179
|
+
for (const resource of resourceBinaryMap)
|
|
46180
|
+
totalSize += resource.binary.byteLength;
|
|
46268
46181
|
for (const fwbinary of fwBinaryMap)
|
|
46269
46182
|
totalSize += fwbinary.binary.byteLength;
|
|
46270
46183
|
if (bootloaderBinary)
|
|
46271
46184
|
totalSize += bootloaderBinary.byteLength;
|
|
46272
46185
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.StartTransferData);
|
|
46186
|
+
const transferStartTime = Date.now();
|
|
46187
|
+
const transferTransport = this.getProtocolV2FirmwareTransferTransport();
|
|
46188
|
+
const chunkSize = this.getProtocolV2FirmwareChunkSize();
|
|
46189
|
+
const onTransferredBytes = (bytes) => {
|
|
46190
|
+
transferredSize = bytes;
|
|
46191
|
+
};
|
|
46192
|
+
Log$4.log(`[FirmwareUpdateV4] transfer started transport=${transferTransport} total=${totalSize} bytes chunk=${chunkSize} bytes`);
|
|
46193
|
+
const resourceTargets = [];
|
|
46273
46194
|
const targets = [];
|
|
46274
|
-
|
|
46275
|
-
const
|
|
46276
|
-
|
|
46277
|
-
|
|
46278
|
-
|
|
46279
|
-
|
|
46280
|
-
|
|
46281
|
-
|
|
46282
|
-
|
|
46283
|
-
|
|
46284
|
-
|
|
46285
|
-
|
|
46195
|
+
try {
|
|
46196
|
+
for (const resource of resourceBinaryMap) {
|
|
46197
|
+
const resourceFilePath = `${PROTOCOL_V2_FIRMWARE_STAGING_VOLUME}${resource.fileName}`;
|
|
46198
|
+
Log$4.log(`[FirmwareUpdateV4] staging resource via FilesystemFileWrite target=${resource.targetId} path=${resourceFilePath} bytes=${resource.binary.byteLength}`);
|
|
46199
|
+
processedSize = yield this.protocolV2CommonUpdateProcess({
|
|
46200
|
+
payload: resource.binary,
|
|
46201
|
+
filePath: resourceFilePath,
|
|
46202
|
+
processedSize,
|
|
46203
|
+
totalSize,
|
|
46204
|
+
onTransferredBytes,
|
|
46205
|
+
});
|
|
46206
|
+
transferredSize = processedSize;
|
|
46207
|
+
resourceTargets.push({
|
|
46208
|
+
target_id: resource.targetId,
|
|
46209
|
+
path: resourceFilePath,
|
|
46210
|
+
});
|
|
46211
|
+
}
|
|
46212
|
+
if (bootloaderBinary) {
|
|
46213
|
+
const bootloaderPath = `${PROTOCOL_V2_FIRMWARE_STAGING_VOLUME}bootloader.bin`;
|
|
46214
|
+
Log$4.log(`[FirmwareUpdateV4] staging bootloader via FilesystemFileWrite target=${ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER} path=${bootloaderPath} bytes=${bootloaderBinary.byteLength}`);
|
|
46215
|
+
processedSize = yield this.protocolV2CommonUpdateProcess({
|
|
46216
|
+
payload: bootloaderBinary,
|
|
46217
|
+
filePath: bootloaderPath,
|
|
46218
|
+
processedSize,
|
|
46219
|
+
totalSize,
|
|
46220
|
+
onTransferredBytes,
|
|
46221
|
+
});
|
|
46222
|
+
transferredSize = processedSize;
|
|
46223
|
+
targets.push({
|
|
46224
|
+
target_id: ProtocolV2FirmwareTargetType.FW_MGMT_TARGET_BOOTLOADER,
|
|
46225
|
+
path: bootloaderPath,
|
|
46226
|
+
});
|
|
46227
|
+
}
|
|
46228
|
+
for (const fwbinary of fwBinaryMap) {
|
|
46229
|
+
const firmwarePath = `${PROTOCOL_V2_FIRMWARE_STAGING_VOLUME}${fwbinary.fileName}`;
|
|
46230
|
+
Log$4.log(`[FirmwareUpdateV4] staging firmware via FilesystemFileWrite target=${fwbinary.targetId} path=${firmwarePath} bytes=${fwbinary.binary.byteLength}`);
|
|
46231
|
+
processedSize = yield this.protocolV2CommonUpdateProcess({
|
|
46232
|
+
payload: fwbinary.binary,
|
|
46233
|
+
filePath: firmwarePath,
|
|
46234
|
+
processedSize,
|
|
46235
|
+
totalSize,
|
|
46236
|
+
onTransferredBytes,
|
|
46237
|
+
});
|
|
46238
|
+
transferredSize = processedSize;
|
|
46239
|
+
targets.push({
|
|
46240
|
+
target_id: fwbinary.targetId,
|
|
46241
|
+
path: firmwarePath,
|
|
46242
|
+
});
|
|
46243
|
+
}
|
|
46244
|
+
if (totalSize > 0) {
|
|
46245
|
+
this.postProgressMessage(100, 'transferData');
|
|
46246
|
+
}
|
|
46247
|
+
const elapsedMs = Date.now() - transferStartTime;
|
|
46248
|
+
Log$4.log(`[FirmwareUpdateV4] transfer finished transport=${transferTransport} bytes=${totalSize} elapsed=${(elapsedMs / 1000).toFixed(2)}s speed=${formatProtocolV2TransferSpeed(totalSize, elapsedMs)} KB/s`);
|
|
46286
46249
|
}
|
|
46287
|
-
|
|
46288
|
-
const
|
|
46289
|
-
|
|
46290
|
-
|
|
46291
|
-
filePath: bootloaderPath,
|
|
46292
|
-
processedSize,
|
|
46293
|
-
totalSize,
|
|
46294
|
-
});
|
|
46295
|
-
targets.push({
|
|
46296
|
-
target_id: ProtocolV2FirmwareTargetType.TARGET_MAIN_BOOT,
|
|
46297
|
-
path: bootloaderPath,
|
|
46298
|
-
});
|
|
46250
|
+
catch (error) {
|
|
46251
|
+
const elapsedMs = Date.now() - transferStartTime;
|
|
46252
|
+
Log$4.warn(`[FirmwareUpdateV4] transfer failed transport=${transferTransport} bytes=${transferredSize}/${totalSize} elapsed=${(elapsedMs / 1000).toFixed(2)}s speed=${formatProtocolV2TransferSpeed(transferredSize, elapsedMs)} KB/s`);
|
|
46253
|
+
throw error;
|
|
46299
46254
|
}
|
|
46300
|
-
|
|
46301
|
-
|
|
46302
|
-
|
|
46303
|
-
|
|
46304
|
-
|
|
46305
|
-
|
|
46306
|
-
totalSize,
|
|
46307
|
-
});
|
|
46308
|
-
targets.push({
|
|
46309
|
-
target_id: (_a = fwbinary.targetId) !== null && _a !== void 0 ? _a : protocolV2FileNameToTargetId(fwbinary.fileName),
|
|
46310
|
-
path: firmwarePath,
|
|
46255
|
+
this.postTipMessage(exports.FirmwareUpdateTipMessage.ConfirmOnDevice);
|
|
46256
|
+
for (const resourceTarget of resourceTargets) {
|
|
46257
|
+
const resourceTargetsBatch = [resourceTarget];
|
|
46258
|
+
Log$4.log(`[FirmwareUpdateV4] DeviceFirmwareUpdateRequest resources=${JSON.stringify(resourceTargetsBatch)}`);
|
|
46259
|
+
const startResponse = yield this.protocolV2StartFirmwareUpdate({
|
|
46260
|
+
targets: resourceTargetsBatch,
|
|
46311
46261
|
});
|
|
46262
|
+
yield this.waitForProtocolV2FirmwareUpdateComplete(resourceTargetsBatch, startResponse);
|
|
46312
46263
|
}
|
|
46313
|
-
if (
|
|
46314
|
-
|
|
46264
|
+
if (targets.length > 0) {
|
|
46265
|
+
Log$4.log(`[FirmwareUpdateV4] DeviceFirmwareUpdateRequest targets=${JSON.stringify(targets)}`);
|
|
46266
|
+
const startResponse = yield this.protocolV2StartFirmwareUpdate({ targets });
|
|
46267
|
+
yield this.waitForProtocolV2FirmwareUpdateComplete(targets, startResponse);
|
|
46315
46268
|
}
|
|
46316
|
-
this.postTipMessage(exports.FirmwareUpdateTipMessage.ConfirmOnDevice);
|
|
46317
|
-
const startResponse = yield this.protocolV2StartFirmwareUpdate({ targets });
|
|
46318
|
-
yield this.waitForProtocolV2FirmwareUpdateComplete(targets, startResponse);
|
|
46319
46269
|
});
|
|
46320
46270
|
}
|
|
46321
46271
|
queryProtocolV2FirmwareUpdateStatus() {
|
|
46322
46272
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46323
46273
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
46324
|
-
return typedCall('
|
|
46274
|
+
return typedCall('DeviceFirmwareUpdateStatusGet', 'DeviceFirmwareUpdateStatus', {}, {
|
|
46325
46275
|
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
46326
46276
|
});
|
|
46327
46277
|
});
|
|
@@ -46334,19 +46284,46 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46334
46284
|
});
|
|
46335
46285
|
});
|
|
46336
46286
|
}
|
|
46287
|
+
isProtocolV2NormalModeFeatures(features) {
|
|
46288
|
+
return !!features && !features.bootloaderMode && features.mode !== 'bootloader';
|
|
46289
|
+
}
|
|
46290
|
+
probeProtocolV2NormalMode() {
|
|
46291
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46292
|
+
const deviceInfo = yield requestProtocolV2DeviceInfo({
|
|
46293
|
+
commands: this.device.getCommands(),
|
|
46294
|
+
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
46295
|
+
request: PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
46296
|
+
});
|
|
46297
|
+
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
46298
|
+
if (this.isProtocolV2NormalModeFeatures(features)) {
|
|
46299
|
+
Log$4.log('Protocol V2 firmware install finished; device is back in normal mode');
|
|
46300
|
+
return true;
|
|
46301
|
+
}
|
|
46302
|
+
return false;
|
|
46303
|
+
});
|
|
46304
|
+
}
|
|
46337
46305
|
assertProtocolV2TargetStatus(statusTargets, expectedTargetIds) {
|
|
46338
|
-
const failedTarget = statusTargets.find(target =>
|
|
46339
|
-
|
|
46306
|
+
const failedTarget = statusTargets.find(target => {
|
|
46307
|
+
var _a;
|
|
46308
|
+
return expectedTargetIds.has((_a = normalizeProtocolV2TargetId(target.target_id)) !== null && _a !== void 0 ? _a : -1) &&
|
|
46309
|
+
isProtocolV2TargetStatusFailed(target.status);
|
|
46310
|
+
});
|
|
46340
46311
|
if (failedTarget) {
|
|
46341
46312
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.FirmwareError, `Protocol V2 firmware target ${failedTarget.target_id} failed`);
|
|
46342
46313
|
}
|
|
46343
|
-
const completedTargets = statusTargets.filter(target =>
|
|
46344
|
-
|
|
46314
|
+
const completedTargets = statusTargets.filter(target => {
|
|
46315
|
+
var _a;
|
|
46316
|
+
return expectedTargetIds.has((_a = normalizeProtocolV2TargetId(target.target_id)) !== null && _a !== void 0 ? _a : -1) &&
|
|
46317
|
+
isProtocolV2TargetStatusFinished(target.status);
|
|
46318
|
+
});
|
|
46345
46319
|
if (completedTargets.length === expectedTargetIds.size && expectedTargetIds.size > 0) {
|
|
46346
46320
|
return true;
|
|
46347
46321
|
}
|
|
46348
|
-
const inProgressTarget = statusTargets.find(target =>
|
|
46349
|
-
|
|
46322
|
+
const inProgressTarget = statusTargets.find(target => {
|
|
46323
|
+
var _a;
|
|
46324
|
+
return expectedTargetIds.has((_a = normalizeProtocolV2TargetId(target.target_id)) !== null && _a !== void 0 ? _a : -1) &&
|
|
46325
|
+
isProtocolV2TargetStatusInProgress(target.status);
|
|
46326
|
+
});
|
|
46350
46327
|
if (inProgressTarget) {
|
|
46351
46328
|
this.postProgressMessage(99, 'installingFirmware');
|
|
46352
46329
|
}
|
|
@@ -46356,11 +46333,8 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46356
46333
|
var _a, _b;
|
|
46357
46334
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46358
46335
|
const expectedTargetIds = new Set(targets.map(target => target.target_id));
|
|
46359
|
-
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === '
|
|
46360
|
-
|
|
46361
|
-
}
|
|
46362
|
-
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === 'DevFirmwareUpdateStatus') {
|
|
46363
|
-
const statusTargets = ((_a = startResponse.message.targets) !== null && _a !== void 0 ? _a : []);
|
|
46336
|
+
if ((startResponse === null || startResponse === void 0 ? void 0 : startResponse.type) === 'DeviceFirmwareUpdateStatus') {
|
|
46337
|
+
const statusTargets = ((_a = startResponse.message.records) !== null && _a !== void 0 ? _a : []);
|
|
46364
46338
|
if (this.assertProtocolV2TargetStatus(statusTargets, expectedTargetIds)) {
|
|
46365
46339
|
return;
|
|
46366
46340
|
}
|
|
@@ -46370,7 +46344,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46370
46344
|
while (Date.now() - startTime < PROTOCOL_V2_INSTALL_TIMEOUT) {
|
|
46371
46345
|
try {
|
|
46372
46346
|
const statusRes = yield this.queryProtocolV2FirmwareUpdateStatus();
|
|
46373
|
-
const statusTargets = ((_b = statusRes.message.
|
|
46347
|
+
const statusTargets = ((_b = statusRes.message.records) !== null && _b !== void 0 ? _b : []);
|
|
46374
46348
|
if (this.assertProtocolV2TargetStatus(statusTargets, expectedTargetIds)) {
|
|
46375
46349
|
return;
|
|
46376
46350
|
}
|
|
@@ -46384,15 +46358,17 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46384
46358
|
if (isProtocolV2PollingTransientError(error)) {
|
|
46385
46359
|
try {
|
|
46386
46360
|
yield this.reconnectProtocolV2Device();
|
|
46361
|
+
if (yield this.probeProtocolV2NormalMode()) {
|
|
46362
|
+
return;
|
|
46363
|
+
}
|
|
46387
46364
|
}
|
|
46388
46365
|
catch (reconnectError) {
|
|
46389
46366
|
lastError = reconnectError;
|
|
46390
|
-
Log$4.log('Protocol V2 firmware install reconnect/
|
|
46367
|
+
Log$4.log('Protocol V2 firmware install reconnect/normal-mode probe failed: ', reconnectError);
|
|
46391
46368
|
}
|
|
46392
46369
|
try {
|
|
46393
46370
|
yield this.pingProtocolV2Device();
|
|
46394
46371
|
Log$4.log('Protocol V2 firmware status unavailable, Ping is ready');
|
|
46395
|
-
return;
|
|
46396
46372
|
}
|
|
46397
46373
|
catch (pingError) {
|
|
46398
46374
|
lastError = pingError;
|
|
@@ -46408,7 +46384,17 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46408
46384
|
exitProtocolV2BootloaderToNormal() {
|
|
46409
46385
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46410
46386
|
this.postTipMessage(exports.FirmwareUpdateTipMessage.SwitchFirmwareReconnectDevice);
|
|
46411
|
-
|
|
46387
|
+
try {
|
|
46388
|
+
yield this.reconnectProtocolV2Device();
|
|
46389
|
+
if (yield this.probeProtocolV2NormalMode()) {
|
|
46390
|
+
Log$4.log('Protocol V2 device is already in normal mode, skip normal reboot');
|
|
46391
|
+
return;
|
|
46392
|
+
}
|
|
46393
|
+
}
|
|
46394
|
+
catch (error) {
|
|
46395
|
+
Log$4.log('Protocol V2 normal-mode probe before reboot failed: ', error);
|
|
46396
|
+
}
|
|
46397
|
+
yield this.protocolV2Reboot(hdTransport.DeviceRebootType.Normal);
|
|
46412
46398
|
});
|
|
46413
46399
|
}
|
|
46414
46400
|
waitForProtocolV2FinalFeatures() {
|
|
@@ -46439,7 +46425,11 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46439
46425
|
timeoutMs: PROTOCOL_V2_SHORT_RESPONSE_TIMEOUT,
|
|
46440
46426
|
request: PROTOCOL_V2_VERSIONS_DEVICE_INFO_REQUEST,
|
|
46441
46427
|
});
|
|
46442
|
-
|
|
46428
|
+
const features = this.device.updateProtocolV2Features(deviceInfo);
|
|
46429
|
+
if (features.bootloaderMode || features.mode === 'bootloader') {
|
|
46430
|
+
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound, 'Protocol V2 device is still in bootloader mode');
|
|
46431
|
+
}
|
|
46432
|
+
return features;
|
|
46443
46433
|
}
|
|
46444
46434
|
catch (error) {
|
|
46445
46435
|
lastError = error;
|
|
@@ -46451,7 +46441,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46451
46441
|
});
|
|
46452
46442
|
}
|
|
46453
46443
|
reconnectProtocolV2Device() {
|
|
46454
|
-
var _a, _b, _c;
|
|
46444
|
+
var _a, _b, _c, _d;
|
|
46455
46445
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46456
46446
|
if (this.isBleReconnect()) {
|
|
46457
46447
|
yield this.acquireProtocolV2BleDevice();
|
|
@@ -46459,17 +46449,30 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46459
46449
|
}
|
|
46460
46450
|
const deviceDiff = yield ((_a = this.device.deviceConnector) === null || _a === void 0 ? void 0 : _a.enumerate());
|
|
46461
46451
|
const devicesDescriptor = (_b = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _b !== void 0 ? _b : [];
|
|
46462
|
-
|
|
46452
|
+
if (DataManager.isBrowserWebUsb(DataManager.getSettings('env')) &&
|
|
46453
|
+
devicesDescriptor.length === 1) {
|
|
46454
|
+
this.device.updateDescriptor(Object.assign(Object.assign({}, devicesDescriptor[0]), { protocolType: PROTOCOL_V2_CONNECT_PROTOCOL }), true);
|
|
46455
|
+
yield this.device.acquire(PROTOCOL_V2_CONNECT_PROTOCOL, { throwOnRunPromiseError: true });
|
|
46456
|
+
this.device.commands.disposed = false;
|
|
46457
|
+
this.device.getCommands().mainId = (_c = this.device.mainId) !== null && _c !== void 0 ? _c : '';
|
|
46458
|
+
yield this.device.initialize();
|
|
46459
|
+
return;
|
|
46460
|
+
}
|
|
46461
|
+
const { deviceList } = yield DevicePool.getDevices(devicesDescriptor, undefined, {
|
|
46462
|
+
connectProtocol: PROTOCOL_V2_CONNECT_PROTOCOL,
|
|
46463
|
+
});
|
|
46463
46464
|
if (deviceList.length !== 1) {
|
|
46464
46465
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.DeviceNotFound);
|
|
46465
46466
|
}
|
|
46467
|
+
Log$4.debug('Protocol V2 firmware reconnect using single enumerated device:', deviceList[0].getConnectId());
|
|
46466
46468
|
this.device.updateFromCache(deviceList[0]);
|
|
46467
|
-
yield this.device.acquire();
|
|
46469
|
+
yield this.device.acquire(PROTOCOL_V2_CONNECT_PROTOCOL, { throwOnRunPromiseError: true });
|
|
46468
46470
|
this.device.commands.disposed = false;
|
|
46469
|
-
this.device.getCommands().mainId = (
|
|
46471
|
+
this.device.getCommands().mainId = (_d = this.device.mainId) !== null && _d !== void 0 ? _d : '';
|
|
46472
|
+
yield this.device.initialize();
|
|
46470
46473
|
});
|
|
46471
46474
|
}
|
|
46472
|
-
protocolV2CommonUpdateProcess({ payload, filePath, processedSize, totalSize, }) {
|
|
46475
|
+
protocolV2CommonUpdateProcess({ payload, filePath, processedSize, totalSize, onTransferredBytes, }) {
|
|
46473
46476
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46474
46477
|
const chunkSize = this.getProtocolV2FirmwareChunkSize();
|
|
46475
46478
|
let offset = 0;
|
|
@@ -46484,7 +46487,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46484
46487
|
const chunkLength = chunkEnd - offset;
|
|
46485
46488
|
const chunk = payload.slice(offset, chunkEnd);
|
|
46486
46489
|
const overwrite = offset === 0;
|
|
46487
|
-
const progress =
|
|
46490
|
+
const progress = getProtocolV2DeviceTransferProgress((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset, (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + chunkEnd, totalSize !== null && totalSize !== void 0 ? totalSize : payload.byteLength);
|
|
46488
46491
|
const writeRes = yield this.fileWriteWithRetry(filePath, payload.byteLength, offset, chunk, overwrite, progress);
|
|
46489
46492
|
const processedByte = Number(writeRes.message.processed_byte);
|
|
46490
46493
|
const nextOffset = Number.isFinite(processedByte) && processedByte > offset
|
|
@@ -46494,11 +46497,23 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46494
46497
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.EmmcFileWriteFirmwareError, `invalid processed_byte ${writeRes.message.processed_byte} for offset ${offset}`);
|
|
46495
46498
|
}
|
|
46496
46499
|
offset = nextOffset;
|
|
46500
|
+
onTransferredBytes === null || onTransferredBytes === void 0 ? void 0 : onTransferredBytes((processedSize !== null && processedSize !== void 0 ? processedSize : 0) + offset);
|
|
46497
46501
|
this.postProgressMessage(getUploadProgress(offset), 'transferData');
|
|
46498
46502
|
}
|
|
46499
46503
|
return totalSize !== undefined ? (processedSize !== null && processedSize !== void 0 ? processedSize : 0) + payload.byteLength : 0;
|
|
46500
46504
|
});
|
|
46501
46505
|
}
|
|
46506
|
+
getProtocolV2FirmwareTransferTransport() {
|
|
46507
|
+
const env = DataManager.getSettings('env');
|
|
46508
|
+
if (env && DataManager.isBleConnect(env)) {
|
|
46509
|
+
return 'BLE';
|
|
46510
|
+
}
|
|
46511
|
+
if (env &&
|
|
46512
|
+
(DataManager.isBrowserWebUsb(env) || DataManager.isDesktopWebUsb(env) || env === 'web')) {
|
|
46513
|
+
return 'WebUSB';
|
|
46514
|
+
}
|
|
46515
|
+
return env !== null && env !== void 0 ? env : 'unknown';
|
|
46516
|
+
}
|
|
46502
46517
|
fileWriteWithRetry(filePath, totalFileSize, offset, chunk, overwrite, progress) {
|
|
46503
46518
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46504
46519
|
const writeFunc = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -46560,22 +46575,21 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46560
46575
|
const commands = this.device.getCommands();
|
|
46561
46576
|
let response;
|
|
46562
46577
|
try {
|
|
46563
|
-
response = yield commands.typedCall('
|
|
46578
|
+
response = yield commands.typedCall('DeviceFirmwareUpdateRequest', PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES, {
|
|
46564
46579
|
targets,
|
|
46565
46580
|
}, {
|
|
46566
|
-
intermediateTypes: ['
|
|
46581
|
+
intermediateTypes: ['DeviceFirmwareUpdateStatus'],
|
|
46582
|
+
timeoutMs: PROTOCOL_V2_START_UPDATE_TIMEOUT,
|
|
46567
46583
|
onIntermediateResponse: (response) => {
|
|
46568
|
-
|
|
46569
|
-
|
|
46570
|
-
if (Number.isFinite(progress)) {
|
|
46571
|
-
this.postProgressMessage(Math.min(progress, 99), 'installingFirmware');
|
|
46584
|
+
if (response.type === 'DeviceFirmwareUpdateStatus') {
|
|
46585
|
+
this.postProgressMessage(99, 'installingFirmware');
|
|
46572
46586
|
}
|
|
46573
46587
|
},
|
|
46574
46588
|
});
|
|
46575
46589
|
}
|
|
46576
46590
|
catch (error) {
|
|
46577
|
-
if (
|
|
46578
|
-
Log$4.log('
|
|
46591
|
+
if (isProtocolV2StartUpdateTransientError(error)) {
|
|
46592
|
+
Log$4.log('Protocol V2 firmware update request did not return; continue status polling', error);
|
|
46579
46593
|
}
|
|
46580
46594
|
else {
|
|
46581
46595
|
throw error;
|
|
@@ -46589,7 +46603,7 @@ class FirmwareUpdateV4 extends FirmwareUpdateBaseMethod {
|
|
|
46589
46603
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46590
46604
|
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
46591
46605
|
try {
|
|
46592
|
-
const res = yield typedCall('
|
|
46606
|
+
const res = yield typedCall('DeviceReboot', 'Success', {
|
|
46593
46607
|
reboot_type: rebootType,
|
|
46594
46608
|
});
|
|
46595
46609
|
return res.message;
|
|
@@ -46674,7 +46688,7 @@ class PromptWebDeviceAccess extends BaseMethod {
|
|
|
46674
46688
|
}
|
|
46675
46689
|
}
|
|
46676
46690
|
|
|
46677
|
-
class
|
|
46691
|
+
class ProtocolInfoRequest extends BaseMethod {
|
|
46678
46692
|
init() {
|
|
46679
46693
|
this.requireProtocolV2 = true;
|
|
46680
46694
|
this.skipForceUpdateCheck = true;
|
|
@@ -46683,7 +46697,7 @@ class GetProtoVersion extends BaseMethod {
|
|
|
46683
46697
|
}
|
|
46684
46698
|
run() {
|
|
46685
46699
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46686
|
-
const res = yield this.device.commands.typedCall('
|
|
46700
|
+
const res = yield this.device.commands.typedCall('ProtocolInfoRequest', 'ProtocolInfo', {});
|
|
46687
46701
|
return Promise.resolve(res.message);
|
|
46688
46702
|
});
|
|
46689
46703
|
}
|
|
@@ -46721,7 +46735,7 @@ class DeviceReboot extends BaseMethod {
|
|
|
46721
46735
|
var _a;
|
|
46722
46736
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46723
46737
|
const res = yield this.device.commands.typedCall('DeviceReboot', 'Success', {
|
|
46724
|
-
reboot_type:
|
|
46738
|
+
reboot_type: normalizeRebootType((_a = this.params.reboot_type) !== null && _a !== void 0 ? _a : this.params.rebootType),
|
|
46725
46739
|
});
|
|
46726
46740
|
return Promise.resolve(res.message);
|
|
46727
46741
|
});
|
|
@@ -46731,7 +46745,7 @@ class DeviceReboot extends BaseMethod {
|
|
|
46731
46745
|
const TARGET_KEYS = [
|
|
46732
46746
|
'hw',
|
|
46733
46747
|
'fw',
|
|
46734
|
-
'
|
|
46748
|
+
'coprocessor',
|
|
46735
46749
|
'se1',
|
|
46736
46750
|
'se2',
|
|
46737
46751
|
'se3',
|
|
@@ -46742,7 +46756,7 @@ const TYPE_KEYS = ['version', 'build_id', 'hash', 'specific'];
|
|
|
46742
46756
|
const DEFAULT_TARGETS = {
|
|
46743
46757
|
hw: true,
|
|
46744
46758
|
fw: true,
|
|
46745
|
-
|
|
46759
|
+
coprocessor: true,
|
|
46746
46760
|
status: true,
|
|
46747
46761
|
};
|
|
46748
46762
|
const DEFAULT_TYPES = {
|
|
@@ -46763,7 +46777,27 @@ function pickBooleanKeys(value, keys) {
|
|
|
46763
46777
|
}
|
|
46764
46778
|
return hasKey ? result : undefined;
|
|
46765
46779
|
}
|
|
46766
|
-
|
|
46780
|
+
function assertKnownKeys(value, keys, name) {
|
|
46781
|
+
if (value == null)
|
|
46782
|
+
return;
|
|
46783
|
+
if (typeof value !== 'object' || Array.isArray(value)) {
|
|
46784
|
+
throw invalidParameter(`Parameter [${name}] must be an object.`);
|
|
46785
|
+
}
|
|
46786
|
+
const allowed = new Set(keys);
|
|
46787
|
+
const unknownKeys = Object.keys(value).filter(key => !allowed.has(key));
|
|
46788
|
+
if (unknownKeys.length > 0) {
|
|
46789
|
+
throw invalidParameter(`Parameter [${name}] contains unsupported key(s): ${unknownKeys.join(', ')}.`);
|
|
46790
|
+
}
|
|
46791
|
+
}
|
|
46792
|
+
function normalizeTargets(value) {
|
|
46793
|
+
assertKnownKeys(value, TARGET_KEYS.map(key => String(key)), 'targets');
|
|
46794
|
+
return pickBooleanKeys(value, TARGET_KEYS);
|
|
46795
|
+
}
|
|
46796
|
+
function normalizeTypes(value) {
|
|
46797
|
+
assertKnownKeys(value, TYPE_KEYS.map(key => String(key)), 'types');
|
|
46798
|
+
return pickBooleanKeys(value, TYPE_KEYS);
|
|
46799
|
+
}
|
|
46800
|
+
class DeviceInfoGet extends BaseMethod {
|
|
46767
46801
|
init() {
|
|
46768
46802
|
var _a, _b;
|
|
46769
46803
|
this.requireProtocolV2 = true;
|
|
@@ -46775,8 +46809,8 @@ class DeviceGetDeviceInfo extends BaseMethod {
|
|
|
46775
46809
|
this.useDevicePassphraseState = false;
|
|
46776
46810
|
this.skipForceUpdateCheck = true;
|
|
46777
46811
|
this.params = {
|
|
46778
|
-
targets: (_a =
|
|
46779
|
-
types: (_b =
|
|
46812
|
+
targets: (_a = normalizeTargets(this.payload.targets)) !== null && _a !== void 0 ? _a : DEFAULT_TARGETS,
|
|
46813
|
+
types: (_b = normalizeTypes(this.payload.types)) !== null && _b !== void 0 ? _b : DEFAULT_TYPES,
|
|
46780
46814
|
};
|
|
46781
46815
|
}
|
|
46782
46816
|
run() {
|
|
@@ -46784,7 +46818,7 @@ class DeviceGetDeviceInfo extends BaseMethod {
|
|
|
46784
46818
|
if (!this.device.isProtocolV2()) {
|
|
46785
46819
|
throw hdShared.createDeviceNotSupportMethodError(this.name, this.device.getCurrentFirmwareType());
|
|
46786
46820
|
}
|
|
46787
|
-
const res = yield this.device.commands.typedCall('
|
|
46821
|
+
const res = yield this.device.commands.typedCall('DeviceInfoGet', 'DeviceInfo', {
|
|
46788
46822
|
targets: this.params.targets,
|
|
46789
46823
|
types: this.params.types,
|
|
46790
46824
|
}, { timeoutMs: PROTOCOL_V2_DEVICE_INFO_TIMEOUT_MS });
|
|
@@ -46793,21 +46827,6 @@ class DeviceGetDeviceInfo extends BaseMethod {
|
|
|
46793
46827
|
}
|
|
46794
46828
|
}
|
|
46795
46829
|
|
|
46796
|
-
class DeviceGetOnboardingStatus extends BaseMethod {
|
|
46797
|
-
init() {
|
|
46798
|
-
this.requireProtocolV2 = true;
|
|
46799
|
-
this.skipForceUpdateCheck = true;
|
|
46800
|
-
this.useDevicePassphraseState = false;
|
|
46801
|
-
this.params = undefined;
|
|
46802
|
-
}
|
|
46803
|
-
run() {
|
|
46804
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46805
|
-
const res = yield this.device.commands.typedCall('GetOnboardingStatus', 'OnboardingStatus', {});
|
|
46806
|
-
return Promise.resolve(res.message);
|
|
46807
|
-
});
|
|
46808
|
-
}
|
|
46809
|
-
}
|
|
46810
|
-
|
|
46811
46830
|
class DeviceFirmwareUpdate extends BaseMethod {
|
|
46812
46831
|
init() {
|
|
46813
46832
|
this.requireProtocolV2 = true;
|
|
@@ -46824,18 +46843,14 @@ class DeviceFirmwareUpdate extends BaseMethod {
|
|
|
46824
46843
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46825
46844
|
const targets = normalizeFirmwareTargets(this.params);
|
|
46826
46845
|
try {
|
|
46827
|
-
const res = yield this.device.commands.typedCall('
|
|
46846
|
+
const res = yield this.device.commands.typedCall('DeviceFirmwareUpdateRequest', PROTOCOL_V2_FIRMWARE_UPDATE_RESPONSE_TYPES, {
|
|
46828
46847
|
targets,
|
|
46829
46848
|
}, Object.assign(Object.assign({}, PROTOCOL_V2_FIRMWARE_UPDATE_OPTIONS), { onIntermediateResponse: (response) => {
|
|
46830
|
-
|
|
46831
|
-
if (response.type !== 'DevFirmwareInstallProgress')
|
|
46832
|
-
return;
|
|
46833
|
-
const progress = Number((_a = response.message) === null || _a === void 0 ? void 0 : _a.progress);
|
|
46834
|
-
if (!Number.isFinite(progress))
|
|
46849
|
+
if (response.type !== 'DeviceFirmwareUpdateStatus')
|
|
46835
46850
|
return;
|
|
46836
46851
|
this.postMessage(createUiMessage(UI_REQUEST.FIRMWARE_PROGRESS, {
|
|
46837
46852
|
device: this.device.toMessageObject(),
|
|
46838
|
-
progress:
|
|
46853
|
+
progress: 99,
|
|
46839
46854
|
progressType: 'installingFirmware',
|
|
46840
46855
|
}));
|
|
46841
46856
|
} }));
|
|
@@ -46862,61 +46877,42 @@ class DeviceGetFirmwareUpdateStatus extends BaseMethod {
|
|
|
46862
46877
|
}
|
|
46863
46878
|
run() {
|
|
46864
46879
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46865
|
-
const res = yield this.device.commands.typedCall('
|
|
46880
|
+
const res = yield this.device.commands.typedCall('DeviceFirmwareUpdateStatusGet', 'DeviceFirmwareUpdateStatus', {});
|
|
46866
46881
|
return Promise.resolve(res.message);
|
|
46867
46882
|
});
|
|
46868
46883
|
}
|
|
46869
46884
|
}
|
|
46870
46885
|
|
|
46871
|
-
class
|
|
46886
|
+
class DeviceFactoryInfoSet extends BaseMethod {
|
|
46872
46887
|
init() {
|
|
46873
46888
|
this.requireProtocolV2 = true;
|
|
46874
46889
|
this.skipForceUpdateCheck = true;
|
|
46875
46890
|
this.useDevicePassphraseState = false;
|
|
46876
46891
|
this.params = {
|
|
46877
|
-
|
|
46878
|
-
|
|
46892
|
+
version: this.payload.version,
|
|
46893
|
+
serial_number: this.payload.serial_number,
|
|
46894
|
+
burn_in_completed: this.payload.burn_in_completed,
|
|
46895
|
+
factory_test_completed: this.payload.factory_test_completed,
|
|
46896
|
+
manufacture_time: this.payload.manufacture_time,
|
|
46879
46897
|
};
|
|
46880
46898
|
}
|
|
46881
46899
|
run() {
|
|
46882
|
-
var _a;
|
|
46883
46900
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46884
|
-
const res = yield this.device.commands.typedCall('
|
|
46885
|
-
|
|
46886
|
-
|
|
46887
|
-
|
|
46888
|
-
|
|
46889
|
-
|
|
46890
|
-
|
|
46891
|
-
|
|
46892
|
-
class FactoryDeviceInfoSettings extends BaseMethod {
|
|
46893
|
-
init() {
|
|
46894
|
-
this.requireProtocolV2 = true;
|
|
46895
|
-
this.skipForceUpdateCheck = true;
|
|
46896
|
-
this.useDevicePassphraseState = false;
|
|
46897
|
-
this.params = {
|
|
46898
|
-
serial_no: this.payload.serial_no,
|
|
46899
|
-
serialNo: this.payload.serialNo,
|
|
46900
|
-
cpu_info: this.payload.cpu_info,
|
|
46901
|
-
cpuInfo: this.payload.cpuInfo,
|
|
46902
|
-
pre_firmware: this.payload.pre_firmware,
|
|
46903
|
-
preFirmware: this.payload.preFirmware,
|
|
46904
|
-
};
|
|
46905
|
-
}
|
|
46906
|
-
run() {
|
|
46907
|
-
var _a, _b, _c;
|
|
46908
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46909
|
-
const res = yield this.device.commands.typedCall('FactoryDeviceInfoSettings', 'Success', {
|
|
46910
|
-
serial_no: (_a = this.params.serial_no) !== null && _a !== void 0 ? _a : this.params.serialNo,
|
|
46911
|
-
cpu_info: (_b = this.params.cpu_info) !== null && _b !== void 0 ? _b : this.params.cpuInfo,
|
|
46912
|
-
pre_firmware: (_c = this.params.pre_firmware) !== null && _c !== void 0 ? _c : this.params.preFirmware,
|
|
46901
|
+
const res = yield this.device.commands.typedCall('DeviceFactoryInfoSet', 'Success', {
|
|
46902
|
+
info: {
|
|
46903
|
+
version: this.params.version,
|
|
46904
|
+
serial_number: this.params.serial_number,
|
|
46905
|
+
burn_in_completed: this.params.burn_in_completed,
|
|
46906
|
+
factory_test_completed: this.params.factory_test_completed,
|
|
46907
|
+
manufacture_time: this.params.manufacture_time,
|
|
46908
|
+
},
|
|
46913
46909
|
});
|
|
46914
46910
|
return Promise.resolve(res.message);
|
|
46915
46911
|
});
|
|
46916
46912
|
}
|
|
46917
46913
|
}
|
|
46918
46914
|
|
|
46919
|
-
class
|
|
46915
|
+
class DeviceFactoryInfoGet extends BaseMethod {
|
|
46920
46916
|
init() {
|
|
46921
46917
|
this.requireProtocolV2 = true;
|
|
46922
46918
|
this.skipForceUpdateCheck = true;
|
|
@@ -46925,13 +46921,13 @@ class FactoryGetDeviceInfo extends BaseMethod {
|
|
|
46925
46921
|
}
|
|
46926
46922
|
run() {
|
|
46927
46923
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46928
|
-
const res = yield this.device.commands.typedCall('
|
|
46924
|
+
const res = yield this.device.commands.typedCall('DeviceFactoryInfoGet', 'DeviceFactoryInfo', {});
|
|
46929
46925
|
return Promise.resolve(res.message);
|
|
46930
46926
|
});
|
|
46931
46927
|
}
|
|
46932
46928
|
}
|
|
46933
46929
|
|
|
46934
|
-
class
|
|
46930
|
+
class FilesystemPermissionFix extends BaseMethod {
|
|
46935
46931
|
init() {
|
|
46936
46932
|
this.requireProtocolV2 = true;
|
|
46937
46933
|
this.skipForceUpdateCheck = true;
|
|
@@ -46940,7 +46936,7 @@ class FilesystemFixPermission extends BaseMethod {
|
|
|
46940
46936
|
}
|
|
46941
46937
|
run() {
|
|
46942
46938
|
return __awaiter(this, void 0, void 0, function* () {
|
|
46943
|
-
const res = yield this.device.commands.typedCall('
|
|
46939
|
+
const res = yield this.device.commands.typedCall('FilesystemPermissionFix', 'Success', {});
|
|
46944
46940
|
return Promise.resolve(res.message);
|
|
46945
46941
|
});
|
|
46946
46942
|
}
|
|
@@ -47043,6 +47039,18 @@ function toUint8Array(value) {
|
|
|
47043
47039
|
}
|
|
47044
47040
|
return new Uint8Array(0);
|
|
47045
47041
|
}
|
|
47042
|
+
function getDeviceTransferProgress$1(bytesBeforeChunk, bytesAfterChunk, totalBytes) {
|
|
47043
|
+
if (!Number.isFinite(totalBytes) || totalBytes <= 0) {
|
|
47044
|
+
return 100;
|
|
47045
|
+
}
|
|
47046
|
+
if (bytesBeforeChunk <= 0 && bytesAfterChunk < totalBytes) {
|
|
47047
|
+
return 0;
|
|
47048
|
+
}
|
|
47049
|
+
if (bytesAfterChunk >= totalBytes) {
|
|
47050
|
+
return 100;
|
|
47051
|
+
}
|
|
47052
|
+
return Math.min(Math.max(Math.ceil((bytesAfterChunk / totalBytes) * 100), 1), 99);
|
|
47053
|
+
}
|
|
47046
47054
|
class FileRead extends BaseMethod {
|
|
47047
47055
|
init() {
|
|
47048
47056
|
this.requireProtocolV2 = true;
|
|
@@ -47083,7 +47091,7 @@ class FileRead extends BaseMethod {
|
|
|
47083
47091
|
while (read < totalLength) {
|
|
47084
47092
|
const readLen = Math.min(chunkSize, totalLength - read);
|
|
47085
47093
|
const offset = startOffset + read;
|
|
47086
|
-
const progress = (_e = this.params.uiPercentage) !== null && _e !== void 0 ? _e :
|
|
47094
|
+
const progress = (_e = this.params.uiPercentage) !== null && _e !== void 0 ? _e : getDeviceTransferProgress$1(read, read + readLen, totalLength);
|
|
47087
47095
|
const res = yield this.device.commands.typedCall('FilesystemFileRead', 'FilesystemFile', {
|
|
47088
47096
|
file: {
|
|
47089
47097
|
path: this.params.path,
|
|
@@ -47156,6 +47164,18 @@ function getConfirmedProgress(processedByte, totalSize, written, dataLength) {
|
|
|
47156
47164
|
}
|
|
47157
47165
|
return 100;
|
|
47158
47166
|
}
|
|
47167
|
+
function getDeviceTransferProgress(bytesBeforeChunk, bytesAfterChunk, totalBytes) {
|
|
47168
|
+
if (!Number.isFinite(totalBytes) || totalBytes <= 0) {
|
|
47169
|
+
return 100;
|
|
47170
|
+
}
|
|
47171
|
+
if (bytesBeforeChunk <= 0 && bytesAfterChunk < totalBytes) {
|
|
47172
|
+
return 0;
|
|
47173
|
+
}
|
|
47174
|
+
if (bytesAfterChunk >= totalBytes) {
|
|
47175
|
+
return 100;
|
|
47176
|
+
}
|
|
47177
|
+
return Math.min(Math.max(Math.ceil((bytesAfterChunk / totalBytes) * 100), 1), 99);
|
|
47178
|
+
}
|
|
47159
47179
|
class FileWrite extends BaseMethod {
|
|
47160
47180
|
init() {
|
|
47161
47181
|
var _a, _b;
|
|
@@ -47205,7 +47225,7 @@ class FileWrite extends BaseMethod {
|
|
|
47205
47225
|
const chunk = data.slice(written, chunkEnd);
|
|
47206
47226
|
const offset = startOffset + written;
|
|
47207
47227
|
const isFirstChunk = chunkIndex === 0;
|
|
47208
|
-
const progress = (_e = this.params.uiPercentage) !== null && _e !== void 0 ? _e :
|
|
47228
|
+
const progress = (_e = this.params.uiPercentage) !== null && _e !== void 0 ? _e : getDeviceTransferProgress(offset, offset + chunk.byteLength, totalSize);
|
|
47209
47229
|
const res = yield this.device.commands.typedCall('FilesystemFileWrite', 'FilesystemFile', {
|
|
47210
47230
|
file: {
|
|
47211
47231
|
path: this.params.path,
|
|
@@ -54907,7 +54927,7 @@ class NostrSignEvent extends BaseMethod {
|
|
|
54907
54927
|
const addressN = validatePath(payload.path, 5);
|
|
54908
54928
|
this.params = {
|
|
54909
54929
|
address_n: addressN,
|
|
54910
|
-
event: bytesToHex(Buffer.from(JSON.stringify(payload.event, null, 0), 'utf-8')),
|
|
54930
|
+
event: bytesToHex$1(Buffer.from(JSON.stringify(payload.event, null, 0), 'utf-8')),
|
|
54911
54931
|
};
|
|
54912
54932
|
}
|
|
54913
54933
|
getVersionRange() {
|
|
@@ -55089,8 +55109,8 @@ class LnurlAuth1 extends BaseMethod {
|
|
|
55089
55109
|
{ name: 'k1', type: 'string', required: true },
|
|
55090
55110
|
]);
|
|
55091
55111
|
this.params = {
|
|
55092
|
-
domain: bytesToHex(Buffer.from(payload.domain, 'utf-8')),
|
|
55093
|
-
data: bytesToHex(Buffer.from(payload.k1, 'hex')),
|
|
55112
|
+
domain: bytesToHex$1(Buffer.from(payload.domain, 'utf-8')),
|
|
55113
|
+
data: bytesToHex$1(Buffer.from(payload.k1, 'hex')),
|
|
55094
55114
|
};
|
|
55095
55115
|
}
|
|
55096
55116
|
getVersionRange() {
|
|
@@ -55749,11 +55769,7 @@ class TonSignData extends BaseMethod {
|
|
|
55749
55769
|
};
|
|
55750
55770
|
}
|
|
55751
55771
|
getVersionRange() {
|
|
55752
|
-
return {
|
|
55753
|
-
pro2: {
|
|
55754
|
-
min: '0.0.0',
|
|
55755
|
-
},
|
|
55756
|
-
};
|
|
55772
|
+
return {};
|
|
55757
55773
|
}
|
|
55758
55774
|
run() {
|
|
55759
55775
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -56561,20 +56577,15 @@ var ApiMethods = /*#__PURE__*/Object.freeze({
|
|
|
56561
56577
|
firmwareUpdateV3: FirmwareUpdateV3,
|
|
56562
56578
|
firmwareUpdateV4: FirmwareUpdateV4,
|
|
56563
56579
|
promptWebDeviceAccess: PromptWebDeviceAccess,
|
|
56564
|
-
|
|
56580
|
+
protocolInfoRequest: ProtocolInfoRequest,
|
|
56565
56581
|
ping: Ping,
|
|
56566
56582
|
deviceReboot: DeviceReboot,
|
|
56567
|
-
|
|
56568
|
-
deviceGetOnboardingStatus: DeviceGetOnboardingStatus,
|
|
56583
|
+
deviceInfoGet: DeviceInfoGet,
|
|
56569
56584
|
deviceFirmwareUpdate: DeviceFirmwareUpdate,
|
|
56570
56585
|
deviceGetFirmwareUpdateStatus: DeviceGetFirmwareUpdateStatus,
|
|
56571
|
-
|
|
56572
|
-
|
|
56573
|
-
|
|
56574
|
-
devGetFirmwareUpdateStatus: DeviceGetFirmwareUpdateStatus,
|
|
56575
|
-
factoryDeviceInfoSettings: FactoryDeviceInfoSettings,
|
|
56576
|
-
factoryGetDeviceInfo: FactoryGetDeviceInfo,
|
|
56577
|
-
filesystemFixPermission: FilesystemFixPermission,
|
|
56586
|
+
deviceFactoryInfoSet: DeviceFactoryInfoSet,
|
|
56587
|
+
deviceFactoryInfoGet: DeviceFactoryInfoGet,
|
|
56588
|
+
filesystemPermissionFix: FilesystemPermissionFix,
|
|
56578
56589
|
filesystemFormat: FilesystemFormat,
|
|
56579
56590
|
filesystemDiskControl: FilesystemDiskControl,
|
|
56580
56591
|
fileRead: FileRead,
|
|
@@ -56979,6 +56990,7 @@ const parseInitOptions = (method) => ({
|
|
|
56979
56990
|
deviceId: method === null || method === void 0 ? void 0 : method.payload.deviceId,
|
|
56980
56991
|
deriveCardano: method && hasDeriveCardano(method),
|
|
56981
56992
|
connectProtocol: method === null || method === void 0 ? void 0 : method.payload.connectProtocol,
|
|
56993
|
+
protocolV2DeviceInfoTimeoutMs: method === null || method === void 0 ? void 0 : method.payload.protocolV2DeviceInfoTimeoutMs,
|
|
56982
56994
|
});
|
|
56983
56995
|
let _core;
|
|
56984
56996
|
let _deviceList;
|
|
@@ -57068,8 +57080,13 @@ const callAPI = (context, message) => __awaiter(void 0, void 0, void 0, function
|
|
|
57068
57080
|
return onCallDevice(context, message, method);
|
|
57069
57081
|
});
|
|
57070
57082
|
const handlePreWarmSignal = (context, message, method) => __awaiter(void 0, void 0, void 0, function* () {
|
|
57071
|
-
|
|
57083
|
+
const createAckResponse = () => {
|
|
57084
|
+
completeMethodRequestContext(method);
|
|
57085
|
+
method.dispose();
|
|
57072
57086
|
return createResponseMessage(method.responseID, true, true);
|
|
57087
|
+
};
|
|
57088
|
+
if (!method.connectId) {
|
|
57089
|
+
return createAckResponse();
|
|
57073
57090
|
}
|
|
57074
57091
|
const key = method.getPreWarmKey();
|
|
57075
57092
|
const inflight = preWarmInflight.get(key);
|
|
@@ -57079,11 +57096,11 @@ const handlePreWarmSignal = (context, message, method) => __awaiter(void 0, void
|
|
|
57079
57096
|
}
|
|
57080
57097
|
catch (_b) {
|
|
57081
57098
|
}
|
|
57082
|
-
return
|
|
57099
|
+
return createAckResponse();
|
|
57083
57100
|
}
|
|
57084
57101
|
const doneAt = preWarmDoneAt.get(key);
|
|
57085
57102
|
if (typeof doneAt === 'number' && Date.now() - doneAt <= method.preWarmTtl) {
|
|
57086
|
-
return
|
|
57103
|
+
return createAckResponse();
|
|
57087
57104
|
}
|
|
57088
57105
|
const run = onCallDevice(context, message, method);
|
|
57089
57106
|
preWarmInflight.set(key, run);
|
|
@@ -57392,6 +57409,13 @@ function initDevice(method) {
|
|
|
57392
57409
|
}
|
|
57393
57410
|
if (method.connectId) {
|
|
57394
57411
|
device = _deviceList.getDevice(method.connectId);
|
|
57412
|
+
if (!device && method.name === 'firmwareUpdateV4' && allDevices.length === 1) {
|
|
57413
|
+
const [singleDevice] = allDevices;
|
|
57414
|
+
if (singleDevice.isBootloader()) {
|
|
57415
|
+
Log.debug('firmwareUpdateV4 uses the only bootloader device when connectId changed after reboot');
|
|
57416
|
+
device = singleDevice;
|
|
57417
|
+
}
|
|
57418
|
+
}
|
|
57395
57419
|
}
|
|
57396
57420
|
else if (allDevices.length === 1) {
|
|
57397
57421
|
[device] = allDevices;
|
|
@@ -57976,10 +58000,18 @@ Object.defineProperty(exports, 'PROTO', {
|
|
|
57976
58000
|
enumerable: true,
|
|
57977
58001
|
get: function () { return hdTransport.Messages; }
|
|
57978
58002
|
});
|
|
58003
|
+
Object.defineProperty(exports, 'ResourceType', {
|
|
58004
|
+
enumerable: true,
|
|
58005
|
+
get: function () { return hdTransport.ResourceType; }
|
|
58006
|
+
});
|
|
57979
58007
|
Object.defineProperty(exports, 'TonSignDataType', {
|
|
57980
58008
|
enumerable: true,
|
|
57981
58009
|
get: function () { return hdTransport.TonSignDataType; }
|
|
57982
58010
|
});
|
|
58011
|
+
Object.defineProperty(exports, 'TonWalletVersion', {
|
|
58012
|
+
enumerable: true,
|
|
58013
|
+
get: function () { return hdTransport.TonWalletVersion; }
|
|
58014
|
+
});
|
|
57983
58015
|
exports.CORE_EVENT = CORE_EVENT;
|
|
57984
58016
|
exports.Core = Core;
|
|
57985
58017
|
exports.DEFAULT_PRIORITY = DEFAULT_PRIORITY;
|