summaryrefslogtreecommitdiffstats
path: root/_ont
diff options
context:
space:
mode:
authorSimone <26844016+simonebortolin@users.noreply.github.com>2023-02-10 21:20:45 +0100
committerGitHub <noreply@github.com>2023-02-10 21:20:45 +0100
commit4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd (patch)
tree26c757d54747d941ad219b7545cc2f8738962597 /_ont
parentFS: Always use the original file (immutable /rom squashfs) to set the ONU hardware version (#148) (diff)
downloadhack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar.gz
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar.bz2
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar.lz
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar.xz
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.tar.zst
hack-gpon.github.io-4649c57e55dba15ba5f5b014ee7bcf89cea4cdfd.zip
Diffstat (limited to '_ont')
-rw-r--r--_ont/ont-huawei-ma5671a-rooted.md103
1 files changed, 17 insertions, 86 deletions
diff --git a/_ont/ont-huawei-ma5671a-rooted.md b/_ont/ont-huawei-ma5671a-rooted.md
index 04b15a2..95d579e 100644
--- a/_ont/ont-huawei-ma5671a-rooted.md
+++ b/_ont/ont-huawei-ma5671a-rooted.md
@@ -12,96 +12,27 @@ layout: default
## Web procedure
-1. Get `sfp_a2_info` and paste into the form
-
-<form id="huawei-rooted">
- <div class="form-floating mb-3">
- <input type="text" class="form-control" placeholder="sfp_a2_info input" name="sfp-a2-info" id="sfp-a2-info" >
- <label for="sfp-a2-info">sfp_a2_info input</label>
- </div>
- <div class="form-floating mb-3">
- <input type="text" class="form-control" placeholder="GPON S/N" name="gpon-sn" id="gpon-sn" value="" pattern="([A-Z]{4}[0-9A-Za-z]{8})|([0-9A-F]{8}[0-9A-Za-z]{8})">
- <label for="gpon-sn">GPON S/N in format GPON12345678 or 47504F4E12345678, empty for not modify it</label>
- </div>
- <div class="form-floating mb-3">
- <input type="text" class="form-control" placeholder="GPON Ploam Password" name="gpon-password" id="gpon-password" value="" maxlength="22">
- <label for="gpon-password">GPON S/N in format 1234567890, 31323334353637383930 or 0x31323334353637383930, empty for not modify it</label>
- </div>
- <div class="form-floating mb-3">
- <input type="text" class="form-control" placeholder="MAC address" name="mac-addr" id="mac-addr" value="" pattern="[0-9A-Fa-f]{2}[:-]?[0-9A-Fa-f]{2}[:-]?[0-9A-Fa-f]{2}[:-]?[0-9A-Fa-f]{2}[:-]?[0-9A-Fa-f]{2}[:-]?[0-9A-Fa-f]{2}">
- <label for="mac-addr">MAC Address in format 48:57:02:da:be:ef, 48-57-02-da-be-ef or 485702dabeef, empty for not modify it</label>
- </div>
- <div class="mb-3">
- <input type="submit" class="btn btn-primary" value="Calculate!">
- </div>
- <div class="form-floating mb-3">
- <input readonly class="form-control" type="text" id="result" placeholder="sfp_a2_info result">
- <label for="result">sfp_a2_info result</label>
- </div>
-</form>
-<script>
- var form = document.getElementById('huawei-rooted');
- form.addEventListener('submit',(event) => {
- event.preventDefault();
- var fomrdata = new FormData(form);
- var sfp_a2_info = fomrdata.get('sfp-a2-info');
- var sfp_a2_info_arr = sfp_a2_info.split('@');
- if(sfp_a2_info_arr.length > 10 && sfp_a2_info_arr[0] === 'begin-base64 644 sfp_a2_info ') {
- var gpon_sn = fomrdata.get('gpon-sn');
- if(gpon_sn.length == 12) {
- var vendor_id = gpon_sn.substring(0, 4);
- var progressive = gpon_sn.substring(4);
- var vendor_id_hex = ([...vendor_id].map((elem, n) => Number(vendor_id.charCodeAt(n)).toString(16)).join(''));
- gpon_sn = vendor_id_hex+progressive;
- }
- if(gpon_sn.length == 16) {
- var hex = base64ToHex(sfp_a2_info_arr[6]);
- hex = hex.substring(0,16) + gpon_sn + hex.substring(32);
- sfp_a2_info_arr[6] = hexToBase64(hex);
- }
- var gpon_password = fomrdata.get('gpon-password');
- if(gpon_password.length > 0) {
- if(gpon_password.length <= 10) {
- gpon_password = ([...gpon_password].map((elem, n) => Number(gpon_password.charCodeAt(n)).toString(16)).join(''));
- gpon_password += '0'.repeat(20-gpon_password.length);
- }
- else if(gpon_password.length == 22 && gpon_password.substring(0,2) === '0x') {
- gpon_password = gpon_password.substring(3);
- }
- if(gpon_password.length == 20) {
- var hex = base64ToHex(sfp_a2_info_arr[5]);
- hex = hex.substring(0,22) + gpon_password + hex.substring(42);
- sfp_a2_info_arr[5] = hexToBase64(hex);
- }
- }
- var mac_addr = fomrdata.get('mac-addr');
- if(mac_addr.length == 17) {
- mac_addr = mac_addr.replace('-','');
- mac_addr = mac_addr.replace(':','');
- }
- if(mac_addr.length == 12) {
- var hex = base64ToHex(sfp_a2_info_arr[9]);
- hex = hex.substring(0,48) + mac_addr + hex.substring(61);
- sfp_a2_info_arr[9] = hexToBase64(hex);
- }
- document.getElementById('result').value = sfp_a2_info_arr.join('@');
- } else {
- document.getElementById('result').value = 'sfp_a2_info variable in wrong format!';
- }
- });
- function hexToBase64(hexStr) {
- return btoa([...hexStr].reduce((acc, _, i) => acc += !(i - 1 & 1) ? String.fromCharCode(parseInt(hexStr.substring(i - 1, i + 1), 16)) : '', ''));
- }
- function base64ToHex(base64Value) {
- return [...atob(base64Value)].map(c=> c.charCodeAt(0).toString(16).padStart(2,0)).join('');
- }
-</script>
+1. Get `fw_printenv sfp_a2_info` and paste into the form
+
+<div id="app">
+ <vue-lantiq-eeprom type='eeprom-rooted-edit'></vue-lantiq-eeprom>
+</div>
+<script src="https://unpkg.com/vue@latest"></script>
+<script src="https://cdn.jsdelivr.net/npm/vue3-sfc-loader"></script>
+<script src="/assets/js/vue-eeprom.js"></script>
+
+{% include alert.html content="Executing these commands requires a minimum of familiarity with `vim`. If you do not know `vim`, follow the commands precisely." alert="Danger" icon="svg-warning" color="red" %}
{:style="counter-reset:none"}
-2. Transfer modified file back into variable `sfp_a2_info`, replace `<output>` with the output of web form.
+1. Copy the script's output to the clipboard
+1. Run the comman `vim /tmp/sfp_a2.txt` in the stick
+1. Press the right mouse button in the terminal or `CTRL`+`V`
+1. Press `ESC` command from keyboard
+1. Type `:wq`
+1. Run:
```shell
-fw_setenv sfp_a2_info "<output>"
+fw_setenv sfp_a2_info ($cat /tmp/sfp_a2.txt)
```
## Temporary file procedure