summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehardwaredevices.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-23 18:19:49 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-08-23 18:19:49 -0500
commit32e6eba8731f7f3328ae287d0493d941dadec06f (patch)
treeac81ffbe137bb27cbd5681f25324f2ae340cd294 /tdecore/tdehardwaredevices.cpp
parent38f05d1e1d61ac758d820a3923e2922337d9908e (diff)
downloadtdelibs-32e6eba8731f7f3328ae287d0493d941dadec06f.tar.gz
tdelibs-32e6eba8731f7f3328ae287d0493d941dadec06f.zip
Initial skeleton for network manager support
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r--tdecore/tdehardwaredevices.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 8fdbcf07e..ab3c06e91 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -16,6 +16,8 @@
Boston, MA 02110-1301, USA.
*/
+#define USE_NETWORKMANAGER_NETWORK_BACKEND
+
#include <tdehardwaredevices.h>
#include <tqfile.h>
@@ -56,6 +58,13 @@
#include <sys/socket.h>
#include <netdb.h>
+// Network connection manager
+#include "tdenetworkconnections.h"
+
+#ifdef USE_NETWORKMANAGER_NETWORK_BACKEND
+#include "networkbackends/network-manager/network-manager.h"
+#endif // USE_NETWORKMANAGER_NETWORK_BACKEND
+
// BEGIN BLOCK
// Copied from include/linux/genhd.h
#define GENHD_FL_REMOVABLE 1
@@ -1314,6 +1323,7 @@ TDENetworkDevice::TDENetworkDevice(TDEGenericDeviceType::TDEGenericDeviceType dt
m_txbytes = -1;
m_rxpackets = -1;
m_txpackets = -1;
+ m_connectionManager = NULL;
}
TDENetworkDevice::~TDENetworkDevice() {
@@ -1447,6 +1457,20 @@ void TDENetworkDevice::internalSetTxPackets(double tx) {
m_txpackets = tx;
}
+TDENetworkConnectionManager* TDENetworkDevice::connectionManager() {
+#ifdef USE_NETWORKMANAGER_NETWORK_BACKEND
+ if (!m_connectionManager) {
+ m_connectionManager = new TDENetworkConnectionManager_BackendNM(m_macAddress);
+ }
+#endif // USE_NETWORKMANAGER_NETWORK_BACKEND
+
+ return m_connectionManager;
+}
+
+void TDENetworkDevice::internalSetConnectionManager(TDENetworkConnectionManager* mgr) {
+ m_connectionManager = mgr;
+}
+
TDEBacklightDevice::TDEBacklightDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
}
@@ -2837,8 +2861,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
// Many devices do not provide their vendor/model ID via udev
- // Go after it manually...
- if (devicevendorid.isNull() || devicemodelid.isNull()) {
+ // Worse, sometimes udev provides an invalid model ID!
+ // Go after it manually if needed...
+ if (devicevendorid.isNull() || devicemodelid.isNull() || devicemodelid.contains("/")) {
if (devicemodalias != TQString::null) {
// For added fun the device string lengths differ between pci and usb
if (devicemodalias.startsWith("pci")) {