From 25331be3164ca609ebecbfcc727ce904e3676594 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Sat, 26 Aug 2023 19:52:12 -0700 Subject: Revert changes to ChibiOS Suspend Code (#21830) * Partially revert #19780 * Finish * Get teensy 3.5/3.6 board files too * fix lint issue * Revert "[Bug] Restore usb suspend wakeup delay (#21676)" This reverts commit e8e989fd7ad7c10e725e50ae8b0a4426e09f7f30. * Apply suggestions from code review Co-authored-by: Joel Challis --------- Co-authored-by: Joel Challis --- platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c | 4 ++++ platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c | 4 ++++ platforms/chibios/boards/IC_TEENSY_3_1/board/board.c | 5 +++++ platforms/chibios/boards/PJRC_TEENSY_3_5/board/board.mk | 11 +++++++++++ platforms/chibios/boards/PJRC_TEENSY_3_5/board/extra.c | 7 +++++++ platforms/chibios/boards/PJRC_TEENSY_3_6/board/board.mk | 11 +++++++++++ platforms/chibios/boards/PJRC_TEENSY_3_6/board/extra.c | 7 +++++++ platforms/chibios/suspend.c | 1 - 8 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 platforms/chibios/boards/PJRC_TEENSY_3_5/board/board.mk create mode 100644 platforms/chibios/boards/PJRC_TEENSY_3_5/board/extra.c create mode 100644 platforms/chibios/boards/PJRC_TEENSY_3_6/board/board.mk create mode 100644 platforms/chibios/boards/PJRC_TEENSY_3_6/board/extra.c (limited to 'platforms') diff --git a/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c b/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c index e38a7e0054..f74c9e8be7 100644 --- a/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c +++ b/platforms/chibios/boards/GENERIC_WB32_F3G71XX/board/board.c @@ -80,3 +80,7 @@ void __early_init(void) { void boardInit(void) { } + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c index 22b4ff73b5..a99537fc27 100644 --- a/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c +++ b/platforms/chibios/boards/GENERIC_WB32_FQ95XX/board/board.c @@ -80,3 +80,7 @@ void __early_init(void) { void boardInit(void) { } + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c index 36ae8051ee..189d90952d 100644 --- a/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c +++ b/platforms/chibios/boards/IC_TEENSY_3_1/board/board.c @@ -144,3 +144,8 @@ void __early_init(void) { * @todo Add your board-specific code, if any. */ void boardInit(void) {} + + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on these boards breaks it. +} diff --git a/platforms/chibios/boards/PJRC_TEENSY_3_5/board/board.mk b/platforms/chibios/boards/PJRC_TEENSY_3_5/board/board.mk new file mode 100644 index 0000000000..e129836b08 --- /dev/null +++ b/platforms/chibios/boards/PJRC_TEENSY_3_5/board/board.mk @@ -0,0 +1,11 @@ +include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_5/board.mk + +# List of all the board related files. +BOARDSRC += $(BOARD_PATH)/board/extra.c + +# Required include directories +BOARDINC += $(BOARD_PATH)/board + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/PJRC_TEENSY_3_5/board/extra.c b/platforms/chibios/boards/PJRC_TEENSY_3_5/board/extra.c new file mode 100644 index 0000000000..4940d6d99b --- /dev/null +++ b/platforms/chibios/boards/PJRC_TEENSY_3_5/board/extra.c @@ -0,0 +1,7 @@ +#include + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on the Teensy 3.6 breaks it, + // resulting in a keyboard which can wake up a PC from Suspend-to-RAM, but + // does not actually produce any keypresses until you un-plug and re-plug. +} diff --git a/platforms/chibios/boards/PJRC_TEENSY_3_6/board/board.mk b/platforms/chibios/boards/PJRC_TEENSY_3_6/board/board.mk new file mode 100644 index 0000000000..aba195db04 --- /dev/null +++ b/platforms/chibios/boards/PJRC_TEENSY_3_6/board/board.mk @@ -0,0 +1,11 @@ +include $(CHIBIOS_CONTRIB)/os/hal/boards/PJRC_TEENSY_3_6/board.mk + +# List of all the board related files. +BOARDSRC += $(BOARD_PATH)/board/extra.c + +# Required include directories +BOARDINC += $(BOARD_PATH)/board + +# Shared variables +ALLCSRC += $(BOARDSRC) +ALLINC += $(BOARDINC) diff --git a/platforms/chibios/boards/PJRC_TEENSY_3_6/board/extra.c b/platforms/chibios/boards/PJRC_TEENSY_3_6/board/extra.c new file mode 100644 index 0000000000..4940d6d99b --- /dev/null +++ b/platforms/chibios/boards/PJRC_TEENSY_3_6/board/extra.c @@ -0,0 +1,7 @@ +#include + +void restart_usb_driver(USBDriver *usbp) { + // Do nothing. Restarting the USB driver on the Teensy 3.6 breaks it, + // resulting in a keyboard which can wake up a PC from Suspend-to-RAM, but + // does not actually produce any keypresses until you un-plug and re-plug. +} diff --git a/platforms/chibios/suspend.c b/platforms/chibios/suspend.c index a937ccf059..ce03433e3a 100644 --- a/platforms/chibios/suspend.c +++ b/platforms/chibios/suspend.c @@ -42,7 +42,6 @@ void suspend_wakeup_init(void) { clear_keys(); #ifdef MOUSEKEY_ENABLE mousekey_clear(); - mousekey_send(); #endif /* MOUSEKEY_ENABLE */ #ifdef PROGRAMMABLE_BUTTON_ENABLE programmable_button_clear(); -- cgit v1.2.3