diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-06-01 18:24:00 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-06-01 18:24:00 -0500 |
commit | f04d5a36adcd7ed3849108fca0ee9e6899eccb1c (patch) | |
tree | ca32ab29e9b79d1b77051935a179918b7f548ce2 | |
parent | 89cfde63b8a29b6513d65cfb0f16b2b210257063 (diff) | |
download | tdelibs-f04d5a36adcd7ed3849108fca0ee9e6899eccb1c.tar.gz tdelibs-f04d5a36adcd7ed3849108fca0ee9e6899eccb1c.zip |
Disable polling of triggerless devices by default
This resolves Bug 1516
-rw-r--r-- | tdecore/tdehardwaredevices.cpp | 19 | ||||
-rw-r--r-- | tdecore/tdehardwaredevices.h | 9 |
2 files changed, 23 insertions, 5 deletions
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp index ddad3cc55..21c31bca4 100644 --- a/tdecore/tdehardwaredevices.cpp +++ b/tdecore/tdehardwaredevices.cpp @@ -2326,17 +2326,12 @@ TDEHardwareDevices::TDEHardwareDevices() { #else m_cpuWatchTimer = new TQTimer(this); connect( m_cpuWatchTimer, SIGNAL(timeout()), this, SLOT(processModifiedCPUs()) ); - TQDir nodezerocpufreq("/sys/devices/system/cpu/cpu0/cpufreq"); - if (nodezerocpufreq.exists()) { - m_cpuWatchTimer->start( 500, FALSE ); // 0.5 second repeating timer - } #endif // Some devices do not receive update signals from udev // These devices must be polled, and a good polling interval is 1 second m_deviceWatchTimer = new TQTimer(this); connect( m_deviceWatchTimer, SIGNAL(timeout()), this, SLOT(processStatelessDevices()) ); - m_deviceWatchTimer->start( 1000, FALSE ); // 1 second repeating timer // Update internal device information queryHardwareInformation(); @@ -2376,6 +2371,20 @@ TDEHardwareDevices::~TDEHardwareDevices() { } } +void TDEHardwareDevices::setTriggerlessHardwareUpdatesEnabled(bool enable) { + if (enable) { + TQDir nodezerocpufreq("/sys/devices/system/cpu/cpu0/cpufreq"); + if (nodezerocpufreq.exists()) { + m_cpuWatchTimer->start( 500, FALSE ); // 0.5 second repeating timer + } + m_deviceWatchTimer->start( 1000, FALSE ); // 1 second repeating timer + } + else { + m_cpuWatchTimer->stop(); + m_deviceWatchTimer->stop(); + } +} + void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice) { struct udev_device *dev; dev = udev_device_new_from_syspath(m_udevStruct, hwdevice->systemPath().ascii()); diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h index 54cba4c29..70c528a85 100644 --- a/tdecore/tdehardwaredevices.h +++ b/tdecore/tdehardwaredevices.h @@ -2024,6 +2024,15 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject void rescanDeviceInformation(TDEGenericDevice* hwdevice); /** + * Enable or disable automatic state updates of triggerless hardware devices + * such as CPUs and network cards. When enabled, your application will use + * additional CPU resources to continually poll triggerless hardware devices. + * Automatic updates are disabled by default. + * @param enable a bool specifiying whether or not automatic updates should be enabled + */ + void setTriggerlessHardwareUpdatesEnabled(bool enable); + + /** * Convert a byte count to human readable form * @param bytes a double containing the number of bytes * @return a TQString containing the human readable byte count |