Keychron / qmk_firmware

Open-source keyboard firmware for Atmel AVR and Arm USB families
https://qmk.fm
GNU General Public License v2.0
656 stars 827 forks source link

Don't turn on OS state indicator LEDs when suspending. #189

Closed qacha closed 4 months ago

qacha commented 8 months ago

Description

Added a check to os_state_indicate and LED_DRIVER_ALLOW_SHUTDOWN. This check disables turning on the OS state indicators (i.e. numlock backlight) when suspending (i.e. when the host is going to sleep), and allows the matrix driver to be shut down.

For these changes to work, rgb_matrix_set_suspend_state and led_matrix_set_suspend_state are modified so they store the suspend state before (indirectly) calling the modified functions.

The changes have been tested on a K10 Pro over both USB and Bluetooth. The led_matrix code has only been compile tested since I have no access to hardware which uses it.

Types of Changes

Issues Fixed or Closed by This PR

188

Checklist

lokher commented 8 months ago

It can be fixed by adding checking USB suspend like as below:

__attribute__((weak)) void os_state_indicate(void) {
#if defined(RGB_DISABLE_WHEN_USB_SUSPENDED) || defined(LED_DISABLE_WHEN_USB_SUSPENDED)
    if (get_transport() == TRANSPORT_USB && USB_DRIVER.state == USB_SUSPENDED) return;
#endif
    ...
}

Thus we don't need to touch qmk core file, we have been avoiding changing the core file.

github-actions[bot] commented 5 months ago

Thank you for your contribution! This pull request has been automatically marked as stale because it has not had activity in the last 45 days. It will be closed in 30 days if no further activity occurs. Please feel free to give a status update now, or re-open when it's ready. For maintainers: Please label with bug, awaiting review, breaking_change, in progress, or on hold to prevent the issue from being re-flagged.

github-actions[bot] commented 4 months ago

Thank you for your contribution! This pull request has been automatically closed because it has not had activity in the last 30 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. // [stale-action-closed]