1
0
Fork 0

Fix CTRL/ALT keyboard does not wake computer from sleep

Fix for Massdrop CTRL and ALT keyboards not waking computer from sleep
This commit is contained in:
patrickmt 2018-10-30 12:23:57 -04:00 committed by Drashna Jaelre
parent f1529e74c4
commit 563fe23e53
2 changed files with 20 additions and 12 deletions

View file

@ -62,6 +62,12 @@ void send_keyboard(report_keyboard_t *report)
{
uint32_t irqflags;
if (usb_state == USB_STATE_POWERDOWN)
{
udc_remotewakeup();
return;
}
#ifdef NKRO_ENABLE
if (!keymap_config.nkro)
{
@ -156,14 +162,15 @@ void send_consumer(uint16_t data)
}
uint8_t g_drvid;
uint8_t g_usb_sleeping = 0;
void main_subtask_usb_state(void)
{
if (usb_state == USB_STATE_POWERDOWN)
{
uint32_t timer_led = timer_read32();
led_on;
if (!g_usb_sleeping)
{
g_usb_sleeping = 1;
if (led_enabled)
{
for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
@ -171,10 +178,11 @@ void main_subtask_usb_state(void)
I2C3733_Control_Set(0);
}
}
while (usb_state == USB_STATE_POWERDOWN)
{
if (timer_read32() - timer_led > 1000) led_off; //Good to indicate went to sleep, but only for a second
}
}
else if (g_usb_sleeping)
{
g_usb_sleeping = 0;
if (led_enabled)
{
for (g_drvid = 0; g_drvid < ISSI3733_DRIVER_COUNT; g_drvid++)
@ -182,12 +190,12 @@ void main_subtask_usb_state(void)
I2C3733_Control_Set(1);
}
}
led_off;
}
}
void main_subtask_led(void)
{
if (g_usb_sleeping) return;
led_matrix_task();
}

View file

@ -210,7 +210,7 @@ static inline void udc_detach(void)
/*! \brief The USB driver sends a resume signal called \e "Upstream Resume"
* This is authorized only when the remote wakeup feature is enabled by host.
*/
static inline void udc_remotewakeup(void)
inline void udc_remotewakeup(void)
{
udd_send_remotewakeup();
}