summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-25 15:59:43 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-08-25 15:59:43 -0500
commitcb9c3ed914b0b1578a3fcaea3e35add08cc0bdfb (patch)
tree1f235fabb0b34970b1096f61878a8aa37e353211
parent1fdeea09282c898d637d61178a64a870439e45f5 (diff)
downloadtdelibs-cb9c3ed914b0b1578a3fcaea3e35add08cc0bdfb.tar.gz
tdelibs-cb9c3ed914b0b1578a3fcaea3e35add08cc0bdfb.zip
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
-rw-r--r--tdecore/tdehw/tdeeventdevice.cpp2
-rw-r--r--tdecore/tdehw/tdeeventdevice.h2
-rw-r--r--tdecore/tdehw/tdehardwaredevices.cpp6
-rw-r--r--tdecore/tdehw/tdeinputdevice.h2
4 files changed, 11 insertions, 1 deletions
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
};
};