Only send hotkey SCI if ACPI OS is loaded

This commit is contained in:
Jeremy Soller 2020-09-23 10:52:20 -06:00 committed by Jeremy Soller
parent 343722e350
commit 00043ebfaf
3 changed files with 29 additions and 18 deletions

View File

@ -221,26 +221,32 @@ bool kbscan_press(uint16_t key, bool pressed, uint8_t * layer) {
break;
case (KT_SCI):
if (pressed) {
uint8_t sci = (uint8_t)(key & 0xFF);
if (!pmc_sci(&PMC_1, sci)) {
// In the case of ignored SCI, reset bit
return false;
// Send SCI if ACPI OS is loaded
if (acpi_ecos != EC_OS_NONE) {
uint8_t sci = (uint8_t)(key & 0xFF);
if (!pmc_sci(&PMC_1, sci)) {
// In the case of ignored SCI, reset bit
return false;
}
}
// Handle hardware hotkeys
hardware_hotkey(key);
}
break;
case (KT_SCI_EXTRA):
if (pressed) {
uint8_t sci = SCI_EXTRA;
sci_extra = (uint8_t)(key & 0xFF);
if (!pmc_sci(&PMC_1, sci)) {
// In the case of ignored SCI, reset bit
return false;
// Send SCI if ACPI OS is loaded
if (acpi_ecos != EC_OS_NONE) {
uint8_t sci = SCI_EXTRA;
sci_extra = (uint8_t)(key & 0xFF);
if (!pmc_sci(&PMC_1, sci)) {
// In the case of ignored SCI, reset bit
return false;
}
}
// Handle hardware hotkeys
hardware_hotkey(key);
}
break;

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-3.0-only
#include <arch/delay.h>
#include <board/acpi.h>
#include <board/gpio.h>
#include <board/lid.h>
#include <board/pmc.h>
@ -33,15 +34,17 @@ void lid_event(void) {
DEBUG("closed\n");
}
// Send SCI
// Send SCI if ACPI OS is loaded
send_sci = true;
}
lid_state = new;
if (send_sci) {
// Send SCI 0x1B for lid event
if (pmc_sci(&PMC_1, 0x1B)) {
send_sci = false;
// Send SCI 0x1B for lid event if ACPI OS is loaded
if (acpi_ecos != EC_OS_NONE) {
if (pmc_sci(&PMC_1, 0x1B)) {
send_sci = false;
}
}
}
}

View File

@ -370,9 +370,11 @@ void power_event(void) {
ac_send_sci = true;
}
if (ac_send_sci) {
// Send SCI 0x16 for AC detect event
if (pmc_sci(&PMC_1, 0x16)) {
ac_send_sci = false;
// Send SCI 0x16 for AC detect event if ACPI OS is loaded
if (acpi_ecos != EC_OS_NONE) {
if (pmc_sci(&PMC_1, 0x16)) {
ac_send_sci = false;
}
}
}
ac_last = ac_new;