paradoxxxzero/gnome-shell-system-monitor-applet — Issue #58: Defective network card bug
Author: NVieville
Created: 2011-10-27 10:31:04+00:00
State: open

Hello (Bonjour),

Because of a buggy device/driver/OS/both/choose (Ethernet device ar8131
with no cable plugged-in on a Lenovo Ideapd u160) the net part of your
gnome-shell extension was displaying "astronomic" values, even with no
real network traffic on other interfaces (wlan, etc.). I added a new
condition to only process network devices that are "up". This seems to be
functional on Fedora 15 x86_64 (I'm using it right now), and seems to
give more realistic values.

# The patch
--- extension.js.orig	2011-10-26 10:55:05.000000000 +0200
+++ extension.js	2011-10-27 12:08:09.657930910 +0200
@@ -562,8 +562,10 @@
let net_lines = Shell.get_file_contents_utf8_sync('/proc/net/dev').split("\n");
for(let i = 3; i < net_lines.length - 1 ; i++) {
let ifc = net_lines[i].replace(/^\s+/g, '').split(":")[0];
- if(ifc.indexOf("br") < 0 && ifc.indexOf("lo") < 0) {
- this.ifs.push(ifc);
+ if(Shell.get_file_contents_utf8_sync('/sys/class/net/' + ifc + '/operstate').replace(/\s/g, "") == "up") {
+ if(ifc.indexOf("br") < 0 && ifc.indexOf("lo") < 0) {
+ this.ifs.push(ifc);
+ }
}
}
this.gtop = new GTop.glibtop_netload();
# End of the patch

I hope these patch will be useful!

Any questions about this subject are welcome.

Cordially,

--
NVieville