diff options
author | Slávek Banko <slavek.banko@axis.cz> | 2016-02-04 20:54:08 +0100 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2016-02-04 20:54:19 +0100 |
commit | c7ba84312e746621f3cbe0d6aadfb0fd8c6e6e76 (patch) | |
tree | 863be17f3791775bbec882a4c626ae6e429e90a9 /tdecore/tdehw | |
parent | 762f90beacbd73121e26c8eef399abae2c2b19c7 (diff) | |
download | tdelibs-c7ba84312e746621f3cbe0d6aadfb0fd8c6e6e76.tar.gz tdelibs-c7ba84312e746621f3cbe0d6aadfb0fd8c6e6e76.zip |
Set partition disk type and status based on the parent device
Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 51046798068760d062a1924fff4a99c7b8a60b71)
Diffstat (limited to 'tdecore/tdehw')
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 54f77470c..2b980e7e1 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -2540,7 +2540,18 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist TDEDiskDeviceType::TDEDiskDeviceType disktype = sdevice->diskType(); TDEDiskDeviceStatus::TDEDiskDeviceStatus diskstatus = TDEDiskDeviceStatus::Null; - disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver); + if (TQString(udev_device_get_property_value(dev, "ID_PART_ENTRY_NUMBER")).isEmpty()) { + disktype = classifyDiskType(dev, devicenode, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver); + } + else { + // Set partition disk type and status based on the parent device + TQString parentsyspath = systempath; + parentsyspath.truncate(parentsyspath.length()-1); // Remove trailing slash + parentsyspath.truncate(parentsyspath.findRev("/")); + TDEStorageDevice* parentdisk = static_cast<TDEStorageDevice*>(findBySystemPath(parentsyspath)); + disktype = parentdisk->diskType(); + diskstatus = diskstatus | parentdisk->diskStatus(); + } sdevice->internalSetDiskType(disktype); device = classifyUnknownDeviceByExternalRules(dev, device, true); // Check external rules for possible subtype overrides disktype = sdevice->diskType(); // The type can be overridden by an external rule @@ -2670,6 +2681,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist if ((filesystemtype.upper() != "CRYPTO_LUKS") && (filesystemtype.upper() != "CRYPTO") && (filesystemtype.upper() != "SWAP") && (!filesystemtype.isNull())) { diskstatus = diskstatus | TDEDiskDeviceStatus::ContainsFilesystem; } + else { + diskstatus = diskstatus & ~TDEDiskDeviceStatus::ContainsFilesystem; + } // Set mountable flag if device is likely to be mountable diskstatus = diskstatus | TDEDiskDeviceStatus::Mountable; |