diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-05 18:21:47 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-04-05 18:21:47 -0500 |
commit | beff973e2e273ef576ba848d5b0bb7b575ce342e (patch) | |
tree | cb274a266d43d272b8251117837c4c806ea6609d /tdecore/tdehardwaredevices.cpp | |
parent | 4567c04cccf7a994c20f2eb55127f6331ad344f5 (diff) | |
download | tdelibs-beff973e2e273ef576ba848d5b0bb7b575ce342e.tar.gz tdelibs-beff973e2e273ef576ba848d5b0bb7b575ce342e.zip |
Reliably detect device driver
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r-- | tdecore/tdehardwaredevices.cpp | 15 |
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") |