summaryrefslogtreecommitdiffstats
path: root/assets/js
diff options
context:
space:
mode:
authorErnesto Castellotti <mail@ernestocastellotti.it>2023-01-11 19:16:39 +0100
committerSimone <26844016+simonebortolin@users.noreply.github.com>2023-01-12 00:02:02 +0100
commit464daa22264ca8c93701d0810d2a8aaf32c6bf54 (patch)
treeec94a1b4a1c0cf9943c06ee49f7aa3124191a491 /assets/js
parentRename utils.js to serialUtil.js (diff)
downloadhack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar.gz
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar.bz2
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar.lz
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar.xz
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.tar.zst
hack-gpon.github.io-464daa22264ca8c93701d0810d2a8aaf32c6bf54.zip
Diffstat (limited to 'assets/js')
-rw-r--r--assets/js/rootLantiq.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/assets/js/rootLantiq.js b/assets/js/rootLantiq.js
index d68d314..480cf6e 100644
--- a/assets/js/rootLantiq.js
+++ b/assets/js/rootLantiq.js
@@ -1,4 +1,4 @@
-async function waitUbootStop(writer, reader, outputMsgCallback) {
+async function waitUbootStop(writer, reader, sfpModel, outputMsgCallback) {
const interval = setInterval(function() {
writer.write(String.fromCharCode(3));
}, 10);
@@ -7,7 +7,7 @@ async function waitUbootStop(writer, reader, outputMsgCallback) {
const { value, done } = await reader.read();
if (value.startsWith('U-Boot')) {
- outputMsgCallback("Root in progress: Trigger characters received. DO NOT TOUCH THE HUAWEI MA5671A UNTIL THE PROCEDURE IS COMPLETED!");
+ outputMsgCallback(`Root in progress: Trigger characters received. DO NOT TOUCH THE ${sfpModel} UNTIL THE PROCEDURE IS COMPLETED!`);
await delay(5000);
clearInterval(interval);
break;
@@ -63,17 +63,17 @@ async function waitFailbackShell(writer, reader, outputMsgCallback) {
}
}
-async function lantiqRootUboot(port, outputMsgCallback, outputErrorCallback, successCallback, baudRate = 115200) {
- outputMsgCallback("Please disconnect the Huawei MA5671A from the SFP adapter if it is currently plugged in!");
+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);
try {
await delay(10000);
- outputMsgCallback("Now you need to insert the Huawei MA5671A into the SFP adapter, if the procedure does not go ahead, check the connections and then remove and reconnect the Huawei MA5671A again",0);
+ 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`);
while(true) {
- await waitUbootStop(writer, reader, outputMsgCallback);
+ await waitUbootStop(writer, reader, sfpModel, outputMsgCallback);
const ubootUnlocked = await checkUbootUnlocked(reader);
if (ubootUnlocked == true) {
@@ -97,16 +97,16 @@ async function lantiqRootUboot(port, outputMsgCallback, outputErrorCallback, suc
await delay(1000);
}
- successCallback();
+ await closePortLineBreak(port, reader, writer, readableStreamClosed, writerStreamClosed);
+ return true;
} catch (err) {
outputErrorCallback(`Error: ${err.message}`);
- } finally {
await closePortLineBreak(port, reader, writer, readableStreamClosed, writerStreamClosed);
- return;
+ return false;
}
}
-async function unlockHuaweiShell(port, outputMsgCallback, outputErrorCallback, successCallback, baudRate = 115200) {
+async function unlockHuaweiShell(port, outputMsgCallback, outputErrorCallback, baudRate = 115200) {
const { reader, writer, readableStreamClosed, writerStreamClosed } = await openPortLineBreak(port, baudRate, outputErrorCallback);
try {
@@ -121,11 +121,11 @@ async function unlockHuaweiShell(port, outputMsgCallback, outputErrorCallback, s
outputMsgCallback("Root in progress: Umount rootfs partitions...");
writer.write('umount /overlay && umount -a\n');
await delay(1000);
- successCallback();
+ await closePortLineBreak(port, reader, writer, readableStreamClosed, writerStreamClosed);
+ return true;
} catch (err) {
outputErrorCallback(`Error: ${err.message}`);
- } finally {
await closePortLineBreak(port, reader, writer, readableStreamClosed, writerStreamClosed);
- return;
+ return false;
}
}