From cb9c3ed914b0b1578a3fcaea3e35add08cc0bdfb Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 25 Aug 2013 15:59:43 -0500 Subject: Fix ACPI button event detection on machines with an independent ACPI event controller module such as Thinkpads Only detect the ACPI key press event, not the key release event --- tdecore/tdehw/tdeeventdevice.cpp | 2 +- tdecore/tdehw/tdeeventdevice.h | 2 ++ tdecore/tdehw/tdehardwaredevices.cpp | 6 ++++++ tdecore/tdehw/tdeinputdevice.h | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tdecore/tdehw/tdeeventdevice.cpp b/tdecore/tdehw/tdeeventdevice.cpp index 3a45cf5d1..185c4153d 100644 --- a/tdecore/tdehw/tdeeventdevice.cpp +++ b/tdecore/tdehw/tdeeventdevice.cpp @@ -143,7 +143,7 @@ void TDEEventDevice::eventReceived() { int r; r = read(m_fd, &ev, sizeof(struct input_event)); if (r > 0) { - if (ev.type == EV_KEY) { + if ((ev.type == EV_KEY) && (ev.value == 1)) { // Only detect keypress events (value == 1) emit keyPressed(ev.code, this); } } diff --git a/tdecore/tdehw/tdeeventdevice.h b/tdecore/tdehw/tdeeventdevice.h index 52dc6ee73..e2a03b10f 100644 --- a/tdecore/tdehw/tdeeventdevice.h +++ b/tdecore/tdehw/tdeeventdevice.h @@ -29,7 +29,9 @@ enum TDEEventDeviceType { Unknown, ACPILidSwitch, ACPISleepButton, + ACPISuspendButton, ACPIPowerButton, + ACPIOtherInput, Other = 0x80000000 }; }; diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 2922ec4d8..211213112 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -3056,6 +3056,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist else if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) { edevice->internalSetEventType(TDEEventDeviceType::ACPIPowerButton); } + else if (edevice->systemPath().contains("_acpi")) { + edevice->internalSetEventType(TDEEventDeviceType::ACPIOtherInput); + } else { edevice->internalSetEventType(TDEEventDeviceType::Unknown); } @@ -3073,6 +3076,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist else if (idevice->systemPath().contains("PNP0C0C") || idevice->systemPath().contains("/LNXPWRBN")) { idevice->internalSetInputType(TDEInputDeviceType::ACPIPowerButton); } + else if (idevice->systemPath().contains("_acpi")) { + idevice->internalSetInputType(TDEInputDeviceType::ACPIOtherInput); + } else { idevice->internalSetInputType(TDEInputDeviceType::Unknown); } diff --git a/tdecore/tdehw/tdeinputdevice.h b/tdecore/tdehw/tdeinputdevice.h index 410ff3e1e..39ccc4404 100644 --- a/tdecore/tdehw/tdeinputdevice.h +++ b/tdecore/tdehw/tdeinputdevice.h @@ -27,7 +27,9 @@ enum TDEInputDeviceType { Unknown, ACPILidSwitch, ACPISleepButton, + ACPISuspendButton, ACPIPowerButton, + ACPIOtherInput, Other = 0x80000000 }; }; -- cgit v1.2.3