diff options
author | Ernesto Castellotti <mail@ernestocastellotti.it> | 2023-01-10 19:15:22 +0100 |
---|---|---|
committer | Simone <26844016+simonebortolin@users.noreply.github.com> | 2023-01-12 00:02:02 +0100 |
commit | 2ad30ba1e95060479d09728e37954b4238438b00 (patch) | |
tree | 465fbf51062110be6236b8cc760cc81a5cdf828e | |
parent | fix (#99) (diff) | |
download | hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar.gz hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar.bz2 hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar.lz hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar.xz hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.tar.zst hack-gpon.github.io-2ad30ba1e95060479d09728e37954b4238438b00.zip |
Diffstat (limited to '')
-rw-r--r-- | _ont/ont-huawei-ma5671a-root-web.md | 66 | ||||
-rw-r--r-- | assets/js/rootLantiq.js | 68 |
2 files changed, 69 insertions, 65 deletions
diff --git a/_ont/ont-huawei-ma5671a-root-web.md b/_ont/ont-huawei-ma5671a-root-web.md index 8a1ee74..0dab812 100644 --- a/_ont/ont-huawei-ma5671a-root-web.md +++ b/_ont/ont-huawei-ma5671a-root-web.md @@ -103,6 +103,7 @@ FALCON => saveenv </div> </div> </div> +<script type="text/javascript" src="/assets/js/rootLantiq.js"></script> <script> if ('serial' in navigator) { document.getElementById('start-button').disabled = false; @@ -166,71 +167,6 @@ FALCON => saveenv rootStep[i].classList.add('success'); rootStepText[i].textContent = message; } - function delay(ms) { - return new Promise(resolve => setTimeout(resolve, ms)); - } - async function waitUbootStop(writer, reader) { - const interval = setInterval(function() { - writer.write(String.fromCharCode(3)); - }, 10); - - while (true) { - const { value, done } = await reader.read(); - - if (value.startsWith('U-Boot')) { - loading("Root in progress: Trigger characters received. DO NOT TOUCH THE HUAWEI MA5671A UNTIL THE PROCEDURE IS COMPLETED!",0); - await delay(5000); - clearInterval(interval); - break; - } - } - } - async function checkUbootUnlocked(reader) { - while (true) { - try { - const { value, done } = await Promise.race([ - reader.read(), - new Promise((_, reject) => setTimeout(reject, 2000, new Error("timeout"))) - ]); - - if (value.startsWith('Press SPACE to delay and Ctrl-C to abort autoboot')) { - return true; - } - } catch (err) { - return false; - } - } - } - async function waitFailbackShell(writer, reader) { - while (true) { - const { value, done } = await reader.read(); - - if (value.startsWith('Press the [f] key and hit [enter] to enter failsafe mode')) { - const interval = setInterval(function() { - writer.write('f\n'); - }, 10); - - loading("Root in progress: Trigger characters received. Waiting for boot to end...",1); - await delay(3000); - clearInterval(interval); - break; - } - } - - const interval = setInterval(function() { - writer.write(String.fromCharCode(10)); - }, 10); - - while (true) { - const { value, done } = await reader.read(); - - if (value.includes('root@(none)')) { - await delay(1000); - clearInterval(interval); - break; - } - } - } async function root({ signal } = {}) { loading("Waiting for the user to choose the port",0); pause("",1); diff --git a/assets/js/rootLantiq.js b/assets/js/rootLantiq.js new file mode 100644 index 0000000..24858c1 --- /dev/null +++ b/assets/js/rootLantiq.js @@ -0,0 +1,68 @@ +function delay(ms) { + return new Promise(resolve => setTimeout(resolve, ms)); +} + +async function waitUbootStop(writer, reader) { + const interval = setInterval(function() { + writer.write(String.fromCharCode(3)); + }, 10); + + while (true) { + const { value, done } = await reader.read(); + + if (value.startsWith('U-Boot')) { + loading("Root in progress: Trigger characters received. DO NOT TOUCH THE HUAWEI MA5671A UNTIL THE PROCEDURE IS COMPLETED!",0); + await delay(5000); + clearInterval(interval); + break; + } + } +} + +async function checkUbootUnlocked(reader) { + while (true) { + try { + const { value, done } = await Promise.race([ + reader.read(), + new Promise((_, reject) => setTimeout(reject, 2000, new Error("timeout"))) + ]); + + if (value.startsWith('Press SPACE to delay and Ctrl-C to abort autoboot')) { + return true; + } + } catch (err) { + return false; + } + } +} + +async function waitFailbackShell(writer, reader) { + while (true) { + const { value, done } = await reader.read(); + + if (value.startsWith('Press the [f] key and hit [enter] to enter failsafe mode')) { + const interval = setInterval(function() { + writer.write('f\n'); + }, 10); + + loading("Root in progress: Trigger characters received. Waiting for boot to end...",1); + await delay(3000); + clearInterval(interval); + break; + } + } + + const interval = setInterval(function() { + writer.write(String.fromCharCode(10)); + }, 10); + + while (true) { + const { value, done } = await reader.read(); + + if (value.includes('root@(none)')) { + await delay(1000); + clearInterval(interval); + break; + } + } +} |