summaryrefslogtreecommitdiffstats
path: root/tdecore/tdehardwaredevices.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-01 21:19:21 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-06-01 21:19:21 -0500
commitb282a7bb897aef54980dc0996a842a2253f013da (patch)
treec2ec573c8c62db883c74790da00bbbfa92255b60 /tdecore/tdehardwaredevices.cpp
parentf04d5a36adcd7ed3849108fca0ee9e6899eccb1c (diff)
downloadtdelibs-b282a7bb897aef54980dc0996a842a2253f013da.tar.gz
tdelibs-b282a7bb897aef54980dc0996a842a2253f013da.zip
Reduce CPU usage of triggerless device polling routine
Fix TDEListView not emitting executed signal for part of entire highlighted item area
Diffstat (limited to 'tdecore/tdehardwaredevices.cpp')
-rw-r--r--tdecore/tdehardwaredevices.cpp64
1 files changed, 59 insertions, 5 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 21c31bca4..7dc2de5e2 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -2386,10 +2386,16 @@ void TDEHardwareDevices::setTriggerlessHardwareUpdatesEnabled(bool enable) {
}
void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice) {
+ rescanDeviceInformation(hwdevice, true);
+}
+
+void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice, bool regenerateDeviceTree) {
struct udev_device *dev;
dev = udev_device_new_from_syspath(m_udevStruct, hwdevice->systemPath().ascii());
- classifyUnknownDevice(dev, hwdevice, false);
- updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
+ updateExistingDeviceInformation(hwdevice);
+ if (regenerateDeviceTree) {
+ updateParentDeviceInformation(hwdevice); // Update parent/child tables for this device
+ }
udev_device_unref(dev);
}
@@ -2874,7 +2880,7 @@ void TDEHardwareDevices::processStatelessDevices() {
TDEGenericHardwareList devList = listAllPhysicalDevices();
for ( hwdevice = devList.first(); hwdevice; hwdevice = devList.next() ) {
if ((hwdevice->type() == TDEGenericDeviceType::RootSystem) || (hwdevice->type() == TDEGenericDeviceType::Network) || (hwdevice->type() == TDEGenericDeviceType::OtherSensor) || (hwdevice->type() == TDEGenericDeviceType::Event) || (hwdevice->type() == TDEGenericDeviceType::Battery) || (hwdevice->type() == TDEGenericDeviceType::PowerSupply)) {
- rescanDeviceInformation(hwdevice);
+ rescanDeviceInformation(hwdevice, false);
emit hardwareUpdated(hwdevice);
emit hardwareEvent(TDEHardwareEvent::HardwareUpdated, hwdevice->uniqueID());
}
@@ -4130,6 +4136,56 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
device = classifyUnknownDeviceByExternalRules(dev, device, false);
}
+ updateExistingDeviceInformation(device, dev);
+
+ if (temp_udev_device) {
+ udev_device_unref(dev);
+ }
+
+ return device;
+}
+
+void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* existingdevice, udev_device* dev) {
+ TQString devicename;
+ TQString devicetype;
+ TQString devicedriver;
+ TQString devicesubsystem;
+ TQString devicenode;
+ TQString systempath;
+ TQString devicevendorid;
+ TQString devicemodelid;
+ TQString devicevendoridenc;
+ TQString devicemodelidenc;
+ TQString devicesubvendorid;
+ TQString devicesubmodelid;
+ TQString devicetypestring;
+ TQString devicetypestring_alt;
+ TQString devicepciclass;
+ TDEGenericDevice* device = existingdevice;
+ bool temp_udev_device = !dev;
+
+ devicename = device->name();
+ devicetype = device->m_udevtype;
+ devicedriver = device->deviceDriver();
+ devicesubsystem = device->subsystem();
+ devicenode = device->deviceNode();
+ systempath = device->systemPath();
+ devicevendorid = device->vendorID();
+ devicemodelid = device->modelID();
+ devicevendoridenc = device->vendorEncoded();
+ devicemodelidenc = device->modelEncoded();
+ devicesubvendorid = device->subVendorID();
+ devicesubmodelid = device->subModelID();
+ devicetypestring = device->m_udevdevicetypestring;
+ devicetypestring_alt = device->udevdevicetypestring_alt;
+ devicepciclass = device->PCIClass();
+
+ if (!dev) {
+ TQString syspathudev = systempath;
+ syspathudev.truncate(syspathudev.length()-1); // Remove trailing slash
+ dev = udev_device_new_from_syspath(m_udevStruct, syspathudev.ascii());
+ }
+
if (device->type() == TDEGenericDeviceType::Disk) {
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
if (sdevice->diskType() & TDEDiskDeviceType::Camera) {
@@ -5133,8 +5189,6 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (temp_udev_device) {
udev_device_unref(dev);
}
-
- return device;
}
void TDEHardwareDevices::updateBlacklists(TDEGenericDevice* hwdevice, udev_device* dev) {