From beff973e2e273ef576ba848d5b0bb7b575ce342e Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Thu, 5 Apr 2012 18:21:47 -0500 Subject: [PATCH] Reliably detect device driver --- tdecore/tdehardwaredevices.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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")