summaryrefslogtreecommitdiffstats
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--assets/js/rootLantiq.js10
-rw-r--r--assets/js/serialUtil.js10
2 files changed, 8 insertions, 12 deletions
diff --git a/assets/js/rootLantiq.js b/assets/js/rootLantiq.js
index 480cf6e..ff0f478 100644
--- a/assets/js/rootLantiq.js
+++ b/assets/js/rootLantiq.js
@@ -64,11 +64,12 @@ async function waitFailbackShell(writer, reader, outputMsgCallback) {
}
async function lantiqRootUboot(port, sfpModel, outputMsgCallback, outputErrorCallback, baudRate = 115200) {
- outputMsgCallback(`Please disconnect the ${sfpModel} from the SFP adapter if it is currently plugged in!`);
-
- const { reader, writer, readableStreamClosed, writerStreamClosed } = await openPortLineBreak(port, baudRate, outputErrorCallback);
+ let reader,writer, readableStreamClosed, writerStreamClosed;
try {
+ outputMsgCallback(`Please disconnect the ${sfpModel} from the SFP adapter if it is currently plugged in!`);
+ ({ reader, writer, readableStreamClosed, writerStreamClosed } = await openPortLineBreak(port, baudRate));
+
await delay(10000);
outputMsgCallback(`Now you need to insert the ${sfpModel} into the SFP adapter, if the procedure does not go ahead, check the connections and then remove and reconnect the ${sfpModel} again`);
@@ -107,9 +108,10 @@ async function lantiqRootUboot(port, sfpModel, outputMsgCallback, outputErrorCal
}
async function unlockHuaweiShell(port, outputMsgCallback, outputErrorCallback, baudRate = 115200) {
- const { reader, writer, readableStreamClosed, writerStreamClosed } = await openPortLineBreak(port, baudRate, outputErrorCallback);
+ let reader,writer, readableStreamClosed, writerStreamClosed;
try {
+ ({ reader, writer, readableStreamClosed, writerStreamClosed } = await openPortLineBreak(port, baudRate));
outputMsgCallback("Root in progress: Rebooting...");
writer.write('reset\n');
await delay(1000);
diff --git a/assets/js/serialUtil.js b/assets/js/serialUtil.js
index c4d6d84..6e9d155 100644
--- a/assets/js/serialUtil.js
+++ b/assets/js/serialUtil.js
@@ -2,14 +2,8 @@ function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
-async function openPortLineBreak(port, baudRate, outputErrorCallback) {
- try {
- await port.open({ baudRate: baudRate });
- } catch (err) {
- outputErrorCallback(`Error: ${err.message}`);
- return;
- }
-
+async function openPortLineBreak(port, baudRate) {
+ await port.open({ baudRate: baudRate });
const textDecoder = new TextDecoderStream();
const readableStreamClosed = port.readable.pipeTo(textDecoder.writable);
const reader = await textDecoder.readable.pipeThrough(new TransformStream(new LineBreakTransformer())).getReader();