From 31d3984d8d8afeed7b1e064428b01e42fe27f2f9 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 23 Mar 2013 12:01:25 +0000 Subject: [PATCH] Fixed Low Speed USB devices broken when using the library HID Class driver (thanks to Michael). --- LUFA/DoxygenPages/ChangeLog.txt | 2 ++ LUFA/Drivers/USB/Class/Device/HIDClassDevice.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/LUFA/DoxygenPages/ChangeLog.txt b/LUFA/DoxygenPages/ChangeLog.txt index 09b1c36397..cd4310a262 100644 --- a/LUFA/DoxygenPages/ChangeLog.txt +++ b/LUFA/DoxygenPages/ChangeLog.txt @@ -17,6 +17,8 @@ * - Updated the BUILD build system module to produce binary BIN files in addition to Intel HEX files * * Fixed: + * - Core: + * - Fixed Low Speed USB devices broken when using the library HID Class driver (thanks to Michael) * - Library Applications: * - Added handler for SCSI_CMD_START_STOP_UNIT in demos using the Mass Storage class, to prevent ejection errors on *nix systems due to an * unknown SCSI command diff --git a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c index f6b665917a..6ca4c1f2d3 100644 --- a/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c +++ b/LUFA/Drivers/USB/Class/Device/HIDClassDevice.c @@ -144,8 +144,8 @@ bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfac HIDInterfaceInfo->Config.ReportINEndpoint.Type = EP_TYPE_INTERRUPT; if (!(Endpoint_ConfigureEndpointTable(&HIDInterfaceInfo->Config.ReportINEndpoint, 1))) - return false; - + return false; + return true; } @@ -155,8 +155,15 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) return; if (HIDInterfaceInfo->State.PrevFrameNum == USB_Device_GetFrameNumber()) - return; - + { + #if defined(USB_DEVICE_OPT_LOWSPEED) + if (!(USB_Options & USB_DEVICE_OPT_LOWSPEED)) + return; + #else + return; + #endif + } + Endpoint_SelectEndpoint(HIDInterfaceInfo->Config.ReportINEndpoint.Address); if (Endpoint_IsReadWriteAllowed()) @@ -191,7 +198,7 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo) Endpoint_ClearIN(); } - + HIDInterfaceInfo->State.PrevFrameNum = USB_Device_GetFrameNumber(); } }