diff options
author | Timothy Pearson <[email protected]> | 2013-08-24 19:48:44 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-08-24 19:48:44 -0500 |
commit | edb0581f3426731bb8247d61f3676d6ce00506f1 (patch) | |
tree | 1ecd2014355bcbba2085a42a5e81054042da377c /tdecore/tdehw | |
parent | 8e37bb9724a476c7f34bd80545a21a91dd63b5b2 (diff) | |
download | tdelibs-edb0581f3426731bb8247d61f3676d6ce00506f1.tar.gz tdelibs-edb0581f3426731bb8247d61f3676d6ce00506f1.zip |
Fix human readable display of ACPI buttons
Diffstat (limited to 'tdecore/tdehw')
-rw-r--r-- | tdecore/tdehw/tdeeventdevice.cpp | 6 | ||||
-rw-r--r-- | tdecore/tdehw/tdeeventdevice.h | 4 | ||||
-rw-r--r-- | tdecore/tdehw/tdegenericdevice.cpp | 26 | ||||
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 10 |
4 files changed, 41 insertions, 5 deletions
diff --git a/tdecore/tdehw/tdeeventdevice.cpp b/tdecore/tdehw/tdeeventdevice.cpp index a98bc78c3..3a45cf5d1 100644 --- a/tdecore/tdehw/tdeeventdevice.cpp +++ b/tdecore/tdehw/tdeeventdevice.cpp @@ -114,6 +114,12 @@ TQStringList TDEEventDevice::friendlySwitchList(TDESwitchType::TDESwitchType swi if (switches & TDESwitchType::LineInInsert) { ret.append(i18n("Line In Inserted")); } + if (switches & TDESwitchType::PowerButton) { + ret.append(i18n("Power Button")); + } + if (switches & TDESwitchType::SleepButton) { + ret.append(i18n("Sleep Button")); + } return ret; } diff --git a/tdecore/tdehw/tdeeventdevice.h b/tdecore/tdehw/tdeeventdevice.h index 50aea54ef..52dc6ee73 100644 --- a/tdecore/tdehw/tdeeventdevice.h +++ b/tdecore/tdehw/tdeeventdevice.h @@ -52,7 +52,9 @@ enum TDESwitchType { KeypadSlide = 0x00000800, FrontProximity = 0x00001000, RotateLock = 0x00002000, - LineInInsert = 0x00004000 + LineInInsert = 0x00004000, + PowerButton = 0x00008000, + SleepButton = 0x00010000 }; inline TDESwitchType operator|(TDESwitchType a, TDESwitchType b) diff --git a/tdecore/tdehw/tdegenericdevice.cpp b/tdecore/tdehw/tdegenericdevice.cpp index 5f51a8b61..4e67ed6d6 100644 --- a/tdecore/tdehw/tdegenericdevice.cpp +++ b/tdecore/tdehw/tdegenericdevice.cpp @@ -273,8 +273,17 @@ TQString TDEGenericDevice::friendlyName() { m_friendlyName = name(); } else if (type() == TDEGenericDeviceType::Event) { - // Use parent node name - if (m_parentDevice) { + if (m_systemPath.contains("PNP0C0D")) { + m_friendlyName = i18n("ACPI Lid Switch"); + } + else if (m_systemPath.contains("PNP0C0E") || m_systemPath.contains("/LNXSLPBN")) { + m_friendlyName = i18n("ACPI Sleep Button"); + } + else if (m_systemPath.contains("PNP0C0C") || m_systemPath.contains("/LNXPWRBN")) { + m_friendlyName = i18n("ACPI Power Button"); + } + else if (m_parentDevice) { + // Use parent node name return m_parentDevice->friendlyName(); } else { @@ -282,8 +291,17 @@ TQString TDEGenericDevice::friendlyName() { } } else if (type() == TDEGenericDeviceType::Input) { - // Use parent node name - if (m_parentDevice) { + if (m_systemPath.contains("PNP0C0D")) { + m_friendlyName = i18n("ACPI Lid Switch"); + } + else if (m_systemPath.contains("PNP0C0E") || m_systemPath.contains("/LNXSLPBN")) { + m_friendlyName = i18n("ACPI Sleep Button"); + } + else if (m_systemPath.contains("PNP0C0C") || m_systemPath.contains("/LNXPWRBN")) { + m_friendlyName = i18n("ACPI Power Button"); + } + else if (m_parentDevice) { + // Use parent node name return m_parentDevice->friendlyName(); } else { diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 250cd11b6..2922ec4d8 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -3135,6 +3135,16 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist supportedSwitches = supportedSwitches | TDESwitchType::LineInInsert; } #endif + // Keep in sync with ACPI Event/Input identification routines above + if (edevice->systemPath().contains("PNP0C0D")) { + supportedSwitches = supportedSwitches | TDESwitchType::Lid; + } + if (edevice->systemPath().contains("PNP0C0E") || edevice->systemPath().contains("/LNXSLPBN")) { + supportedSwitches = supportedSwitches | TDESwitchType::SleepButton; + } + if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) { + supportedSwitches = supportedSwitches | TDESwitchType::PowerButton; + } } edevice->internalSetProvidedSwitches(supportedSwitches); |