|
|
@ -348,6 +348,13 @@ TDEGenericDevice* TDEHardwareDevices::findByDeviceNode(TQString devnode) {
|
|
|
|
if (hwdevice->deviceNode() == devnode) {
|
|
|
|
if (hwdevice->deviceNode() == devnode) {
|
|
|
|
return hwdevice;
|
|
|
|
return hwdevice;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// For storage devices, check also against the mapped name
|
|
|
|
|
|
|
|
TDEStorageDevice *sdevice = dynamic_cast<TDEStorageDevice*>(hwdevice);
|
|
|
|
|
|
|
|
if (sdevice) {
|
|
|
|
|
|
|
|
if (sdevice->mappedName() == devnode) {
|
|
|
|
|
|
|
|
return sdevice;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
@ -368,11 +375,11 @@ TDEStorageDevice* TDEHardwareDevices::findDiskByUID(TQString uid) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEHardwareDevices::processHotPluggedHardware() {
|
|
|
|
void TDEHardwareDevices::processHotPluggedHardware() {
|
|
|
|
udev_device* dev = udev_monitor_receive_device(m_udevMonitorStruct);
|
|
|
|
udev_device *dev = udev_monitor_receive_device(m_udevMonitorStruct);
|
|
|
|
if (dev) {
|
|
|
|
if (dev) {
|
|
|
|
TQString actionevent(udev_device_get_action(dev));
|
|
|
|
TQString actionevent(udev_device_get_action(dev));
|
|
|
|
if (actionevent == "add") {
|
|
|
|
if (actionevent == "add") {
|
|
|
|
TDEGenericDevice* device = classifyUnknownDevice(dev);
|
|
|
|
TDEGenericDevice *device = classifyUnknownDevice(dev);
|
|
|
|
|
|
|
|
|
|
|
|
// Make sure this device is not a duplicate
|
|
|
|
// Make sure this device is not a duplicate
|
|
|
|
TDEGenericDevice *hwdevice;
|
|
|
|
TDEGenericDevice *hwdevice;
|
|
|
@ -1970,7 +1977,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
|| (devicesubsystem == "scsi_tape"))
|
|
|
|
|| (devicesubsystem == "scsi_tape"))
|
|
|
|
&& ((devicenode != "")
|
|
|
|
&& ((devicenode != "")
|
|
|
|
)) {
|
|
|
|
)) {
|
|
|
|
if (!device) device = new TDEStorageDevice(TDEGenericDeviceType::Disk);
|
|
|
|
if (!device) {
|
|
|
|
|
|
|
|
device = new TDEStorageDevice(TDEGenericDeviceType::Disk);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (devicetype == "host") {
|
|
|
|
else if (devicetype == "host") {
|
|
|
|
if (devicesubsystem == "bluetooth") {
|
|
|
|
if (devicesubsystem == "bluetooth") {
|
|
|
@ -2466,10 +2475,20 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
|
|
|
|
udev_device_unref(dev);
|
|
|
|
udev_device_unref(dev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the device mapped name if present
|
|
|
|
|
|
|
|
TDEStorageDevice *sdevice = dynamic_cast<TDEStorageDevice*>(device);
|
|
|
|
|
|
|
|
if (sdevice) {
|
|
|
|
|
|
|
|
sdevice->updateMappedName();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return device;
|
|
|
|
return device;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* existingdevice, udev_device* dev) {
|
|
|
|
void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice *device, udev_device *dev) {
|
|
|
|
|
|
|
|
if (!device) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString devicename;
|
|
|
|
TQString devicename;
|
|
|
|
TQString devicetype;
|
|
|
|
TQString devicetype;
|
|
|
|
TQString devicedriver;
|
|
|
|
TQString devicedriver;
|
|
|
@ -2485,7 +2504,6 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
|
|
|
|
TQString devicetypestring;
|
|
|
|
TQString devicetypestring;
|
|
|
|
TQString devicetypestring_alt;
|
|
|
|
TQString devicetypestring_alt;
|
|
|
|
TQString devicepciclass;
|
|
|
|
TQString devicepciclass;
|
|
|
|
TDEGenericDevice* device = existingdevice;
|
|
|
|
|
|
|
|
bool temp_udev_device = !dev;
|
|
|
|
bool temp_udev_device = !dev;
|
|
|
|
|
|
|
|
|
|
|
|
devicename = device->name();
|
|
|
|
devicename = device->name();
|
|
|
@ -2766,7 +2784,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
|
|
|
|
|
|
|
|
|
|
|
|
// Set mountable flag if device is likely to be mountable
|
|
|
|
// Set mountable flag if device is likely to be mountable
|
|
|
|
diskstatus = diskstatus | TDEDiskDeviceStatus::Mountable;
|
|
|
|
diskstatus = diskstatus | TDEDiskDeviceStatus::Mountable;
|
|
|
|
if ((devicetypestring.upper().isNull()) && (disktype & TDEDiskDeviceType::HDD)) {
|
|
|
|
if (devicetypestring.upper().isNull() && devicetypestring_alt.upper().isNull() && (disktype & TDEDiskDeviceType::HDD)) {
|
|
|
|
|
|
|
|
// For mapped devices, ID_TYPE may be missing, so need to check the alternative device
|
|
|
|
|
|
|
|
// type string too. For example for LUKS disk, ID_TYPE is null and DEVTYPE is "disk"
|
|
|
|
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
|
|
|
|
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (removable) {
|
|
|
|
if (removable) {
|
|
|
@ -2795,6 +2815,11 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
|
|
|
|
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
|
|
|
|
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Encrypted or RAID disks are not mountable
|
|
|
|
|
|
|
|
if (filesystemtype.upper() == "CRYPTO_LUKS" || filesystemtype.upper() == "CRYPTO" ||
|
|
|
|
|
|
|
|
filesystemusage.upper() == "RAID") {
|
|
|
|
|
|
|
|
diskstatus = diskstatus & ~TDEDiskDeviceStatus::Mountable;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (holdingDeviceNodes.count() > 0) {
|
|
|
|
if (holdingDeviceNodes.count() > 0) {
|
|
|
|
diskstatus = diskstatus | TDEDiskDeviceStatus::UsedByDevice;
|
|
|
|
diskstatus = diskstatus | TDEDiskDeviceStatus::UsedByDevice;
|
|
|
|