Fix human readable display of ACPI buttons

pull/16/head
Timothy Pearson 11 years ago
parent 8e37bb9724
commit edb0581f34

@ -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;
}

@ -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)

@ -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 {

@ -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);

Loading…
Cancel
Save