summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tdecore/hwlibdata/pnpdev/CMakeLists.txt2
-rw-r--r--tdecore/hwlibdata/pnpdev/dpy.ids8
-rw-r--r--tdecore/tdehardwaredevices.cpp762
-rw-r--r--tdecore/tdehardwaredevices.h858
4 files changed, 1178 insertions, 452 deletions
diff --git a/tdecore/hwlibdata/pnpdev/CMakeLists.txt b/tdecore/hwlibdata/pnpdev/CMakeLists.txt
index 61b1df38e..98b117d54 100644
--- a/tdecore/hwlibdata/pnpdev/CMakeLists.txt
+++ b/tdecore/hwlibdata/pnpdev/CMakeLists.txt
@@ -13,5 +13,5 @@
##### other data ################################
install( FILES
- pnp.ids
+ pnp.ids dpy.ids
DESTINATION ${DATA_INSTALL_DIR}/tdehwlib/pnpdev )
diff --git a/tdecore/hwlibdata/pnpdev/dpy.ids b/tdecore/hwlibdata/pnpdev/dpy.ids
new file mode 100644
index 000000000..605ef28f4
--- /dev/null
+++ b/tdecore/hwlibdata/pnpdev/dpy.ids
@@ -0,0 +1,8 @@
+# This file is provided soley in the interest of cross platform compatibility
+# It only contains information on certain generic core system devices that cannot be looked up via another method
+# All marks are the property of their owners
+
+ACR Acer
+LPL LG
+PHL Philips
+SEC Samsung \ No newline at end of file
diff --git a/tdecore/tdehardwaredevices.cpp b/tdecore/tdehardwaredevices.cpp
index 7aa06feee..fcb70cbc2 100644
--- a/tdecore/tdehardwaredevices.cpp
+++ b/tdecore/tdehardwaredevices.cpp
@@ -38,6 +38,9 @@
#include <sys/ioctl.h>
#include <linux/fs.h>
+// Backlight devices
+#include <linux/fb.h>
+
// Network devices
#include <sys/types.h>
#include <ifaddrs.h>
@@ -64,6 +67,17 @@
// This command will greatly help when attempting to find properties to distinguish one device from another
// udevadm info --query=all --path=/sys/....
+// This routine is courtsey of an answer on "Stack Overflow"
+// It takes an LSB-first int and makes it an MSB-first int (or vice versa)
+unsigned int reverse_bits(register unsigned int x)
+{
+ x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));
+ x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));
+ x = (((x & 0xf0f0f0f0) >> 4) | ((x & 0x0f0f0f0f) << 4));
+ x = (((x & 0xff00ff00) >> 8) | ((x & 0x00ff00ff) << 8));
+ return((x >> 16) | (x << 16));
+}
+
TDESensorCluster::TDESensorCluster() {
label = TQString::null;
current = -1;
@@ -93,7 +107,7 @@ TQString &TDEGenericDevice::name() {
return m_deviceName;
}
-void TDEGenericDevice::setName(TQString dn) {
+void TDEGenericDevice::internalSetName(TQString dn) {
m_deviceName = dn;
}
@@ -101,7 +115,7 @@ TQString &TDEGenericDevice::vendorName() {
return m_vendorName;
}
-void TDEGenericDevice::setVendorName(TQString vn) {
+void TDEGenericDevice::internalSetVendorName(TQString vn) {
m_vendorName = vn;
}
@@ -109,7 +123,7 @@ TQString &TDEGenericDevice::vendorModel() {
return m_vendorModel;
}
-void TDEGenericDevice::setVendorModel(TQString vm) {
+void TDEGenericDevice::internalSetVendorModel(TQString vm) {
m_vendorModel = vm;
}
@@ -117,7 +131,7 @@ TQString &TDEGenericDevice::serialNumber() {
return m_serialNumber;
}
-void TDEGenericDevice::setSerialNumber(TQString sn) {
+void TDEGenericDevice::internalSetSerialNumber(TQString sn) {
m_serialNumber = sn;
}
@@ -125,7 +139,7 @@ TQString &TDEGenericDevice::systemPath() {
return m_systemPath;
}
-void TDEGenericDevice::setSystemPath(TQString sp) {
+void TDEGenericDevice::internalSetSystemPath(TQString sp) {
m_systemPath = sp;
}
@@ -133,7 +147,7 @@ TQString &TDEGenericDevice::deviceNode() {
return m_deviceNode;
}
-void TDEGenericDevice::setDeviceNode(TQString sn) {
+void TDEGenericDevice::internalSetDeviceNode(TQString sn) {
m_deviceNode = sn;
}
@@ -141,7 +155,7 @@ TQString &TDEGenericDevice::deviceBus() {
return m_deviceBus;
}
-void TDEGenericDevice::setDeviceBus(TQString db) {
+void TDEGenericDevice::internalSetDeviceBus(TQString db) {
m_deviceBus = db;
}
@@ -154,7 +168,7 @@ TQString &TDEGenericDevice::vendorID() {
return m_vendorID;
}
-void TDEGenericDevice::setVendorID(TQString id) {
+void TDEGenericDevice::internalSetVendorID(TQString id) {
m_vendorID = id;
m_vendorID.replace("0x", "");
}
@@ -163,7 +177,7 @@ TQString &TDEGenericDevice::modelID() {
return m_modelID;
}
-void TDEGenericDevice::setModelID(TQString id) {
+void TDEGenericDevice::internalSetModelID(TQString id) {
m_modelID = id;
m_modelID.replace("0x", "");
}
@@ -172,7 +186,7 @@ TQString &TDEGenericDevice::vendorEncoded() {
return m_vendorenc;
}
-void TDEGenericDevice::setVendorEncoded(TQString id) {
+void TDEGenericDevice::internalSetVendorEncoded(TQString id) {
m_vendorenc = id;
}
@@ -180,7 +194,7 @@ TQString &TDEGenericDevice::modelEncoded() {
return m_modelenc;
}
-void TDEGenericDevice::setModelEncoded(TQString id) {
+void TDEGenericDevice::internalSetModelEncoded(TQString id) {
m_modelenc = id;
}
@@ -188,7 +202,7 @@ TQString &TDEGenericDevice::subVendorID() {
return m_subvendorID;
}
-void TDEGenericDevice::setSubVendorID(TQString id) {
+void TDEGenericDevice::internalSetSubVendorID(TQString id) {
m_subvendorID = id;
m_subvendorID.replace("0x", "");
}
@@ -197,7 +211,7 @@ TQString &TDEGenericDevice::PCIClass() {
return m_pciClass;
}
-void TDEGenericDevice::setPCIClass(TQString cl) {
+void TDEGenericDevice::internalSetPCIClass(TQString cl) {
m_pciClass = cl;
m_pciClass.replace("0x", "");
}
@@ -206,7 +220,7 @@ TQString &TDEGenericDevice::moduleAlias() {
return m_modAlias;
}
-void TDEGenericDevice::setModuleAlias(TQString ma) {
+void TDEGenericDevice::internalSetModuleAlias(TQString ma) {
m_modAlias = ma;
}
@@ -214,7 +228,7 @@ TQString &TDEGenericDevice::deviceDriver() {
return m_deviceDriver;
}
-void TDEGenericDevice::setDeviceDriver(TQString dr) {
+void TDEGenericDevice::internalSetDeviceDriver(TQString dr) {
m_deviceDriver = dr;
}
@@ -222,7 +236,7 @@ TQString &TDEGenericDevice::subsystem() {
return m_subsystem;
}
-void TDEGenericDevice::setSubsystem(TQString ss) {
+void TDEGenericDevice::internalSetSubsystem(TQString ss) {
m_subsystem = ss;
}
@@ -230,12 +244,12 @@ TQString &TDEGenericDevice::subModelID() {
return m_submodelID;
}
-void TDEGenericDevice::setSubModelID(TQString id) {
+void TDEGenericDevice::internalSetSubModelID(TQString id) {
m_submodelID = id;
m_submodelID.replace("0x", "");
}
-void TDEGenericDevice::setParentDevice(TDEGenericDevice* pd) {
+void TDEGenericDevice::internalSetParentDevice(TDEGenericDevice* pd) {
m_parentDevice = pd;
}
@@ -251,7 +265,7 @@ bool TDEGenericDevice::blacklistedForUpdate() {
return m_blacklistedForUpdate;
}
-void TDEGenericDevice::setBlacklistedForUpdate(bool bl) {
+void TDEGenericDevice::internalSetBlacklistedForUpdate(bool bl) {
m_blacklistedForUpdate = bl;
}
@@ -364,7 +378,7 @@ TDEDiskDeviceType::TDEDiskDeviceType TDEStorageDevice::diskType() {
return m_diskType;
}
-void TDEStorageDevice::setDiskType(TDEDiskDeviceType::TDEDiskDeviceType dt) {
+void TDEStorageDevice::internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType dt) {
m_diskType = dt;
}
@@ -376,7 +390,7 @@ TDEDiskDeviceStatus::TDEDiskDeviceStatus TDEStorageDevice::diskStatus() {
return m_diskStatus;
}
-void TDEStorageDevice::setDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st) {
+void TDEStorageDevice::internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st) {
m_diskStatus = st;
}
@@ -388,7 +402,7 @@ TQString &TDEStorageDevice::diskLabel() {
return m_diskName;
}
-void TDEStorageDevice::setDiskLabel(TQString dn) {
+void TDEStorageDevice::internalSetDiskLabel(TQString dn) {
m_diskName = dn;
}
@@ -396,7 +410,7 @@ bool TDEStorageDevice::mediaInserted() {
return m_mediaInserted;
}
-void TDEStorageDevice::setMediaInserted(bool inserted) {
+void TDEStorageDevice::internalSetMediaInserted(bool inserted) {
m_mediaInserted = inserted;
}
@@ -404,7 +418,7 @@ TQString &TDEStorageDevice::fileSystemName() {
return m_fileSystemName;
}
-void TDEStorageDevice::setFileSystemName(TQString fn) {
+void TDEStorageDevice::internalSetFileSystemName(TQString fn) {
m_fileSystemName = fn;
}
@@ -412,7 +426,7 @@ TQString &TDEStorageDevice::fileSystemUsage() {
return m_fileSystemUsage;
}
-void TDEStorageDevice::setFileSystemUsage(TQString fu) {
+void TDEStorageDevice::internalSetFileSystemUsage(TQString fu) {
m_fileSystemUsage = fu;
}
@@ -420,7 +434,7 @@ TQString &TDEStorageDevice::diskUUID() {
return m_diskUUID;
}
-void TDEStorageDevice::setDiskUUID(TQString id) {
+void TDEStorageDevice::internalSetDiskUUID(TQString id) {
m_diskUUID = id;
}
@@ -428,7 +442,7 @@ TQStringList &TDEStorageDevice::holdingDevices() {
return m_holdingDevices;
}
-void TDEStorageDevice::setHoldingDevices(TQStringList hd) {
+void TDEStorageDevice::internalSetHoldingDevices(TQStringList hd) {
m_holdingDevices = hd;
}
@@ -436,7 +450,7 @@ TQStringList &TDEStorageDevice::slaveDevices() {
return m_slaveDevices;
}
-void TDEStorageDevice::setSlaveDevices(TQStringList sd) {
+void TDEStorageDevice::internalSetSlaveDevices(TQStringList sd) {
m_slaveDevices = sd;
}
@@ -813,7 +827,7 @@ double &TDECPUDevice::frequency() {
return m_frequency;
}
-void TDECPUDevice::setFrequency(double fr) {
+void TDECPUDevice::internalSetFrequency(double fr) {
m_frequency = fr;
}
@@ -821,7 +835,7 @@ double &TDECPUDevice::minFrequency() {
return m_minfrequency;
}
-void TDECPUDevice::setMinFrequency(double fr) {
+void TDECPUDevice::internalSetMinFrequency(double fr) {
m_minfrequency = fr;
}
@@ -829,7 +843,7 @@ double &TDECPUDevice::maxFrequency() {
return m_maxfrequency;
}
-void TDECPUDevice::setMaxFrequency(double fr) {
+void TDECPUDevice::internalSetMaxFrequency(double fr) {
m_maxfrequency = fr;
}
@@ -837,7 +851,7 @@ double &TDECPUDevice::transitionLatency() {
return m_transitionlatency;
}
-void TDECPUDevice::setTransitionLatency(double tl) {
+void TDECPUDevice::internalSetTransitionLatency(double tl) {
m_transitionlatency = tl;
}
@@ -845,7 +859,7 @@ TQString &TDECPUDevice::governor() {
return m_governor;
}
-void TDECPUDevice::setGovernor(TQString gr) {
+void TDECPUDevice::internalSetGovernor(TQString gr) {
m_governor = gr;
}
@@ -853,7 +867,7 @@ TQString &TDECPUDevice::scalingDriver() {
return m_scalingdriver;
}
-void TDECPUDevice::setScalingDriver(TQString dr) {
+void TDECPUDevice::internalSetScalingDriver(TQString dr) {
m_scalingdriver = dr;
}
@@ -861,7 +875,7 @@ TQStringList &TDECPUDevice::dependentProcessors() {
return m_tiedprocs;
}
-void TDECPUDevice::setDependentProcessors(TQStringList dp) {
+void TDECPUDevice::internalSetDependentProcessors(TQStringList dp) {
m_tiedprocs = dp;
}
@@ -869,7 +883,7 @@ TQStringList &TDECPUDevice::availableFrequencies() {
return m_frequencies;
}
-void TDECPUDevice::setAvailableFrequencies(TQStringList af) {
+void TDECPUDevice::internalSetAvailableFrequencies(TQStringList af) {
m_frequencies = af;
}
@@ -883,7 +897,7 @@ TDESensorClusterMap TDESensorDevice::values() {
return m_sensorValues;
}
-void TDESensorDevice::setValues(TDESensorClusterMap cl) {
+void TDESensorDevice::internalSetValues(TDESensorClusterMap cl) {
m_sensorValues = cl;
}
@@ -897,7 +911,7 @@ double TDEBatteryDevice::voltage() {
return m_currentVoltage;
}
-void TDEBatteryDevice::setVoltage(double vt) {
+void TDEBatteryDevice::internalSetVoltage(double vt) {
m_currentVoltage = vt;
}
@@ -905,7 +919,7 @@ double TDEBatteryDevice::maximumVoltage() {
return m_maximumVoltage;
}
-void TDEBatteryDevice::setMaximumVoltage(double vt) {
+void TDEBatteryDevice::internalSetMaximumVoltage(double vt) {
m_maximumVoltage = vt;
}
@@ -913,7 +927,7 @@ double TDEBatteryDevice::minimumVoltage() {
return m_minimumVoltage;
}
-void TDEBatteryDevice::setMinimumVoltage(double vt) {
+void TDEBatteryDevice::internalSetMinimumVoltage(double vt) {
m_minimumVoltage = vt;
}
@@ -921,7 +935,7 @@ double TDEBatteryDevice::maximumDesignVoltage() {
return m_maximumDesignVoltage;
}
-void TDEBatteryDevice::setMaximumDesignVoltage(double vt) {
+void TDEBatteryDevice::internalSetMaximumDesignVoltage(double vt) {
m_maximumDesignVoltage = vt;
}
@@ -929,7 +943,7 @@ double TDEBatteryDevice::energy() {
return m_currentEnergy;
}
-void TDEBatteryDevice::setEnergy(double vt) {
+void TDEBatteryDevice::internalSetEnergy(double vt) {
m_currentEnergy = vt;
}
@@ -937,7 +951,7 @@ double TDEBatteryDevice::alarmEnergy() {
return m_alarmEnergy;
}
-void TDEBatteryDevice::setAlarmEnergy(double vt) {
+void TDEBatteryDevice::internalSetAlarmEnergy(double vt) {
m_alarmEnergy = vt;
}
@@ -945,7 +959,7 @@ double TDEBatteryDevice::maximumEnergy() {
return m_maximumEnergy;
}
-void TDEBatteryDevice::setMaximumEnergy(double vt) {
+void TDEBatteryDevice::internalSetMaximumEnergy(double vt) {
m_maximumEnergy = vt;
}
@@ -953,7 +967,7 @@ double TDEBatteryDevice::maximumDesignEnergy() {
return m_maximumDesignEnergy;
}
-void TDEBatteryDevice::setMaximumDesignEnergy(double vt) {
+void TDEBatteryDevice::internalSetMaximumDesignEnergy(double vt) {
m_maximumDesignEnergy = vt;
}
@@ -961,7 +975,7 @@ double TDEBatteryDevice::dischargeRate() {
return m_dischargeRate;
}
-void TDEBatteryDevice::setDischargeRate(double vt) {
+void TDEBatteryDevice::internalSetDischargeRate(double vt) {
m_dischargeRate = vt;
}
@@ -969,7 +983,7 @@ TQString &TDEBatteryDevice::technology() {
return m_technology;
}
-void TDEBatteryDevice::setTechnology(TQString tc) {
+void TDEBatteryDevice::internalSetTechnology(TQString tc) {
m_technology = tc;
}
@@ -977,7 +991,7 @@ TQString &TDEBatteryDevice::status() {
return m_status;
}
-void TDEBatteryDevice::setStatus(TQString tc) {
+void TDEBatteryDevice::internalSetStatus(TQString tc) {
m_status = tc;
}
@@ -985,7 +999,7 @@ bool TDEBatteryDevice::installed() {
return m_installed;
}
-void TDEBatteryDevice::setInstalled(bool tc) {
+void TDEBatteryDevice::internalSetInstalled(bool tc) {
m_installed = tc;
}
@@ -1003,7 +1017,7 @@ bool TDEMainsPowerDevice::online() {
return m_online;
}
-void TDEMainsPowerDevice::setOnline(bool tc) {
+void TDEMainsPowerDevice::internalSetOnline(bool tc) {
m_online = tc;
}
@@ -1021,7 +1035,7 @@ TQString TDENetworkDevice::macAddress() {
return m_macAddress;
}
-void TDENetworkDevice::setMacAddress(TQString ma) {
+void TDENetworkDevice::internalSetMacAddress(TQString ma) {
m_macAddress = ma;
}
@@ -1029,7 +1043,7 @@ TQString TDENetworkDevice::state() {
return m_state;
}
-void TDENetworkDevice::setState(TQString st) {
+void TDENetworkDevice::internalSetState(TQString st) {
m_state = st;
}
@@ -1037,7 +1051,7 @@ bool TDENetworkDevice::carrierPresent() {
return m_carrier;
}
-void TDENetworkDevice::setCarrierPresent(bool cp) {
+void TDENetworkDevice::internalSetCarrierPresent(bool cp) {
m_carrier = cp;
}
@@ -1045,7 +1059,7 @@ bool TDENetworkDevice::dormant() {
return m_dormant;
}
-void TDENetworkDevice::setDormant(bool dm) {
+void TDENetworkDevice::internalSetDormant(bool dm) {
m_dormant = dm;
}
@@ -1053,7 +1067,7 @@ TQString TDENetworkDevice::ipV4Address() {
return m_ipV4Address;
}
-void TDENetworkDevice::setIpV4Address(TQString ad) {
+void TDENetworkDevice::internalSetIpV4Address(TQString ad) {
m_ipV4Address = ad;
}
@@ -1061,7 +1075,7 @@ TQString TDENetworkDevice::ipV6Address() {
return m_ipV6Address;
}
-void TDENetworkDevice::setIpV6Address(TQString ad) {
+void TDENetworkDevice::internalSetIpV6Address(TQString ad) {
m_ipV6Address = ad;
}
@@ -1069,7 +1083,7 @@ TQString TDENetworkDevice::ipV4Netmask() {
return m_ipV4Netmask;
}
-void TDENetworkDevice::setIpV4Netmask(TQString nm) {
+void TDENetworkDevice::internalSetIpV4Netmask(TQString nm) {
m_ipV4Netmask = nm;
}
@@ -1077,7 +1091,7 @@ TQString TDENetworkDevice::ipV6Netmask() {
return m_ipV6Netmask;
}
-void TDENetworkDevice::setIpV6Netmask(TQString nm) {
+void TDENetworkDevice::internalSetIpV6Netmask(TQString nm) {
m_ipV6Netmask = nm;
}
@@ -1085,7 +1099,7 @@ TQString TDENetworkDevice::ipV4Broadcast() {
return m_ipV4Broadcast;
}
-void TDENetworkDevice::setIpV4Broadcast(TQString br) {
+void TDENetworkDevice::internalSetIpV4Broadcast(TQString br) {
m_ipV4Broadcast = br;
}
@@ -1093,7 +1107,7 @@ TQString TDENetworkDevice::ipV6Broadcast() {
return m_ipV6Broadcast;
}
-void TDENetworkDevice::setIpV6Broadcast(TQString br) {
+void TDENetworkDevice::internalSetIpV6Broadcast(TQString br) {
m_ipV6Broadcast = br;
}
@@ -1101,7 +1115,7 @@ TQString TDENetworkDevice::ipV4Destination() {
return m_ipV4Destination;
}
-void TDENetworkDevice::setIpV4Destination(TQString ds) {
+void TDENetworkDevice::internalSetIpV4Destination(TQString ds) {
m_ipV4Destination = ds;
}
@@ -1109,7 +1123,7 @@ TQString TDENetworkDevice::ipV6Destination() {
return m_ipV6Destination;
}
-void TDENetworkDevice::setIpV6Destination(TQString ds) {
+void TDENetworkDevice::internalSetIpV6Destination(TQString ds) {
m_ipV6Destination = ds;
}
@@ -1117,7 +1131,7 @@ double TDENetworkDevice::rxBytes() {
return m_rxbytes;
}
-void TDENetworkDevice::setRxBytes(double rx) {
+void TDENetworkDevice::internalSetRxBytes(double rx) {
m_rxbytes = rx;
}
@@ -1125,7 +1139,7 @@ double TDENetworkDevice::txBytes() {
return m_txbytes;
}
-void TDENetworkDevice::setTxBytes(double tx) {
+void TDENetworkDevice::internalSetTxBytes(double tx) {
m_txbytes = tx;
}
@@ -1133,7 +1147,7 @@ double TDENetworkDevice::rxPackets() {
return m_rxpackets;
}
-void TDENetworkDevice::setRxPackets(double rx) {
+void TDENetworkDevice::internalSetRxPackets(double rx) {
m_rxpackets = rx;
}
@@ -1141,15 +1155,127 @@ double TDENetworkDevice::txPackets() {
return m_txpackets;
}
-void TDENetworkDevice::setTxPackets(double tx) {
+void TDENetworkDevice::internalSetTxPackets(double tx) {
m_txpackets = tx;
}
+TDEBacklightDevice::TDEBacklightDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
+}
+
+TDEBacklightDevice::~TDEBacklightDevice() {
+}
+
+TDEDisplayPowerLevel::TDEDisplayPowerLevel TDEBacklightDevice::powerLevel() {
+ return m_powerLevel;
+}
+
+void TDEBacklightDevice::internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl) {
+ m_powerLevel = pl;
+}
+
+void TDEBacklightDevice::internalSetMaximumRawBrightness(int br) {
+ m_maximumBrightness = br;
+}
+
+void TDEBacklightDevice::internalSetCurrentRawBrightness(int br) {
+ m_currentBrightness = br;
+}
+
+int TDEBacklightDevice::brightnessSteps() {
+ return m_maximumBrightness + 1;
+}
+
+double TDEBacklightDevice::brightnessPercent() {
+ return (((m_currentBrightness*1.0)/m_maximumBrightness)*100.0);
+}
+
+bool TDEBacklightDevice::canSetBrightness() {
+ TQString brightnessnode = systemPath() + "/brightness";
+ int rval = access (brightnessnode.ascii(), W_OK);
+ if (rval == 0) {
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
+}
+
+int TDEBacklightDevice::rawBrightness() {
+ return m_currentBrightness;
+}
+
+void TDEBacklightDevice::setRawBrightness(int br) {
+ TQString brightnessnode = systemPath() + "/brightness";
+ TQFile file( brightnessnode );
+ if ( file.open( IO_WriteOnly ) ) {
+ TQString brightnessCommand;
+ brightnessCommand = TQString("%1").arg(br);
+ TQTextStream stream( &file );
+ stream << brightnessCommand;
+ file.close();
+ }
+}
+
+TDEMonitorDevice::TDEMonitorDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn) : TDEGenericDevice(dt, dn) {
+}
+
+TDEMonitorDevice::~TDEMonitorDevice() {
+}
+
+bool TDEMonitorDevice::connected() {
+ return m_connected;
+}
+
+void TDEMonitorDevice::internalSetConnected(bool cn) {
+ m_connected = cn;
+}
+
+bool TDEMonitorDevice::enabled() {
+ return m_enabled;
+}
+
+void TDEMonitorDevice::internalSetEnabled(bool en) {
+ m_enabled = en;
+}
+
+TQByteArray TDEMonitorDevice::edid() {
+ return m_edid;
+}
+
+void TDEMonitorDevice::internalSetEdid(TQByteArray ed) {
+ m_edid = ed;
+}
+
+TDEResolutionList TDEMonitorDevice::resolutions() {
+ return m_resolutions;
+}
+
+void TDEMonitorDevice::internalSetResolutions(TDEResolutionList rs) {
+ m_resolutions = rs;
+}
+
+TQString TDEMonitorDevice::portType() {
+ return m_portType;
+}
+
+void TDEMonitorDevice::internalSetPortType(TQString pt) {
+ m_portType = pt;
+}
+
+TDEDisplayPowerLevel::TDEDisplayPowerLevel TDEMonitorDevice::powerLevel() {
+ return m_powerLevel;
+}
+
+void TDEMonitorDevice::internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl) {
+ m_powerLevel = pl;
+}
+
TDEHardwareDevices::TDEHardwareDevices() {
// Initialize members
pci_id_map = 0;
usb_id_map = 0;
pnp_id_map = 0;
+ dpy_id_map = 0;
// Set up device list
m_deviceList.setAutoDelete( TRUE ); // the list owns the objects
@@ -1254,6 +1380,9 @@ TDEHardwareDevices::~TDEHardwareDevices() {
if (pnp_id_map) {
delete pnp_id_map;
}
+ if (dpy_id_map) {
+ delete dpy_id_map;
+ }
}
void TDEHardwareDevices::rescanDeviceInformation(TDEGenericDevice* hwdevice) {
@@ -1406,21 +1535,21 @@ void TDEHardwareDevices::processModifiedCPUs() {
curline.remove(0, curline.find(":")+1);
curline = curline.stripWhiteSpace();
if (cdevice->name() != curline) modified = true;
- cdevice->setName(curline);
+ cdevice->internalSetName(curline);
}
if (curline.startsWith("cpu MHz")) {
curline.remove(0, curline.find(":")+1);
curline = curline.stripWhiteSpace();
if (cdevice->frequency() != curline.toDouble()) modified = true;
- cdevice->setFrequency(curline.toDouble());
+ cdevice->internalSetFrequency(curline.toDouble());
}
if (curline.startsWith("vendor_id")) {
curline.remove(0, curline.find(":")+1);
curline = curline.stripWhiteSpace();
if (cdevice->vendorName() != curline) modified = true;
- cdevice->setVendorName(curline);
+ cdevice->internalSetVendorName(curline);
if (cdevice->vendorEncoded() != curline) modified = true;
- cdevice->setVendorEncoded(curline);
+ cdevice->internalSetVendorEncoded(curline);
}
}
@@ -1498,19 +1627,19 @@ void TDEHardwareDevices::processModifiedCPUs() {
// Update CPU information structure
if (cdevice->governor() != scalinggovernor) modified = true;
- cdevice->setGovernor(scalinggovernor);
+ cdevice->internalSetGovernor(scalinggovernor);
if (cdevice->scalingDriver() != scalingdriver) modified = true;
- cdevice->setScalingDriver(scalingdriver);
+ cdevice->internalSetScalingDriver(scalingdriver);
if (cdevice->minFrequency() != minfrequency) modified = true;
- cdevice->setMinFrequency(minfrequency);
+ cdevice->internalSetMinFrequency(minfrequency);
if (cdevice->maxFrequency() != maxfrequency) modified = true;
- cdevice->setMaxFrequency(maxfrequency);
+ cdevice->internalSetMaxFrequency(maxfrequency);
if (cdevice->transitionLatency() != trlatency) modified = true;
- cdevice->setTransitionLatency(trlatency);
+ cdevice->internalSetTransitionLatency(trlatency);
if (cdevice->dependentProcessors().join(" ") != affectedcpulist.join(" ")) modified = true;
- cdevice->setDependentProcessors(affectedcpulist);
+ cdevice->internalSetDependentProcessors(affectedcpulist);
if (cdevice->availableFrequencies().join(" ") != frequencylist.join(" ")) modified = true;
- cdevice->setAvailableFrequencies(frequencylist);
+ cdevice->internalSetAvailableFrequencies(frequencylist);
}
if (modified) {
@@ -1865,6 +1994,9 @@ TDEGenericDeviceType::TDEGenericDeviceType readGenericDeviceTypeFromString(TQStr
else if (query == "Peripheral") {
ret = TDEGenericDeviceType::Peripheral;
}
+ else if (query == "Backlight") {
+ ret = TDEGenericDeviceType::Backlight;
+ }
else if (query == "Battery") {
ret = TDEGenericDeviceType::Battery;
}
@@ -2051,7 +2183,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDeviceByExternalRules(udev_
}
if (desiredSubdeviceType != sdevice->diskType()) {
printf("[tdehardwaredevices] Rules file %s used to set device subtype for device at path %s\n\r", device->m_externalRulesFile.ascii(), device->systemPath().ascii()); fflush(stdout);
- sdevice->setDiskType(desiredSubdeviceType);
+ sdevice->internalSetDiskType(desiredSubdeviceType);
}
}
}
@@ -2144,7 +2276,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDeviceByExternalRules(udev_
// Process blacklist entries
rulesFile.setGroup("DeviceSettings");
- device->setBlacklistedForUpdate(rulesFile.readBoolEntry("UPDATE_BLACKLISTED", device->blacklistedForUpdate()));
+ device->internalSetBlacklistedForUpdate(rulesFile.readBoolEntry("UPDATE_BLACKLISTED", device->blacklistedForUpdate()));
}
}
++it;
@@ -2385,6 +2517,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
// Try to at least generally classify unclassified devices
if (device == 0) {
+ if (devicesubsystem == "backlight") {
+ if (!device) device = new TDEBacklightDevice(TDEGenericDeviceType::Backlight);
+ }
if (systempath.lower().startsWith("/sys/devices/virtual")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherVirtual);
}
@@ -2422,7 +2557,12 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::MDIO);
}
if (devicesubsystem == "graphics") {
- if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ if (devicenode.isNull()) { // GPUs do not have associated device nodes
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ }
+ else {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
+ }
}
if ((devicesubsystem == "event_source")
|| (devicesubsystem == "rtc")) {
@@ -2435,7 +2575,12 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::IEEE1394);
}
if (devicesubsystem == "drm") {
- if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Monitor);
+ if (devicenode.isNull()) { // Monitors do not have associated device nodes
+ if (!device) device = new TDEMonitorDevice(TDEGenericDeviceType::Monitor);
+ }
+ else {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
+ }
}
if (devicesubsystem == "serio") {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Serial);
@@ -2482,16 +2627,18 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (!device) device = new TDEBatteryDevice(TDEGenericDeviceType::Battery);
}
}
- if (devicesubsystem == "backlight") {
- if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::PowerSupply);
- }
// Moderate accuracy classification, if PCI device class is available
// See http://www.acm.uiuc.edu/sigops/roll_your_own/7.c.1.html for codes and meanings
if (!devicepciclass.isNull()) {
// Pre PCI 2.0
if (devicepciclass.startsWith("0001")) {
- if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ if (devicenode.isNull()) { // GPUs do not have associated device nodes
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ }
+ else {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
+ }
}
// Post PCI 2.0
if (devicepciclass.startsWith("01")) {
@@ -2501,7 +2648,12 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (!device) device = new TDENetworkDevice(TDEGenericDeviceType::Network);
}
if (devicepciclass.startsWith("03")) {
- if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ if (devicenode.isNull()) { // GPUs do not have associated device nodes
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::GPU);
+ }
+ else {
+ if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::Platform);
+ }
}
if (devicepciclass.startsWith("04")) {
if (!device) device = new TDEGenericDevice(TDEGenericDeviceType::OtherMultimedia);
@@ -2541,19 +2693,19 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
// Set preliminary basic device information
- device->setName(devicename);
- device->setDeviceNode(devicenode);
- device->setSystemPath(systempath);
- device->setVendorID(devicevendorid);
- device->setModelID(devicemodelid);
- device->setVendorEncoded(devicevendoridenc);
- device->setModelEncoded(devicemodelidenc);
- device->setSubVendorID(devicesubvendorid);
- device->setSubModelID(devicesubmodelid);
- device->setModuleAlias(devicemodalias);
- device->setDeviceDriver(devicedriver);
- device->setSubsystem(devicesubsystem);
- device->setPCIClass(devicepciclass);
+ device->internalSetName(devicename);
+ device->internalSetDeviceNode(devicenode);
+ device->internalSetSystemPath(systempath);
+ device->internalSetVendorID(devicevendorid);
+ device->internalSetModelID(devicemodelid);
+ device->internalSetVendorEncoded(devicevendoridenc);
+ device->internalSetModelEncoded(devicemodelidenc);
+ device->internalSetSubVendorID(devicesubvendorid);
+ device->internalSetSubModelID(devicesubmodelid);
+ device->internalSetModuleAlias(devicemodalias);
+ device->internalSetDeviceDriver(devicedriver);
+ device->internalSetSubsystem(devicesubsystem);
+ device->internalSetPCIClass(devicepciclass);
updateBlacklists(device, dev);
@@ -2644,9 +2796,9 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
TQString filesystemtype(udev_device_get_property_value(dev, "ID_FS_TYPE"));
TQString filesystemusage(udev_device_get_property_value(dev, "ID_FS_USAGE"));
- device->setVendorName(devicevendor);
- device->setVendorModel(devicemodel);
- device->setDeviceBus(devicebus);
+ device->internalSetVendorName(devicevendor);
+ device->internalSetVendorModel(devicemodel);
+ device->internalSetDeviceBus(devicebus);
TDEStorageDevice* sdevice = static_cast<TDEStorageDevice*>(device);
@@ -2655,7 +2807,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (force_full_classification) {
disktype = classifyDiskType(dev, devicebus, devicetypestring, systempath, devicevendor, devicemodel, filesystemtype, devicedriver);
- sdevice->setDiskType(disktype);
+ 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
}
@@ -2727,7 +2879,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (TQString(udev_device_get_property_value(dev, "ID_CDROM_MEDIA_STATE")).upper() == "BLANK") {
diskstatus = diskstatus | TDEDiskDeviceStatus::Blank;
}
- sdevice->setMediaInserted(!(TQString(udev_device_get_property_value(dev, "ID_CDROM_MEDIA")) == "0"));
+ sdevice->internalSetMediaInserted(!(TQString(udev_device_get_property_value(dev, "ID_CDROM_MEDIA")) == "0"));
}
if (disktype & TDEDiskDeviceType::Zip) {
@@ -2742,7 +2894,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
namefile.close();
}
if (!zipsize.isNull()) {
- sdevice->setMediaInserted((zipsize.toInt() != 0));
+ sdevice->internalSetMediaInserted((zipsize.toInt() != 0));
}
}
@@ -2792,13 +2944,13 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
udev_device_unref(slavedev);
}
- sdevice->setDiskType(disktype);
- sdevice->setDiskUUID(diskuuid);
- sdevice->setDiskStatus(diskstatus);
- sdevice->setFileSystemName(filesystemtype);
- sdevice->setFileSystemUsage(filesystemusage);
- sdevice->setSlaveDevices(slaveDeviceNodes);
- sdevice->setHoldingDevices(holdingDeviceNodes);
+ sdevice->internalSetDiskType(disktype);
+ sdevice->internalSetDiskUUID(diskuuid);
+ sdevice->internalSetDiskStatus(diskstatus);
+ sdevice->internalSetFileSystemName(filesystemtype);
+ sdevice->internalSetFileSystemUsage(filesystemusage);
+ sdevice->internalSetSlaveDevices(slaveDeviceNodes);
+ sdevice->internalSetHoldingDevices(holdingDeviceNodes);
// Clean up disk label
if ((sdevice->isDiskOfType(TDEDiskDeviceType::CDROM))
@@ -2823,7 +2975,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
}
- sdevice->setDiskLabel(disklabel);
+ sdevice->internalSetDiskLabel(disklabel);
}
if (device->type() == TDEGenericDeviceType::Network) {
@@ -2861,18 +3013,18 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
TQString line;
line = stream.readLine();
if (nodename == "address") {
- ndevice->setMacAddress(line);
+ ndevice->internalSetMacAddress(line);
}
if (nodename == "carrier") {
- ndevice->setCarrierPresent(line.toInt());
+ ndevice->internalSetCarrierPresent(line.toInt());
}
if (nodename == "dormant") {
- ndevice->setDormant(line.toInt());
+ ndevice->internalSetDormant(line.toInt());
}
if (nodename == "operstate") {
TQString friendlyState = line.lower();
friendlyState[0] = friendlyState[0].upper();
- ndevice->setState(friendlyState);
+ ndevice->internalSetState(friendlyState);
}
file.close();
}
@@ -2899,44 +3051,44 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
- ndevice->setIpV4Address(address);
+ ndevice->internalSetIpV4Address(address);
}
if (family == AF_INET6) {
address.truncate(address.findRev("%"));
- ndevice->setIpV6Address(address);
+ ndevice->internalSetIpV6Address(address);
}
}
s = getnameinfo(ifa->ifa_netmask, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
- ndevice->setIpV4Netmask(address);
+ ndevice->internalSetIpV4Netmask(address);
}
if (family == AF_INET6) {
address.truncate(address.findRev("%"));
- ndevice->setIpV6Netmask(address);
+ ndevice->internalSetIpV6Netmask(address);
}
}
s = getnameinfo(ifa->ifa_ifu.ifu_broadaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
- ndevice->setIpV4Broadcast(address);
+ ndevice->internalSetIpV4Broadcast(address);
}
if (family == AF_INET6) {
address.truncate(address.findRev("%"));
- ndevice->setIpV6Broadcast(address);
+ ndevice->internalSetIpV6Broadcast(address);
}
}
s = getnameinfo(ifa->ifa_ifu.ifu_dstaddr, (family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6), host, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
if (s == 0) {
TQString address(host);
if (family == AF_INET) {
- ndevice->setIpV4Destination(address);
+ ndevice->internalSetIpV4Destination(address);
}
if (family == AF_INET6) {
address.truncate(address.findRev("%"));
- ndevice->setIpV6Destination(address);
+ ndevice->internalSetIpV6Destination(address);
}
}
}
@@ -2963,16 +3115,16 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
TQString line;
line = stream.readLine();
if (nodename == "rx_bytes") {
- ndevice->setRxBytes(line.toDouble());
+ ndevice->internalSetRxBytes(line.toDouble());
}
if (nodename == "tx_bytes") {
- ndevice->setTxBytes(line.toDouble());
+ ndevice->internalSetTxBytes(line.toDouble());
}
if (nodename == "rx_packets") {
- ndevice->setRxPackets(line.toDouble());
+ ndevice->internalSetRxPackets(line.toDouble());
}
if (nodename == "tx_packets") {
- ndevice->setTxPackets(line.toDouble());
+ ndevice->internalSetTxPackets(line.toDouble());
}
file.close();
}
@@ -3035,7 +3187,7 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
}
TDESensorDevice* sdevice = dynamic_cast<TDESensorDevice*>(device);
- sdevice->setValues(sensors);
+ sdevice->internalSetValues(sensors);
}
if (device->type() == TDEGenericDeviceType::Battery) {
@@ -3057,43 +3209,43 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
TQString line;
line = stream.readLine();
if (nodename == "alarm") {
- bdevice->setAlarmEnergy(line.toDouble()/1000000.0);
+ bdevice->internalSetAlarmEnergy(line.toDouble()/1000000.0);
}
if (nodename == "energy_full") {
- bdevice->setMaximumEnergy(line.toDouble()/1000000.0);
+ bdevice->internalSetMaximumEnergy(line.toDouble()/1000000.0);
}
if (nodename == "energy_full_design") {
- bdevice->setMaximumDesignEnergy(line.toDouble()/1000000.0);
+ bdevice->internalSetMaximumDesignEnergy(line.toDouble()/1000000.0);
}
if (nodename == "energy_now") {
- bdevice->setEnergy(line.toDouble()/1000000.0);
+ bdevice->internalSetEnergy(line.toDouble()/1000000.0);
}
if (nodename == "manufacturer") {
- bdevice->setVendorName(line.stripWhiteSpace());
+ bdevice->internalSetVendorName(line.stripWhiteSpace());
}
if (nodename == "model_name") {
- bdevice->setVendorModel(line.stripWhiteSpace());
+ bdevice->internalSetVendorModel(line.stripWhiteSpace());
}
if (nodename == "power_now") {
- bdevice->setDischargeRate(line.toDouble()/1000000.0);
+ bdevice->internalSetDischargeRate(line.toDouble()/1000000.0);
}
if (nodename == "present") {
- bdevice->setInstalled(line.toInt());
+ bdevice->internalSetInstalled(line.toInt());
}
if (nodename == "serial_number") {
- bdevice->setSerialNumber(line.stripWhiteSpace());
+ bdevice->internalSetSerialNumber(line.stripWhiteSpace());
}
if (nodename == "status") {
- bdevice->setStatus(line);
+ bdevice->internalSetStatus(line);
}
if (nodename == "technology") {
- bdevice->setTechnology(line);
+ bdevice->internalSetTechnology(line);
}
if (nodename == "voltage_min_design") {
- bdevice->setMinimumVoltage(line.toDouble()/1000000.0);
+ bdevice->internalSetMinimumVoltage(line.toDouble()/1000000.0);
}
if (nodename == "voltage_now") {
- bdevice->setVoltage(line.toDouble()/1000000.0);
+ bdevice->internalSetVoltage(line.toDouble()/1000000.0);
}
file.close();
}
@@ -3121,37 +3273,165 @@ TDEGenericDevice* TDEHardwareDevices::classifyUnknownDevice(udev_device* dev, TD
TQString line;
line = stream.readLine();
if (nodename == "manufacturer") {
- pdevice->setVendorName(line.stripWhiteSpace());
+ pdevice->internalSetVendorName(line.stripWhiteSpace());
}
if (nodename == "model_name") {
- pdevice->setVendorModel(line.stripWhiteSpace());
+ pdevice->internalSetVendorModel(line.stripWhiteSpace());
}
if (nodename == "online") {
- pdevice->setOnline(line.toInt());
+ pdevice->internalSetOnline(line.toInt());
}
if (nodename == "serial_number") {
- pdevice->setSerialNumber(line.stripWhiteSpace());
+ pdevice->internalSetSerialNumber(line.stripWhiteSpace());
+ }
+ file.close();
+ }
+ ++valuesdirit;
+ }
+ }
+ }
+
+ if (device->type() == TDEGenericDeviceType::Backlight) {
+ // Populate all backlight values
+ TDEBacklightDevice* bdevice = dynamic_cast<TDEBacklightDevice*>(device);
+ TQString valuesnodename = systempath + "/";
+ TQDir valuesdir(valuesnodename);
+ valuesdir.setFilter(TQDir::All);
+ TQString nodename;
+ const TQFileInfoList *dirlist = valuesdir.entryInfoList();
+ if (dirlist) {
+ TQFileInfoListIterator valuesdirit(*dirlist);
+ TQFileInfo *dirfi;
+ while ( (dirfi = valuesdirit.current()) != 0 ) {
+ nodename = dirfi->fileName();
+ TQFile file( valuesnodename + nodename );
+ if ( file.open( IO_ReadOnly ) ) {
+ TQTextStream stream( &file );
+ TQString line;
+ line = stream.readLine();
+ if (nodename == "bl_power") {
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel pl = TDEDisplayPowerLevel::On;
+ int rpl = line.toInt();
+ if (rpl == FB_BLANK_UNBLANK) {
+ pl = TDEDisplayPowerLevel::On;
+ }
+ else if (rpl == FB_BLANK_POWERDOWN) {
+ pl = TDEDisplayPowerLevel::Off;
+ }
+ bdevice->internalSetPowerLevel(pl);
+ }
+ if (nodename == "max_brightness") {
+ bdevice->internalSetMaximumRawBrightness(line.toInt());
+ }
+ if (nodename == "actual_brightness") {
+ bdevice->internalSetCurrentRawBrightness(line.toInt());
+ }
+ file.close();
+ }
+ ++valuesdirit;
+ }
+ }
+ }
+
+ if (device->type() == TDEGenericDeviceType::Monitor) {
+ TDEMonitorDevice* mdevice = dynamic_cast<TDEMonitorDevice*>(device);
+ TQString valuesnodename = systempath + "/";
+ TQDir valuesdir(valuesnodename);
+ valuesdir.setFilter(TQDir::All);
+ TQString nodename;
+ const TQFileInfoList *dirlist = valuesdir.entryInfoList();
+ if (dirlist) {
+ TQFileInfoListIterator valuesdirit(*dirlist);
+ TQFileInfo *dirfi;
+ while ( (dirfi = valuesdirit.current()) != 0 ) {
+ nodename = dirfi->fileName();
+ TQFile file( valuesnodename + nodename );
+ if ( file.open( IO_ReadOnly ) ) {
+ TQTextStream stream( &file );
+ TQString line;
+ line = stream.readLine();
+ if (nodename == "status") {
+ mdevice->internalSetConnected(line.lower() == "connected");
+ }
+ if (nodename == "enabled") {
+ mdevice->internalSetEnabled(line.lower() == "enabled");
+ }
+ if (nodename == "modes") {
+ TQStringList resinfo;
+ TQStringList resolutionsStringList = line.upper();
+ while ((!stream.atEnd()) && (!line.isNull())) {
+ line = stream.readLine();
+ if (!line.isNull()) {
+ resolutionsStringList.append(line.upper());
+ }
+ }
+ TDEResolutionList resolutions;
+ resolutions.clear();
+ for (TQStringList::Iterator it = resolutionsStringList.begin(); it != resolutionsStringList.end(); ++it) {
+ resinfo = TQStringList::split('X', *it, true);
+ resolutions.append(TDEResolutionPair((*(resinfo.at(0))).toUInt(), (*(resinfo.at(1))).toUInt()));
+ }
+ mdevice->internalSetResolutions(resolutions);
+ }
+ if (nodename == "dpms") {
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel pl = TDEDisplayPowerLevel::On;
+ if (line == "On") {
+ pl = TDEDisplayPowerLevel::On;
+ }
+ else if (line == "Standby") {
+ pl = TDEDisplayPowerLevel::Standby;
+ }
+ else if (line == "Suspend") {
+ pl = TDEDisplayPowerLevel::Suspend;
+ }
+ else if (line == "Off") {
+ pl = TDEDisplayPowerLevel::Off;
+ }
+ mdevice->internalSetPowerLevel(pl);
}
file.close();
}
++valuesdirit;
}
}
+
+ TQString genericPortName = mdevice->systemPath();
+ genericPortName.remove(0, genericPortName.find("-")+1);
+ genericPortName.truncate(genericPortName.findRev("-"));
+ mdevice->internalSetPortType(genericPortName);
+
+ if (mdevice->connected()) {
+ TQPair<TQString,TQString> monitor_info = getEDIDMonitorName(device->systemPath());
+ if (!monitor_info.first.isNull()) {
+ mdevice->internalSetVendorName(monitor_info.first);
+ mdevice->internalSetVendorModel(monitor_info.second);
+ mdevice->m_friendlyName = monitor_info.first + " " + monitor_info.second;
+ }
+ mdevice->internalSetEdid(getEDID(mdevice->systemPath()));
+ }
+ else {
+ mdevice->m_friendlyName = i18n("Disconnected %1 Port").arg(genericPortName);
+ mdevice->internalSetEdid(TQByteArray());
+ mdevice->internalSetResolutions(TDEResolutionList());
+ }
+
+ // FIXME
+ // Much of the code in libkrandr should be integrated into/interfaced with this library
}
// Set basic device information again, as some information may have changed
- device->setName(devicename);
- device->setDeviceNode(devicenode);
- device->setSystemPath(systempath);
- device->setVendorID(devicevendorid);
- device->setModelID(devicemodelid);
- device->setVendorEncoded(devicevendoridenc);
- device->setModelEncoded(devicemodelidenc);
- device->setSubVendorID(devicesubvendorid);
- device->setSubModelID(devicesubmodelid);
- device->setDeviceDriver(devicedriver);
- device->setSubsystem(devicesubsystem);
- device->setPCIClass(devicepciclass);
+ device->internalSetName(devicename);
+ device->internalSetDeviceNode(devicenode);
+ device->internalSetSystemPath(systempath);
+ device->internalSetVendorID(devicevendorid);
+ device->internalSetModelID(devicemodelid);
+ device->internalSetVendorEncoded(devicevendoridenc);
+ device->internalSetModelEncoded(devicemodelidenc);
+ device->internalSetSubVendorID(devicesubvendorid);
+ device->internalSetSubModelID(devicesubmodelid);
+ device->internalSetDeviceDriver(devicedriver);
+ device->internalSetSubsystem(devicesubsystem);
+ device->internalSetPCIClass(devicepciclass);
return device;
}
@@ -3163,7 +3443,7 @@ void TDEHardwareDevices::updateBlacklists(TDEGenericDevice* hwdevice, udev_devic
// For "U3 System" fake CD
if ((hwdevice->vendorID() == "08ec") && (hwdevice->modelID() == "0020") && (TQString(udev_device_get_property_value(dev, "ID_TYPE")) == "cd")) {
- hwdevice->setBlacklistedForUpdate(true);
+ hwdevice->internalSetBlacklistedForUpdate(true);
}
}
@@ -3247,7 +3527,7 @@ void TDEHardwareDevices::updateParentDeviceInformation(TDEGenericDevice* hwdevic
}
}
- hwdevice->setParentDevice(parentdevice);
+ hwdevice->internalSetParentDevice(parentdevice);
}
void TDEHardwareDevices::updateParentDeviceInformation() {
@@ -3276,7 +3556,7 @@ void TDEHardwareDevices::addCoreSystemDevices() {
nodename = dirfi->fileName();
if (nodename != "." && nodename != "..") {
hwdevice = new TDEGenericDevice(TDEGenericDeviceType::Root);
- hwdevice->setSystemPath(dirfi->absFilePath());
+ hwdevice->internalSetSystemPath(dirfi->absFilePath());
m_deviceList.append(hwdevice);
}
++devicesdirit;
@@ -3301,7 +3581,7 @@ void TDEHardwareDevices::addCoreSystemDevices() {
line = line.stripWhiteSpace();
processorNumber = line.toInt();
hwdevice = new TDECPUDevice(TDEGenericDeviceType::CPU);
- hwdevice->setSystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
+ hwdevice->internalSetSystemPath(TQString("/sys/devices/system/cpu/cpu%1").arg(processorNumber));
m_deviceList.append(hwdevice);
#if 0
// Set up CPU information monitor
@@ -3609,6 +3889,156 @@ TQString TDEHardwareDevices::findPNPDeviceName(TQString pnpid) {
}
}
+TQString TDEHardwareDevices::findMonitorManufacturerName(TQString dpyid) {
+ TQString friendlyName = TQString::null;
+
+ if (!dpy_id_map) {
+ dpy_id_map = new TDEDeviceIDMap;
+
+ TQStringList hardware_info_directories(KGlobal::dirs()->resourceDirs("data"));
+ TQString hardware_info_directory_suffix("tdehwlib/pnpdev/");
+ TQString hardware_info_directory;
+ TQString database_filename;
+
+ for ( TQStringList::Iterator it = hardware_info_directories.begin(); it != hardware_info_directories.end(); ++it ) {
+ hardware_info_directory = (*it);
+ hardware_info_directory += hardware_info_directory_suffix;
+
+ if (KGlobal::dirs()->exists(hardware_info_directory)) {
+ database_filename = hardware_info_directory + "dpy.ids";
+ if (TQFile::exists(database_filename)) {
+ break;
+ }
+ }
+ }
+
+ if (!TQFile::exists(database_filename)) {
+ printf("[tdehardwaredevices] Unable to locate monitor information database dpy.ids\n\r"); fflush(stdout);
+ return i18n("Unknown Monitor Device");
+ }
+
+ TQFile database(database_filename);
+ if (database.open(IO_ReadOnly)) {
+ TQTextStream stream(&database);
+ TQString line;
+ TQString dpyID;
+ TQString vendorName;
+ TQString deviceMapKey;
+ TQStringList devinfo;
+ while (!stream.atEnd()) {
+ line = stream.readLine();
+ if ((!line.upper().startsWith("\t")) && (!line.upper().startsWith("#"))) {
+ devinfo = TQStringList::split('\t', line, false);
+ if (devinfo.count() > 1) {
+ dpyID = *(devinfo.at(0));
+ vendorName = *(devinfo.at(1));;
+ vendorName = vendorName.stripWhiteSpace();
+ deviceMapKey = dpyID.upper().stripWhiteSpace();
+ if (!deviceMapKey.isNull()) {
+ dpy_id_map->insert(deviceMapKey, vendorName, true);
+ }
+ }
+ }
+ }
+ database.close();
+ }
+ else {
+ printf("[tdehardwaredevices] Unable to open monitor information database %s\n\r", database_filename.ascii()); fflush(stdout);
+ }
+ }
+
+ if (dpy_id_map) {
+ TQString deviceName;
+
+ deviceName = (*dpy_id_map)[dpyid];
+
+ return deviceName;
+ }
+ else {
+ return i18n("Unknown Monitor Device");
+ }
+}
+
+TQPair<TQString,TQString> TDEHardwareDevices::getEDIDMonitorName(TQString path) {
+ TQPair<TQString,TQString> edid;
+ TQByteArray binaryedid = getEDID(path);
+ if (binaryedid.isNull()) {
+ return TQPair<TQString,TQString>(TQString::null, TQString::null);
+ }
+
+ // Get the manufacturer ID
+ unsigned char letter_1 = ((binaryedid[8]>>2) & 0x1F) + 0x40;
+ unsigned char letter_2 = (((binaryedid[8] & 0x03) << 3) | ((binaryedid[9]>>5) & 0x07)) + 0x40;
+ unsigned char letter_3 = (binaryedid[9] & 0x1F) + 0x40;
+ TQChar qletter_1 = TQChar(letter_1);
+ TQChar qletter_2 = TQChar(letter_2);
+ TQChar qletter_3 = TQChar(letter_3);
+ TQString manufacturer_id = TQString("%1%2%3").arg(qletter_1).arg(qletter_2).arg(qletter_3);
+
+ // Get the model ID
+ unsigned int raw_model_id = (((binaryedid[10] << 8) | binaryedid[11]) << 16) & 0xFFFF0000;
+ // Reverse the bit order
+ unsigned int model_id = reverse_bits(raw_model_id);
+
+ // Try to get the model name
+ bool has_friendly_name = false;
+ unsigned char descriptor_block[18];
+ int i;
+ for (i=72;i<90;i++) {
+ descriptor_block[i-72] = binaryedid[i] & 0xFF;
+ }
+ if ((descriptor_block[0] != 0) || (descriptor_block[1] != 0) || (descriptor_block[3] != 0xFC)) {
+ for (i=90;i<108;i++) {
+ descriptor_block[i-90] = binaryedid[i] & 0xFF;
+ }
+ if ((descriptor_block[0] != 0) || (descriptor_block[1] != 0) || (descriptor_block[3] != 0xFC)) {
+ for (i=108;i<126;i++) {
+ descriptor_block[i-108] = binaryedid[i] & 0xFF;
+ }
+ }
+ }
+
+ TQString monitor_name;
+ if ((descriptor_block[0] == 0) && (descriptor_block[1] == 0) && (descriptor_block[3] == 0xFC)) {
+ char* pos = strchr((char *)(descriptor_block+5), '\n');
+ if (pos) {
+ *pos = 0;
+ has_friendly_name = true;
+ monitor_name = TQString((char *)(descriptor_block+5));
+ }
+ else {
+ has_friendly_name = false;
+ }
+ }
+
+ // Look up manufacturer name
+ TQString manufacturer_name = findMonitorManufacturerName(manufacturer_id);
+ if (manufacturer_name.isNull()) {
+ manufacturer_name = manufacturer_id;
+ }
+
+ if (has_friendly_name) {
+ edid.first = TQString("%1").arg(manufacturer_name);
+ edid.second = TQString("%2").arg(monitor_name);
+ }
+ else {
+ edid.first = TQString("%1").arg(manufacturer_name);
+ edid.second = TQString("0x%2").arg(model_id, 0, 16);
+ }
+
+ return edid;
+}
+
+TQByteArray TDEHardwareDevices::getEDID(TQString path) {
+ TQFile file(TQString("%1/edid").arg(path));
+ if (!file.open (IO_ReadOnly)) {
+ return TQByteArray();
+ }
+ TQByteArray binaryedid = file.readAll();
+ file.close();
+ return binaryedid;
+}
+
TQString TDEHardwareDevices::getFriendlyDeviceTypeStringFromType(TDEGenericDeviceType::TDEGenericDeviceType query) {
TQString ret = "Unknown Device";
@@ -3694,6 +4124,9 @@ TQString TDEHardwareDevices::getFriendlyDeviceTypeStringFromType(TDEGenericDevic
else if (query == TDEGenericDeviceType::Peripheral) {
ret = i18n("Peripheral");
}
+ else if (query == TDEGenericDeviceType::Backlight) {
+ ret = i18n("Backlight");
+ }
else if (query == TDEGenericDeviceType::Battery) {
ret = i18n("Battery");
}
@@ -3834,6 +4267,9 @@ TQPixmap TDEHardwareDevices::getDeviceTypeIconFromType(TDEGenericDeviceType::TDE
else if (query == TDEGenericDeviceType::Peripheral) {
ret = DesktopIcon("kcmpci", size);
}
+ else if (query == TDEGenericDeviceType::Backlight) {
+ ret = DesktopIcon("kscreensaver", size); // FIXME
+ }
else if (query == TDEGenericDeviceType::Battery) {
ret = DesktopIcon("energy", size);
}
diff --git a/tdecore/tdehardwaredevices.h b/tdecore/tdehardwaredevices.h
index f25d80eda..c230474a1 100644
--- a/tdecore/tdehardwaredevices.h
+++ b/tdecore/tdehardwaredevices.h
@@ -69,6 +69,7 @@ enum TDEGenericDeviceType {
Serial,
Parallel,
Peripheral,
+ Backlight,
Battery,
PowerSupply,
Dock,
@@ -214,41 +215,21 @@ class TDECORE_EXPORT TDEGenericDevice
TQString &name();
/**
- * @param a TQString with the device name, if any
- */
- void setName(TQString dn);
-
- /**
* @return a TQString with the vendor name, if any
*/
TQString &vendorName();
/**
- * @param a TQString with the vendor name, if any
- */
- void setVendorName(TQString vn);
-
- /**
* @return a TQString with the vendor model, if any
*/
TQString &vendorModel();
/**
- * @param a TQString with the vendor model, if any
- */
- void setVendorModel(TQString vm);
-
- /**
* @return a TQString with the serial number, if any
*/
TQString &serialNumber();
/**
- * @param a TQString with the serial number, if any
- */
- void setSerialNumber(TQString sn);
-
- /**
* @return a TQString with a friendly name
*
* While TDE tries very hard to generate and return a friendly name for this device,
@@ -262,11 +243,6 @@ class TDECORE_EXPORT TDEGenericDevice
TQString &deviceBus();
/**
- * @param a TQString with the device bus name, if any
- */
- void setDeviceBus(TQString db);
-
- /**
* @return a TQString with the system path, if any
*
* This method is non-portable, so be careful!
@@ -274,167 +250,212 @@ class TDECORE_EXPORT TDEGenericDevice
TQString &systemPath();
/**
- * @param a TQString with the system path, if any
+ * @return a TQString with the system device node, if any
*
* This method is non-portable, so be careful!
*/
- void setSystemPath(TQString sp);
+ TQString &deviceNode();
/**
- * @return a TQString with the system device node, if any
- *
- * This method is non-portable, so be careful!
+ * @return true if this device has been blacklisted for update actions
*/
- TQString &deviceNode();
+ bool blacklistedForUpdate();
/**
- * @param a TQString with the system device node, if any
- *
- * This method is non-portable, so be careful!
+ * @return a TQString containing a unique identifier for this device
*/
- void setDeviceNode(TQString sn);
+ TQString uniqueID();
/**
- * @return true if this device has been blacklisted for update actions
+ * @return a TQString with the vendor ID, if any
*/
- bool blacklistedForUpdate();
+ TQString &vendorID();
/**
- * @param bl true if this device has been blacklisted for update actions
+ * @return a TQString with the model ID, if any
*/
- void setBlacklistedForUpdate(bool bl);
+ TQString &modelID();
/**
- * @return a TQString containing a unique identifier for this device
+ * @return a TQString with the encoded vendor, if any
*/
- TQString uniqueID();
+ TQString &vendorEncoded();
/**
- * @return a TQString with the vendor ID, if any
+ * @return a TQString with the encoded model, if any
*/
- TQString &vendorID();
+ TQString &modelEncoded();
/**
- * @param a TQString with the vendor ID, if any
+ * @return a TQString with the subvendor ID, if any
*/
- void setVendorID(TQString id);
+ TQString &subVendorID();
/**
- * @return a TQString with the model ID, if any
+ * @return a TQString with the submodel ID, if any
*/
- TQString &modelID();
+ TQString &subModelID();
/**
- * @param a TQString with the model ID, if any
+ * @return a TQString with the PCI device class, if any
*/
- void setModelID(TQString id);
+ TQString &PCIClass();
/**
- * @return a TQString with the encoded vendor, if any
+ * @return a TQString with the module alias string, if any
*/
- TQString &vendorEncoded();
+ TQString &moduleAlias();
/**
- * @param a TQString with the encoded vendor, if any
+ * @return a TQString with the device driver, if any
*/
- void setVendorEncoded(TQString id);
+ TQString &deviceDriver();
/**
- * @return a TQString with the encoded model, if any
+ * @return a TQString with the subsystem type, if any
*/
- TQString &modelEncoded();
+ TQString &subsystem();
/**
- * @param a TQString with the encoded model, if any
+ * @return a TDEGenericDevice* with the parent device, if any
*/
- void setModelEncoded(TQString id);
+ TDEGenericDevice* parentDevice();
/**
- * @return a TQString with the subvendor ID, if any
+ * @return a TQString containing the friendly type name
*/
- TQString &subVendorID();
+ virtual TQString friendlyDeviceType();
/**
- * @param a TQString with the subvendor ID, if any
+ * @return a TQString containing the device bus ID, if any
*/
- void setSubVendorID(TQString id);
+ TQString busID();
/**
- * @return a TQString with the submodel ID, if any
+ * Get an icon for this device
+ * @param size a KIcon::StdSizes structure specifying the desired icon size
+ * @return a TQPixmap containing the icon for the specified type
*/
- TQString &subModelID();
+ virtual TQPixmap icon(KIcon::StdSizes size);
+ protected:
/**
- * @param a TQString with the submodel ID, if any
+ * @param a TQString with the device name, if any
+ * @internal
*/
- void setSubModelID(TQString id);
+ void internalSetName(TQString dn);
/**
- * @return a TQString with the PCI device class, if any
+ * @param a TQString with the vendor name, if any
+ * @internal
*/
- TQString &PCIClass();
+ void internalSetVendorName(TQString vn);
/**
- * @param a TQString with the PCI device class, if any
+ * @param a TQString with the vendor model, if any
+ * @internal
*/
- void setPCIClass(TQString cl);
+ void internalSetVendorModel(TQString vm);
/**
- * @return a TQString with the module alias string, if any
+ * @param a TQString with the serial number, if any
+ * @internal
*/
- TQString &moduleAlias();
+ void internalSetSerialNumber(TQString sn);
/**
- * @param a TQString with the module alias string, if any
+ * @param a TQString with the device bus name, if any
+ * @internal
*/
- void setModuleAlias(TQString ma);
+ void internalSetDeviceBus(TQString db);
/**
- * @return a TQString with the device driver, if any
+ * @param a TQString with the system path, if any
+ * @internal
+ *
+ * This method is non-portable, so be careful!
*/
- TQString &deviceDriver();
+ void internalSetSystemPath(TQString sp);
/**
- * @param a TQString with the device driver, if any
+ * @param a TQString with the system device node, if any
+ * @internal
+ *
+ * This method is non-portable, so be careful!
*/
- void setDeviceDriver(TQString dr);
+ void internalSetDeviceNode(TQString sn);
/**
- * @return a TQString with the subsystem type, if any
+ * @param bl true if this device has been blacklisted for update actions
+ * @internal
*/
- TQString &subsystem();
+ void internalSetBlacklistedForUpdate(bool bl);
/**
- * @param a TQString with the subsystem type, if any
+ * @param a TQString with the vendor ID, if any
+ * @internal
*/
- void setSubsystem(TQString ss);
+ void internalSetVendorID(TQString id);
/**
- * @param a TDEGenericDevice* with the parent device, if any
+ * @param a TQString with the model ID, if any
+ * @internal
*/
- void setParentDevice(TDEGenericDevice* pd);
+ void internalSetModelID(TQString id);
/**
- * @return a TDEGenericDevice* with the parent device, if any
+ * @param a TQString with the encoded vendor, if any
+ * @internal
*/
- TDEGenericDevice* parentDevice();
+ void internalSetVendorEncoded(TQString id);
/**
- * @return a TQString containing the friendly type name
+ * @param a TQString with the encoded model, if any
+ * @internal
*/
- virtual TQString friendlyDeviceType();
+ void internalSetModelEncoded(TQString id);
/**
- * @return a TQString containing the device bus ID, if any
+ * @param a TQString with the subvendor ID, if any
+ * @internal
*/
- TQString busID();
+ void internalSetSubVendorID(TQString id);
/**
- * Get an icon for this device
- * @param size a KIcon::StdSizes structure specifying the desired icon size
- * @return a TQPixmap containing the icon for the specified type
+ * @param a TQString with the submodel ID, if any
+ * @internal
*/
- virtual TQPixmap icon(KIcon::StdSizes size);
+ void internalSetSubModelID(TQString id);
+
+ /**
+ * @param a TQString with the PCI device class, if any
+ * @internal
+ */
+ void internalSetPCIClass(TQString cl);
+
+ /**
+ * @param a TQString with the module alias string, if any
+ * @internal
+ */
+ void internalSetModuleAlias(TQString ma);
+
+ /**
+ * @param a TQString with the device driver, if any
+ * @internal
+ */
+ void internalSetDeviceDriver(TQString dr);
+
+ /**
+ * @param a TQString with the subsystem type, if any
+ * @internal
+ */
+ void internalSetSubsystem(TQString ss);
+
+ /**
+ * @param a TDEGenericDevice* with the parent device, if any
+ * @internal
+ */
+ void internalSetParentDevice(TDEGenericDevice* pd);
private:
TDEGenericDeviceType::TDEGenericDeviceType m_deviceType;
@@ -487,101 +508,46 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
TQString &diskLabel();
/**
- * @param a TQString with the disk or partition label, if any
- */
- void setDiskLabel(TQString dn);
-
- /**
* @return a TQString with the disk UUID, if any
*/
TQString &diskUUID();
/**
- * @param a TQString with the disk UUID, if any
- */
- void setDiskUUID(TQString id);
-
- /**
* @return an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags
*/
TDEDiskDeviceType::TDEDiskDeviceType diskType();
/**
- * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags
- */
- void setDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
-
- /**
- * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags
- */
- bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
-
- /**
* @return an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags
*/
TDEDiskDeviceStatus::TDEDiskDeviceStatus diskStatus();
/**
- * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags
- */
- void setDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
-
- /**
- * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags
- */
- bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
-
- /**
* @return true if media inserted, false if no media available
*/
bool mediaInserted();
/**
- * @param a bool with the media status
- */
- void setMediaInserted(bool inserted);
-
- /**
* @return a TQString with the filesystem name, if any
*/
TQString &fileSystemName();
/**
- * @param a TQString with the filesystem name, if any
- */
- void setFileSystemName(TQString fn);
-
- /**
* @return a TQString with the filesystem usage string, if any
*/
TQString &fileSystemUsage();
/**
- * @param a TQString with the filesystem usage string, if any
- */
- void setFileSystemUsage(TQString fu);
-
- /**
* @return a TQStringList containing system paths to all devices with a lock on this device, if any
*/
TQStringList &holdingDevices();
/**
- * @param a TQStringList containing system paths to all devices with a lock on this device, if any
- */
- void setHoldingDevices(TQStringList hd);
-
- /**
* @return a TQStringList containing system paths to all devices locked by this device, if any
*/
TQStringList &slaveDevices();
/**
- * @param a TQStringList containing system paths to all devices locked by this device, if any
- */
- void setSlaveDevices(TQStringList sd);
-
- /**
* Mounts the device if not encrypted
*
* @param a TQString containing a requested mount name under /media, if desired
@@ -654,6 +620,71 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
*/
TQString friendlyDeviceType();
+ /**
+ * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags
+ */
+ bool isDiskOfType(TDEDiskDeviceType::TDEDiskDeviceType tf);
+
+ /**
+ * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags
+ */
+ bool checkDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus sf);
+
+ protected:
+ /**
+ * @param a TQString with the disk or partition label, if any
+ * @internal
+ */
+ void internalSetDiskLabel(TQString dn);
+
+ /**
+ * @param a TQString with the disk UUID, if any
+ * @internal
+ */
+ void internalSetDiskUUID(TQString id);
+
+ /**
+ * @param an OR-ed combination of TDEDiskDeviceType::TDEDiskDeviceType type flags
+ * @internal
+ */
+ void internalSetDiskType(TDEDiskDeviceType::TDEDiskDeviceType tf);
+
+ /**
+ * @param an OR-ed combination of TDEDiskDeviceStatus::TDEDiskDeviceStatus type flags
+ * @internal
+ */
+ void internalSetDiskStatus(TDEDiskDeviceStatus::TDEDiskDeviceStatus st);
+
+ /**
+ * @param a bool with the media status
+ * @internal
+ */
+ void internalSetMediaInserted(bool inserted);
+
+ /**
+ * @param a TQString with the filesystem name, if any
+ * @internal
+ */
+ void internalSetFileSystemName(TQString fn);
+
+ /**
+ * @param a TQString with the filesystem usage string, if any
+ * @internal
+ */
+ void internalSetFileSystemUsage(TQString fu);
+
+ /**
+ * @param a TQStringList containing system paths to all devices with a lock on this device, if any
+ * @internal
+ */
+ void internalSetHoldingDevices(TQStringList hd);
+
+ /**
+ * @param a TQStringList containing system paths to all devices locked by this device, if any
+ * @internal
+ */
+ void internalSetSlaveDevices(TQStringList sd);
+
private:
TDEDiskDeviceType::TDEDiskDeviceType m_diskType;
TDEDiskDeviceStatus::TDEDiskDeviceStatus m_diskStatus;
@@ -665,6 +696,8 @@ class TDECORE_EXPORT TDEStorageDevice : public TDEGenericDevice
TQString m_mountPath;
TQStringList m_holdingDevices;
TQStringList m_slaveDevices;
+
+ friend class TDEHardwareDevices;
};
class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
@@ -687,79 +720,88 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
double &frequency();
/**
- * @param a double with the current CPU frequency in MHz, if available
+ * @return a double with the minimum CPU frequency in MHz, if available
*/
- void setFrequency(double fr);
+ double &minFrequency();
/**
- * @return a double with the minimum CPU frequency in MHz, if available
+ * @return a double with the maximum CPU frequency in MHz, if available
*/
- double &minFrequency();
+ double &maxFrequency();
/**
- * @param a double with the minimum CPU frequency in MHz, if available
+ * @return a double with the transition latency in ns, if available
*/
- void setMinFrequency(double fr);
+ double &transitionLatency();
/**
- * @return a double with the maximum CPU frequency in MHz, if available
+ * @return a TQString with the current CPU governor policy, if available
*/
- double &maxFrequency();
+ TQString &governor();
/**
- * @param a double with the maximum CPU frequency in MHz, if available
+ * @return a TQString with the current CPU scaling driver, if available
*/
- void setMaxFrequency(double fr);
+ TQString &scalingDriver();
/**
- * @return a double with the transition latency in ns, if available
+ * @return a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available
*/
- double &transitionLatency();
+ TQStringList &dependentProcessors();
/**
- * @param a double with the transition latency in ns, if available
+ * @return a TQStringList with all valid scaling frequencies in Hz, if available
*/
- void setTransitionLatency(double tl);
+ TQStringList &availableFrequencies();
+ protected:
/**
- * @return a TQString with the current CPU governor policy, if available
+ * @param a double with the current CPU frequency in MHz, if available
+ * @internal
*/
- TQString &governor();
+ void internalSetFrequency(double fr);
/**
- * @param a TQString with the current CPU governor policy, if available
+ * @param a double with the minimum CPU frequency in MHz, if available
+ * @internal
*/
- void setGovernor(TQString gr);
+ void internalSetMinFrequency(double fr);
/**
- * @return a TQString with the current CPU scaling driver, if available
+ * @param a double with the maximum CPU frequency in MHz, if available
+ * @internal
*/
- TQString &scalingDriver();
+ void internalSetMaxFrequency(double fr);
/**
- * @param a TQString with the current CPU scaling driver, if available
+ * @param a double with the transition latency in ns, if available
+ * @internal
*/
- void setScalingDriver(TQString dr);
+ void internalSetTransitionLatency(double tl);
/**
- * @return a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available
+ * @param a TQString with the current CPU governor policy, if available
+ * @internal
*/
- TQStringList &dependentProcessors();
+ void internalSetGovernor(TQString gr);
/**
- * @param a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available
+ * @param a TQString with the current CPU scaling driver, if available
+ * @internal
*/
- void setDependentProcessors(TQStringList dp);
+ void internalSetScalingDriver(TQString dr);
/**
- * @return a TQStringList with all valid scaling frequencies in Hz, if available
+ * @param a TQStringList with the IDs of all processors that are dependent on the frequency/power settings of this one, if available
+ * @internal
*/
- TQStringList &availableFrequencies();
+ void internalSetDependentProcessors(TQStringList dp);
/**
* @param a TQStringList with all valid scaling frequencies in Hz, if available
+ * @internal
*/
- void setAvailableFrequencies(TQStringList af);
+ void internalSetAvailableFrequencies(TQStringList af);
private:
double m_frequency;
@@ -770,6 +812,8 @@ class TDECORE_EXPORT TDECPUDevice : public TDEGenericDevice
TQString m_scalingdriver;
TQStringList m_tiedprocs;
TQStringList m_frequencies;
+
+ friend class TDEHardwareDevices;
};
class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice
@@ -792,124 +836,137 @@ class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice
double voltage();
/**
- * @param a double with the current battery voltage, if available
+ * @return a double with the minimum battery voltage, if available
*/
- void setVoltage(double vt);
+ double minimumVoltage();
/**
- * @return a double with the minimum battery voltage, if available
+ * @return a double with the maximum battery voltage, if available
*/
- double minimumVoltage();
+ double maximumVoltage();
/**
- * @param a double with the minimum battery voltage, if available
+ * @return a double with the designed maximum battery voltage, if available
*/
- void setMinimumVoltage(double vt);
+ double maximumDesignVoltage();
/**
- * @return a double with the maximum battery voltage, if available
+ * @return a double with the current battery energy in watt-hours, if available
*/
- double maximumVoltage();
+ double energy();
/**
- * @param a double with the maximum battery voltage, if available
+ * @return a double with the current battery alarm energy in watt-hours, if available
*/
- void setMaximumVoltage(double vt);
+ double alarmEnergy();
/**
- * @return a double with the designed maximum battery voltage, if available
+ * @return a double with the maximum battery energy in watt-hours, if available
*/
- double maximumDesignVoltage();
+ double maximumEnergy();
/**
- * @param a double with the designed maximum battery voltage, if available
+ * @return a double with the designed maximum battery energy in watt-hours, if available
*/
- void setMaximumDesignVoltage(double vt);
+ double maximumDesignEnergy();
/**
- * @return a double with the current battery energy in watt-hours, if available
+ * @return a double with the current battery discharge rate in volt-hours, if available
*/
- double energy();
+ double dischargeRate();
/**
- * @param a double with the current battery energy in watt-hours, if available
+ * @return a TQString with the battery technology, if available
*/
- void setEnergy(double vt);
+ TQString &technology();
/**
- * @return a double with the current battery alarm energy in watt-hours, if available
+ * @return a TQString with the battery status, if available
*/
- double alarmEnergy();
+ TQString &status();
/**
- * @param a double with the current battery alarm energy in watt-hours, if available
+ * @return TRUE if the battery is installed
*/
- void setAlarmEnergy(double vt);
+ bool installed();
/**
- * @return a double with the maximum battery energy in watt-hours, if available
+ * @return a double with the current battery charge in percent, if available
*/
- double maximumEnergy();
+ double chargePercent();
+ protected:
/**
- * @param a double with the maximum battery energy in watt-hours, if available
+ * @param a double with the current battery voltage, if available
+ * @internal
*/
- void setMaximumEnergy(double vt);
+ void internalSetVoltage(double vt);
/**
- * @return a double with the designed maximum battery energy in watt-hours, if available
+ * @param a double with the minimum battery voltage, if available
+ * @internal
*/
- double maximumDesignEnergy();
+ void internalSetMinimumVoltage(double vt);
/**
- * @param a double with the designed maximum battery energy in watt-hours, if available
+ * @param a double with the maximum battery voltage, if available
+ * @internal
*/
- void setMaximumDesignEnergy(double vt);
+ void internalSetMaximumVoltage(double vt);
/**
- * @return a double with the current battery discharge rate in volt-hours, if available
+ * @param a double with the designed maximum battery voltage, if available
+ * @internal
*/
- double dischargeRate();
+ void internalSetMaximumDesignVoltage(double vt);
/**
- * @param a double with the current battery discharge rate in volt-hours, if available
+ * @param a double with the current battery energy in watt-hours, if available
+ * @internal
*/
- void setDischargeRate(double vt);
+ void internalSetEnergy(double vt);
/**
- * @return a TQString with the battery technology, if available
+ * @param a double with the current battery alarm energy in watt-hours, if available
+ * @internal
*/
- TQString &technology();
+ void internalSetAlarmEnergy(double vt);
/**
- * @param a TQString with the battery technology, if available
+ * @param a double with the maximum battery energy in watt-hours, if available
+ * @internal
*/
- void setTechnology(TQString tc);
+ void internalSetMaximumEnergy(double vt);
/**
- * @return a TQString with the battery status, if available
+ * @param a double with the designed maximum battery energy in watt-hours, if available
+ * @internal
*/
- TQString &status();
+ void internalSetMaximumDesignEnergy(double vt);
/**
- * @param a TQString with the battery status, if available
+ * @param a double with the current battery discharge rate in volt-hours, if available
+ * @internal
*/
- void setStatus(TQString tc);
+ void internalSetDischargeRate(double vt);
/**
- * @return TRUE if the battery is installed
+ * @param a TQString with the battery technology, if available
+ * @internal
*/
- bool installed();
+ void internalSetTechnology(TQString tc);
/**
- * @param TRUE if the battery is installed
+ * @param a TQString with the battery status, if available
+ * @internal
*/
- void setInstalled(bool tc);
+ void internalSetStatus(TQString tc);
/**
- * @return a double with the current battery charge in percent, if available
+ * @param TRUE if the battery is installed
+ * @internal
*/
- double chargePercent();
+ void internalSetInstalled(bool tc);
private:
double m_currentVoltage;
@@ -924,6 +981,8 @@ class TDECORE_EXPORT TDEBatteryDevice : public TDEGenericDevice
TQString m_technology;
TQString m_status;
bool m_installed;
+
+ friend class TDEHardwareDevices;
};
class TDECORE_EXPORT TDEMainsPowerDevice : public TDEGenericDevice
@@ -945,13 +1004,17 @@ class TDECORE_EXPORT TDEMainsPowerDevice : public TDEGenericDevice
*/
bool online();
+ protected:
/**
* @param TRUE if power supply is online via mains power, FALSE if not
+ * @internal
*/
- void setOnline(bool vt);
+ void internalSetOnline(bool vt);
private:
bool m_online;
+
+ friend class TDEHardwareDevices;
};
class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice
@@ -974,159 +1037,176 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice
TQString macAddress();
/**
- * @param ma a TQString containing the network device's MAC address
+ * @return a TQString containing the network device's operational state
*/
- void setMacAddress(TQString ma);
+ TQString state();
/**
- * @return a TQString containing the network device's operational state
+ * @return TRUE if carrier is present, FALSE if not
*/
- TQString state();
+ bool carrierPresent();
/**
- * @param st a TQString containing the network device's operational state
+ * @return TRUE if device is dormant, FALSE if not
*/
- void setState(TQString st);
+ bool dormant();
/**
- * @return TRUE if carrier is present, FALSE if not
+ * @return a TQString containing the network device's IPv4 address
*/
- bool carrierPresent();
+ TQString ipV4Address();
/**
- * @param TRUE if carrier is present, FALSE if not
+ * @return a TQString containing the network device's IPv6 address
*/
- void setCarrierPresent(bool cp);
+ TQString ipV6Address();
/**
- * @return TRUE if device is dormant, FALSE if not
+ * @return a TQString containing the network device's IPv4 netmask
*/
- bool dormant();
+ TQString ipV4Netmask();
/**
- * @param TRUE if device is dormant, FALSE if not
+ * @return a TQString containing the network device's IPv6 netmask
*/
- void setDormant(bool dm);
+ TQString ipV6Netmask();
/**
- * @return a TQString containing the network device's IPv4 address
+ * @return a TQString containing the network device's IPv4 broadcast
*/
- TQString ipV4Address();
+ TQString ipV4Broadcast();
/**
- * @param ad a TQString containing the network device's IPv4 address
+ * @return a TQString containing the network device's IPv6 broadcast
*/
- void setIpV4Address(TQString ad);
+ TQString ipV6Broadcast();
/**
- * @return a TQString containing the network device's IPv6 address
+ * @return a TQString containing the network device's IPv4 destination
*/
- TQString ipV6Address();
+ TQString ipV4Destination();
/**
- * @param ad a TQString containing the network device's IPv6 address
+ * @return a TQString containing the network device's IPv6 destination
*/
- void setIpV6Address(TQString ad);
+ TQString ipV6Destination();
/**
- * @return a TQString containing the network device's IPv4 netmask
+ * @return a double with the number of received bytes, if available
*/
- TQString ipV4Netmask();
+ double rxBytes();
/**
- * @param nm a TQString containing the network device's IPv4 netmask
+ * @return a double with the number of transmitted bytes, if available
*/
- void setIpV4Netmask(TQString nm);
+ double txBytes();
/**
- * @return a TQString containing the network device's IPv6 netmask
+ * @return a double with the number of received packets, if available
*/
- TQString ipV6Netmask();
+ double rxPackets();
/**
- * @param nm a TQString containing the network device's IPv6 netmask
+ * @return a double with the number of transmitted packets, if available
*/
- void setIpV6Netmask(TQString nm);
+ double txPackets();
+ protected:
/**
- * @return a TQString containing the network device's IPv4 broadcast
+ * @param ma a TQString containing the network device's MAC address
+ * @internal
*/
- TQString ipV4Broadcast();
+ void internalSetMacAddress(TQString ma);
/**
- * @param br a TQString containing the network device's IPv4 broadcast
+ * @param st a TQString containing the network device's operational state
+ * @internal
*/
- void setIpV4Broadcast(TQString br);
+ void internalSetState(TQString st);
/**
- * @return a TQString containing the network device's IPv6 broadcast
+ * @param TRUE if carrier is present, FALSE if not
+ * @internal
*/
- TQString ipV6Broadcast();
+ void internalSetCarrierPresent(bool cp);
/**
- * @param br a TQString containing the network device's IPv6 broadcast
+ * @param TRUE if device is dormant, FALSE if not
+ * @internal
*/
- void setIpV6Broadcast(TQString br);
+ void internalSetDormant(bool dm);
/**
- * @return a TQString containing the network device's IPv4 destination
+ * @param ad a TQString containing the network device's IPv4 address
+ * @internal
*/
- TQString ipV4Destination();
+ void internalSetIpV4Address(TQString ad);
/**
- * @param ds a TQString containing the network device's IPv4 destination
+ * @param ad a TQString containing the network device's IPv6 address
+ * @internal
*/
- void setIpV4Destination(TQString ds);
+ void internalSetIpV6Address(TQString ad);
/**
- * @return a TQString containing the network device's IPv6 destination
+ * @param nm a TQString containing the network device's IPv4 netmask
+ * @internal
*/
- TQString ipV6Destination();
+ void internalSetIpV4Netmask(TQString nm);
/**
- * @param ds a TQString containing the network device's IPv6 destination
+ * @param nm a TQString containing the network device's IPv6 netmask
+ * @internal
*/
- void setIpV6Destination(TQString ds);
+ void internalSetIpV6Netmask(TQString nm);
/**
- * @return a double with the number of received bytes, if available
+ * @param br a TQString containing the network device's IPv4 broadcast
+ * @internal
*/
- double rxBytes();
+ void internalSetIpV4Broadcast(TQString br);
/**
- * @param rx a double with the number of received bytes, if available
+ * @param br a TQString containing the network device's IPv6 broadcast
+ * @internal
*/
- void setRxBytes(double rx);
+ void internalSetIpV6Broadcast(TQString br);
/**
- * @return a double with the number of transmitted bytes, if available
+ * @param ds a TQString containing the network device's IPv4 destination
+ * @internal
*/
- double txBytes();
+ void internalSetIpV4Destination(TQString ds);
/**
- * @param tx a double with the number of transmitted bytes, if available
+ * @param ds a TQString containing the network device's IPv6 destination
+ * @internal
*/
- void setTxBytes(double tx);
+ void internalSetIpV6Destination(TQString ds);
/**
- * @return a double with the number of received packets, if available
+ * @param rx a double with the number of received bytes, if available
+ * @internal
*/
- double rxPackets();
+ void internalSetRxBytes(double rx);
/**
- * @param rx a double with the number of received packets, if available
+ * @param tx a double with the number of transmitted bytes, if available
+ * @internal
*/
- void setRxPackets(double rx);
+ void internalSetTxBytes(double tx);
/**
- * @return a double with the number of transmitted packets, if available
+ * @param rx a double with the number of received packets, if available
+ * @internal
*/
- double txPackets();
+ void internalSetRxPackets(double rx);
/**
* @param tx a double with the number of transmitted packets, if available
+ * @internal
*/
- void setTxPackets(double tx);
+ void internalSetTxPackets(double tx);
private:
TQString m_macAddress;
@@ -1145,7 +1225,185 @@ class TDECORE_EXPORT TDENetworkDevice : public TDEGenericDevice
double m_txbytes;
double m_rxpackets;
double m_txpackets;
+
+ friend class TDEHardwareDevices;
+};
+
+namespace TDEDisplayPowerLevel {
+enum TDEDisplayPowerLevel {
+ On,
+ Standby,
+ Suspend,
+ Off
};
+};
+
+class TDECORE_EXPORT TDEBacklightDevice : public TDEGenericDevice
+{
+ public:
+ /**
+ * Constructor.
+ * @param Device type
+ */
+ TDEBacklightDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
+
+ /**
+ * Destructor.
+ */
+ ~TDEBacklightDevice();
+
+ /**
+ * @return a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level
+ */
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel powerLevel();
+
+ /**
+ * @return an integer with the number of discrete control steps available
+ */
+ int brightnessSteps();
+
+ /**
+ * @return a double with the current brightness percentage
+ */
+ double brightnessPercent();
+
+ /**
+ * @return TRUE if permissions allow brightness can be set, FALSE if not
+ */
+ bool canSetBrightness();
+
+ /**
+ * @return an int with the current raw brightness
+ */
+ int rawBrightness();
+
+ /**
+ * @param br an integer with the new raw brightness value
+ */
+ void setRawBrightness(int br);
+
+ protected:
+ /**
+ * @param pl a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level
+ * @internal
+ */
+ void internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl);
+
+ /**
+ * @param br an integer with the maximum raw brightness value
+ * @internal
+ */
+ void internalSetMaximumRawBrightness(int br);
+
+ /**
+ * @param br an integer with the current raw brightness value
+ * @internal
+ */
+ void internalSetCurrentRawBrightness(int br);
+
+ private:
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel m_powerLevel;
+ int m_currentBrightness;
+ int m_maximumBrightness;
+
+ friend class TDEHardwareDevices;
+};
+
+typedef TQPair<unsigned int, unsigned int> TDEResolutionPair;
+typedef TQValueList< TDEResolutionPair > TDEResolutionList;
+
+class TDECORE_EXPORT TDEMonitorDevice : public TDEGenericDevice
+{
+ public:
+ /**
+ * Constructor.
+ * @param Device type
+ */
+ TDEMonitorDevice(TDEGenericDeviceType::TDEGenericDeviceType dt, TQString dn=TQString::null);
+
+ /**
+ * Destructor.
+ */
+ ~TDEMonitorDevice();
+
+ /**
+ * @return TRUE if a monitor is connected, FALSE if not
+ */
+ bool connected();
+
+ /**
+ * @return TRUE if this port is enabled, FALSE if not
+ */
+ bool enabled();
+
+ /**
+ * @return a TQByteArray containing this monitor's EDID information
+ */
+ TQByteArray edid();
+
+ /**
+ * @return a TDEResolutionList containing this monitor's supported resolutions
+ */
+ TDEResolutionList resolutions();
+
+ /**
+ * @return a TQString containing the display port type
+ */
+ TQString portType();
+
+ /**
+ * @return a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level
+ */
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel powerLevel();
+
+ protected:
+ /**
+ * @param TRUE if a monitor is connected, FALSE if not
+ * @internal
+ */
+ void internalSetConnected(bool cn);
+
+ /**
+ * @param TRUE if this port is enabled, FALSE if not
+ * @internal
+ */
+ void internalSetEnabled(bool en);
+
+ /**
+ * @param ed a TQByteArray containing this monitor's EDID information
+ * @internal
+ */
+ void internalSetEdid(TQByteArray ed);
+
+ /**
+ * @param rs a TDEResolutionList containing this monitor's supported resolutions
+ * @internal
+ */
+ void internalSetResolutions(TDEResolutionList rs);
+
+ /**
+ * @param pt a TQString containing the display port type
+ * @internal
+ */
+ void internalSetPortType(TQString pt);
+
+ /**
+ * @param pl a TDEDisplayPowerLevel::TDEDisplayPowerLevel with the current power level
+ * @internal
+ */
+ void internalSetPowerLevel(TDEDisplayPowerLevel::TDEDisplayPowerLevel pl);
+
+ private:
+ bool m_connected;
+ bool m_enabled;
+ TQByteArray m_edid;
+ TDEResolutionList m_resolutions;
+ TQString m_portType;
+ TDEDisplayPowerLevel::TDEDisplayPowerLevel m_powerLevel;
+
+ friend class TDEHardwareDevices;
+};
+
typedef TQMap<TQString, TDESensorCluster> TDESensorClusterMap;
@@ -1168,13 +1426,17 @@ class TDECORE_EXPORT TDESensorDevice : public TDEGenericDevice
*/
TDESensorClusterMap values();
+ protected:
/**
* @param a TDESensorClusterMap with the current sensor values
+ * @internal
*/
- void setValues(TDESensorClusterMap cl);
+ void internalSetValues(TDESensorClusterMap cl);
private:
TDESensorClusterMap m_sensorValues;
+
+ friend class TDEHardwareDevices;
};
typedef TQPtrList<TDEGenericDevice> TDEGenericHardwareList;
@@ -1269,6 +1531,13 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
TQString findPNPDeviceName(TQString pnpid);
/**
+ * Look up the monitor manufacturer in the system display database
+ * @param pnpid a TQString containing the display manufacturer ID
+ * @return a TQString containing the manufacturer name, if found
+ */
+ TQString findMonitorManufacturerName(TQString dpyid);
+
+ /**
* Get a friendly string describing a device type
* @param query a TDEGenericDeviceType::TDEGenericDeviceType specifying a device type
* @return a TQString containing the friendly type name
@@ -1315,6 +1584,18 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
void addCoreSystemDevices();
+ /**
+ * Get the binary monitor EDID for the specified sysfs path
+ * @return a TQByteArray containing the EDID
+ */
+ TQByteArray getEDID(TQString path);
+
+ /**
+ * Get the monitor EDID name for the specified sysfs path
+ * @return a TQPair<TQString,TQString> containing the monitor vendor and model, if available
+ */
+ TQPair<TQString,TQString> getEDIDMonitorName(TQString path);
+
struct udev *m_udevStruct;
struct udev_monitor *m_udevMonitorStruct;
TDEGenericHardwareList m_deviceList;
@@ -1332,6 +1613,7 @@ class TDECORE_EXPORT TDEHardwareDevices : public TQObject
TDEDeviceIDMap* pci_id_map;
TDEDeviceIDMap* usb_id_map;
TDEDeviceIDMap* pnp_id_map;
+ TDEDeviceIDMap* dpy_id_map;
friend class TDEGenericDevice;
friend class TDEStorageDevice;