From 9b33264c99979c526a0660eecc071ad8f2678ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 31 Jan 2016 16:35:26 +0100 Subject: [PATCH] Force removable flag for flask disks in tdehwlib This resolves Bug 2473 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit dc350e6c6406a78621763c2d4fcbea8deca01c7c) --- tdecore/tdehw/tdehardwaredevices.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 26dc010f5..4aca70439 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -2656,6 +2656,16 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist if (hotpluggable) { diskstatus = diskstatus | TDEDiskDeviceStatus::Hotpluggable; } + // Force removable flag for flash disks + // udev reports disks as non-removable for card readers on PCI controllers + if (((disktype & TDEDiskDeviceType::CompactFlash) + || (disktype & TDEDiskDeviceType::MemoryStick) + || (disktype & TDEDiskDeviceType::SmartMedia) + || (disktype & TDEDiskDeviceType::SDMMC)) + && !(diskstatus & TDEDiskDeviceStatus::Removable) + && !(diskstatus & TDEDiskDeviceStatus::Hotpluggable)) { + diskstatus = diskstatus | TDEDiskDeviceStatus::Removable; + } if ((filesystemtype.upper() != "CRYPTO_LUKS") && (filesystemtype.upper() != "CRYPTO") && (filesystemtype.upper() != "SWAP") && (!filesystemtype.isNull())) { diskstatus = diskstatus | TDEDiskDeviceStatus::ContainsFilesystem;