summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehardwaredevices.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2012-04-05 18:21:47 -0500
committerTimothy Pearson <[email protected]>2012-04-05 18:21:47 -0500
commitbeff973e2e273ef576ba848d5b0bb7b575ce342e (patch)
treecb274a266d43d272b8251117837c4c806ea6609d /tdecore/tdehardwaredevices.cpp
parent4567c04cccf7a994c20f2eb55127f6331ad344f5 (diff)
downloadtdelibs-beff973e2e273ef576ba848d5b0bb7b575ce342e.tar.gz
tdelibs-beff973e2e273ef576ba848d5b0bb7b575ce342e.zip
Reliably detect device driver
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r--tdecore/tdehardwaredevices.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 55a5b4817..c98c21a48 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -1395,6 +1395,21 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
}
+ // Most of the timeudev doesn't barf up a device driver either, so go after it manually...
+ if (devicedriver.isNull()) {
+ TQString driverSymlink = udev_device_get_syspath(dev);
+ TQString driverSymlinkDir = driverSymlink;
+ driverSymlink.append("/device/driver");
+ driverSymlinkDir.append("/device/");
+ TQFileInfo dirfi(driverSymlink);
+ if (dirfi.isSymLink()) {
+ char* collapsedPath = realpath((driverSymlinkDir + dirfi.readLink()).ascii(), NULL);
+ devicedriver = TQString(collapsedPath);
+ free(collapsedPath);
+ devicedriver.remove(0, devicedriver.findRev("/")+1);
+ }
+ }
+
// Classify generic device type and create appropriate object
if ((devicetype == "disk")
|| (devicetype == "partition")