diff --git a/emhttp/plugins/dynamix/nchan/update_3 b/emhttp/plugins/dynamix/nchan/update_3
index 89db15da0..9dd703774 100755
--- a/emhttp/plugins/dynamix/nchan/update_3
+++ b/emhttp/plugins/dynamix/nchan/update_3
@@ -1,7 +1,7 @@
#!/usr/bin/php -q
| ",$device['Locator'],": ",_var($device,'Manufacturer')," ",_var($device,'Part Number'),", $size ",_var($device,'Type')," @ ",_var($device,'Configured Memory Speed')," | ";
}
-exec("ls --indicator-style=none /sys/class/net|grep -Po '^(bond|eth)\d+$'",$sPorts);
+exec("ls --indicator-style=none /sys/class/net|grep -Po '^(bond|eth|wlan)\d+$'",$sPorts);
$i = 0;
$network = count($sPorts) > 1 ? ""._('Network').":" : _('Network').':';
foreach ($sPorts as $port) {
- $int = "/sys/class/net/$port";
- $mtu = file_get_contents("$int/mtu");
- $link = @file_get_contents("$int/carrier")==1;
+ $int = "/sys/class/net/$port";
+ $mtu = port_get_contents("$int/mtu");
+ $link = port_get_contents("$int/carrier")==1;
$name = $i ? "" : $network;
$more = $i++ ? "port" : "";
- if (substr($port,0,4)=='bond') {
+ switch (substr($port,0,4)) {
+ case 'bond':
if ($link) {
$bond_mode = str_replace('Bonding Mode: ','',file("/proc/net/bonding/$port",FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES)[1]);
echo "| $name | $port: $bond_mode, mtu $mtu |
";
} else {
echo "| $name | $port: ",_('bond down')," |
";
}
- } else {
+ break;
+ case 'wlan':
+ if ($link) {
+ unset($speed);
+ exec("iw $port link | awk '/^\s+[rt]x bitrate: /{print $1,$2,$3,$4}'",$speed);
+ if (count($speed)==2) {
+ [$rxrate, $rxunit] = explode(' ',explode(': ',$speed[0])[1]);
+ [$txrate, $txunit] = explode(' ',explode(': ',$speed[1])[1]);
+ echo "| $name | $port: ",_('Rx'),": ",round($rxrate)," ",str_replace('Bit/s','bps',$rxunit),", ",_('Tx').": ",round($txrate)," ",str_replace('Bit/s','bps',$txunit),", mtu $mtu |
";
+ } else {
+ echo "| $name | $port: ",_('not connected')," |
";
+ }
+ } else {
+ echo "| $name | $port: ",_('interface down')," |
";
+ }
+ break;
+ default:
if ($link) {
$speed = file_get_contents("$int/speed");
$duplex = file_get_contents("$int/duplex");
@@ -184,6 +205,7 @@ foreach ($sPorts as $port) {
} else {
echo "| $name | $port: ",_('interface down')," |
";
}
+ break;
}
}
?>