Hi,

this patch is the work of* *Lee Essen which he posted here
in January.

https://lists.openwrt.org/pipermail/openwrt-devel/2012-January/013602.html

Unfortunately not everything was merged back then. The integration into
the web-ui was lost. I have rebased the patch against the current
trunk and also did a minor fix to make it work against the current
version of the dsl_control.sh script.

Please review an apply.

Patch follows:
---
--- a/modules/admin-full/luasrc/view/admin_status/index.htm
+++ b/modules/admin-full/luasrc/view/admin_status/index.htm
@@ -21,6 +21,7 @@ $Id: index.htm 9069 2012-08-17 15:06:46Z
        local has_dhcp = luci.fs.access("/etc/config/dhcp")
        local has_wifi = luci.fs.stat("/etc/config/wireless")
              has_wifi = has_wifi and has_wifi.size > 0
+       local has_dsl = luci.fs.stat("/etc/init.d/dsl_control")
 
        if luci.http.formvalue("status") == "1" then
                local ntm = require "luci.model.network".init()
@@ -79,6 +80,12 @@ $Id: index.htm 9069 2012-08-17 15:06:46Z
                        }
                end
 
+               if has_dsl then
+                       local dsl_stat = luci.sys.exec("/etc/init.d/dsl_control 
lucistat")
+                       local dsl_func = loadstring(dsl_stat)
+                       rv.dsl = dsl_func()
+               end
+
                luci.http.prepare_content("application/json")
                luci.http.write_json(rv)
 
@@ -213,6 +220,29 @@ $Id: index.htm 9069 2012-08-17 15:06:46Z
                        }
                        <% end %>
 
+                       <% if has_dsl then %>
+                               var dsl_i = document.getElementById('dsl_i');
+                               var dsl_s = document.getElementById('dsl_s');
+
+                               var s = String.format(
+                                       '<strong><%:Status%>: </strong>%s<br 
/>' +
+                                       '<strong><%:Line State%>: </strong>%s 
[0x%x]<br />' +
+                                       '<strong><%:Line Speed%>: </strong>%s/s 
/ %s/s<br />' +
+                                       '<strong><%:Line Attenuation%>: 
</strong>%s dB / %s dB<br />' +
+                                       '<strong><%:Noise Margin%>: </strong>%s 
dB / %s dB<br />',
+                                               info.dsl.line_state, 
info.dsl.line_state_detail,
+                                               info.dsl.line_state_num,
+                                               info.dsl.data_rate_down_s, 
info.dsl.data_rate_up_s,
+                                               info.dsl.line_attenuation_down, 
info.dsl.line_attenuation_up,
+                                               info.dsl.noise_margin_down, 
info.dsl.noise_margin_up
+                               );
+                               dsl_s.innerHTML = 
String.format('<small>%s</small>', s);
+                               dsl_i.innerHTML = String.format(
+                                       '<img 
src="<%=resource%>/icons/ethernet.png" />' +
+                                       '<br /><small>ADSL</small>'
+                               );
+                       <% end %>
+
                        <% if has_dhcp then %>
                        var ls = document.getElementById('lease_status_table');
                        if (ls)
@@ -588,6 +618,20 @@ $Id: index.htm 9069 2012-08-17 15:06:46Z
        </table>
 </fieldset>
 <% end %>
+
+<% if has_dsl then %>
+<fieldset class="cbi-section">
+       <legend><%:ADSL%></legend>
+       <table width="100%" cellspacing="10">
+               <tr><td width="33%" style="vertical-align:top"><%:ADSL 
Status%></td><td>
+                       <table><tr>
+                               <td id="dsl_i" style="width:16px; 
text-align:center; padding:3px"><img 
src="<%=resource%>/icons/ethernet_disabled.png" /><br /><small>?</small></td>
+                               <td id="dsl_s" style="vertical-align:middle; 
padding: 3px"><em><%:Collecting data...%></em></td>
+                       </tr></table>
+               </td></tr>
+       </table>
+</fieldset>
+<% end %>
 
 <% if has_wifi then %>
 <fieldset class="cbi-section">

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to