diff --git a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c index bf39420ee2..24701087ba 100644 --- a/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c +++ b/Demos/Host/ClassDriver/JoystickHostWithParser/JoystickHostWithParser.c @@ -132,15 +132,14 @@ int main(void) { HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; + /* Update the report item value if it is contained within the current report */ + if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) + continue; + + /* Determine what report item is being tested, process updated value as needed */ if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the joystick button value if it is contained within the current report, if not, - * skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) - continue; - if (ReportItem->Value) LEDMask = LEDS_ALL_LEDS; } @@ -149,12 +148,6 @@ int main(void) (ReportItem->Attributes.Usage.Usage == USAGE_Y)) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the joystick relative position value if it is contained within the current - * report, if not, skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(JoystickReport, ReportItem))) - continue; - int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); if (ReportItem->Attributes.Usage.Usage == USAGE_X) diff --git a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c index 8fe3edefeb..78ec56aa32 100644 --- a/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c +++ b/Demos/Host/ClassDriver/KeyboardHostWithParser/KeyboardHostWithParser.c @@ -130,18 +130,16 @@ int main(void) { HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; - /* Check if the current report item is a keyboard scancode */ + /* Update the report item value if it is contained within the current report */ + if (!(USB_GetHIDReportItemInfo(KeyboardReport, ReportItem))) + continue; + + /* Determine what report item is being tested, process updated value as needed */ if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD) && (ReportItem->Attributes.BitSize == 8) && (ReportItem->Attributes.Logical.Maximum > 1) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Retrieve the keyboard scancode from the report data retrieved from the device if it is - * contained within the current report, if not, skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(KeyboardReport, ReportItem))) - continue; - /* Key code is an unsigned char in length, cast to the appropriate type */ uint8_t KeyCode = (uint8_t)ReportItem->Value; diff --git a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c index db176e580d..b6411858ab 100644 --- a/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c +++ b/Demos/Host/ClassDriver/MouseHostWithParser/MouseHostWithParser.c @@ -132,15 +132,14 @@ int main(void) { HID_ReportItem_t* ReportItem = &HIDReportInfo.ReportItems[ReportNumber]; + /* Update the report item value if it is contained within the current report */ + if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem))) + continue; + + /* Determine what report item is being tested, process updated value as needed */ if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the mouse button value if it is contained within the current report, if not, - * skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem))) - continue; - if (ReportItem->Value) LEDMask = LEDS_ALL_LEDS; } @@ -148,12 +147,6 @@ int main(void) (ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the mouse wheel value if it is contained within the current - * report, if not, skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem))) - continue; - int16_t WheelDelta = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); if (WheelDelta) @@ -164,12 +157,6 @@ int main(void) (ReportItem->Attributes.Usage.Usage == USAGE_Y)) && (ReportItem->ItemType == REPORT_ITEM_TYPE_In)) { - /* Get the mouse relative position value if it is contained within the current - * report, if not, skip to the next item in the parser list - */ - if (!(USB_GetHIDReportItemInfo(MouseReport, ReportItem))) - continue; - int16_t DeltaMovement = (int16_t)(ReportItem->Value << (16 - ReportItem->Attributes.BitSize)); if (ReportItem->Attributes.Usage.Usage == USAGE_X) diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.c b/LUFA/Drivers/USB/Class/Host/HIDParser.c index 3ef9c78129..6c81ae8e50 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDParser.c +++ b/LUFA/Drivers/USB/Class/Host/HIDParser.c @@ -340,8 +340,10 @@ uint16_t USB_GetHIDReportSize(HID_ReportInfo_t* const ParserData, const uint8_t { for (uint8_t i = 0; i < HID_MAX_REPORT_IDS; i++) { + uint16_t ReportSizeBits = ParserData->ReportIDSizes[i].ReportSizeBits[ReportType]; + if (ParserData->ReportIDSizes[i].ReportID == ReportID) - return ParserData->ReportIDSizes[i].ReportSizeBits[ReportType]; + return ((ReportSizeBits >> 3) + ((ReportSizeBits & 0x07) ? 1 : 0)); } return 0; diff --git a/LUFA/Drivers/USB/Class/Host/HIDParser.h b/LUFA/Drivers/USB/Class/Host/HIDParser.h index 53601ec617..b7225f3329 100644 --- a/LUFA/Drivers/USB/Class/Host/HIDParser.h +++ b/LUFA/Drivers/USB/Class/Host/HIDParser.h @@ -215,7 +215,7 @@ typedef struct { uint8_t ReportID; /** Report ID of the report within the HID interface */ - uint8_t ReportSizeBits[3]; /** Total number of bits in each report type for the given Report ID, + uint16_t ReportSizeBits[3]; /** Total number of bits in each report type for the given Report ID, * indexed by the \ref HID_ReportItemTypes_t enum */ } HID_ReportSizeInfo_t; diff --git a/LUFA/ManPages/ChangeLog.txt b/LUFA/ManPages/ChangeLog.txt index 9f9157de5d..1b5ede67bb 100644 --- a/LUFA/ManPages/ChangeLog.txt +++ b/LUFA/ManPages/ChangeLog.txt @@ -57,6 +57,7 @@ * - Fixed incorrect values of USB_CONFIG_ATTR_SELFPOWERED and USB_CONFIG_ATTR_REMOTEWAKEUP tokens (thanks to Claus Christensen) * - Fixed SerialStream driver blocking while waiting for characters to be received instead of returning EOF * - Fixed SerialStream driver not setting stdin to the created serial stream + * - Fixed USB_GetHIDReportSize() returning the number of bits in the specified report instead of bytes * * \section Sec_ChangeLog091223 Version 091223 * diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt index e7561e603a..bf61e9d4b6 100644 --- a/LUFA/ManPages/LUFAPoweredProjects.txt +++ b/LUFA/ManPages/LUFAPoweredProjects.txt @@ -36,6 +36,7 @@ * - AVR USB Modem, a 3G Wireless Modem host: http://code.google.com/p/avrusbmodem/ * - Bicycle POV: http://www.code.google.com/p/bicycleledpov/ * - CAMTRIG, a remote Camera Trigger device: http://code.astraw.com/projects/motmot/camtrig + * - CD Driver Emulator Dongle for ISO Files: http://cdemu.blogspot.com/ * - ClockTamer, a configurable clock generator: http://code.google.com/p/clock-tamer/ * - "Fingerlicking Wingdinger" (WARNING: Bad Language if no Javascript), a MIDI controller: http://noisybox.net/electronics/wingdinger/ * - Garmin GPS USB to NMEA standard serial sentence translator: http://github.com/nall/garmin-transmogrifier/tree/master diff --git a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c index 90559208d3..91ed775bb4 100644 --- a/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c +++ b/Projects/AVRISP-MKII/Lib/XPROG/TINYNVM.c @@ -167,10 +167,6 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint while (WriteLength) { - /* Wait until the NVM controller is no longer busy */ - if (!(TINYNVM_WaitWhileNVMControllerBusy())) - return false; - /* Write the low byte of data to the target */ XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI); XPROGTarget_SendByte(*(WriteBuffer++)); @@ -179,6 +175,10 @@ bool TINYNVM_WriteMemory(const uint16_t WriteAddress, uint8_t* WriteBuffer, uint XPROGTarget_SendByte(TPI_CMD_SST | TPI_POINTER_INDIRECT_PI); XPROGTarget_SendByte(*(WriteBuffer++)); + /* Wait until the NVM controller is no longer busy */ + if (!(TINYNVM_WaitWhileNVMControllerBusy())) + return false; + /* Need to decrement the write length twice, since we read out a whole word */ WriteLength -= 2; } diff --git a/Projects/Webserver/Lib/HTTPServerApp.c b/Projects/Webserver/Lib/HTTPServerApp.c index c2263cb98c..ad768c89bc 100644 --- a/Projects/Webserver/Lib/HTTPServerApp.c +++ b/Projects/Webserver/Lib/HTTPServerApp.c @@ -41,7 +41,7 @@ * given location, and gives extra connection information. */ char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n" - "Server: LUFA RNDIS\r\n" + "Server: LUFA " LUFA_VERSION_STRING "\r\n" "Connection: close\r\n" "MIME-version: 1.0\r\n" "Content-Type: "; @@ -50,7 +50,7 @@ char PROGMEM HTTP200Header[] = "HTTP/1.1 200 OK\r\n" * given URL is invalid, and gives extra error information. */ char PROGMEM HTTP404Header[] = "HTTP/1.1 404 Not Found\r\n" - "Server: LUFA RNDIS\r\n" + "Server: LUFA " LUFA_VERSION_STRING "\r\n" "Connection: close\r\n" "MIME-version: 1.0\r\n" "Content-Type: text/plain\r\n\r\n" diff --git a/Projects/Webserver/Lib/HTTPServerApp.h b/Projects/Webserver/Lib/HTTPServerApp.h index 33a647bfe5..b1139280c0 100644 --- a/Projects/Webserver/Lib/HTTPServerApp.h +++ b/Projects/Webserver/Lib/HTTPServerApp.h @@ -40,6 +40,8 @@ #include #include + #include + #include #include