@onekeyfe/hd-core 0.3.6-alpha.0 → 0.3.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uploadFirmware.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/uploadFirmware.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAU,WAAW,EAA+B,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,6BAA6B,CAAC;AA6CnF,eAAO,MAAM,cAAc,eAAsB,MAAM,kBAKtD,CAAC;AAEF,eAAO,MAAM,cAAc,eACb,UAAU,GAAG,KAAK,aACnB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,eACD,MAAM,cAAc,kEAqElC,CAAC;
|
|
1
|
+
{"version":3,"file":"uploadFirmware.d.ts","sourceRoot":"","sources":["../../../src/api/firmware/uploadFirmware.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAU,WAAW,EAA+B,MAAM,cAAc,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAwB,MAAM,6BAA6B,CAAC;AA6CnF,eAAO,MAAM,cAAc,eAAsB,MAAM,kBAKtD,CAAC;AAEF,eAAO,MAAM,cAAc,eACb,UAAU,GAAG,KAAK,aACnB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,eACD,MAAM,cAAc,kEAqElC,CAAC;AAuJF,eAAO,MAAM,cAAc,cAAqB,SAAS,YAAY,MAAM,QAAQ,WAAW,qBAY7F,CAAC;AAEF,eAAO,MAAM,eAAe,cACf,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,UACN,WAAW,qBAwBpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,cAChB,SAAS,yBACG,WAAW,KAAK,IAAI,UACnC,MAAM,UACN,WAAW,qBAQpB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14084,9 +14084,9 @@ const newTouchUpdateProcess = (updateType, postMessage, device, { payload }) =>
|
|
|
14084
14084
|
return response;
|
|
14085
14085
|
});
|
|
14086
14086
|
const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, overwrite, progress) => __awaiter(void 0, void 0, void 0, function* () {
|
|
14087
|
-
var _a, _b, _c, _d, _e;
|
|
14087
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14088
14088
|
const writeFunc = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
14089
|
-
var
|
|
14089
|
+
var _g;
|
|
14090
14090
|
const typedCall = device.getCommands().typedCall.bind(device.getCommands());
|
|
14091
14091
|
const writeRes = yield typedCall('EmmcFileWrite', 'EmmcFile', {
|
|
14092
14092
|
file: {
|
|
@@ -14101,7 +14101,7 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
|
|
|
14101
14101
|
});
|
|
14102
14102
|
if (writeRes.type !== 'EmmcFile') {
|
|
14103
14103
|
if (writeRes.type === 'CallMethodError') {
|
|
14104
|
-
if (((
|
|
14104
|
+
if (((_g = writeRes.message.error) !== null && _g !== void 0 ? _g : '').indexOf(SESSION_ERROR) > -1) {
|
|
14105
14105
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, SESSION_ERROR);
|
|
14106
14106
|
}
|
|
14107
14107
|
}
|
|
@@ -14121,14 +14121,20 @@ const emmcFileWriteWithRetry = (device, filePath, chunkLength, offset, chunk, ov
|
|
|
14121
14121
|
if (retryCount === 0) {
|
|
14122
14122
|
throw hdShared.ERRORS.TypedError(hdShared.HardwareErrorCode.RuntimeError, 'emmc file write firmware error');
|
|
14123
14123
|
}
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14124
|
+
const env = DataManager.getSettings('env');
|
|
14125
|
+
if (env === 'react-native') {
|
|
14126
|
+
yield wait(3000);
|
|
14127
|
+
yield ((_a = device.deviceConnector) === null || _a === void 0 ? void 0 : _a.acquire(device.originalDescriptor.id, null, true));
|
|
14128
|
+
yield device.initialize();
|
|
14129
|
+
}
|
|
14130
|
+
else if (error.message.indexOf(SESSION_ERROR) > -1) {
|
|
14131
|
+
const deviceDiff = yield ((_b = device.deviceConnector) === null || _b === void 0 ? void 0 : _b.enumerate());
|
|
14132
|
+
const devicesDescriptor = (_c = deviceDiff === null || deviceDiff === void 0 ? void 0 : deviceDiff.descriptors) !== null && _c !== void 0 ? _c : [];
|
|
14127
14133
|
const { deviceList } = yield DevicePool.getDevices(devicesDescriptor, undefined);
|
|
14128
|
-
if (deviceList.length === 1 && ((
|
|
14134
|
+
if (deviceList.length === 1 && ((_e = (_d = deviceList[0]) === null || _d === void 0 ? void 0 : _d.features) === null || _e === void 0 ? void 0 : _e.bootloader_mode)) {
|
|
14129
14135
|
device.updateFromCache(deviceList[0]);
|
|
14130
14136
|
yield device.acquire();
|
|
14131
|
-
device.getCommands().mainId = (
|
|
14137
|
+
device.getCommands().mainId = (_f = device.mainId) !== null && _f !== void 0 ? _f : '';
|
|
14132
14138
|
}
|
|
14133
14139
|
}
|
|
14134
14140
|
yield wait(3000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onekeyfe/hd-core",
|
|
3
|
-
"version": "0.3.6
|
|
3
|
+
"version": "0.3.6",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "OneKey",
|
|
6
6
|
"homepage": "https://github.com/OneKeyHQ/hardware-js-sdk#readme",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"url": "https://github.com/OneKeyHQ/hardware-js-sdk/issues"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@onekeyfe/hd-shared": "^0.3.6
|
|
28
|
-
"@onekeyfe/hd-transport": "^0.3.6
|
|
27
|
+
"@onekeyfe/hd-shared": "^0.3.6",
|
|
28
|
+
"@onekeyfe/hd-transport": "^0.3.6",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"bignumber.js": "^9.0.2",
|
|
31
31
|
"bytebuffer": "^5.0.1",
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"@types/semver": "^7.3.9",
|
|
44
44
|
"ripple-keypairs": "^1.1.4"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "e0ea70bfa9176a2ec88e4391622a99a84c4841ed"
|
|
47
47
|
}
|
|
@@ -231,7 +231,12 @@ const emmcFileWriteWithRetry = async (
|
|
|
231
231
|
if (retryCount === 0) {
|
|
232
232
|
throw ERRORS.TypedError(HardwareErrorCode.RuntimeError, 'emmc file write firmware error');
|
|
233
233
|
}
|
|
234
|
-
|
|
234
|
+
const env = DataManager.getSettings('env');
|
|
235
|
+
if (env === 'react-native') {
|
|
236
|
+
await wait(3000);
|
|
237
|
+
await device.deviceConnector?.acquire(device.originalDescriptor.id, null, true);
|
|
238
|
+
await device.initialize();
|
|
239
|
+
} else if (error.message.indexOf(SESSION_ERROR) > -1) {
|
|
235
240
|
const deviceDiff = await device.deviceConnector?.enumerate();
|
|
236
241
|
const devicesDescriptor = deviceDiff?.descriptors ?? [];
|
|
237
242
|
const { deviceList } = await DevicePool.getDevices(devicesDescriptor, undefined);
|