projects
/
pub
/
lufa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix HID class device driver -- if a SetIDle request is issued with the LSB of wValue...
[pub/lufa.git]
/
Demos
/
Device
/
LowLevel
/
Keyboard
/
Keyboard.c
diff --git
a/Demos/Device/LowLevel/Keyboard/Keyboard.c
b/Demos/Device/LowLevel/Keyboard/Keyboard.c
index
185d968
..
2527148
100644
(file)
--- a/
Demos/Device/LowLevel/Keyboard/Keyboard.c
+++ b/
Demos/Device/LowLevel/Keyboard/Keyboard.c
@@
-225,8
+225,8
@@
void EVENT_USB_UnhandledControlPacket(void)
{
\r
Endpoint_ClearSETUP();
\r
\r
{
\r
Endpoint_ClearSETUP();
\r
\r
- /* Get idle period in MSB */
\r
- IdleCount = (
USB_ControlRequest.wValue >> 8
);
\r
+ /* Get idle period in MSB
, IdleCount must be multiplied by 4 to get number of milliseconds
*/
\r
+ IdleCount = (
(USB_ControlRequest.wValue & 0xFF00) >> 6
);
\r
\r
/* Acknowledge status stage */
\r
while (!(Endpoint_IsINReady()));
\r
\r
/* Acknowledge status stage */
\r
while (!(Endpoint_IsINReady()));
\r
@@
-239,8
+239,8
@@
void EVENT_USB_UnhandledControlPacket(void)
{
\r
Endpoint_ClearSETUP();
\r
\r
{
\r
Endpoint_ClearSETUP();
\r
\r
- /* Write the current idle duration to the host */
\r
- Endpoint_Write_Byte(IdleCount);
\r
+ /* Write the current idle duration to the host
, must be divided by 4 before sent to host
*/
\r
+ Endpoint_Write_Byte(IdleCount
>> 2
);
\r
\r
/* Send the flag to the host */
\r
Endpoint_ClearIN();
\r
\r
/* Send the flag to the host */
\r
Endpoint_ClearIN();
\r
@@
-329,8
+329,8
@@
void SendNextReport(void)
/* Check if the idle period is set and has elapsed */
\r
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
\r
{
\r
/* Check if the idle period is set and has elapsed */
\r
if ((IdleCount != HID_IDLE_CHANGESONLY) && (!(IdleMSRemaining)))
\r
{
\r
- /* Reset the idle time remaining counter
, must multiply by 4 to get the duration in milliseconds
*/
\r
- IdleMSRemaining =
(IdleCount << 2)
;
\r
+ /* Reset the idle time remaining counter */
\r
+ IdleMSRemaining =
IdleCount
;
\r
\r
/* Idle period is set and has elapsed, must send a report to the host */
\r
SendReport = true;
\r
\r
/* Idle period is set and has elapsed, must send a report to the host */
\r
SendReport = true;
\r