diff options
author | Ernesto Castellotti <mail@ernestocastellotti.it> | 2023-01-11 00:55:41 +0100 |
---|---|---|
committer | Simone <26844016+simonebortolin@users.noreply.github.com> | 2023-01-12 00:02:02 +0100 |
commit | 85e80a257f014abf1dae161ad1052d65bb6bea85 (patch) | |
tree | 2b0662a0b06a484f705febb0f4546e4e86978eca /_ont/ont-huawei-ma5671a-root-web.md | |
parent | Moved all root process to rootLantiq.js (diff) | |
download | hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar.gz hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar.bz2 hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar.lz hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar.xz hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.tar.zst hack-gpon.github.io-85e80a257f014abf1dae161ad1052d65bb6bea85.zip |
Diffstat (limited to '')
-rw-r--r-- | _ont/ont-huawei-ma5671a-root-web.md | 75 |
1 files changed, 25 insertions, 50 deletions
diff --git a/_ont/ont-huawei-ma5671a-root-web.md b/_ont/ont-huawei-ma5671a-root-web.md index 9f3eeaf..a68c09d 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/utils.js"></script> <script type="text/javascript" src="/assets/js/rootLantiq.js"></script> <script> if ('serial' in navigator) { @@ -183,58 +184,32 @@ FALCON => saveenv console.log('Error: port not open\n'); return; } - loading("Please disconnect the Huawei MA5671A from the SFP adapter if it is currently plugged in!",0); - try { - await port.open({ baudRate: 115200 }); - } catch (err) { - showError(`Error: ${err.message}`,0); - console.log(`Error: ${err.message}\n`); - return; - } - const textDecoder = new TextDecoderStream(); - const readableStreamClosed = port.readable.pipeTo(textDecoder.writable); - const reader = textDecoder.readable.pipeThrough(new TransformStream(new LineBreakTransformer())).getReader(); - const textEncoderStream = new TextEncoderStream(); - const writerStreamClosed = textEncoderStream.readable.pipeTo(port.writable); - const writer = textEncoderStream.writable.getWriter(); - try { - await lantiqRootUboot(writer, reader, (msg) => { - loading(msg, 0); - }); - showSuccess("Congratulations! Step completed.", 0); - } catch (err) { - showError(`Error: ${err.message}`,0); - console.log(`Error: ${err.message}\n`); - reader.cancel(); - await readableStreamClosed.catch(() => { /* Ignore the error */ }); - writer.close(); - await writerStreamClosed; - await port.close(); - return; - } - try { - await unlockHuaweiShell(writer, reader, (msg) => { + await lantiqRootUboot(port, + (msg) => { + loading(msg, 0); + }, + (err) => { + showError(err, 0); + console.log(err); + }, + () => { + showSuccess("Congratulations! Step completed.", 0); + } + ); + + await unlockHuaweiShell(port, + (msg) => { loading(msg, 1); - }); - - showSuccess("Congratulations! Step completed.",1); - } catch (err) { - showError(`Error: ${err.message}`,1); - console.log(`Error: ${err.message}\n`); - reader.cancel(); - await readableStreamClosed.catch(() => { /* Ignore the error */ }); - writer.close(); - await writerStreamClosed; - await port.close(); - return; - } - - reader.cancel(); - await readableStreamClosed.catch(() => { /* Ignore the error */ }); - writer.close(); - await writerStreamClosed; - await port.close(); + }, + (err) => { + showError(err, 1); + console.log(err); + }, + () => { + showSuccess("Congratulations! Step completed.", 1); + } + ); } </script> |