diff options
author | tmk <nobody@nowhere> | 2012-08-28 20:55:52 +0900 |
---|---|---|
committer | tmk <nobody@nowhere> | 2012-08-28 21:12:45 +0900 |
commit | 7350b7c6aa300a234244c264b10d1732803c27df (patch) | |
tree | e10a9b447ff6a531a9ba544aadad80995599ea0f | |
parent | e075361b6f6bfe24e8d12d125bdab46345087432 (diff) |
Fix the way of sending out IN packet.
This fixes problem that it losts keycode when send keycodes in row in layer.c.
Undef CONSOLE_ENABLE build option makes this problem clear.
-rw-r--r-- | protocol/lufa/lufa.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index 99d241ded0..b7ecb8488d 100644 --- a/protocol/lufa/lufa.c +++ b/protocol/lufa/lufa.c @@ -344,14 +344,14 @@ static void send_keyboard(report_keyboard_t *report) Endpoint_SelectEndpoint(KEYBOARD_IN_EPNUM); /* Check if Keyboard Endpoint Ready for Read/Write */ - if (Endpoint_IsReadWriteAllowed()) - { - /* Write Keyboard Report Data */ - Endpoint_Write_Stream_LE(report, sizeof(report_keyboard_t), NULL); + while (!Endpoint_IsReadWriteAllowed()) ; + + /* Write Keyboard Report Data */ + Endpoint_Write_Stream_LE(report, sizeof(report_keyboard_t), NULL); + + /* Finalize the stream transfer to send the last packet */ + Endpoint_ClearIN(); - /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearIN(); - } keyboard_report_sent = *report; } @@ -362,14 +362,13 @@ static void send_mouse(report_mouse_t *report) Endpoint_SelectEndpoint(MOUSE_IN_EPNUM); /* Check if Mouse Endpoint Ready for Read/Write */ - if (Endpoint_IsReadWriteAllowed()) - { - /* Write Mouse Report Data */ - Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL); + while (!Endpoint_IsReadWriteAllowed()) ; - /* Finalize the stream transfer to send the last packet */ - Endpoint_ClearIN(); - } + /* Write Mouse Report Data */ + Endpoint_Write_Stream_LE(report, sizeof(report_mouse_t), NULL); + + /* Finalize the stream transfer to send the last packet */ + Endpoint_ClearIN(); #endif } @@ -380,10 +379,9 @@ static void send_system(uint16_t data) .usage = data }; Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); - if (Endpoint_IsReadWriteAllowed()) { - Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); - Endpoint_ClearIN(); - } + while (!Endpoint_IsReadWriteAllowed()) ; + Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); + Endpoint_ClearIN(); } static void send_consumer(uint16_t data) @@ -393,10 +391,9 @@ static void send_consumer(uint16_t data) .usage = data }; Endpoint_SelectEndpoint(EXTRAKEY_IN_EPNUM); - if (Endpoint_IsReadWriteAllowed()) { - Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); - Endpoint_ClearIN(); - } + while (!Endpoint_IsReadWriteAllowed()) ; + Endpoint_Write_Stream_LE(&r, sizeof(report_extra_t), NULL); + Endpoint_ClearIN(); } |