Author: richard
Date: Fri Apr 3 08:38:53 2009
New Revision: 5120
URL: http://svn.slimdevices.com/jive?rev=5120&view=rev
Log:
Bug: N/A
Description:
Port forward the diagnostics applet.
Modified:
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/Diagnostics/DiagnosticsApplet.lua
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua
Modified:
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/Diagnostics/DiagnosticsApplet.lua
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/Diagnostics/DiagnosticsApplet.lua?rev=5120&r1=5119&r2=5120&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/Diagnostics/DiagnosticsApplet.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/applets/Diagnostics/DiagnosticsApplet.lua
Fri Apr 3 08:38:53 2009
@@ -11,7 +11,7 @@
local Applet = require("jive.Applet")
local DNS = require("jive.net.DNS")
-local Wireless = require("jive.net.Wireless")
+local Networking = require("jive.net.Networking")
local Process = require("jive.net.Process")
local SocketTcp = require("jive.net.SocketTcp")
local SlimServer = require("jive.slim.SlimServer")
@@ -245,8 +245,10 @@
self:setValue("MAC_ADDRESS", mac)
-- networks
- local iface = Wireless(jnt, "eth0")
- self:wlanStatus(iface)
+ local iface = Networking:wirelessInterface()
+ local wlan = Networking(jnt, iface)
+
+ self:wlanStatus(wlan)
-- servers
Modified:
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua
URL:
http://svn.slimdevices.com/jive/7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua?rev=5120&r1=5119&r2=5120&view=diff
==============================================================================
---
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua
(original)
+++
7.4/trunk/squeezeplay/src/squeezeplay_squeezeos/share/jive/net/Networking.lua
Fri Apr 3 08:38:53 2009
@@ -496,6 +496,59 @@
local status = {}
for k,v in string.gmatch(statusStr, "([^=]+)=([^\n]+)\n") do
status[k] = v
+ end
+
+ -- exit early if we are not connected
+ if status.wpa_state ~= "COMPLETED" then
+ return status
+ end
+
+ local f, err = io.popen("/sbin/ifconfig " .. self.interface)
+ if f == nil then
+ log:error("Can't read ifconfig: ", err)
+ else
+ local ifconfig = f:read("*all")
+ f:close()
+
+ local ipaddr = string.match(ifconfig, "inet addr:([%d\.]+)")
+ local subnet = string.match(ifconfig, "Mask:([%d\.]+)")
+
+ status.ip_address = ipaddr
+ status.ip_subnet = subnet
+ end
+
+ -- exit early if we do not have an ip address
+ if not status.ip_address then
+ return status
+ end
+
+ local f, err = io.popen("/bin/ip route")
+ if f == nil then
+ log:error("Can't read default route: ", err)
+ else
+ local iproute = f:read("*all")
+ f:close()
+
+ local gateway = string.match(iproute, "default via ([%d\.]+)")
+
+ status.ip_gateway = gateway
+ end
+
+ local f = io.open("/etc/resolv.conf")
+ if f ~= nil then
+ while true do
+ local line = f:read("*l")
+ if line == nil then
+ break
+ end
+
+ local dns = string.match(line, "nameserver ([%d\.]+)")
+ if dns then
+ status.ip_dns = dns
+ break
+ end
+ end
+ f:close()
end
return status
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins