The script I used is as provided below, and was used most recently on some TP-Link and Dynalink units, is quite brief (aka Q&D) and does the job. Coded for personal use, it is not "industrial strength" as in its present form it must run from its own folder, doesn't catch any errors etc. It may need small adjustments for slightly differing modem commands, slower telnet responses etc. The command adsl may be found for example as adslcfg in some models, though arguments are usually unchanged. Because of inbuilt waits it takes about 6 seconds to produce the charts. This code does not write config data to the modem.
I would appreciate if readers who find it useful would post back with improvements, or changes for a particular modem, or superior graphics. Needless to add, there are no guarantees.
This is a Tcl expect script. Bash users may need to install expect. Gnuplot does the drawing.
adsltool.sh:
Code: Select all
#!/usr/bin/expect
#-------------------------------------------------------------------
# Chart Hlog, QLN and SNR arrays from Broadcom chip modems
# (TP-Link, Dynalink, etc) - Dazzled 2013
#-------------------------------------------------------------------
set untitled 1
set timeout 1
log_user 0
spawn telnet "192.168.1.1"
expect "Login name: " {send "admin\r"}
expect "Password: " {send "admin\r"}
foreach cmd {"--QLN" "--SNR" "--Hlog" "--Bits"} outf {"qln.dat" "snr.dat" "hlg.dat" "bit.dat"} {
set fp [open "$outf" w]
expect "> " {send "adsl info $cmd\r"}
expect "\n" {set buf "$expect_out(buffer)"; puts -nonewline $fp "$buf"; exp_continue}
close $fp
if {$untitled} {set header [exec sed -n "/Channel/p" "$outf"]; set untitled 0 }
exec sed --in-place "1, 5d" "$outf"
}
expect ">" {send "logout\r"}
exec echo -e "set title \"$header\"" > plot1.cmd
exec gnuplot -persist plot.cmd
exit
Code: Select all
#-------------------------------------------------------------------
#plot commands called by adsltool.sh -- Dazzled 2013
#-------------------------------------------------------------------
set term wxt title "Modem Line Test"
set lmargin 5
set rmargin 5
set grid x front
set mxtics 5
set xlabel "Tone No"
set xrange [:511]
#--------------------lower plot--------------
set multiplot layout 2, 1
set origin 0, 0
set x2range [0:2208]
set x2tics nomirror out ("142 kHz" 142,"500" 500,"750" 750,"1000" 1000,"1250" 1250,"1500" 1500,"2000 kHz" 2000)
set ylabel "Hlog, QLN dB"
set ytics nomirror
set y2label "SNR dB"
set y2tics nomirror
plot "qln.dat" using 1:2 with lines axis x1y1 title "QLN", \
"hlg.dat" using 1:2 with lines axis x1y1 title "Hlog", \
"snr.dat" using 1:2 with histeps axis x1y2 title "SNR"
#--------------------upper plot-------------
load "plot1.cmd"
set origin 0, .5
unset x2tics
unset xlabel
set grid x y front
set ylabel "Bits"
set y2label "Bits"
set style fill solid
plot "bit.dat" using 1:2 with boxes title "BPT"
unset multiplot