diff options
author | Slávek Banko <[email protected]> | 2020-02-23 17:05:27 +0100 |
---|---|---|
committer | Slávek Banko <[email protected]> | 2020-02-23 17:15:14 +0100 |
commit | 1945986691db4c8d8742ebed3f8b29f4e2f83eaa (patch) | |
tree | e94d8dc8f28eb2ab732e16b633afefc843284b5f /tdecore | |
parent | f3cd32503240eee2c0f1749ba5410dddb59355a4 (diff) | |
download | tdelibs-1945986691db4c8d8742ebed3f8b29f4e2f83eaa.tar.gz tdelibs-1945986691db4c8d8742ebed3f8b29f4e2f83eaa.zip |
tdehwlib: Add event device classification according to the provided switches.
This will resolve event device detection on special hardware, for example,
the LID switch on Pinebook Pro.
Signed-off-by: Slávek Banko <[email protected]>
(cherry picked from commit f68fadda81d0e107d904a08db30bd8cccbbd1a21)
Diffstat (limited to 'tdecore')
-rw-r--r-- | tdecore/tdehw/tdehardwaredevices.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tdecore/tdehw/tdehardwaredevices.cpp b/tdecore/tdehw/tdehardwaredevices.cpp index 697048dbf..8ee62ca8f 100644 --- a/tdecore/tdehw/tdehardwaredevices.cpp +++ b/tdecore/tdehw/tdehardwaredevices.cpp @@ -3432,13 +3432,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<TDEEventDevice*>(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")) { |