lufa: Fix for freeze at re/boot time problem
Calling led_set() in ISR can cause the problem. With converter especially, led_set() can take long time and USB can be stuck in the end. USB-USB converter freezes occasionally when computer power up or reboot. https://geekhack.org/index.php?topic=69169.msg2740179#msg2740179 This is also related to suspend/wakeup issue #386.
This commit is contained in:
parent
1e0af6809d
commit
993a9b02f7
1 changed files with 7 additions and 9 deletions
|
|
@ -697,12 +697,12 @@ static uint8_t _led_stats = 0;
|
||||||
__attribute__((weak))
|
__attribute__((weak))
|
||||||
void hook_usb_suspend_entry(void)
|
void hook_usb_suspend_entry(void)
|
||||||
{
|
{
|
||||||
// Turn LED off to save power
|
// Turn off LED to save power and keep its status to resotre it later.
|
||||||
// Set 0 with putting aside status before suspend and restore
|
// LED status will be updated by keyboard_task() in main loop hopefully.
|
||||||
// it after wakeup, then LED is updated at keyboard_task() in main loop
|
|
||||||
_led_stats = keyboard_led_stats;
|
_led_stats = keyboard_led_stats;
|
||||||
keyboard_led_stats = 0;
|
keyboard_led_stats = 0;
|
||||||
led_set(keyboard_led_stats);
|
|
||||||
|
// Calling long task here can prevent USB state transition
|
||||||
|
|
||||||
matrix_clear();
|
matrix_clear();
|
||||||
clear_keyboard();
|
clear_keyboard();
|
||||||
|
|
@ -731,10 +731,8 @@ void hook_usb_wakeup(void)
|
||||||
sleep_led_disable();
|
sleep_led_disable();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Restore LED status
|
// Restore LED status and update at keyboard_task() in main loop
|
||||||
// BIOS/grub won't recognize/enumerate if led_set() takes long(around 40ms?)
|
|
||||||
// Converters fall into the case and miss wakeup event(timeout to reply?) in the end.
|
|
||||||
//led_set(host_keyboard_leds());
|
|
||||||
// Instead, restore stats and update at keyboard_task() in main loop
|
|
||||||
keyboard_led_stats = _led_stats;
|
keyboard_led_stats = _led_stats;
|
||||||
|
|
||||||
|
// Calling long task here can prevent USB state transition
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue