projects
/
pub
/
USBasp.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/USBasp.git]
/
Demos
/
Device
/
LowLevel
/
Mouse
/
Mouse.c
diff --git
a/Demos/Device/LowLevel/Mouse/Mouse.c
b/Demos/Device/LowLevel/Mouse/Mouse.c
index
c0989c5
..
60eb7fa
100644
(file)
--- a/
Demos/Device/LowLevel/Mouse/Mouse.c
+++ b/
Demos/Device/LowLevel/Mouse/Mouse.c
@@
-197,8
+197,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
, must multiply by 4 to get the duration in 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
@@
-211,8
+211,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
@@
-289,8
+289,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