From f68fadda81d0e107d904a08db30bd8cccbbd1a21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sun, 23 Feb 2020 17:05:27 +0100 Subject: tdehwlib: Add event device classification according to the provided switches. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will resolve event device detection on special hardware, for example, the LID switch on Pinebook Pro. Signed-off-by: Slávek Banko --- tdecore/tdehw/tdehardwaredevices.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'tdecore/tdehw') diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index cde5e3bcb..b700ac3ab 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -3501,13 +3501,19 @@ void TDEHardwareDevices::updateExistingDeviceInformation(TDEGenericDevice* exist if (device->type() == TDEGenericDeviceType::Event) { // Try to obtain as much type information about this event device as possible TDEEventDevice* edevice = dynamic_cast(device); - if (edevice->systemPath().contains("PNP0C0D")) { + TDESwitchType::TDESwitchType edevice_switches = edevice->providedSwitches(); + if (edevice->systemPath().contains("PNP0C0D") + || (edevice_switches & TDESwitchType::Lid)) { edevice->internalSetEventType(TDEEventDeviceType::ACPILidSwitch); } - else if (edevice->systemPath().contains("PNP0C0E") || edevice->systemPath().contains("/LNXSLPBN")) { + else if (edevice->systemPath().contains("PNP0C0E") + || edevice->systemPath().contains("/LNXSLPBN") + || (edevice_switches & TDESwitchType::SleepButton)) { edevice->internalSetEventType(TDEEventDeviceType::ACPISleepButton); } - else if (edevice->systemPath().contains("PNP0C0C") || edevice->systemPath().contains("/LNXPWRBN")) { + else if (edevice->systemPath().contains("PNP0C0C") + || edevice->systemPath().contains("/LNXPWRBN") + || (edevice_switches & TDESwitchType::PowerButton)) { edevice->internalSetEventType(TDEEventDeviceType::ACPIPowerButton); } else if (edevice->systemPath().contains("_acpi")) { -- cgit v1.2.1