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
pull/16/head
Timothy Pearson 11 years ago
parent 1fdeea0928
commit cb9c3ed914

@ -143,7 +143,7 @@ void TDEEventDevice::eventReceived() {
int r; int r;
r = read(m_fd, &ev, sizeof(struct input_event)); r = read(m_fd, &ev, sizeof(struct input_event));
if (r > 0) { 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); emit keyPressed(ev.code, this);
} }
} }

@ -29,7 +29,9 @@ enum TDEEventDeviceType {
Unknown, Unknown,
ACPILidSwitch, ACPILidSwitch,
ACPISleepButton, ACPISleepButton,
ACPISuspendButton,
ACPIPowerButton, ACPIPowerButton,
ACPIOtherInput,
Other = 0x80000000 Other = 0x80000000
}; };
}; };

@ -3056,6 +3056,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
else if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) { else if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) {
edevice->internalSetEventType(TDEEventDeviceType::ACPIPowerButton); edevice->internalSetEventType(TDEEventDeviceType::ACPIPowerButton);
} }
else if (edevice->systemPath().contains("_acpi")) {
edevice->internalSetEventType(TDEEventDeviceType::ACPIOtherInput);
}
else { else {
edevice->internalSetEventType(TDEEventDeviceType::Unknown); edevice->internalSetEventType(TDEEventDeviceType::Unknown);
} }
@ -3073,6 +3076,9 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist
else if (idevice->systemPath().contains("PNP0C0C") || idevice->systemPath().contains("/LNXPWRBN")) { else if (idevice->systemPath().contains("PNP0C0C") || idevice->systemPath().contains("/LNXPWRBN")) {
idevice->internalSetInputType(TDEInputDeviceType::ACPIPowerButton); idevice->internalSetInputType(TDEInputDeviceType::ACPIPowerButton);
} }
else if (idevice->systemPath().contains("_acpi")) {
idevice->internalSetInputType(TDEInputDeviceType::ACPIOtherInput);
}
else { else {
idevice->internalSetInputType(TDEInputDeviceType::Unknown); idevice->internalSetInputType(TDEInputDeviceType::Unknown);
} }

@ -27,7 +27,9 @@ enum TDEInputDeviceType {
Unknown, Unknown,
ACPILidSwitch, ACPILidSwitch,
ACPISleepButton, ACPISleepButton,
ACPISuspendButton,
ACPIPowerButton, ACPIPowerButton,
ACPIOtherInput,
Other = 0x80000000 Other = 0x80000000
}; };
}; };

Loading…
Cancel
Save