summaryrefslogtreecommitdiffstats
path: root/src/sysinfolibsysfs.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/sysinfolibsysfs.cpp')
-rw-r--r--src/sysinfolibsysfs.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/sysinfolibsysfs.cpp b/src/sysinfolibsysfs.cpp
new file mode 100644
index 0000000..feacd30
--- /dev/null
+++ b/src/sysinfolibsysfs.cpp
@@ -0,0 +1,52 @@
+/*
+ * sysinfolibsysfs.cpp
+ *
+ * Created on: Mar 23, 2011
+ * Author: niklas
+ */
+
+#include "sysinfolibsysfs.h"
+
+SysInfoLibsysfs::SysInfoLibsysfs() {
+ // TODO Auto-generated constructor stub
+
+}
+
+SysInfoLibsysfs::~SysInfoLibsysfs() {
+ // TODO Auto-generated destructor stub
+}
+
+void SysInfoLibsysfs::getInfoAboutNetworkInterface()
+{
+ struct sysfs_class_device *class_device = sysfs_open_class_device("net","eth0");
+ struct dlist *attrlist = sysfs_get_classdev_attributes(class_device);
+ struct sysfs_device *device = sysfs_get_classdev_device(class_device);
+ //struct sysfs_driver *driver = sysfs_get_classdev_driver(class_device);
+ if(device == NULL) {
+ qDebug() << "device is NULL!";
+ }
+ else {
+ qDebug() << "--- print eth0 device path:";
+ qDebug() << QString(device->path);
+ }
+
+ sysfs_close_class_device(class_device);
+}
+
+void SysInfoLibsysfs::getInfoAboutClassNet()
+{
+ struct sysfs_class *sysfsclass = sysfs_open_class("net");
+ struct dlist *devices = sysfs_get_class_devices(sysfsclass);
+ struct sysfs_device *dev = NULL;
+ dlist_for_each_data(devices,dev, struct sysfs_device) {
+ if(dev == NULL) {
+ qDebug() << "device is NULL!";
+ }
+ else {
+ qDebug() << "--- print device:";
+ qDebug() << QString(dev->name);
+ }
+ }
+
+ sysfs_close_class(sysfsclass);
+}