summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgregory guy <gregory-tde@laposte.net>2021-01-18 16:27:00 +0100
committergregory guy <gregory-tde@laposte.net>2021-01-21 15:57:50 +0100
commit59e62bdebaa8acfba440bb2bf5404297fc5e82f4 (patch)
tree1844f324aa0895b8cafe2c1d940d583984b183dc /src
parentd1e8f93d7936bde61119443ebab236846b942d55 (diff)
downloadtork-59e62bdebaa8acfba440bb2bf5404297fc5e82f4.tar.gz
tork-59e62bdebaa8acfba440bb2bf5404297fc5e82f4.zip
This fix aims to get rid of the eth0, eth1...name for network cards.
Signed-off-by: gregory guy <gregory-tde@laposte.net>
Diffstat (limited to 'src')
-rw-r--r--src/torkview.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/src/torkview.cpp b/src/torkview.cpp
index 8aa8ba1..1dd8b5d 100644
--- a/src/torkview.cpp
+++ b/src/torkview.cpp
@@ -281,21 +281,26 @@ void torkView::sendAnonymousEmail() {
bool torkView::checkInterface() {
bool gotone = false;
- //Would anyone have this many ethernet cards?
- TQStringList devices;
- devices << "eth" << "wlan";
- for ( TQStringList::Iterator it = devices.begin(); it != devices.end(); ++it ){
- for (int i=0; i < 5; i++){
- TQString devpath = TQString("/sys/class/net/%1%2").arg((*it)).arg(i);
- TQDir ethdir(devpath);
- if (ethdir.exists()){
- mSysDevPathList.append(devpath);
- gotone = true;
- }else
- continue;
+ TQString sysNet = "/sys/class/net/";
+
+ TQDir dir(sysNet);
+ TQStringList netCard = dir.entryList();
+
+ for ( TQStringList::iterator it = netCard.begin(); it != netCard.end(); it++ )
+ {
+ if( (*it) == "." || (*it) == ".." ) continue;
+
+ TQString netDevice = sysNet + (*it) + "/device";
+ TQDir netPath( netDevice );
+
+ if( netPath.exists() )
+ {
+ TQString ethCard = sysNet + (*it);
+ mSysDevPathList.append(ethCard);
+ gotone = true;
}
- }
+ }
return gotone;
}