# $language = "VBScript" | |
# $interface = "1.0" | |
Sub SendApplicationCommand(shell_command) | |
crt.Screen.Send shell_command & VbCr & VbCr | |
crt.sleep 1000 | |
End Sub | |
Sub main | |
pon_ni = inputbox("PON NI: [0-15]" ) | |
if pon_ni < 8 then | |
SendApplicationCommand "/board/i2c/dev_change dev=sw2" | |
crt.sleep 100 | |
SendApplicationCommand "/board/i2c/dev_write width=8 addr=0 val=0x" & hex(2 ^ (7 - pon_ni)) &" " | |
crt.sleep 10 | |
else | |
SendApplicationCommand "/board/i2c/dev_change dev=sw3" | |
crt.sleep 100 | |
if pon_ni < 12 then | |
SendApplicationCommand "/board/i2c/dev_write width=8 addr=0 val=0x" & hex(2 ^ ( pon_ni - 4)) &" " | |
crt.sleep 10 | |
else | |
SendApplicationCommand "/board/i2c/dev_write width=8 addr=0 val=0x" & hex(2 ^ ( pon_ni - 12)) &" " | |
crt.sleep 10 | |
end if | |
end if | |
SendApplicationCommand "/board/i2c/dev_change sfp2 " | |
crt.sleep 10 | |
SendApplicationCommand "/board/i2c/dev_read width=8 addr=0x68" | |
crt.sleep 10 | |
SendApplicationCommand "/board/i2c/dev_read width=8 addr=0x69" | |
crt.sleep 10 | |
End Sub |