aboutsummaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/protocol/arm_atsam/main_arm_atsam.c18
-rw-r--r--tmk_core/protocol/chibios/chibios.c2
-rw-r--r--tmk_core/protocol/lufa/lufa.c2
3 files changed, 19 insertions, 3 deletions
diff --git a/tmk_core/protocol/arm_atsam/main_arm_atsam.c b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
index 8abcfd6090..15592bf908 100644
--- a/tmk_core/protocol/arm_atsam/main_arm_atsam.c
+++ b/tmk_core/protocol/arm_atsam/main_arm_atsam.c
@@ -88,7 +88,13 @@ void send_nkro(report_nkro_t *report) {
__disable_irq();
__DMB();
- memcpy(udi_hid_nkro_report, report, UDI_HID_NKRO_REPORT_SIZE);
+ /*
+ Skipping ahead `sizeof(report->report_id)` bytes
+ since `report_id` is not used by this driver
+ */
+ void *report_no_report_id = (void *)((char *)report + sizeof(report->report_id));
+
+ memcpy(udi_hid_nkro_report, report_no_report_id, UDI_HID_NKRO_REPORT_SIZE);
udi_hid_nkro_b_report_valid = 1;
udi_hid_nkro_send_report();
@@ -105,7 +111,17 @@ void send_mouse(report_mouse_t *report) {
__disable_irq();
__DMB();
+# ifdef MOUSE_SHARED_EP
+ /*
+ Skipping ahead `sizeof(report->report_id)` bytes
+ since `report_id` is not used by this driver
+ */
+ void *report_no_report_id = (void *)((char *)report + sizeof(report->report_id));
+
+ memcpy(udi_hid_mou_report, report_no_report_id, UDI_HID_MOU_REPORT_SIZE);
+# else
memcpy(udi_hid_mou_report, report, UDI_HID_MOU_REPORT_SIZE);
+# endif
udi_hid_mou_b_report_valid = 1;
udi_hid_mou_send_report();
diff --git a/tmk_core/protocol/chibios/chibios.c b/tmk_core/protocol/chibios/chibios.c
index a249af8d38..b879bdac77 100644
--- a/tmk_core/protocol/chibios/chibios.c
+++ b/tmk_core/protocol/chibios/chibios.c
@@ -184,7 +184,7 @@ void protocol_pre_task(void) {
/* Do this in the suspended state */
suspend_power_down(); // on AVR this deep sleeps for 15ms
/* Remote wakeup */
- if ((USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED) && suspend_wakeup_condition()) {
+ if (suspend_wakeup_condition() && (USB_DRIVER.status & USB_GETSTATUS_REMOTE_WAKEUP_ENABLED)) {
usbWakeupHost(&USB_DRIVER);
# if USB_SUSPEND_WAKEUP_DELAY > 0
// Some hubs, kvm switches, and monitors do
diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c
index 2142b04460..b0c9758d2f 100644
--- a/tmk_core/protocol/lufa/lufa.c
+++ b/tmk_core/protocol/lufa/lufa.c
@@ -836,7 +836,7 @@ void protocol_pre_task(void) {
dprintln("suspending keyboard");
while (USB_DeviceState == DEVICE_STATE_Suspended) {
suspend_power_down();
- if (USB_Device_RemoteWakeupEnabled && suspend_wakeup_condition()) {
+ if (suspend_wakeup_condition() && USB_Device_RemoteWakeupEnabled) {
USB_Device_SendRemoteWakeup();
clear_keyboard();